@@ -339,23 +339,32 @@ def _compute_needed_terms(self):
339
339
sign = sign ,
340
340
)
341
341
)
342
- for term in invoice_payment_terms :
342
+ for term in invoice_payment_terms [ "line_ids" ] :
343
343
key = frozendict (
344
344
{
345
345
"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
+ # ),
346
353
}
347
- # "date_maturity": fields.Date.to_date(term.get("date")),
348
- # "discount_date": term.get("discount_date"),
349
- # "discount_percentage": term.get("discount_percentage"),
350
354
)
351
355
values = {
352
356
"balance" : term ["company_amount" ],
353
357
"amount_currency" : term ["foreign_amount" ],
354
358
"discount_amount_currency" : term ["discount_amount_currency" ]
355
359
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
+ # ),
359
368
}
360
369
if key not in invoice .needed_terms :
361
370
invoice .needed_terms [key ] = values
0 commit comments