diff --git a/addons/analytic/analytic.py b/addons/analytic/analytic.py
index b59f5d2e926..30c01cea19c 100644
--- a/addons/analytic/analytic.py
+++ b/addons/analytic/analytic.py
@@ -31,6 +31,13 @@ class account_analytic_account(osv.osv):
_name = 'account.analytic.account'
_inherit = ['mail.thread']
_description = 'Analytic Account'
+ _track = {
+ 'state': {
+ 'analytic.mt_account_pending': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'pending',
+ 'analytic.mt_account_closed': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'close',
+ 'analytic.mt_account_opened': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'open',
+ },
+ }
def _compute_level_tree(self, cr, uid, ids, child_ids, res, field_names, context=None):
currency_obj = self.pool.get('res.currency')
@@ -189,7 +196,7 @@ class account_analytic_account(osv.osv):
'date_start': fields.date('Start Date'),
'date': fields.date('Date End', select=True),
'company_id': fields.many2one('res.company', 'Company', required=False), #not required because we want to allow different companies to use the same chart of account, except for leaf accounts.
- 'state': fields.selection([('template', 'Template'),('draft','New'),('open','In Progress'), ('cancelled', 'Cancelled'),('pending','To Renew'),('close','Closed')], 'Status', required=True,),
+ 'state': fields.selection([('template', 'Template'),('draft','New'),('open','In Progress'), ('cancelled', 'Cancelled'),('pending','To Renew'),('close','Closed')], 'Status', required=True, track_visibility=1),
'currency_id': fields.function(_currency, fnct_inv=_set_company_currency, #the currency_id field is readonly except if it's a view account and if there is no company
store = {
'res.company': (_get_analytic_account, ['currency_id'], 10),
diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py
index 17086c8934f..53a6bbbc26b 100644
--- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py
+++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py
@@ -87,30 +87,16 @@ class account_analytic_account(osv.osv):
return res
def set_close(self, cr, uid, ids, context=None):
- self.write(cr, uid, ids, {'state': 'close'}, context=context)
- message = _("Contract has been closed.")
- self.message_post(cr, uid, ids, body=message, subtype="hr_timesheet_invoice.mt_account_closed", context=context)
- return True
+ return self.write(cr, uid, ids, {'state': 'close'}, context=context)
def set_cancel(self, cr, uid, ids, context=None):
- self.write(cr, uid, ids, {'state': 'cancelled'}, context=context)
- message = _("Contract has been canceled.")
- self.message_post(cr, uid, ids, body=message, context=context)
- return True
+ return self.write(cr, uid, ids, {'state': 'cancelled'}, context=context)
def set_open(self, cr, uid, ids, context=None):
- self.write(cr, uid, ids, {'state': 'open'}, context=context)
- message = _("Contract has been opened.")
- self.message_post(cr, uid, ids, body=message, subtype="hr_timesheet_invoice.mt_account_renewed", context=context)
- return True
+ return self.write(cr, uid, ids, {'state': 'open'}, context=context)
def set_pending(self, cr, uid, ids, context=None):
- self.write(cr, uid, ids, {'state': 'pending'}, context=context)
- message = _("Contract has been set as pending.")
- self.message_post(cr, uid, ids, body=message, subtype="hr_timesheet_invoice.mt_account_renew", context=context)
- return True
-
-account_analytic_account()
+ return self.write(cr, uid, ids, {'state': 'pending'}, context=context)
class account_analytic_line(osv.osv):
diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice_data.xml b/addons/hr_timesheet_invoice/hr_timesheet_invoice_data.xml
index 895329debfc..bc8aec86848 100644
--- a/addons/hr_timesheet_invoice/hr_timesheet_invoice_data.xml
+++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice_data.xml
@@ -22,35 +22,5 @@
20.0
-
-
- Contract to Renew
- account.analytic.account
-
-
- Contract Finished
- account.analytic.account
-
-
- Contract Renewed
- account.analytic.account
-
-
-
- Contract to Renew
- crm.case.section
-
-
-
- Contract Finished
- crm.case.section
-
-
-
- Contract Renewed
- crm.case.section
-
-
-