Skip to Content
Menu
This question has been flagged
942 Views

Hello!

We are using Odoo version 12. We are auto-validating the invoices which are created by a 3rd party module based on E-Commerce orders. Following code is involved:


                if not invoiceId:
invoiceId = saleObj.action_invoice_create()
invoiceObj = self.env['account.invoice'].browse(invoiceId)
if ecommerceInvoiceId and invoiceId:
invoiceObj = self.env[
'account.invoice'].browse(invoiceId)
invoiceObj.write({'name': ecommerceInvoiceId})
invoiceObj = self.env['account.invoice'].browse(invoiceId)
invoiceObj.action_invoice_open()# Open(confirm) invoice after creation. 


The Problem: The validation works fine. But the date_due calculation based on the payment terms does not work. Date_Due is always the same as the invoice date. It should be +30 Days from the invoice date, based on the payment terms. The payment terms are set correctly in the invoice. If I validate the invoice manually with the button, the date_due is calculated correctly.


Thanks for your help!

Avatar
Discard