← Back to team overview

openerp-india team mailing list archive

[Bug 1098948] Re: Avoid recursive OnChange event

 

Hi,

I'm attaching the code currently used (a mix between sale_layout and
sale_margin)

Please focus on:
onchange_price_unit
onchange_margin_percent
onchange_markup_percent

The fields that interact each other are:
price_unit
price_discount
margin
margin_percent
markup_percent

As you will see, I try to use a flag inside a context, but this value is only visible in this function context (even after multiple on change)
eg:context.update({'ignore_margin_update': True});

** Attachment added: "sale_layout_margin.py"
   https://bugs.launchpad.net/openobject-server/+bug/1098948/+attachment/3560803/+files/sale_layout_margin.py

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/1098948

Title:
  Avoid recursive OnChange event

Status in OpenERP Server:
  Confirmed

Bug description:
  In a custom module that I'm trying to develop, there are three fields
  with a OnChange event that affects each of the other fields.

  The main issue is that the OnChange event is propagated threw all
  fields again and again until a balance is found (the value does not
  change, so the OnChange event is not triggered).

  Is there a way to avoid the OnChange "butterfly effect" ?

  I tried with a custom tag variable passed in the context dictionnary,
  but apparently this custom context is lost when exiting the OnChange
  event.

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/1098948/+subscriptions


References