Skip to content

Commit

Permalink
Avoid to write weight if it's not changed
Browse files Browse the repository at this point in the history
  • Loading branch information
mboscolo committed Feb 28, 2025
1 parent 4d4c725 commit a1666d3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions plm_automatic_weight/models/product_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,12 @@ def write(self, vals):
vals['weight'] = weight_cad + weight_additional
elif product_id.automatic_compute_selection == 'use_normal_bom':
vals['weight'] = weight_additional + product_id.weight_n_bom_computed
if product_id.weight==vals['weight']:
del vals['weight']
res = super(PlmComponent, self).write(vals)
for product_product_id in self:
product_product_id.fix_parent()
if 'weight' in vals:
for product_product_id in self:
product_product_id.fix_parent()
return res

def fix_parent(self):
Expand Down

0 comments on commit a1666d3

Please sign in to comment.