~vauxoo/addons-vauxoo/7.0-project_issue_conf-dev_luis

« back to all changes in this revision

Viewing changes to m321_customization/sale.py

 
[MERGE] Merge to add all changes in trunk series

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
        for line in sale_brw.order_line:
66
66
            virtual = line.product_id.qty_available
67
67
            real = line.product_id.virtual_available
68
 
            if virtual == real and line.product_uom_qty > virtual or line.product_uom_qty > virtual:
 
68
            if virtual == real and\
 
69
                line.product_uom_qty > virtual or\
 
70
                line.product_uom_qty > virtual:
69
71
                raise osv.except_osv(_('Error'), _(
70
 
                    'The quantity in the line of the product %s is minor that quantity available ' % line.product_id.name))
 
72
                    'The quantity in the line of the product %s is minor that\
 
73
                    quantity available ' % line.product_id.name))
71
74
 
72
 
            elif virtual > real and line.product_uom_qty > real and line.product_uom_qty < virtual and not line.check_confirm:
 
75
            elif virtual > real and line.product_uom_qty > real and\
 
76
                line.product_uom_qty < virtual and not line.check_confirm:
73
77
                raise osv.except_osv(_('Error'), _(
74
 
                    'The amount you want to sell is not available in the real stock of product %s, but if a shipment next, if you want to make this sale select Stock future sales line' % line.product_id.name))
 
78
                    'The amount you want to sell is not available in the real\
 
79
                    stock of product %s, but if a shipment next, if you want\
 
80
                    to make this sale select Stock future sales line'
 
81
                    % line.product_id.name))
75
82
 
76
83
        return True
77
84
 
78
85
 
79
 
 
80
 
 
81
86
class sale_order_line(osv.Model):
82
87
 
83
88
    def product_id_change(self, cr, uid, ids, pricelist, product, qty=0,
84
 
                          uom=False, qty_uos=0, uos=False, name='', partner_id=False,
85
 
                          lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False, context=None):
 
89
                            uom=False, qty_uos=0, uos=False, name='',
 
90
                            partner_id=False,
 
91
                            lang=False, update_tax=True, date_order=False,
 
92
                            packaging=False, fiscal_position=False, flag=False,
 
93
                            context=None):
86
94
        if context is None:
87
95
            context = {}
88
96
        product_obj = self.pool.get('product.product')
89
97
        res = super(
90
 
            sale_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty=qty,
91
 
                                                     uom=uom, qty_uos=qty_uos, uos=uos, name=name, partner_id=partner_id,
92
 
                                                     lang=lang, update_tax=update_tax, date_order=date_order, packaging=packaging, fiscal_position=fiscal_position, flag=flag)
 
98
            sale_order_line, self).product_id_change(cr, uid, ids, pricelist,
 
99
                                 product, qty=qty,
 
100
                                 uom=uom, qty_uos=qty_uos,
 
101
                                 uos=uos, name=name,
 
102
                                 partner_id=partner_id,
 
103
                                 lang=lang,
 
104
                                 update_tax=update_tax,
 
105
                                 date_order=date_order,
 
106
                                 packaging=packaging,
 
107
                                 fiscal_position=fiscal_position, flag=flag)
93
108
 
94
109
        future_stock = product and self.pool.get(
95
110
            'stock.move').search(cr, uid, [('product_id', '=', product),
96
 
                                           ('state', 'in', (
97
 
                                            'assigned', 'confirmed', 'waiting')),
98
 
                                           ('picking_id.type', '=', 'in')], context=context)
 
111
                           ('state', 'in', (
 
112
                            'assigned', 'confirmed', 'waiting')),
 
113
                           ('picking_id.type', '=', 'in')], context=context)
99
114
        future_stock and res.get('value', False) and res.get(
100
115
            'value', False).update({'stock_move_ids': future_stock})
101
116
 
103
118
 
104
119
    _inherit = 'sale.order.line'
105
120
    _columns = {
106
 
        'stock_move_ids': fields.one2many('stock.move', 'id_sale', 'Future Stock', readonly=True, help="Stock move future to reference of salesman for knowing that product is available"),
107
 
        'check_confirm': fields.boolean("Future Stock'", help="This field indicates if the salesman is in accordance with sale a product   that is not available but if in a future stock"),
 
121
        'stock_move_ids': fields.one2many('stock.move', 'id_sale',
 
122
            'Future Stock', readonly=True,
 
123
            help="Stock move future to reference of salesman for knowing that\
 
124
                product is available"),
 
125
        'check_confirm': fields.boolean("Future Stock'",
 
126
            help="This field indicates if the salesman is in accordance with\
 
127
                sale a product   that is not available but if in a\
 
128
                future stock"),
108
129
 
109
130
    }
110