Dear tryton team.
I know this may be an easy action but I’m facing issues I’ll describe:
Goal : I want to add a tax to invoice at invoice level (not line) using flask tryton.
I’m trying to do it like:
invoice_data = {‘party’: 52, ‘currency’: 12, ‘account’: 2, ‘company’: 1, ‘taxes’: [(‘add’, [1])]}
just before the Invoice.create(invoice_data)
I know taxes is related to account_invoice_tax model, so I need to create that instance and then add the id to my invoice? But that instance needs an invoice.id… so… I’m a littler lost
Based on tryton client I know fields base, amount, are mandatory to create tax at invoice_level, but I don’t know how to add those properly.
Thanks in advance.
Why? taxes are managed on line level and automatically computed when the invoices is created. So it will be easier to set the tax for the line.
If you want to create a non computed record you should manually add all the flags and set the manual flag to True to avoid the system recomputing this line.
Then you just need to set the propoer unit price on the line.
Tryton will take care of computing the correct taxes (if you also set them on the line) and everything else.