[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) <whe@odoo.com>
This commit is contained in:
Michele
2023-07-17 12:06:24 +02:00
committed by William Henrotin
parent b61a148648
commit 28180b070a
+1 -1
View File
@@ -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')