[FIX] sale: fix company_id assignment on order line creation

Due to the following revision:
456d7b38f1

The company on the order line was not assigned
when creating a new line in an existing sale order.

The company was correctly assigned when you created
the order line with the order, and when changing the company
of the order, but not when adding a new line on an existing order.

This new trigger repairs this regression.
This commit is contained in:
Denis Ledoux 2016-12-07 16:31:01 +01:00
parent 36c6edf4bc
commit 82a07d1072
1 changed files with 1 additions and 0 deletions

View File

@ -953,6 +953,7 @@ class sale_order_line(osv.osv):
'salesman_id':fields.related('order_id', 'user_id', type='many2one', relation='res.users', store=True, string='Salesperson'),
'company_id': fields.related('order_id', 'company_id', type='many2one', relation='res.company', string='Company', store={
'sale.order': (_get_sale_order, ['company_id'], 20),
'sale.order.line': (lambda self, cr, uid, ids, c=None: ids, ['order_id'], 20),
}, readonly=True),
'delay': fields.float('Delivery Lead Time', required=True, help="Number of days between the order confirmation and the shipping of the products to the customer", readonly=True, states={'draft': [('readonly', False)]}),
'procurement_ids': fields.one2many('procurement.order', 'sale_line_id', 'Procurements'),