Use depends on methods

issue5191
review45481002
This commit is contained in:
Cédric Krier
2018-05-31 13:25:29 +02:00
parent c7b6076af2
commit 8a8435b063
3 changed files with 5 additions and 17 deletions
+1 -8
View File
@@ -40,6 +40,7 @@ class InvoiceLine:
__metaclass__ = PoolMeta
__name__ = 'account.invoice.line'
@fields.depends('origin')
def _get_tax_rule_pattern(self):
pool = Pool()
SaleLine = pool.get('sale.line')
@@ -60,11 +61,3 @@ class InvoiceLine:
pattern['from_country'] = from_country.id if from_country else None
pattern['to_country'] = to_country.id if to_country else None
return pattern
@fields.depends('origin')
def on_change_product(self):
super(InvoiceLine, self).on_change_product()
@fields.depends('origin')
def on_change_account(self):
super(InvoiceLine, self).on_change_account()
+2 -5
View File
@@ -25,6 +25,8 @@ class PurchaseLine:
__metaclass__ = PoolMeta
__name__ = 'purchase.line'
@fields.depends('purchase', '_parent_purchase.warehouse',
'_parent_purchase.invoice_address')
def _get_tax_rule_pattern(self):
pattern = super(PurchaseLine, self)._get_tax_rule_pattern()
@@ -39,8 +41,3 @@ class PurchaseLine:
pattern['from_country'] = from_country.id if from_country else None
pattern['to_country'] = to_country.id if to_country else None
return pattern
@fields.depends('_parent_purchase.warehouse',
'_parent_purchase.invoice_address')
def on_change_product(self):
super(PurchaseLine, self).on_change_product()
+2 -4
View File
@@ -25,6 +25,8 @@ class SaleLine:
__metaclass__ = PoolMeta
__name__ = 'sale.line'
@fields.depends('sale', '_parent_sale.warehouse',
'_parent_sale.shipment_address')
def _get_tax_rule_pattern(self):
pool = Pool()
Location = pool.get('stock.location')
@@ -46,7 +48,3 @@ class SaleLine:
pattern['from_country'] = from_country.id if from_country else None
pattern['to_country'] = to_country.id if to_country else None
return pattern
@fields.depends('_parent_sale.warehouse', '_parent_sale.shipment_address')
def on_change_product(self):
super(SaleLine, self).on_change_product()