From 6e1e4f084bc4ee04bba1cd03ea805eda6e00c42a Mon Sep 17 00:00:00 2001 From: "Sanjay Gohel (Open ERP)" Date: Thu, 22 Nov 2012 10:47:59 +0530 Subject: [PATCH 1/5] [IMP]improve code for tracking field and add code for tracked it bzr revid: sgo@tinyerp.com-20121122051759-lks3ykule5w5om6x --- addons/crm/crm_lead.py | 8 ++++---- addons/mail/mail_thread.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 0a824aef83e..d3795c39d34 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -197,7 +197,7 @@ class crm_lead(base_stage, format_address, osv.osv): 'date_action_next': fields.datetime('Next Action', readonly=1), 'email_from': fields.char('Email', size=128, help="Email address of the contact", select=1), 'section_id': fields.many2one('crm.case.section', 'Sales Team', \ - select=True, help='When sending mails, the default email address is taken from the sales team.'), + select=True, tracked=True, help='When sending mails, the default email address is taken from the sales team.'), 'create_date': fields.datetime('Creation Date' , readonly=True), 'email_cc': fields.text('Global CC', size=252 , help="These email addresses will be added to the CC field of all inbound and outbound emails for this record before being sent. Separate multiple email addresses with a comma"), 'description': fields.text('Notes'), @@ -213,9 +213,9 @@ class crm_lead(base_stage, format_address, osv.osv): 'type':fields.selection([ ('lead','Lead'), ('opportunity','Opportunity'), ],'Type', help="Type is used to separate Leads and Opportunities"), 'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority', select=True), 'date_closed': fields.datetime('Closed', readonly=True), - 'stage_id': fields.many2one('crm.case.stage', 'Stage', + 'stage_id': fields.many2one('crm.case.stage', 'Stage',tracked=True, domain="['&', ('fold', '=', False), '&', '|', ('section_ids', '=', section_id), ('case_default', '=', True), '|', ('type', '=', type), ('type', '=', 'both')]"), - 'user_id': fields.many2one('res.users', 'Salesperson'), + 'user_id': fields.many2one('res.users', 'Salesperson',tracked=True), 'referred': fields.char('Referred By', size=64), 'date_open': fields.datetime('Opened', readonly=True), 'day_open': fields.function(_compute_day, string='Days to Open', \ @@ -228,7 +228,7 @@ class crm_lead(base_stage, format_address, osv.osv): # Only used for type opportunity 'probability': fields.float('Success Rate (%)',group_operator="avg"), - 'planned_revenue': fields.float('Expected Revenue'), + 'planned_revenue': fields.float('Expected Revenue',tracked=True), 'ref': fields.reference('Reference', selection=crm._links_get, size=128), 'ref2': fields.reference('Reference 2', selection=crm._links_get, size=128), 'phone': fields.char("Phone", size=64), diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index a90dc9b3a2b..4d98ecbdc97 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -295,7 +295,7 @@ class mail_thread(osv.AbstractModel): return false_value(f) if f._type == 'many2one': if not isinstance(v, browse_record): - v = self.pool[f.relation].browse(cr, SUPERUSER_ID, v) + v = self.pool[f._obj].browse(cr, SUPERUSER_ID, v) return v.name_get()[0][1] if f._type == 'selection': # TODO get translated value From b2be129ead052721c56f22d28b2edced404060af Mon Sep 17 00:00:00 2001 From: "Sanjay Gohel (Open ERP)" Date: Thu, 22 Nov 2012 10:56:35 +0530 Subject: [PATCH 2/5] [IMP]tracked project task fields bzr revid: sgo@tinyerp.com-20121122052635-vutkm8h23gc6t171 --- addons/project/project.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/project/project.py b/addons/project/project.py index 68122d1a614..7beef9e1050 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -749,7 +749,7 @@ class task(base_stage, osv.osv): 'description': fields.text('Description'), 'priority': fields.selection([('4','Very Low'), ('3','Low'), ('2','Medium'), ('1','Important'), ('0','Very important')], 'Priority', select=True), 'sequence': fields.integer('Sequence', select=True, help="Gives the sequence order when displaying a list of tasks."), - 'stage_id': fields.many2one('project.task.type', 'Stage', + 'stage_id': fields.many2one('project.task.type', 'Stage',tracked=True, domain="['&', ('fold', '=', False), '|', ('project_ids', '=', project_id), ('case_default', '=', True)]"), 'state': fields.related('stage_id', 'state', type="selection", store=True, selection=_TASK_STATE, string="Status", readonly=True, @@ -769,7 +769,7 @@ class task(base_stage, osv.osv): 'date_start': fields.datetime('Starting Date',select=True), 'date_end': fields.datetime('Ending Date',select=True), 'date_deadline': fields.date('Deadline',select=True), - 'project_id': fields.many2one('project.project', 'Project', ondelete='set null', select="1"), + 'project_id': fields.many2one('project.project', 'Project', ondelete='set null', select="1",tracked=True), 'parent_ids': fields.many2many('project.task', 'project_task_parent_rel', 'task_id', 'parent_id', 'Parent Tasks'), 'child_ids': fields.many2many('project.task', 'project_task_parent_rel', 'parent_id', 'task_id', 'Delegated Tasks'), 'notes': fields.text('Notes'), @@ -795,7 +795,7 @@ class task(base_stage, osv.osv): 'project.task': (lambda self, cr, uid, ids, c={}: ids, ['work_ids', 'remaining_hours', 'planned_hours'], 10), 'project.task.work': (_get_task, ['hours'], 10), }), - 'user_id': fields.many2one('res.users', 'Assigned to'), + 'user_id': fields.many2one('res.users', 'Assigned to',tracked=True), 'delegated_user_id': fields.related('child_ids', 'user_id', type='many2one', relation='res.users', string='Delegated To'), 'partner_id': fields.many2one('res.partner', 'Customer'), 'work_ids': fields.one2many('project.task.work', 'task_id', 'Work done'), From 104bf4c64b4430de0ceab7f57413602313314a55 Mon Sep 17 00:00:00 2001 From: "Sanjay Gohel (Open ERP)" Date: Thu, 22 Nov 2012 11:00:37 +0530 Subject: [PATCH 3/5] [IMP]tracked hr recruitment fields bzr revid: sgo@tinyerp.com-20121122053037-vt1pkzajh8yqmzlu --- addons/hr_recruitment/hr_recruitment.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index de1539da55a..a6c62265206 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -186,7 +186,7 @@ class hr_applicant(base_stage, osv.Model): 'partner_id': fields.many2one('res.partner', 'Contact'), 'create_date': fields.datetime('Creation Date', readonly=True, select=True), 'write_date': fields.datetime('Update Date', readonly=True), - 'stage_id': fields.many2one ('hr.recruitment.stage', 'Stage', + 'stage_id': fields.many2one ('hr.recruitment.stage', 'Stage',tracked=True, domain="['&', ('fold', '=', False), '|', ('department_id', '=', department_id), ('department_id', '=', False)]"), 'state': fields.related('stage_id', 'state', type="selection", store=True, selection=AVAILABLE_STATES, string="Status", readonly=True, @@ -197,7 +197,7 @@ class hr_applicant(base_stage, osv.Model): set to \'Pending\'.'), 'categ_ids': fields.many2many('hr.applicant_category', string='Tags'), 'company_id': fields.many2one('res.company', 'Company'), - 'user_id': fields.many2one('res.users', 'Responsible'), + 'user_id': fields.many2one('res.users', 'Responsible',tracked=True), # Applicant Columns 'date_closed': fields.datetime('Closed', readonly=True, select=True), 'date_open': fields.datetime('Opened', readonly=True, select=True), From 0afceb9dbd1dd38965b252fa3a2a2a47d807fc15 Mon Sep 17 00:00:00 2001 From: "Sanjay Gohel (Open ERP)" Date: Thu, 22 Nov 2012 11:50:23 +0530 Subject: [PATCH 4/5] [IMP]tracked sale project_issue and invoice fields bzr revid: sgo@tinyerp.com-20121122062023-wzj8p4s0yj9gntep --- addons/account/account_invoice.py | 4 ++-- addons/project_issue/project_issue.py | 4 ++-- addons/sale/sale.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 35afac5a508..0d558afbbbc 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -207,7 +207,7 @@ class account_invoice(osv.osv): ('open','Open'), ('paid','Paid'), ('cancel','Cancelled'), - ],'Status', select=True, readonly=True, + ],'Status', select=True, readonly=True,tracked=True, help=' * The \'Draft\' status is used when a user is encoding a new and unconfirmed Invoice. \ \n* The \'Pro-forma\' when invoice is in Pro-forma status,invoice does not have an invoice number. \ \n* The \'Open\' status is used when user create invoice,a invoice number is generated.Its in open status till user does not pay invoice. \ @@ -275,7 +275,7 @@ class account_invoice(osv.osv): help="Remaining amount due."), 'payment_ids': fields.function(_compute_lines, relation='account.move.line', type="many2many", string='Payments'), 'move_name': fields.char('Journal Entry', size=64, readonly=True, states={'draft':[('readonly',False)]}), - 'user_id': fields.many2one('res.users', 'Salesperson', readonly=True, states={'draft':[('readonly',False)]}), + 'user_id': fields.many2one('res.users', 'Salesperson', readonly=True, tracked=True, states={'draft':[('readonly',False)]}), 'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position', readonly=True, states={'draft':[('readonly',False)]}) } _defaults = { diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index 90640363906..7c6b6efec2c 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -245,14 +245,14 @@ class project_issue(base_stage, osv.osv): 'version_id': fields.many2one('project.issue.version', 'Version'), 'stage_id': fields.many2one ('project.task.type', 'Stage', domain="['&', ('fold', '=', False), '|', ('project_ids', '=', project_id), ('case_default', '=', True)]"), - 'project_id':fields.many2one('project.project', 'Project'), + 'project_id':fields.many2one('project.project', 'Project',tracked=True), 'duration': fields.float('Duration'), 'task_id': fields.many2one('project.task', 'Task', domain="[('project_id','=',project_id)]"), 'day_open': fields.function(_compute_day, string='Days to Open', \ multi='compute_day', type="float", store=True), 'day_close': fields.function(_compute_day, string='Days to Close', \ multi='compute_day', type="float", store=True), - 'user_id': fields.many2one('res.users', 'Assigned to', required=False, select=1), + 'user_id': fields.many2one('res.users', 'Assigned to', required=False, select=1,tracked=True), 'working_hours_open': fields.function(_compute_day, string='Working Hours to Open the Issue', \ multi='compute_day', type="float", store=True), 'working_hours_close': fields.function(_compute_day, string='Working Hours to Close the Issue', \ diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 3c568cc8227..4ee0c05b510 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -187,7 +187,7 @@ class sale_order(osv.osv): ('manual', 'Sale to Invoice'), ('invoice_except', 'Invoice Exception'), ('done', 'Done'), - ], 'Status', readonly=True, help="Gives the status of the quotation or sales order. \nThe exception status is automatically set when a cancel operation occurs in the processing of a document linked to the sale order. \nThe 'Waiting Schedule' status is set when the invoice is confirmed but waiting for the scheduler to run on the order date.", select=True), + ], 'Status', readonly=True, tracked=True, help="Gives the status of the quotation or sales order. \nThe exception status is automatically set when a cancel operation occurs in the processing of a document linked to the sale order. \nThe 'Waiting Schedule' status is set when the invoice is confirmed but waiting for the scheduler to run on the order date.", select=True), 'date_order': fields.date('Date', required=True, readonly=True, select=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}), 'create_date': fields.datetime('Creation Date', readonly=True, select=True, help="Date on which sales order is created."), 'date_confirm': fields.date('Confirmation Date', readonly=True, select=True, help="Date on which sales order is confirmed."), From 36710694fe28260d814cc651e60fba9acfca79ea Mon Sep 17 00:00:00 2001 From: "Sanjay Gohel (Open ERP)" Date: Thu, 22 Nov 2012 12:17:20 +0530 Subject: [PATCH 5/5] [IMP]tracked res partner fields bzr revid: sgo@tinyerp.com-20121122064720-e8ohgrvas0iazvdi --- addons/crm/res_partner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/res_partner.py b/addons/crm/res_partner.py index e43534476fd..5304569302c 100644 --- a/addons/crm/res_partner.py +++ b/addons/crm/res_partner.py @@ -39,7 +39,7 @@ class res_partner(osv.osv): return res _columns = { - 'section_id': fields.many2one('crm.case.section', 'Sales Team'), + 'section_id': fields.many2one('crm.case.section', 'Sales Team',tracked=True), 'opportunity_ids': fields.one2many('crm.lead', 'partner_id',\ 'Leads and Opportunities', domain=[('state','in', ('draft','open','pending'))]), 'meeting_ids': fields.many2many('crm.meeting', 'crm_meeting_partner_rel','partner_id', 'meeting_id',