_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):
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,
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 <em>%s</em> %s" % (_("Manufacturing Order"), procurement.production_id.name, _("Created"))
+ self.message_post(cr, uid, [procurement.id], body=body, context=context)
procurement_order()
" 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'),
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,
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 <em>%s</em> %s" % (_("Task"), procurement.task_id.name, _("Created"))
+ self.message_post(cr, uid, [procurement.id], body=body, context=context)
procurement_order()
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 <em>%s</em> %s" % (_("Draft Purchase Order"), procurement.purchase_id.name, _("Created"))
+ self.message_post(cr, uid, [procurement.id], body=body, context=context)
procurement_order()