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

How to stop Recursive calling of Onchange Event?

By
deep
on 9/20/13, 9:53 AM 2,157 views

In Version 7... Lets Consider I have 3 fields called "basic", "tac_perc" and "tac_amt"..

And the calculation goes like this: Basic: 1000 TAC %: 20 TAC Amount: 200

(i.e) 20 % on basic will be my TAC amount which is 200..

(Or) if u had entered 200 in tac_amount then 20 will be calculated as TAC %...

Now I have written 2 onchange functions: [Which is working good]

  1. onchange_percent: which calculates n give me TAC amount
  2. onchange_amount: which calculates n give me TAC %..

    <field name="tac_perc" on_change="onchange_percent(basic, tac_perc)"/>

    <field name="tac_amt" on_change="onchange_amount(basic, tac_amt)"/>

So When I enter 10% in "tac_perc" field, It calls the onchange_percent, which will calculate and populates the value to "tac_amount", but then again since "tac_amount" field is also having onchange method [onchange_amount], it then executes n returns the value to "tac_perc".. and the process continues...

So my question is How to stop the dynamicall triggering the Onchange Event.. or is there anyway to know how through which the onchange event is called...

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: 9/20/13, 9:53 AM
Seen: 2157 times
Last updated: 3/16/15, 8:10 AM