Skip to content

Commit

Permalink
[FIX] account_payment_term_multi_day: Use old API for method compute …
Browse files Browse the repository at this point in the history
…due to argument incompatibility
  • Loading branch information
pedrobaeza committed Aug 21, 2015
1 parent 47afff0 commit c0d5090
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions account_payment_term_multi_day/models/account_payment_term.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@
class AccountPaymentTerm(models.Model):
_inherit = "account.payment.term"

@api.multi
def compute(self, value, date_ref=False):
result = super(AccountPaymentTerm, self).compute(value, date_ref)[0]
def compute(self, cr, uid, id, value, date_ref=False, context=None):
"""This method can't be new API due to arguments names are not
standard for the API wrapper.
"""
result = super(AccountPaymentTerm, self).compute(
cr, uid, id, value=value, date_ref=date_ref, context=context)
payment_term = self.browse(cr, uid, id, context=context)
if not result:
return [result]
for i, line in enumerate(self.line_ids):
return result
for i, line in enumerate(payment_term.line_ids):
if not line.payment_days:
continue
payment_days = line._decode_payment_days(line.payment_days)
Expand All @@ -50,7 +54,7 @@ def compute(self, value, date_ref=False):
day = days_in_month
new_date = date + relativedelta(day=day, months=1)
result[i] = (fields.Date.to_string(new_date), result[i][1])
return [result]
return result


class AccountPaymentTermLine(models.Model):
Expand Down

0 comments on commit c0d5090

Please sign in to comment.