From d6d901c7bc23c7aaafd09c2abccfbe6a7c963b70 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Mon, 23 Oct 2017 15:44:24 +0200 Subject: [PATCH] [FIX] stock: updating quantity on hand changes the source name of a product When a stock.inventory.line was created, it changed the src translation of the product if the user was not in english US. opw:776528 --- addons/stock/models/stock_inventory.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/stock/models/stock_inventory.py b/addons/stock/models/stock_inventory.py index 271e12759b3..996dfec0b5d 100644 --- a/addons/stock/models/stock_inventory.py +++ b/addons/stock/models/stock_inventory.py @@ -310,7 +310,7 @@ class InventoryLine(models.Model): 'product.product', 'Product', index=True, required=True) product_name = fields.Char( - 'Product Name', related='product_id.name', store=True) + 'Product Name', related='product_id.name', store=True, readonly=True) product_code = fields.Char( 'Product Code', related='product_id.default_code', store=True) product_uom_id = fields.Many2one( @@ -373,8 +373,14 @@ class InventoryLine(models.Model): self._compute_theoretical_qty() self.product_qty = self.theoretical_qty + @api.model + def write(self, values): + values.pop('product_name', False) + res = super(InventoryLine, self).write(values) + @api.model def create(self, values): + values.pop('product_name', False) if 'product_id' in values and 'product_uom_id' not in values: values['product_uom_id'] = self.env['product.product'].browse(values['product_id']).uom_id.id existings = self.search([