SST-10: remove field 'default_code' on update-product as it may conflict with inventory_lines

develop
Andreas Osim 2018-12-21 11:39:43 +01:00
parent 4834159b28
commit dcb7e5dbdb
1 changed files with 2 additions and 0 deletions

View File

@ -80,6 +80,8 @@ class ProductTemplate(models.Model):
vals = self.correct_values(vals)
product_template = self.with_context(active_test=False).search([('default_code', '=', vals['default_code'])])
if product_template:
# default_code may not be changed if there is already an inventory_line (in other company), so we remove it from the dict
vals.pop('default_code',None)
product_template.write(vals)
else:
if vals['active']: