Skip to content

Commit 288ba2c

Browse files
[MIG] l10n_br_account: compute_needed_terms
1 parent 2688f48 commit 288ba2c

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

l10n_br_account/models/account_move.py

+21-10
Original file line numberDiff line numberDiff line change
@@ -339,23 +339,34 @@ def _compute_needed_terms(self):
339339
sign=sign,
340340
)
341341
)
342-
for term in invoice_payment_terms:
342+
for term in invoice_payment_terms["line_ids"]:
343343
key = frozendict(
344344
{
345345
"move_id": invoice.id,
346+
"date_maturity": fields.Date.to_date(term.get("date")),
347+
"discount_date": invoice_payment_terms.get(
348+
"discount_date"
349+
),
350+
# "discount_percentage": invoice_payment_terms.get(
351+
# "discount_percentage"
352+
# ),
346353
}
347-
# "date_maturity": fields.Date.to_date(term.get("date")),
348-
# "discount_date": term.get("discount_date"),
349-
# "discount_percentage": term.get("discount_percentage"),
350354
)
351355
values = {
352-
"balance": term["company_amount"],
353-
"amount_currency": term["foreign_amount"],
354-
"discount_amount_currency": term["discount_amount_currency"]
356+
"balance": term.get("company_amount"),
357+
"amount_currency": term.get("foreign_amount"),
358+
"discount_amount_currency": term.get(
359+
"discount_amount_currency"
360+
)
361+
or 0.0,
362+
"discount_balance": invoice_payment_terms.get(
363+
"discount_balance"
364+
)
355365
or 0.0,
356-
"discount_balance": term["discount_balance"] or 0.0,
357-
"discount_date": term["discount_date"],
358-
# "discount_percentage": term["discount_percentage"],
366+
"discount_date": invoice_payment_terms.get("discount_date"),
367+
# "discount_percentage": invoice_payment_terms.get(
368+
# "discount_percentage"
369+
# ),
359370
}
360371
if key not in invoice.needed_terms:
361372
invoice.needed_terms[key] = values

0 commit comments

Comments
 (0)