diff --git a/addons/mrp/procurement.py b/addons/mrp/procurement.py index f718856fbf8..82390a2f2c1 100644 --- a/addons/mrp/procurement.py +++ b/addons/mrp/procurement.py @@ -31,7 +31,7 @@ class procurement_order(osv.osv): _columns = { 'bom_id': fields.many2one('mrp.bom', 'BoM', ondelete='cascade', select=True), 'property_ids': fields.many2many('mrp.property', 'procurement_property_rel', 'procurement_id','property_id', 'Properties'), - 'production_id': fields.many2one('mrp.production', 'Manufucture Order'), + 'production_id': fields.many2one('mrp.production', 'Manufacturing Order'), } def check_produce_product(self, cr, uid, procurement, context=None): @@ -80,8 +80,10 @@ class procurement_order(osv.osv): procurement_obj = self.pool.get('procurement.order') for procurement in procurement_obj.browse(cr, uid, ids, context=context): res_id = procurement.move_id.id + #TOFIX: split into new function to compute manufacturing lead time newdate = datetime.strptime(procurement.date_planned, '%Y-%m-%d %H:%M:%S') - relativedelta(days=procurement.product_id.product_tmpl_id.produce_delay or 0.0) newdate = newdate - relativedelta(days=company.manufacturing_lead) + #TOFIX: implement hook method for creating production order produce_id = production_obj.create(cr, uid, { 'origin': procurement.origin, 'product_id': procurement.product_id.id, @@ -111,8 +113,8 @@ class procurement_order(osv.osv): def production_order_create_note(self, cr, uid, ids, context=None): for procurement in self.browse(cr, uid, ids, context=context): - body = "%s %s %s" % (_("Manufacturing Order"), procurement.production_id.name, _("Created")) - self.message_post(cr, uid, ids, body=body, context=context) + body = "%s %s %s" % (_("Manufacturing Order"), procurement.production_id.name, _("Created")) + self.message_post(cr, uid, [procurement.id], body=body, context=context) procurement_order() diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py index aa3b2a2a673..5f8cd3c0b56 100644 --- a/addons/procurement/procurement.py +++ b/addons/procurement/procurement.py @@ -104,7 +104,7 @@ class procurement_order(osv.osv): " a make to order method."), 'note': fields.text('Note'), - 'message': fields.char('Latest error', size=124, help="Exception occurred while computing procurement orders."), + 'message': fields.char('Latest error', size=124, help="Exception occurred while computing procurement orders."), #TOCHECK: is it need after OpenChatter ? 'state': fields.selection([ ('draft','Draft'), ('cancel','Cancelled'), diff --git a/addons/project_mrp/project_procurement.py b/addons/project_mrp/project_procurement.py index 1daf03dfd9f..63e72493e35 100644 --- a/addons/project_mrp/project_procurement.py +++ b/addons/project_mrp/project_procurement.py @@ -69,8 +69,10 @@ class procurement_order(osv.osv): def action_produce_assign_service(self, cr, uid, ids, context=None): project_task = self.pool.get('project.task') for procurement in self.browse(cr, uid, ids, context=context): + #TOFIX: split into new function to compute task planning hours project = self._get_project(cr, uid, procurement, context=context) planned_hours = self._convert_qty_company_hours(cr, uid, procurement, context=context) + #TOFIX: implement hook method for creating Task task_id = project_task.create(cr, uid, { 'name': '%s:%s' % (procurement.origin or '', procurement.product_id.name), 'date_deadline': procurement.date_planned, @@ -90,8 +92,8 @@ class procurement_order(osv.osv): def project_task_create_note(self, cr, uid, ids, context=None): for procurement in self.browse(cr, uid, ids, context=context): - body = "%s %s %s" % (_("Task"), procurement.task_id.name, _("Created")) - self.message_post(cr, uid, ids, body=body, context=context) + body = "%s %s %s" % (_("Task"), procurement.task_id.name, _("Created")) + self.message_post(cr, uid, [procurement.id], body=body, context=context) procurement_order() diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index a574d8e4467..6bc76f14f34 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -1083,8 +1083,8 @@ class procurement_order(osv.osv): def purchase_order_create_note(self, cr, uid, ids, context=None): for procurement in self.browse(cr, uid, ids, context=context): - body = "%s %s %s" % (_("Draft Purchase Order"), procurement.purchase_id.name, _("Created")) - self.message_post(cr, uid, ids, body=body, context=context) + body = "%s %s %s" % (_("Draft Purchase Order"), procurement.purchase_id.name, _("Created")) + self.message_post(cr, uid, [procurement.id], body=body, context=context) procurement_order()