I am trying to port my module from Odoo 7 to Odoo 8. When i try to install my module the following error occurs.
Traceback (most recent call last):
File "/home/gowtham/Desktop/odoo-8.0/openerp/http.py", line 544, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/gowtham/Desktop/odoo-8.0/openerp/http.py", line 581, in dispatch
result = self._call_function(**self.params)
File "/home/gowtham/Desktop/odoo-8.0/openerp/http.py", line 317, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/gowtham/Desktop/odoo-8.0/openerp/service/model.py", line 118, in wrapper
return f(dbname, *args, **kwargs)
File "/home/gowtham/Desktop/odoo-8.0/openerp/http.py", line 314, in checked_call
return self.endpoint(*a, **kw)
File "/home/gowtham/Desktop/odoo-8.0/openerp/http.py", line 810, in __call__
return self.method(*args, **kw)
File "/home/gowtham/Desktop/odoo-8.0/openerp/http.py", line 410, in response_wrap
response = f(*args, **kw)
File "/home/gowtham/Desktop/odoo-8.0/openerp/addons/web/controllers/main.py", line 955, in exec_workflow
return request.session.exec_workflow(model, id, signal)
File "/home/gowtham/Desktop/odoo-8.0/openerp/http.py", line 1118, in exec_workflow
r = self.proxy('object').exec_workflow(self.db, self.uid, self.password, model, signal, id)
File "/home/gowtham/Desktop/odoo-8.0/openerp/http.py", line 886, in proxy_method
result = dispatch_rpc(self.service_name, method, args)
File "/home/gowtham/Desktop/odoo-8.0/openerp/http.py", line 115, in dispatch_rpc
result = dispatch(method, params)
File "/home/gowtham/Desktop/odoo-8.0/openerp/service/model.py", line 37, in dispatch
res = fn(db, uid, *params)
File "/home/gowtham/Desktop/odoo-8.0/openerp/service/model.py", line 118, in wrapper
return f(dbname, *args, **kwargs)
File "/home/gowtham/Desktop/odoo-8.0/openerp/service/model.py", line 188, in exec_workflow
return exec_workflow_cr(cr, uid, obj, signal, *args)
File "/home/gowtham/Desktop/odoo-8.0/openerp/service/model.py", line 182, in exec_workflow_cr
return execute_cr(cr, uid, obj, 'signal_workflow', [res_id], signal)[res_id]
File "/home/gowtham/Desktop/odoo-8.0/openerp/service/model.py", line 164, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/home/gowtham/Desktop/odoo-8.0/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/home/gowtham/Desktop/odoo-8.0/openerp/models.py", line 3575, in signal_workflow
result[res_id] = workflow.trg_validate(uid, self._name, res_id, signal, cr)
File "/home/gowtham/Desktop/odoo-8.0/openerp/workflow/__init__.py", line 85, in trg_validate
return WorkflowService.new(cr, uid, res_type, res_id).validate(signal)
File "/home/gowtham/Desktop/odoo-8.0/openerp/workflow/service.py", line 91, in validate
res2 = wi.validate(signal)
File "/home/gowtham/Desktop/odoo-8.0/openerp/workflow/instance.py", line 80, in validate
wi.process(signal=signal, force_running=force_running, stack=stack)
File "/home/gowtham/Desktop/odoo-8.0/openerp/workflow/workitem.py", line 120, in process
ok = self._split_test(activity['split_mode'], signal, stack)
File "/home/gowtham/Desktop/odoo-8.0/openerp/workflow/workitem.py", line 248, in _split_test
self._join_test(t[0], t[1], stack)
File "/home/gowtham/Desktop/odoo-8.0/openerp/workflow/workitem.py", line 257, in _join_test
WorkflowItem.create(self.session, self.record, activity, inst_id, stack=stack)
File "/home/gowtham/Desktop/odoo-8.0/openerp/workflow/workitem.py", line 95, in create
workflow_item.process(stack=stack)
File "/home/gowtham/Desktop/odoo-8.0/openerp/workflow/workitem.py", line 116, in process
if not self._execute(activity, stack):
File "/home/gowtham/Desktop/odoo-8.0/openerp/workflow/workitem.py", line 187, in _execute
id_new = self.wkf_expr_execute(activity)
File "/home/gowtham/Desktop/odoo-8.0/openerp/workflow/workitem.py", line 313, in wkf_expr_execute
return self.wkf_expr_eval_expr(activity['action'])
File "/home/gowtham/Desktop/odoo-8.0/openerp/workflow/workitem.py", line 291, in wkf_expr_eval_expr
result = eval(line, env, nocopy=True)
File "/home/gowtham/Desktop/odoo-8.0/openerp/tools/safe_eval.py", line 314, in safe_eval
return eval(c, globals_dict, locals_dict)
File "", line 1, in <module>
File "/home/gowtham/Desktop/odoo-8.0/openerp/api.py", line 266, in wrapper
return new_api(self, *args, **kwargs)
File "/home/gowtham/Desktop/odoo-8.0/openerp/api.py", line 592, in new_api
result = method(self._model, cr, uid, self.ids, *args, **old_kwargs)
File "/home/gowtham/Desktop/odoo-8.0/openerp/addons/stock_indent/stock_indent.py", line 404, in action_picking_create
wf_service = netsvc.LocalService("workflow")
ValueError: "global name 'netsvc' is not defined" while evaluating u'action_picking_create()'
My python code:
def action_picking_create(self, cr, uid, ids, context=None):
proc_obj = self.pool.get('procurement.order')
move_obj = self.pool.get('stock.move')
wf_service = netsvc.LocalService("workflow")
assert len(ids) == 1, 'This option should only be used for a single id at a time.'
picking_id = False
indent = self.browse(cr, uid, ids[0], context=context)
#Check if gatepass is not installed, transfer product to stock for repairing, else
#Create a returnable gatepass to send supplier to repair their location\
gatepass_flow = self._check_gatepass_flow(cr, uid, indent,context)
if gatepass_flow and indent.type == 'existing':
self.create_transfer_move(cr, uid, indent, True, context)
elif not gatepass_flow and indent.type == 'existing':
self.create_repairing_gatepass(cr, uid, ids, context)
self.create_transfer_move(cr, uid, indent, False, context)
if indent.product_lines:
picking_id = self._create_pickings_and_procurements(cr, uid, indent, indent.product_lines, None, context=context)
move_ids = move_obj.search(cr,uid,[('picking_id','=',picking_id)])
pro_ids = proc_obj.search(cr,uid,[('move_id','in',move_ids)])
for pro in pro_ids:
workflow.trg_validate(uid, 'procurement.order', pro, 'button_check', cr)
self.write(cr, uid, ids, {'picking_id': picking_id, 'state' : 'inprogress', 'message_follower_ids': [(4, indent.approver_id and indent.approver_id.partner_id and indent.approver_id.partner_id.id)]}, context=context)
return picking_id
My workflow xml file:
<record model="workflow.activity" id="act_inprogress">
<field name="wkf_id" ref="wkf_indent" />
<field name="name">activity.inprogress</field>
<field name="kind">subflow</field>
<field name="subflow_id" search="[('name','=','stock.picking.basic')]" />
<field name="action">action_picking_create()</field>
</record>
It seems netsvc is depricted and tried using the new api command "self.signal_workflow('action_assign')" too. But still i cannot find away to make a trigger can someone explain and help me with the porting?