Skip to content

Commit

Permalink
IMP: regression
Browse files Browse the repository at this point in the history
  • Loading branch information
mboscolo committed Nov 6, 2024
1 parent 80cbffa commit 2e045a6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion plm_auto_internalref/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
##############################################################################
{
"name": "PLM Auto Internal Reference",
"version": "16.0.2",
"version": "16.0.3",
"author": "OmniaSolutions",
"website": "https://odooplm.omniasolutions.website",
"category": "Manufacturing/Product Lifecycle Management (PLM)",
Expand Down
17 changes: 17 additions & 0 deletions plm_auto_internalref/models/product_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,21 @@ def oc_engineering_code(self):
for pp_id in self:
pp_id.default_code=pp_id.computeDefaultCode({},
pp_id.product_tmpl_id)
@api.model_create_multi
def create(self, vals):
for val_dict in vals:
new_default_code = self.computeDefaultCode(val_dict)
if new_default_code:
val_dict['default_code'] = new_default_code
return super().create(vals)

def write(self, vals):
ret = False
for product in self:
new_default_code = product.computeDefaultCode(vals,
product)
if new_default_code:
vals['default_code'] = new_default_code
ret = super(models.Model, product).write(vals)
return ret

8 changes: 8 additions & 0 deletions plm_auto_internalref/models/product_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,13 @@ def oc_engineering_code(self):
for pt_id in self:
pt_id.default_code=self.env['product.product'].computeDefaultCode({},
pt_id)
@api.model_create_multi
def create(self, vals):
obj_pp = self.env['product.product']
for val_dict in vals:
new_default_code = obj_pp.computeDefaultCode(val_dict)
if new_default_code:
val_dict['default_code'] = new_default_code
return super().create(vals)

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

0 comments on commit 2e045a6

Please sign in to comment.