From 28180b070aeb9dcb4a25c8cf47fc5c7a0fec2f96 Mon Sep 17 00:00:00 2001 From: Michele Date: Tue, 4 Jul 2023 13:37:12 +0000 Subject: [PATCH] [FIX] stock: add default company_id on stock lot The field company id on stock lot is required but there is not a default value. The default value should be the current company id closes odoo/odoo#128640 X-original-commit: 9b21686616f51db1246ae51c29dab4af2c341323 Signed-off-by: William Henrotin (whe) --- addons/stock/models/stock_lot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/models/stock_lot.py b/addons/stock/models/stock_lot.py index b21902a944d..356a2c91607 100644 --- a/addons/stock/models/stock_lot.py +++ b/addons/stock/models/stock_lot.py @@ -30,7 +30,7 @@ class StockLot(models.Model): product_qty = fields.Float('Quantity', compute='_product_qty') note = fields.Html(string='Description') display_complete = fields.Boolean(compute='_compute_display_complete') - company_id = fields.Many2one('res.company', 'Company', required=True, store=True, index=True) + company_id = fields.Many2one('res.company', 'Company', required=True, index=True, default=lambda self: self.env.company.id) delivery_ids = fields.Many2many('stock.picking', compute='_compute_delivery_ids', string='Transfers') delivery_count = fields.Integer('Delivery order count', compute='_compute_delivery_ids') last_delivery_partner_id = fields.Many2one('res.partner', compute='_compute_delivery_ids')