Ciao Nico,
grazie per l'aiuto, purtroppo non son oriuscito a risolvere, o meglio funziona solo se disinstallo il modulo "sale_commission".
Ho aggiunto
if type(ids) not in (list, tuple):
ids = [ids]
Se aggiungo questa if non riesco più a confermare un preventivo in ordine, di seguito la classe modificata e l'errore che si genera.
come tu mi hai detto precisamente di seguito la classe
class sale_order_line(orm.Model):
"""Modificamos las lineas ventas para incluir las comisiones en las facturas creadas desde ventas"""
_inherit = "sale.order.line"
def invoice_line_create(self, cr, uid, ids, context=None):
if type(ids) not in (list, tuple):
ids = [ids]
if context is None:
context = {}
invoice_line_pool = self.pool.get('account.invoice.line')
invoice_line_agent_pool = self.pool.get('invoice.line.agent')
res = super(sale_order_line, self).invoice_line_create(cr, uid, ids, context)
so_ref = self.browse(cr, uid, ids)[0].order_id
for so_agent_id in so_ref.sale_agent_ids:
inv_lines = invoice_line_pool.browse(cr, uid, res, context=context)
for inv_line in inv_lines:
if inv_line.product_id and inv_line.product_id.commission_exent is not True:
vals = {
'invoice_line_id': inv_line.id,
'agent_id': so_agent_id.agent_id.id,
'commission_id': so_agent_id.commission_id.id,
'settled': False
}
line_agent_id = invoice_line_agent_pool.create(cr, uid, vals, context=context)
invoice_line_agent_pool.calculate_commission(cr, uid, [line_agent_id], context=context)
return res
Server Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/openerp/addons/web/session.py", line 89, in send
return openerp.netsvc.dispatch_rpc(service_name, method, args)
File "/usr/lib/python2.7/dist-packages/openerp/netsvc.py", line 296, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
File "/usr/lib/python2.7/dist-packages/openerp/service/web_services.py", line 632, in dispatch
res = fn(db, uid, *params)
File "/usr/lib/python2.7/dist-packages/openerp/osv/osv.py", line 190, in execute_kw
return self.execute(db, uid, obj, method, *args, **kw or {})
File "/usr/lib/python2.7/dist-packages/openerp/osv/osv.py", line 132, in wrapper
return f(self, dbname, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/osv/osv.py", line 199, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/usr/lib/python2.7/dist-packages/openerp/osv/osv.py", line 187, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/usr/lib/python2.7/dist-packages/openerp/addons/portal_sale/portal_sale.py", line 65, in action_button_confirm
return super(sale_order, self).action_button_confirm(cr, uid, ids, context=context)
File "/usr/lib/python2.7/dist-packages/openerp/addons/sale/sale.py", line 583, in action_button_confirm
wf_service.trg_validate(uid, 'sale.order', ids[0], 'order_confirm', cr)
File "/usr/lib/python2.7/dist-packages/openerp/workflow/wkf_service.py", line 119, in trg_validate
res2 = instance.validate(cr, id, ident, signal)
File "/usr/lib/python2.7/dist-packages/openerp/workflow/instance.py", line 43, in validate
workitem.process(cr, witem, ident, signal, force_running, stack=stack)
File "/usr/lib/python2.7/dist-packages/openerp/workflow/workitem.py", line 60, in process
ok = _split_test(cr, workitem, activity, ident, signal, stack)
File "/usr/lib/python2.7/dist-packages/openerp/workflow/workitem.py", line 175, in _split_test
_join_test(cr, t[0], t[1], ident, stack)
File "/usr/lib/python2.7/dist-packages/openerp/workflow/workitem.py", line 183, in _join_test
create(cr,[activity], inst_id, ident, stack)
File "/usr/lib/python2.7/dist-packages/openerp/workflow/workitem.py", line 40, in create
process(cr, res, ident, stack=stack)
File "/usr/lib/python2.7/dist-packages/openerp/workflow/workitem.py", line 60, in process
ok = _split_test(cr, workitem, activity, ident, signal, stack)
File "/usr/lib/python2.7/dist-packages/openerp/workflow/workitem.py", line 175, in _split_test
_join_test(cr, t[0], t[1], ident, stack)
File "/usr/lib/python2.7/dist-packages/openerp/workflow/workitem.py", line 183, in _join_test
create(cr,[activity], inst_id, ident, stack)
File "/usr/lib/python2.7/dist-packages/openerp/workflow/workitem.py", line 40, in create
process(cr, res, ident, stack=stack)
File "/usr/lib/python2.7/dist-packages/openerp/workflow/workitem.py", line 60, in process
ok = _split_test(cr, workitem, activity, ident, signal, stack)
File "/usr/lib/python2.7/dist-packages/openerp/workflow/workitem.py", line 175, in _split_test
_join_test(cr, t[0], t[1], ident, stack)
File "/usr/lib/python2.7/dist-packages/openerp/workflow/workitem.py", line 183, in _join_test
create(cr,[activity], inst_id, ident, stack)
File "/usr/lib/python2.7/dist-packages/openerp/workflow/workitem.py", line 40, in create
process(cr, res, ident, stack=stack)
File "/usr/lib/python2.7/dist-packages/openerp/workflow/workitem.py", line 52, in process
result = _execute(cr, workitem, activity, ident, stack)
File "/usr/lib/python2.7/dist-packages/openerp/workflow/workitem.py", line 106, in _execute
returned_action = wkf_expr.execute(cr, ident, workitem, activity)
File "/usr/lib/python2.7/dist-packages/openerp/workflow/wkf_expr.py", line 67, in execute
return _eval_expr(cr, ident, workitem, activity)
File "/usr/lib/python2.7/dist-packages/openerp/workflow/wkf_expr.py", line 57, in _eval_expr
ret = eval(line, env, nocopy=True)
File "/usr/lib/python2.7/dist-packages/openerp/tools/safe_eval.py", line 288, in safe_eval
return eval(test_expr(expr, _SAFE_OPCODES, mode=mode), globals_dict, locals_dict)
File "", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/openerp/osv/orm.py", line 378, in function_proxy
return attr(self._cr, self._uid, [self._id], *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/addons/sale_commission/sale_order.py", line 140, in action_ship_create
res = super(sale_order, self).action_ship_create(cr, uid, ids, context=context)
TypeError: action_ship_create() got an unexpected keyword argument 'context'