diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py
index 672c0b13d48..45241938264 100644
--- a/addons/mrp/mrp.py
+++ b/addons/mrp/mrp.py
@@ -361,10 +361,10 @@ class mrp_bom(osv.osv):
def create(self, cr, uid, vals, context=None):
obj_id = super(mrp_bom, self).create(cr, uid, vals, context=context)
- self.case_create_send_note(cr, uid, [obj_id], context=context)
+ self.create_send_note(cr, uid, [obj_id], context=context)
return obj_id
- def case_create_send_note(self, cr, uid, ids, context=None):
+ def create_send_note(self, cr, uid, ids, context=None):
prod_obj = self.pool.get('product.product')
for obj in self.browse(cr, uid, ids, context=context):
for prod in prod_obj.browse(cr, uid, [obj.product_id], context=context):
@@ -514,7 +514,7 @@ class mrp_production(osv.osv):
def create(self, cr, uid, vals, context=None):
obj_id = super(mrp_production, self).create(cr, uid, vals, context=context)
- self.case_create_send_note(cr, uid, [obj_id], context=context)
+ self.create_send_note(cr, uid, [obj_id], context=context)
return obj_id
def unlink(self, cr, uid, ids, context=None):
@@ -523,44 +523,52 @@ class mrp_production(osv.osv):
raise osv.except_osv(_('Invalid action !'), _('Cannot delete a manufacturing order in state \'%s\'') % production.state)
return super(mrp_production, self).unlink(cr, uid, ids, context=context)
- def get_needaction_user_id(self, cr, uid, ids, name, arg, context=None):
- result = {}
+ def get_needaction_user_ids(self, cr, uid, ids, context=None):
+ result = dict.fromkeys(ids, [])
for obj in self.browse(cr, uid, ids, context=context):
- result[obj.id] = False
- if (obj.state == 'draft' and obj.user_id):
- result[obj.id] = obj.user_id.id
+ if obj.state == 'draft' and obj.user_id:
+ result[obj.id] = [obj.user_id.id]
return result
- def case_create_send_note(self, cr, uid, ids, context=None):
+ def message_get_subscribers(self, cr, uid, ids, context=None):
+ sub_ids = self.message_get_subscribers_ids(cr, uid, ids, context=context);
for obj in self.browse(cr, uid, ids, context=context):
- if obj.user_id.id :
- self.message_subscribe(cr, uid, ids, [obj.user_id.id], context=context)
- obj.message_append_note('',_("Manufacturing order has been created."))
+ if obj.user_id:
+ sub_ids.append(obj.user_id.id)
+ return self.pool.get('res.users').read(cr, uid, sub_ids, context=context)
+
+ def create_send_note(self, cr, uid, ids, context=None):
+ self.message_append_note(cr, uid, ids, 'System Notification', _("Manufacturing order has been created."), context=context)
return True
- def case_cancel_send_note(self, cr, uid, ids, context=None):
- message = _("Manufacturing order has been cancelled.")
- self.message_append_note(cr, uid, ids, '', message, context=context)
+ def action_cancel_send_note(self, cr, uid, ids, context=None):
+ for id in ids:
+ message = _("Manufacturing order has been canceled.")
+ self.message_append_note(cr, uid, [id], 'System Notification', message, context=context)
return True
- def case_ready_send_note(self, cr, uid, ids, context=None):
- message = _("Manufacturing order is ready to produce.")
- self.message_append_note(cr, uid, ids, '', message, context=context)
+ def action_ready_send_note(self, cr, uid, ids, context=None):
+ for id in ids:
+ message = _("Manufacturing order is ready to produce.")
+ self.message_append_note(cr, uid, [id], 'System Notification', message, context=context)
return True
- def case_inproduction_send_note(self, cr, uid, ids, context=None):
- message = _("Manufacturing order is in production.")
- self.message_append_note(cr, uid, ids, '', message, context=context)
+ def action_inproduction_send_note(self, cr, uid, ids, context=None):
+ for id in ids:
+ message = _("Manufacturing order is in production.")
+ self.message_append_note(cr, uid, [id], 'System Notification', message, context=context)
return True
- def case_done_send_note(self, cr, uid, ids, context=None):
- message = _("Manufacturing order has been done.")
- self.message_append_note(cr, uid, ids, '', message, context=context)
+ def action_done_send_note(self, cr, uid, ids, context=None):
+ for id in ids:
+ message = _("Manufacturing order has been done.")
+ self.message_append_note(cr, uid, [id], 'System Notification', message, context=context)
return True
- def case_waiting_send_note(self, cr, uid, ids, context=None):
- message = _("Manufacturing order has been confirmed and waiting for goods.")
- self.message_append_note(cr, uid, ids, '', message, context=context)
+ def action_waiting_send_note(self, cr, uid, ids, context=None):
+ for id in ids:
+ message = _("Manufacturing order has been confirmed and waiting for goods.")
+ self.message_append_note(cr, uid, [id], 'System Notification', message, context=context)
return True
def copy(self, cr, uid, id, default=None, context=None):
@@ -689,7 +697,7 @@ class mrp_production(osv.osv):
move_obj.action_cancel(cr, uid, [x.id for x in production.move_created_ids])
move_obj.action_cancel(cr, uid, [x.id for x in production.move_lines])
self.write(cr, uid, ids, {'state': 'cancel'})
- self.case_cancel_send_note(cr, uid, ids, context)
+ self.action_cancel_send_note(cr, uid, ids, context)
return True
def action_ready(self, cr, uid, ids, context=None):
@@ -704,7 +712,7 @@ class mrp_production(osv.osv):
if production.move_prod_id:
move_obj.write(cr, uid, [production.move_prod_id.id],
{'location_id': production.location_dest_id.id})
- self.case_ready_send_note(cr, uid, [production_id], context)
+ self.action_ready_send_note(cr, uid, [production_id], context)
return True
def action_production_end(self, cr, uid, ids, context=None):
@@ -714,7 +722,7 @@ class mrp_production(osv.osv):
for production in self.browse(cr, uid, ids):
self._costs_generate(cr, uid, production)
self.write(cr, uid, ids, {'state': 'done', 'date_finished': time.strftime('%Y-%m-%d %H:%M:%S')})
- self.case_done_send_note(cr, uid, ids, context)
+ self.action_done_send_note(cr, uid, ids, context)
return True
def test_production_done(self, cr, uid, ids):
@@ -884,7 +892,7 @@ class mrp_production(osv.osv):
@return: True
"""
self.write(cr, uid, ids, {'state': 'in_production', 'date_start': time.strftime('%Y-%m-%d %H:%M:%S')})
- self.case_inproduction_send_note(cr, uid, ids, context)
+ self.action_inproduction_send_note(cr, uid, ids, context)
return True
def test_if_product(self, cr, uid, ids):
@@ -1062,7 +1070,7 @@ class mrp_production(osv.osv):
production.name,
datetime.strptime(production.date_planned,'%Y-%m-%d %H:%M:%S').strftime('%m/%d/%Y'),
)
- self.case_waiting_send_note(cr, uid, [production.id], context);
+ self.action_waiting_send_note(cr, uid, [production.id], context);
return shipment_id
def force_production(self, cr, uid, ids, *args):
diff --git a/addons/mrp_operations/mrp_operations.py b/addons/mrp_operations/mrp_operations.py
index b3fc572450a..ba1e68f5824 100644
--- a/addons/mrp_operations/mrp_operations.py
+++ b/addons/mrp_operations/mrp_operations.py
@@ -156,44 +156,44 @@ class mrp_production_workcenter_line(osv.osv):
prod_obj.write(cr, uid, [prod.production_id.id], {'date_start':dstart}, context=context, mini=False)
return result
- def case_draft_send_note(self, cr, uid, ids):
+ def action_draft_send_note(self, cr, uid, ids):
prod_obj = self.pool.get('mrp.production')
for workorder in self.browse(cr, uid, ids):
for prod in prod_obj.browse(cr, uid, [workorder.production_id]):
message = _("Work order has been created for %s production order.") % (prod.id.name)
- self.message_append_note(cr, uid, ids, '', message)
+ self.message_append_note(cr, uid, ids, 'System Notification', message)
return True
- def case_start_send_note(self, cr, uid, ids):
+ def action_start_send_note(self, cr, uid, ids):
prod_obj = self.pool.get('mrp.production')
for workorder in self.browse(cr, uid, ids):
for prod in prod_obj.browse(cr, uid, [workorder.production_id]):
message = _("Work order has been started for %s production order.") % (prod.id.name)
- self.message_append_note(cr, uid, ids, '', message)
+ self.message_append_note(cr, uid, ids, 'System Notification', message)
return True
- def case_done_send_note(self, cr, uid, ids):
+ def action_done_send_note(self, cr, uid, ids):
prod_obj = self.pool.get('mrp.production')
for workorder in self.browse(cr, uid, ids):
for prod in prod_obj.browse(cr, uid, [workorder.production_id]):
message = _("Work order has been done for %s production order.") % (prod.id.name)
- self.message_append_note(cr, uid, ids, '', message)
+ self.message_append_note(cr, uid, ids, 'System Notification', message)
return True
- def case_pending_send_note(self, cr, uid, ids):
+ def action_pending_send_note(self, cr, uid, ids):
prod_obj = self.pool.get('mrp.production')
for workorder in self.browse(cr, uid, ids):
for prod in prod_obj.browse(cr, uid, [workorder.production_id]):
message = _("Work order is pending for %s production order.") % (prod.id.name)
- self.message_append_note(cr, uid, ids, '', message)
+ self.message_append_note(cr, uid, ids, 'System Notification', message)
return True
- def case_cancel_send_note(self, cr, uid, ids):
+ def action_cancel_send_note(self, cr, uid, ids):
prod_obj = self.pool.get('mrp.production')
for workorder in self.browse(cr, uid, ids):
for prod in prod_obj.browse(cr, uid, [workorder.production_id]):
message = _("Work order has been cancelled for %s production order.") % (prod.id.name)
- self.message_append_note(cr, uid, ids, '', message)
+ self.message_append_note(cr, uid, ids, 'System Notification', message)
return True
def action_draft(self, cr, uid, ids):
@@ -201,7 +201,7 @@ class mrp_production_workcenter_line(osv.osv):
@return: True
"""
self.write(cr, uid, ids, {'state':'draft'})
- self.case_draft_send_note(cr, uid, ids)
+ self.action_draft_send_note(cr, uid, ids)
return True
def action_start_working(self, cr, uid, ids):
@@ -210,7 +210,7 @@ class mrp_production_workcenter_line(osv.osv):
"""
self.modify_production_order_state(cr, uid, ids, 'start')
self.write(cr, uid, ids, {'state':'startworking', 'date_start': time.strftime('%Y-%m-%d %H:%M:%S')})
- self.case_start_send_note(cr, uid, ids)
+ self.action_start_send_note(cr, uid, ids)
return True
def action_done(self, cr, uid, ids):
@@ -227,7 +227,7 @@ class mrp_production_workcenter_line(osv.osv):
delay += (date_finished-date_start).seconds / float(60*60)
self.write(cr, uid, ids, {'state':'done', 'date_finished': date_now,'delay':delay})
- self.case_done_send_note(cr, uid, ids)
+ self.action_done_send_note(cr, uid, ids)
self.modify_production_order_state(cr,uid,ids,'done')
return True
@@ -236,7 +236,7 @@ class mrp_production_workcenter_line(osv.osv):
@return: True
"""
self.write(cr, uid, ids, {'state':'cancel'})
- self.case_cancel_send_note(cr, uid, ids)
+ self.action_cancel_send_note(cr, uid, ids)
return True
def action_pause(self, cr, uid, ids):
@@ -244,7 +244,7 @@ class mrp_production_workcenter_line(osv.osv):
@return: True
"""
self.write(cr, uid, ids, {'state':'pause'})
- self.case_pending_send_note(cr, uid, ids)
+ self.action_pending_send_note(cr, uid, ids)
return True
def action_resume(self, cr, uid, ids):
@@ -252,7 +252,7 @@ class mrp_production_workcenter_line(osv.osv):
@return: True
"""
self.write(cr, uid, ids, {'state':'startworking'})
- self.case_start_send_note(cr, uid, ids)
+ self.action_start_send_note(cr, uid, ids)
return True
mrp_production_workcenter_line()
diff --git a/addons/product/product.py b/addons/product/product.py
index d97e602ef7c..5ba36323958 100644
--- a/addons/product/product.py
+++ b/addons/product/product.py
@@ -530,10 +530,10 @@ class product_product(osv.osv):
def create(self, cr, uid, vals, context=None):
obj_id = super(product_product, self).create(cr, uid, vals, context=context)
- self.case_create_send_note(cr, uid, [obj_id], context=context)
+ self.create_send_note(cr, uid, [obj_id], context=context)
return obj_id
- def case_create_send_note(self, cr, uid, ids, context=None):
+ def create_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
self.message_append_note(cr, uid, ids, _('System notification'),
_("Product has been created."), type='notification', context=context)