@@ -339,23 +339,34 @@ 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
- "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
+ )
355
365
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
+ # ),
359
370
}
360
371
if key not in invoice .needed_terms :
361
372
invoice .needed_terms [key ] = values
0 commit comments