Incorrect sequence when calling Super()

Bug #1317686 reported by Luis Felipe Miléo - http://www.kmee.com.br
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
New
Undecided
Unassigned

Bug Description

Hi,

I have this modules installed:

1 - purchase
2 - account_fiscal_position_rule_purchase ( depends purchase)
3 - l10n_br_purchase ( depends account_fiscal_position_rule_purchase

#l10n_br_core/l10n_br_purchase/purchase.py

    def onchange_partner_id(self, cr, uid, ids, partner_id=False,
                            company_id=False, context=None, **kwargs):
        if not context:
            context = {}
        # TODO try to upstream web_context_tunnel in fiscal-rules
        # to avoid having to change this signature
        fiscal_category_id = context.get('fiscal_category_id')
        if not company_id:
            company_id = self.pool['res.users'].browse(
                cr, uid, uid, context).company_id.id
        return super(PurchaseOrder, self).onchange_partner_id(
            cr, uid, ids, partner_id, company_id, context,
            fiscal_category_id=fiscal_category_id, **kwargs)

#account_fiscal_position_rule_purchase/purchase.py:

    def onchange_partner_id(self, cr, uid, ids, partner_id, company_id=None,
                            context=None, **kwargs):
        if not context:
            context = {}

        result = super(purchase_order, self).onchange_partner_id(
            cr, uid, ids, partner_id)

        if not partner_id or not company_id:
            return result

        kwargs.update({
            'company_id': company_id,
            'partner_id': partner_id,
            'partner_invoice_id': partner_id,
            'partner_shipping_id': partner_id,
            'context': context
        })
        return self._fiscal_position_map(cr, uid, result, **kwargs)

# purchase/purchase.py

    def onchange_partner_id(self, cr, uid, ids, partner_id):
        partner = self.pool.get('res.partner')
        if not partner_id:
            return {'value': {
                'fiscal_position': False,
                'payment_term_id': False,
                }}
        supplier_address = partner.address_get(cr, uid, [partner_id], ['default'])
        supplier = partner.browse(cr, uid, partner_id)
        return {'value': {
            'pricelist_id': supplier.property_product_pricelist_purchase.id,
            'fiscal_position': supplier.property_account_position and supplier.property_account_position.id or False,
            'payment_term_id': supplier.property_supplier_payment_term.id or False,
            }}

In common situations the l10n_br_purchase calls account_fiscal_position_rule_purchase that calls the onchange_partner_id from purchase, but we receive this following error:

Client Traceback (most recent call last):
  File "/opt/openerp/web/addons/web/http.py", line 204, in dispatch
    response["result"] = method(self, **self.params)
  File "/opt/openerp/web/addons/web/controllers/main.py", line 1128, in call_kw
    return self._call_kw(req, model, method, args, kwargs)
  File "/opt/openerp/web/addons/web/controllers/main.py", line 1120, in _call_kw
    return getattr(req.session.model(model), method)(*args, **kwargs)
  File "/opt/openerp/web/addons/web/session.py", line 42, in proxy
    result = self.proxy.execute_kw(self.session._db, self.session._uid, self.session._password, self.model, method, args, kw)
  File "/opt/openerp/web/addons/web/session.py", line 30, in proxy_method
    result = self.session.send(self.service_name, method, *args)
  File "/opt/openerp/web/addons/web/session.py", line 103, in send
    raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info)

Server Traceback (most recent call last):
  File "/opt/openerp/web/addons/web/session.py", line 89, in send
    return openerp.netsvc.dispatch_rpc(service_name, method, args)
  File "/opt/openerp/server/openerp/netsvc.py", line 292, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/opt/openerp/server/openerp/service/web_services.py", line 626, in dispatch
    res = fn(db, uid, *params)
  File "/opt/openerp/server/openerp/osv/osv.py", line 190, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/opt/openerp/server/openerp/osv/osv.py", line 132, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/opt/openerp/server/openerp/osv/osv.py", line 199, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/opt/openerp/server/openerp/osv/osv.py", line 187, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/opt/openerp/l10n_br_core/l10n_br_purchase/purchase.py", line 106, in onchange_partner_id
    fiscal_category_id=fiscal_category_id, **kwargs)
TypeError: onchange_partner_id() takes exactly 5 arguments (8 given)

I don't know why the super calling sequence is wrong, but if i uninstall account_fiscal_position_rule_purchase and install l10n_br_purchase everything starts to work properly.

Any one have some issue like this?

Thanks in advance.

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.