From 82a07d10724d262096a61a1a3318069d17e86115 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 7 Dec 2016 16:31:01 +0100 Subject: [PATCH] [FIX] sale: fix company_id assignment on order line creation Due to the following revision: 456d7b38f1f6c889ab24e391154dbe1d21f34371 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. --- addons/sale/sale.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 2fe8948f81a..9cf27eda1eb 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -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'),