literal string parameters to on_change not supported

Bug #889741 reported by Ferdinand
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Web (MOVED TO GITHUB)
Fix Released
Low
OpenERP R&D Web Team

Bug Description

Example custom module (sorry didn't find an example in certified modules yet)
works in GTK

my blind guess - inheritance problem

http://bazaar.launchpad.net/~c2c/c2c-rd-addons/trunk/files/head:/c2c_product_price_unit/

purchase_view.xml

     <field name="inherit_id" ref="purchase.purchase_order_line_form"/>
....
           <field
              name="price_unit_pu"
              on_change="onchange_price_unit('price_unit',price_unit_pu,price_unit_id)"/>

purchase.py

    def onchange_price_unit(self, cr, uid, ids, field_name,price_pu, price_unit_id):
        if price_pu and price_unit_id:
           coeff = self.pool.get('c2c_product.price_unit').get_coeff(cr, uid, price_unit_id)
           price = price_pu / coeff

           return {'value': {field_name : price}}
        return False

Related branches

Revision history for this message
Ferdinand (office-chricar) wrote :

may be that this happens only if the field with the trigger is new in the module

Changed in openerp-web:
assignee: nobody → OpenERP R&D Web Team (openerp-dev-web)
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Ferdinand (office-chricar) wrote :

please increase the importance

We must be able to rely that triggers work

Changed in openerp-web:
importance: Low → Medium
Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

I believe the issue comes from the web client currently not handling literal strings for onchange parameters, more than anything related to inheritance

Changed in openerp-web:
importance: Medium → Low
summary: - not all on change triggers are fired
+ literal string parameters to on_change not supported
Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

A fix for this issue has been pushed to the branch https://code.launchpad.net/~openerp-dev/openerp-web/trunk-onchange-string-literals-xmo

Could you test if it solves the problem on your custom module?

Changed in openerp-web:
status: Confirmed → Fix Committed
Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

Fix pushed to trunk, revision <email address hidden>

Changed in openerp-web:
status: Fix Committed → Fix Released
Revision history for this message
Ferdinand (office-chricar) wrote :

Sorry the issue is definitely not fixed

the trigger writes a log text for test purpose, and it works fine with GTK, but not log text when using the web client rev 1528

hence the trigger is NOT fired at all.

Changed in openerp-web:
status: Fix Released → New
Changed in openerp-web:
status: New → Fix Released
Changed in openerp-web:
status: Fix Released → New
Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

> the trigger writes a log text for test purpose, and it works fine with GTK, but not log text when using the web client rev 1528

And yet adding the same onchange call your perform (a string and 2 variable arguments) to an existing view works perfectly here.

Could you ensure your cache has been cleaned (to know the code is up to date) and see (and copy here) any error appearing in your javascript console?

Changed in openerp-web:
status: New → Incomplete
Revision history for this message
Ferdinand (office-chricar) wrote :

Failed to load resource
js:29070Error: Could not get field with name '{'company_id': parent.company_id}' for onchange 'product_id_change_c2c_pu(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit_pu, parent.address_invoice_id, parent.currency_id, {'company_id': parent.company_id}, price_unit_id)'

sorry
it's a coding error
my be the js errors could be shown in pop-ups

Changed in openerp-web:
status: Incomplete → New
Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

> sorry it's a coding error

No problem closing the bug as resolved then.

> my be the js errors could be shown in pop-ups

Yeah, making it easier to see would probably be a good idea, at least for this kind of errors.

Changed in openerp-web:
status: New → Fix Released
Revision history for this message
Ferdinand (office-chricar) wrote :

Sorry once more

I changed (error) (1)
on_change="product_id_change_c2c_pu(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit_pu, parent.address_invoice_id, parent.currency_id, {'company_id': parent.company_id},price_unit_id)"

to (working) (2)
on_change="product_id_change_c2c_pu(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit_pu, parent.address_invoice_id, parent.currency_id, parent.company_id,price_unit_id)"/>

replacing
{'company_id': parent.company_id}
by
parent.company_id

nevertheless
parent.company_id is a non existing field
- hence the the coding (1) returned an error - which is correct behaviour
- while coding(2) just ignores a reference to a not existing field - which IMHO should not be allowed.

Changed in openerp-web:
status: Fix Released → New
Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

> parent.company_id is a non existing field

Yes, that does sound like a bug in the handling of parent.* references in on_change resolution. But it's a different issue than this bug, please stop reopening this one and create a new one for that new issue.

Changed in openerp-web:
status: New → Fix Released
Revision history for this message
Alexis de Lattre (alexis-via) wrote :

After a Google search, I arrived on this bug report. I am having some issues with the web interface of OpenERP 6.1 when passing parent.* fields to on_change. The bug occurs with Firefox but not with Chrome. I'll try to make a new bug report if I have time.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.