Odoo Help

0

How to stop Recursive calling of Onchange Event?

By
deep
on 9/20/13, 9:53 AM 2,501 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...

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 9/20/13, 9:53 AM
Seen: 2501 times
Last updated: 3/16/15, 8:10 AM