New report intrastat for OpenERP

crash when creating final invoice in OERP 6.1

Reported by Alexandre Fayolle - camptocamp on 2012-03-29
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
New report intrastat
Undecided
Unassigned

Bug Description

I'm trying to setup an instance with OERP 6.1 and various modules, and it seems that the current trunk has not followed some API changes in the 6.1 branch, resulting in crashes in super() chained calls.

Example at hand: when creating a final invoice for a sale, I get:

Server Traceback (most recent call last):
File "[$ROOT]/src/webclient/addons/web/common/http.py", line 592, in send
result = openerp.netsvc.dispatch_rpc(service_name, method, args)
File "[$ROOT]/src/server/openerp/netsvc.py", line 360, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
File "[$ROOT]/src/server/openerp/service/web_services.py", line 572, in dispatch
res = fn(db, uid, *params)
File "[$ROOT]/src/server/openerp/osv/osv.py", line 167, in execute_kw
return self.execute(db, uid, obj, method, *args, **kw or {})
File "[$ROOT]/src/server/openerp/osv/osv.py", line 121, in wrapper
return f(self, dbname, *args, **kwargs)
File "[$ROOT]/src/server/openerp/osv/osv.py", line 176, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "[$ROOT]/src/server/openerp/osv/osv.py", line 164, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "[$ROOT]/src/server/openerp/addons/sale/sale.py", line 483, in manual_invoice
wf_service.trg_validate(uid, 'sale.order', id, 'manual_invoice', cr)
File "[$ROOT]/src/server/openerp/workflow/wkf_service.py", line 124, in trg_validate
res2 = instance.validate(cr, id, ident, signal)
File "[$ROOT]/src/server/openerp/workflow/instance.py", line 48, in validate
workitem.process(cr, witem, ident, signal, force_running, stack=stack)
File "[$ROOT]/src/server/openerp/workflow/workitem.py", line 61, in process
ok = _split_test(cr, workitem, activity['split_mode'], ident, signal, stack)
File "[$ROOT]/src/server/openerp/workflow/workitem.py", line 176, in _split_test
_join_test(cr, t[0], t[1], ident, stack)
File "[$ROOT]/src/server/openerp/workflow/workitem.py", line 184, in _join_test
create(cr,[activity], inst_id, ident, stack)
File "[$ROOT]/src/server/openerp/workflow/workitem.py", line 41, in create
process(cr, res, ident, stack=stack)
File "[$ROOT]/src/server/openerp/workflow/workitem.py", line 53, in process
result = _execute(cr, workitem, activity, ident, stack)
File "[$ROOT]/src/server/openerp/workflow/workitem.py", line 128, in _execute
id_new = wkf_expr.execute(cr, ident, workitem, activity)
File "[$ROOT]/src/server/openerp/workflow/wkf_expr.py", line 68, in execute
return _eval_expr(cr, ident, workitem, activity['action'])
File "[$ROOT]/src/server/openerp/workflow/wkf_expr.py", line 58, in _eval_expr
ret = eval(line, env, nocopy=True)
File "[$ROOT]/src/server/openerp/tools/safe_eval.py", line 241, in safe_eval
return eval(test_expr(expr,_SAFE_OPCODES, mode=mode), globals_dict, locals_dict)
File "", line 1, in <module>
File "[$ROOT]/src/server/openerp/osv/orm.py", line 368, in function_proxy
return attr(self._cr, self._uid, [self._id], *args, **kwargs)
File "[$ROOT]/src/server/openerp/addons/base_sale_multichannels/sale.py", line 734, in action_invoice_create
res = super(sale_order, self).action_invoice_create(cr, uid, ids, grouped, states, date_inv, context)
TypeError: action_invoice_create() takes at most 6 arguments (8 given)

Instrumenting the code in base_sale_multichannels/sale.py", line 734 showed that the action_invoice_create method causing the fault is src/server/openerp/addons/l10n_fr_intrastat_product/sale.py", line 28, which indeed has a different prototype from the one in sale/sale.py and base_sale_multichannels/sale.py

I join a simple patch fixing the issue.

Alexis de Lattre (alexis-via) wrote :

I have merged your branch.
To try to excuse myself for this very long delay, I have given you direct commit rights to this code :)

Changed in new-report-intrastat:
status: New → Fix Committed
Alexis de Lattre (alexis-via) wrote :

I also wanted to say that, after a new feature that I will add this afternoon, I will make a dedicated branch for 6.1 where I won't inherit action_invoice_create any more, but I will inherit the new "_prepare_invoice" functions (only present in OpenERP 6.1... a contribution of Akretion !) That will impove code quality and performances !

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

Other bug subscribers