Skip to content

Commit

Permalink
fix singleton error
Browse files Browse the repository at this point in the history
  • Loading branch information
mboscolo committed Nov 22, 2024
1 parent 303fca3 commit 0042165
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 4 additions & 2 deletions plm/models/ir_attachment.py
Original file line number Diff line number Diff line change
Expand Up @@ -3241,14 +3241,16 @@ def GetCloneDocumentValues(self, args):
"""
return the new attributes to be used for cloning the document
"""
_old_product_attrs, old_attachment_attrs, new_product_attrs = args
old_product_attrs, old_attachment_attrs, new_product_attrs = args
out_attachment_value = json.loads(old_attachment_attrs)
new_product_attrs = json.loads(new_product_attrs)
if hasattr(self, "customGetCloneDocumentValues"):
#
# If you implement the customGetCloneDocumentValues this call will be used to customize the value of the new cloned document from the client clone action
#
out_attachment_value=self.customGetCloneDocumentValues(out_attachment_value)
out_attachment_value=self.customGetCloneDocumentValues(out_attachment_value,
json.loads(old_product_attrs),
new_product_attrs)
else:
#
out_attachment_value['engineering_code'] = f"{new_product_attrs['engineering_code']}-{self.env['ir.sequence'].next_by_code('ir.attachment.progress')}"
Expand Down
10 changes: 5 additions & 5 deletions plm_auto_internalref/models/product_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ def create(self, vals):
return super().create(vals)

def write(self, vals):
new_default_code = self.env['product.product'].computeDefaultCode(vals,
self)
if new_default_code :
logging.info('OdooPLM: Default Code set to %s ' % (new_default_code))
vals['default_code'] = new_default_code
for product_template_id in self:
new_default_code = self.env['product.product'].computeDefaultCode(vals,
product_template_id)
if new_default_code :
vals['default_code'] = new_default_code
return super(ProductTemplateExtension, self).write(vals)


Expand Down

0 comments on commit 0042165

Please sign in to comment.