Add all depends fields to on_change_product method of sale.line model

This commit is contained in:
jmartin 2014-07-02 09:09:49 +02:00
parent 3104e68ba3
commit 8311e518b7
1 changed files with 5 additions and 4 deletions

View File

@ -65,12 +65,13 @@ class SaleLine:
def default_cost_price():
return Decimal('0.0')
@fields.depends('product')
@fields.depends('product', 'unit', 'quantity', 'description',
'_parent_sale.party', '_parent_sale.currency',
'_parent_sale.sale_date')
def on_change_product(self):
if not self.product:
return {}
res = super(SaleLine, self).on_change_product()
res['cost_price'] = self.product.cost_price
if self.product:
res['cost_price'] = self.product.cost_price
return res
@fields.depends('type', 'quantity', 'cost_price', 'amount', 'unit_price',