[IMP] open chatter messages on the procurement.
bzr revid: tta@openerp.com-20121003075730-hkwuqmpkriswphgh
This commit is contained in:
@@ -31,6 +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'),
|
||||
}
|
||||
|
||||
def check_produce_product(self, cr, uid, procurement, context=[]):
|
||||
@@ -95,16 +96,23 @@ class procurement_order(osv.osv):
|
||||
'move_prod_id': res_id,
|
||||
'company_id': procurement.company_id.id,
|
||||
})
|
||||
|
||||
res[procurement.id] = produce_id
|
||||
self.write(cr, uid, [procurement.id], {'state': 'running'})
|
||||
self.running_send_note(cr, uid, ids, context=context)
|
||||
self.write(cr, uid, [procurement.id], {'state': 'running', 'production_id': produce_id})
|
||||
|
||||
bom_result = production_obj.action_compute(cr, uid,
|
||||
[produce_id], properties=[x.id for x in procurement.property_ids])
|
||||
wf_service.trg_validate(uid, 'mrp.production', produce_id, 'button_confirm', cr)
|
||||
if res_id:
|
||||
move_obj.write(cr, uid, [res_id],
|
||||
{'location_id': procurement.location_id.id})
|
||||
self.production_order_create_note(cr, uid, ids, context=context)
|
||||
return res
|
||||
|
||||
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)
|
||||
|
||||
procurement_order()
|
||||
|
||||
|
||||
@@ -366,7 +366,6 @@ class procurement_order(osv.osv):
|
||||
self.write(cr, uid, ids, {'state': 'running',
|
||||
'message': message}, context=context)
|
||||
self.message_post(cr, uid, ids, body=message, context=context)
|
||||
self.running_send_note(cr, uid, ids, context=context)
|
||||
return True
|
||||
|
||||
def _check_make_to_stock_service(self, cr, uid, procurement, context=None):
|
||||
@@ -407,7 +406,6 @@ class procurement_order(osv.osv):
|
||||
"""
|
||||
for procurement in self.browse(cr, uid, ids, context=context):
|
||||
self.write(cr, uid, [procurement.id], {'state': 'running'})
|
||||
self.running_send_note(cr, uid, ids, context=None)
|
||||
return True
|
||||
|
||||
def action_produce_assign_product(self, cr, uid, ids, context=None):
|
||||
@@ -469,7 +467,6 @@ class procurement_order(osv.osv):
|
||||
@return: True
|
||||
"""
|
||||
res = self.write(cr, uid, ids, {'state': 'ready'})
|
||||
self.ready_send_note(cr, uid, ids, context=None)
|
||||
return res
|
||||
|
||||
def action_done(self, cr, uid, ids):
|
||||
@@ -503,12 +500,6 @@ class procurement_order(osv.osv):
|
||||
def confirm_send_note(self, cr, uid, ids, context=None):
|
||||
self.message_post(cr, uid, ids, body=_("Procurement has been <b>confirmed</b>."), context=context)
|
||||
|
||||
def running_send_note(self, cr, uid, ids, context=None):
|
||||
self.message_post(cr, uid, ids, body=_("Procurement has been set to <b>running</b>."), context=context)
|
||||
|
||||
def ready_send_note(self, cr, uid, ids, context=None):
|
||||
self.message_post(cr, uid, ids, body=_("Procurement has been set to <b>ready</b>."), context=context)
|
||||
|
||||
def cancel_send_note(self, cr, uid, ids, context=None):
|
||||
self.message_post(cr, uid, ids, body=_("Procurement has been <b>cancelled</b>."), context=context)
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
|
||||
class procurement_order(osv.osv):
|
||||
_name = "procurement.order"
|
||||
@@ -82,11 +83,17 @@ class procurement_order(osv.osv):
|
||||
'description': procurement.note,
|
||||
'project_id': project and project.id or False,
|
||||
'company_id': procurement.company_id.id,
|
||||
},context=context)
|
||||
},context=context)
|
||||
self.write(cr, uid, [procurement.id], {'task_id': task_id, 'state': 'running', 'message':'from project: task created.'}, context=context)
|
||||
self.running_send_note(cr, uid, ids, context=None)
|
||||
self.document_send_note(cr, uid, [procurement.id], body='%s %s:%s %s' % (_("Task"), procurement.origin or '', procurement.product_id.name, _("created")), context=context)
|
||||
self.project_task_create_note(cr, uid, ids, context=context)
|
||||
return task_id
|
||||
|
||||
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)
|
||||
|
||||
procurement_order()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -1082,9 +1082,15 @@ class procurement_order(osv.osv):
|
||||
}
|
||||
res[procurement.id] = self.create_procurement_purchase_order(cr, uid, procurement, po_vals, line_vals, context=new_context)
|
||||
self.write(cr, uid, [procurement.id], {'state': 'running', 'purchase_id': res[procurement.id]})
|
||||
self.running_send_note(cr, uid, [procurement.id], context=context)
|
||||
self.document_send_note(cr, uid, [procurement.id], body='%s %s %s' % (_("Draft Purchase Order"), name or '', _("created")), context=context)
|
||||
self.purchase_order_create_note(self, cr, uid, ids, context=context)
|
||||
return res
|
||||
|
||||
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)
|
||||
|
||||
procurement_order()
|
||||
|
||||
class mail_mail(osv.osv):
|
||||
|
||||
Reference in New Issue
Block a user