Pricing form

This commit is contained in:
2026-06-07 21:43:37 +02:00
parent 1abfbbbc3d
commit 74d1465470

View File

@@ -997,7 +997,8 @@ class Pricing(ModelSQL,ModelView):
depends=['available_components'])#, ondelete='CASCADE')
available_components = fields.Function(
fields.One2Many('pricing.component', '', "Available Components"),
'on_change_with_available_components')
'on_change_with_available_components',
setter='set_available_components')
quantity = fields.Numeric("Qt",digits='unit')
settl_price = fields.Numeric("Settl. price",digits='unit')
fixed_qt = fields.Numeric("Fixed qt",digits='unit', readonly=True)
@@ -1046,6 +1047,10 @@ class Pricing(ModelSQL,ModelView):
return Component.search([('sale_line', '=', sale_line)])
return []
@classmethod
def set_available_components(cls, records, name, value):
pass
@staticmethod
def _weighted_average_price(fixed_qt, fixed_price, unfixed_qt, unfixed_price):
fixed_qt = Decimal(str(fixed_qt or 0))