Open partoneoftwo opened 4 years ago
You probably need to trigger the onchange specs.
Take a look at this section from the odoo development cookbook -
After way too many hours, I managed to get the functionality in Odoo to trigger; calculate taxes on created Expenses.
It does indeed calculate taxes now, so this is great!
This was achieved by running this command from Odooly:
env['hr.expense'].create({'product_id':39,'company_id':1,'employee_id':2,'name': "Zibby Tiny Lasagna",'unit_amount':'100','untaxed_amount':'100','quantity':'1','analytic_account_id':16,'company_currency_id':14,'account_id':'205','product_uom_id':1,'analytic_tag_ids':[('is_editable','0',[])],'tax_ids': [(6, 0, [5])]})
Remainder: The products are supposed to have a tax setting, but this is bruteforced by the tax_ids command above. So right now, Odoo doesn't follow which tax setting which was set in the product_id.
I found a clue, which got me closer to the solution here: https://www.odoo.com/es_ES/forum/ayuda-1/question/solved-get-and-set-default-tax-by-python-command-line-82209
How do I create expenses with tax correctly calculated?
When I use odooly to create an expense, I am able to create the expense, with the correct product chosen, and the specified date and amount. However the total is not correct, because the product I choose should have a TAX on it. Since all transactions on my expenses must show excluding and including VAT.
The goal here is: That the tax amount on the expense created by Odooly is calculated correctly.
My server/Odoo instance: In my case it works perfectly when manually entered, and the views and frontend calculate the tax value correctly when I use the mouse to select the correct product, the correct values are also then persisted to the database when clicking save.
The command I have tried to run is the following: ``
I have tried the following:
There seems to be a hint from a tangentially related question on the Odoo forums: - https://www.odoo.com/fr_FR/forum/aide-1/question/account-invoice-tax-is-not-calculated-from-line-data-imported-to-account-invoice-136828
Maybe the clue lies in the view for hr.expense located at Views ---> hr.expense.sheet.form, which refers to several fields that seem relevant to tax on expense.
But I can't figure it out... And now I've exhausted all options
Any help or pointers?