Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Is there any way to calculate amount_subtotal from account.invoice.line use onchange of tax without clock on update Button

By
Odoo
on 6/27/14, 3:04 AM 667 views

Hi,

I want to calculate amount_subtotal use onchange function of tax_id without click on the update button of customer invoice line.....need a help

0
David Arnold
On 6/27/14, 4:19 AM

One of the reasons there is a button might be, that the tax calculation method is a rather costly python method. Actually you can kind of verify this when clicking on the update button. It is not truely "lighting fast".

Asuming you wouldn't be scared by performance decline you should probably look for the action that is triggered by the Update Button within the account_invoice.xml

Then you might add a onchange onto a meaningful field of the invoice line. Product Id is probably not wise, as it doen't change with quantity, euqally quantitiy might not change with price, and price might not change with discount, and discount might not change with taxes.. So probably the hard bit is to intelligently figure out on wich field change, you want the calculus to be triggered (altering other fields having not update effect, and running it on every field being performancewise totaly unacceptable)

 

-- EDIT --

Sorry I only got it right after a second and third reading.

You should probably look at the computation:
https://github.com/odoo/odoo/blob/master/addons/account/account_invoice.py#L1697

especially:
https://github.com/odoo/odoo/blob/master/addons/account/account_invoice.py#L1732-L1743

How the update method works:
https://github.com/odoo/odoo/blob/master/addons/account/account_invoice.py#L738-L752
 

I would truely suggest, observing as well the corresponding activity on the dev branch, as tax is refactored in V8.
There is a whole set of branches like: https://github.com/odoo-dev/odoo/tree/master-new-tax-design-tpa

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 6/27/14, 3:04 AM
Seen: 667 times
Last updated: 3/16/15, 8:10 AM