Skip to content

Commit

Permalink
Merge b44f17c into e0359a7
Browse files Browse the repository at this point in the history
  • Loading branch information
acsonefho committed May 10, 2019
2 parents e0359a7 + b44f17c commit 6a50575
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions account_invoice_triple_discount/models/account_invoice.py
Expand Up @@ -32,8 +32,15 @@ class AccountInvoiceLine(models.Model):
default=0.0,
)

@api.multi
@api.depends('discount2', 'discount3')
# Each iteration of api.multi is done into a different cache!
# As we're using cache to define a value into discount field, we have
# to stay into the same cache. So we can not use api.multi in this case.
@api.one
@api.depends(
'price_unit', 'discount', 'invoice_line_tax_ids', 'quantity',
'product_id', 'invoice_id.partner_id',
'invoice_id.currency_id', 'invoice_id.company_id',
'invoice_id.date_invoice', 'invoice_id.date', 'discount2', 'discount3')
def _compute_price(self):
prev_values = self.triple_discount_preprocess()
super(AccountInvoiceLine, self)._compute_price()
Expand All @@ -60,7 +67,7 @@ def triple_discount_preprocess(self):
discount2=line.discount2,
discount3=line.discount3,
)
line.update({
line._cache.update({
'discount': line._get_triple_discount(),
'discount2': 0.0,
'discount3': 0.0
Expand Down

0 comments on commit 6a50575

Please sign in to comment.