user = self.pool.get('res.users').browse(cr, uid, uid, context)
res['time_unit'] = user.company_id.project_time_mode_id.id
else:
- try:
- product = ir_model_data.get_object(cr, uid, 'product', 'product_product_consultant')
+ product = ir_model_data.xmlid_to_object(cr, uid, 'product.product_product_consultant')
+ if product and product.exists():
res['time_unit'] = product.uom_id.id
- except ValueError:
- # keep default value in that case
- _logger.warning("Product with xml_id 'product.product_product_consultant' not found")
+ res['timesheet'] = res.get('module_account_analytic_analysis')
return res
def _get_default_time_unit(self, cr, uid, context=None):
# Then we finish the good picking
self.write(cr, uid, [pick.id], {'backorder_id': new_picking})
self.action_move(cr, uid, [new_picking], context=context)
- wf_service.trg_validate(uid, 'stock.picking', new_picking, 'button_done', cr)
- wf_service.trg_write(uid, 'stock.picking', pick.id, cr)
+ self.signal_button_done(cr, uid, [new_picking])
+ workflow.trg_write(uid, 'stock.picking', pick.id, cr)
- delivered_pack_id = pick.id
- back_order_name = self.browse(cr, uid, delivered_pack_id, context=context).name
- self.message_post(cr, uid, new_picking, body=_("Back order <em>%s</em> has been <b>created</b>.") % (back_order_name), context=context)
+ delivered_pack_id = new_picking
+ self.message_post(cr, uid, new_picking, body=_("Back order <em>%s</em> has been <b>created</b>.") % (pick.name), context=context)
else:
self.action_move(cr, uid, [pick.id], context=context)
- wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_done', cr)
+ self.signal_button_done(cr, uid, [pick.id])
delivered_pack_id = pick.id
delivered_pack = self.browse(cr, uid, delivered_pack_id, context=context)