Pricing form
This commit is contained in:
@@ -995,9 +995,10 @@ class Pricing(ModelSQL,ModelView):
|
||||
'pricing.component', "Component",
|
||||
domain=[('id', 'in', Eval('available_components', []))],
|
||||
depends=['available_components'])#, ondelete='CASCADE')
|
||||
available_components = fields.Function(
|
||||
fields.One2Many('pricing.component', '', "Available Components"),
|
||||
'on_change_with_available_components')
|
||||
available_components = fields.Function(
|
||||
fields.One2Many('pricing.component', '', "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)
|
||||
@@ -1036,15 +1037,19 @@ class Pricing(ModelSQL,ModelView):
|
||||
return Decimal(0)
|
||||
|
||||
@fields.depends('line', 'sale_line')
|
||||
def on_change_with_available_components(self, name=None):
|
||||
Component = Pool().get('pricing.component')
|
||||
line = getattr(self, 'line', None)
|
||||
if line:
|
||||
return Component.search([('line', '=', line)])
|
||||
def on_change_with_available_components(self, name=None):
|
||||
Component = Pool().get('pricing.component')
|
||||
line = getattr(self, 'line', None)
|
||||
if line:
|
||||
return Component.search([('line', '=', line)])
|
||||
sale_line = getattr(self, 'sale_line', None)
|
||||
if sale_line:
|
||||
return Component.search([('sale_line', '=', sale_line)])
|
||||
return []
|
||||
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):
|
||||
|
||||
Reference in New Issue
Block a user