[6.0RC1][account_fiscal_position_rule_sale] Problems with 'onchange_partner_id'

Bug #695103 reported by Alberto Luengo Cabanillas (Pexego)
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Won't Fix
Undecided
Unassigned

Bug Description

Hi all,
Using following revisions from trunk (just downloaded today):

Server: 3163
Addons: 4033
Extra-addons:5126

and having installed 'account_fiscal_position_rule_sale' module: when creating a new Sale Order, the 'onchange_partner_id' method overriden in this module crashes because it receives an incorrect number of parameters from view:

(extract from sale_view.xml, lines 30-40)
<record id="view_order_form3" model="ir.ui.view">
   <field name="name">account_fiscal_postion_rule_form_view_order_form3</field>
      <field name="model">sale.order</field>
      <field name="inherit_id" ref="sale.view_order_form"/>
      <field name="priority">32</field>
      <field name="arch" type="xml">
    <field name="partner_id" position="replace">
                             <field name="partner_id" on_change="onchange_partner_id(partner_invoice_id, partner_id, shop_id)" required="1"/>
    </field>
          </field>
  </record>

when it should be:

(...)
<field name="partner_id" on_change="onchange_partner_id(partner_id, shop_id)" required="1"/>
(...)

Regards,

Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote :

Hello Alberto:

Do you have the "delivery" module installed?
if yes, this is a know issue: because account_fiscal_position_rule_sale cannot depend on "delivery" (because it makes no sense, just bloat the system).
Still delivery redefines the onchange_partner_id method! So it conflicts with account_fiscal_position_rule_sale!

This is a generic issue with the crappy positional arguments system used in OpenERP on_change methods. Hopefully we will have a better system (dictionary based) in future OpenERP versions.

For now, a workaround to make account_fiscal_position_rule_sale work, is to change its __openerp__.py file in order to make it depend on "delivery". Then restart the server and do an "update module list" in OpenERP admin.
Now it should work.

Since we should cope with the current OpenERP on_change system, I would like we make a new module like "account_fiscal_position_rule_sale_delivery" that depends both on account_fiscal_position_rule_sale and delivery and only override the on_change with the proper signature. This module would do nothing but just make module compatible.

Does the trick work for you? What do you think about creating an other "compatibility module" while OpenERP sticks with that crappy on_change system?

Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Alberto,

'account_fiscal_position_rule_sale' module is in Extra-addons . So we can not fix it.Our R&D Teams are focused on the latest OpenERP version, and this issue does not affect it. So i am closing this bug.

Thanks.

Changed in openobject-addons:
status: New → Won't Fix
Revision history for this message
Alberto Luengo Cabanillas (Pexego) (alberto-pexego) wrote :

Hello Raphaël,

I don't have "delivery" module installed in the DB I'm using. I agree with you that the 'onchange' methods signature is inconsistent (as same as the 'context=None/context={}' case), and I hope that the community reach an agreement.
IMHO, I prefer changing the call of 'onchange_partner_id' in 'sale_view.xml' instead of making it dependant on another module, because I think this is less 'invasive'. Besides, what is the purpose of this 'partner_invoice_id' argument in 'onchange_partner_id' method? because is never read, isn't it?.
Regards and thanks for your answer,

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.