diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py
index 5601179e0fc..da3ca65c24b 100644
--- a/addons/account/account_bank_statement.py
+++ b/addons/account/account_bank_statement.py
@@ -127,6 +127,7 @@ class account_bank_statement(osv.osv):
_order = "date desc, id desc"
_name = "account.bank.statement"
_description = "Bank Statement"
+ _inherit = ['mail.thread']
_columns = {
'name': fields.char('Name', size=64, required=True, states={'draft': [('readonly', False)]}, readonly=True, help='if you give the Name other then /, its created Accounting Entries Move will be with same name as statement name. This allows the statement entries to have the same references than the statement itself'), # readonly for account_cash_statement
'date': fields.date('Date', required=True, states={'confirm': [('readonly', True)]}, select=True),
@@ -364,7 +365,7 @@ class account_bank_statement(osv.osv):
'name': st_number,
'balance_end_real': st.balance_end
}, context=context)
- self.log(cr, uid, st.id, _('Statement %s is confirmed, journal items are created.') % (st_number,))
+ self.message_append_note(cr, uid, ids, body=_('Statement %s is confirmed, journal items are created.') % (st_number,), context=context)
return self.write(cr, uid, ids, {'state':'confirm'}, context=context)
def button_cancel(self, cr, uid, ids, context=None):
diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py
index d0f7579a86e..c7d643b404b 100644
--- a/addons/account/account_invoice.py
+++ b/addons/account/account_invoice.py
@@ -1002,7 +1002,7 @@ class account_invoice(osv.osv):
if obj_inv.type in ('out_invoice', 'out_refund'):
ctx = self.get_log_context(cr, uid, context=ctx)
message = _("Invoice '%s' is validated.") % name
- self.log(cr, uid, inv_id, message, context=ctx)
+ self.message_append_note(cr, uid, ids, body=message, context=context)
return True
def action_cancel(self, cr, uid, ids, *args):
@@ -1232,7 +1232,7 @@ class account_invoice(osv.osv):
# TODO: use currency's formatting function
msg = _("Invoice '%s' is paid partially: %s%s of %s%s (%s%s remaining)") % \
(name, pay_amount, code, invoice.amount_total, code, total, code)
- self.log(cr, uid, inv_id, msg)
+ self.message_append_note(cr, uid, ids, body=msg, context=context)
self.pool.get('account.move.line').reconcile_partial(cr, uid, line_ids, 'manual', context)
# Update the stored value (fields.function), so we write to trigger recompute
diff --git a/addons/crm_claim/crm_claim.py b/addons/crm_claim/crm_claim.py
index 792cfbc3e9e..bbb27b795bc 100644
--- a/addons/crm_claim/crm_claim.py
+++ b/addons/crm_claim/crm_claim.py
@@ -127,8 +127,6 @@ class crm_claim(crm.crm_case, osv.osv):
for l in self.browse(cr, uid, ids):
# When coming from draft override date and stage otherwise just set state
if l.state == 'draft':
- message = _("The claim '%s' has been opened.") % l.name
- self.log(cr, uid, l.id, message)
stage_id = self.stage_find(cr, uid, l.section_id.id or False, [('sequence','>',0)])
if stage_id:
self.stage_set(cr, uid, [l.id], stage_id)
diff --git a/addons/project_scrum/project_scrum.py b/addons/project_scrum/project_scrum.py
index 85eba636b90..d34669df255 100644
--- a/addons/project_scrum/project_scrum.py
+++ b/addons/project_scrum/project_scrum.py
@@ -44,6 +44,7 @@ class project_scrum_sprint(osv.osv):
_name = 'project.scrum.sprint'
_description = 'Project Scrum Sprint'
_order = 'date_start desc'
+ _inherit = ['mail.thread']
def _compute(self, cr, uid, ids, fields, arg, context=None):
res = {}.fromkeys(ids, 0.0)
progress = {}
@@ -71,28 +72,27 @@ class project_scrum_sprint(osv.osv):
def button_cancel(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state':'cancel'}, context=context)
+ self.cancel_send_note(cr, uid, ids, context=None)
return True
def button_draft(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state':'draft'}, context=context)
+ self.draft_send_note(cr, uid, ids, context=None)
return True
def button_open(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state':'open'}, context=context)
- for (id, name) in self.name_get(cr, uid, ids):
- message = _("The sprint '%s' has been opened.") % (name,)
- self.log(cr, uid, id, message)
+ self.open_send_note(cr, uid, ids, context=None)
return True
def button_close(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state':'done'}, context=context)
- for (id, name) in self.name_get(cr, uid, ids):
- message = _("The sprint '%s' has been closed.") % (name,)
- self.log(cr, uid, id, message)
+ self.close_send_note(cr, uid, ids, context=None)
return True
def button_pending(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state':'pending'}, context=context)
+ self.pending_send_note(cr, uid, ids, context=None)
return True
_columns = {
@@ -138,6 +138,39 @@ class project_scrum_sprint(osv.osv):
v['date_stop'] = (datetime.now() + relativedelta(days=int(proj.sprint_size or 14))).strftime('%Y-%m-%d')
return {'value':v}
+ # ----------------------------------------
+ # OpenChatter methods and notifications
+ # ----------------------------------------
+
+ def create(self, cr, uid, vals, context=None):
+ obj_id = super(project_scrum_sprint, self).create(cr, uid, vals, context)
+ self.create_send_note(cr, uid, [obj_id], context=context)
+ return obj_id
+
+ def draft_send_note(self, cr, uid, ids, context=None):
+ for obj in self.browse(cr, uid, ids, context=context):
+ self.message_append_note(cr, uid, [obj.id], body=_("Sprint has been set to draft."), context=context)
+
+ 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, [obj.id], body=_("Sprint has been created."), context=context)
+
+ def open_send_note(self, cr, uid, ids, context=None):
+ for obj in self.browse(cr, uid, ids, context=context):
+ self.message_append_note(cr, uid, [obj.id], body=_("Sprint has been opened."), context=context)
+
+ def pending_send_note(self, cr, uid, ids, context=None):
+ for obj in self.browse(cr, uid, ids, context=context):
+ self.message_append_note(cr, uid, [obj.id], body=_("Sprint has been set to pending."), context=context)
+
+ def cancel_send_note(self, cr, uid, ids, context=None):
+ for obj in self.browse(cr, uid, ids, context=context):
+ self.message_append_note(cr, uid, [obj.id], body=_("Sprint has been cancelled."), context=context)
+
+ def close_send_note(self, cr, uid, ids, context=None):
+ for obj in self.browse(cr, uid, ids, context=context):
+ self.message_append_note(cr, uid, [obj.id], body=_("Sprint has been closed."), context=context)
+
project_scrum_sprint()
class project_scrum_product_backlog(osv.osv):
diff --git a/addons/project_scrum/project_scrum_view.xml b/addons/project_scrum/project_scrum_view.xml
index 183d6fc3c92..1cf954f62b9 100644
--- a/addons/project_scrum/project_scrum_view.xml
+++ b/addons/project_scrum/project_scrum_view.xml
@@ -232,7 +232,8 @@
project.scrum.sprint
form
-
diff --git a/addons/project_scrum/wizard/project_scrum_backlog_sprint.py b/addons/project_scrum/wizard/project_scrum_backlog_sprint.py
index 72b80a969fb..89ed7a8428a 100644
--- a/addons/project_scrum/wizard/project_scrum_backlog_sprint.py
+++ b/addons/project_scrum/wizard/project_scrum_backlog_sprint.py
@@ -24,6 +24,7 @@ from tools.translate import _
class backlog_sprint_assign(osv.osv_memory):
_name = 'project.scrum.backlog.assign.sprint'
_description = 'Assign sprint to backlogs'
+ _inherit = ['mail.thread']
_columns = {
'sprint_id': fields.many2one('project.scrum.sprint', 'Sprint', required=True, help="Select Sprint to assign backlog."),
'state_open': fields.boolean('Open Backlog', help="Change the state of product backlogs to open if its in draft state"),
@@ -55,12 +56,12 @@ class backlog_sprint_assign(osv.osv_memory):
'remaining_hours':backlog.expected_hours,
})
message = _("Product Backlog '%s' is converted into Task %d.") %(backlog.name, task_id)
- self.log(cr, uid, backlog.id, message)
+ self.message_append_note(cr, uid, ids, body=message, context=context)
if data.state_open and backlog.state == "draft":
backlog_obj.write(cr, uid, backlog.id, {'state':'open'})
sprint = sprint_obj.browse(cr, uid, data.sprint_id.id, context=context)
message = _("Product Backlog '%s' is assigned to sprint %s") %(backlog.name, sprint.name)
- self.log(cr, uid, backlog.id, message)
+ self.message_append_note(cr, uid, ids, body=message, context=context)
backlog_obj.write(cr, uid, backlog_ids, {'sprint_id': data.sprint_id.id}, context=context)
return {'type': 'ir.actions.act_window_close'}
diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py
index 687221f371b..97fe017ce62 100644
--- a/addons/purchase/purchase.py
+++ b/addons/purchase/purchase.py
@@ -290,8 +290,6 @@ class purchase_order(osv.osv):
for line in po.order_line:
if line.state=='draft':
todo.append(line.id)
- message = _("Purchase order '%s' is confirmed.") % (po.name,)
- self.log(cr, uid, po.id, message)
# current_name = self.name_get(cr, uid, ids)[0][1]
self.pool.get('purchase.order.line').action_confirm(cr, uid, todo, context)
for id in ids:
@@ -327,9 +325,7 @@ class purchase_order(osv.osv):
# Deleting the existing instance of workflow for PO
wf_service.trg_delete(uid, 'purchase.order', p_id, cr)
wf_service.trg_create(uid, 'purchase.order', p_id, cr)
- for (id,name) in self.name_get(cr, uid, ids):
- message = _("Purchase order '%s' has been set in draft state.") % name
- self.log(cr, uid, id, message)
+ self.draft_send_note(cr, uid, ids, context=None)
return True
def action_invoice_create(self, cr, uid, ids, context=None):
@@ -433,8 +429,7 @@ class purchase_order(osv.osv):
for (id, name) in self.name_get(cr, uid, ids):
wf_service.trg_validate(uid, 'purchase.order', id, 'purchase_cancel', cr)
- message = _("Purchase order '%s' is cancelled.") % name
- self.log(cr, uid, id, message)
+ self.cancel_send_note(cr, uid, ids, context)
return True
def _prepare_order_picking(self, cr, uid, order, context=None):
@@ -688,6 +683,9 @@ class purchase_order(osv.osv):
def invoice_done_send_note(self, cr, uid, ids, context=None):
self.message_append_note(cr, uid, ids, body=_("Invoice paid."), context=context)
+
+ def draft_send_note(self, cr, uid, ids, context=None):
+ return self.message_append_note(cr, uid, ids, body=_("Purchase Order has been set to draft."), context=context)
def cancel_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):