Skip to content

Commit c023f8a

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

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

l10n_br_account/models/account_move.py

+16-7
Original file line numberDiff line numberDiff line change
@@ -339,23 +339,32 @@ 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 = {
352356
"balance": term["company_amount"],
353357
"amount_currency": term["foreign_amount"],
354358
"discount_amount_currency": term["discount_amount_currency"]
355359
or 0.0,
356-
"discount_balance": term["discount_balance"] or 0.0,
357-
"discount_date": term["discount_date"],
358-
# "discount_percentage": term["discount_percentage"],
360+
"discount_balance": invoice_payment_terms.get(
361+
"discount_balance"
362+
)
363+
or 0.0,
364+
"discount_date": invoice_payment_terms.get("discount_date"),
365+
# "discount_percentage": invoice_payment_terms.get(
366+
# "discount_percentage"
367+
# ),
359368
}
360369
if key not in invoice.needed_terms:
361370
invoice.needed_terms[key] = values

0 commit comments

Comments
 (0)