From c5e59dde48c5e6f542abf30ad11020875d560316 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Fri, 9 Jul 2010 16:57:15 +0530 Subject: [PATCH 01/16] [IMP] Project_issue : minor modifs bzr revid: jvo@tinyerp.com-20100709112715-qne7f7p3d7sqj8tq --- .../project_issue/report/project_issue_report.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/addons/project_issue/report/project_issue_report.py b/addons/project_issue/report/project_issue_report.py index 833a792c34d..c79ac3eae64 100644 --- a/addons/project_issue/report/project_issue_report.py +++ b/addons/project_issue/report/project_issue_report.py @@ -52,7 +52,7 @@ class project_issue_report(osv.osv): _columns = { 'name': fields.char('Year', size=64, required=False, readonly=True), 'user_id':fields.many2one('res.users', 'Responsible', readonly=True), - 'user_id2':fields.many2one('res.users', 'Assigned To', readonly=True), + 'user_id2':fields.many2one('res.users', 'Assignee', readonly=True), 'section_id':fields.many2one('crm.case.section', 'Section', readonly=True), 'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True), 'avg_answers': fields.function(_get_data, string='Avg. Answers', method=True, type="integer"), @@ -66,17 +66,17 @@ class project_issue_report(osv.osv): ('11', 'November'), ('12', 'December')], 'Month', readonly=True), 'company_id': fields.many2one('res.company', 'Company', readonly=True), 'day': fields.char('Day', size=128, readonly=True), - 'opening_date': fields.date('Opening Date', readonly=True), + 'opening_date': fields.date('Date of Opening', readonly=True), 'creation_date': fields.date('Creation Date', readonly=True), - 'date_closed': fields.date('Closed Date', readonly=True), + 'date_closed': fields.date('Date of Closing', readonly=True), 'categ_id': fields.many2one('crm.case.categ', 'Category', domain="[('section_id','=',section_id),('object_id.model', '=', 'project.issue')]"), 'stage_id': fields.many2one ('crm.case.stage', 'Stage', domain="[('object_id.model', '=', 'project.issue')]"), 'nbr': fields.integer('# of Issues', readonly=True), - 'working_hours_open': fields.float('# Working Open Hours', readonly=True), - 'working_hours_close': fields.float('# Working Closing Hours', readonly=True), - 'delay_open': fields.float('Avg opening Delay', digits=(16,2), readonly=True, group_operator="avg", + 'working_hours_open': fields.float('Avg. Working Hours to Open', readonly=True), + 'working_hours_close': fields.float('Avg. Working Hours to Close', readonly=True), + 'delay_open': fields.float('Avg. Delay to Open', digits=(16,2), readonly=True, group_operator="avg", help="Number of Days to close the project issue"), - 'delay_close': fields.float('Avg Closing Delay', digits=(16,2), readonly=True, group_operator="avg", + 'delay_close': fields.float('Avg. Delay to Close', digits=(16,2), readonly=True, group_operator="avg", help="Number of Days to close the project issue"), 'company_id' : fields.many2one('res.company', 'Company'), 'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'), From ea6c6dd089740b979114148dc918282a48f8a036 Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Fri, 9 Jul 2010 17:05:54 +0530 Subject: [PATCH 02/16] [Fix]:purchase_requisition : requisition type exclusive then set the confirm purchase order in procurement bzr revid: sbh@tinyerp.com-20100709113554-htq4ole8xlezba0w --- addons/purchase_requisition/purchase_requisition.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/purchase_requisition/purchase_requisition.py b/addons/purchase_requisition/purchase_requisition.py index 7f7c10a0c8a..532c9918b60 100644 --- a/addons/purchase_requisition/purchase_requisition.py +++ b/addons/purchase_requisition/purchase_requisition.py @@ -129,10 +129,14 @@ class purchase_order(osv.osv): } def wkf_confirm_order(self, cr, uid, ids, context={}): res = super(purchase_order, self).wkf_confirm_order(cr, uid, ids, context) + proc_obj=self.pool.get('procurement.order') for po in self.browse(cr, uid, ids, context): if po.requisition_id and (po.requisition_id.exclusive=='exclusive'): for order in po.requisition_id.purchase_ids: if order.id<>po.id: + proc_ids = proc_obj.search(cr, uid, [('purchase_id', '=', order.id)]) + if proc_ids and po.state=='confirmed': + proc_obj.wirte(cr,uid,proc_ids,{'purchase_id':po.id}) wf_service = netsvc.LocalService("workflow") wf_service.trg_validate(uid, 'purchase.order', order.id, 'purchase_cancel', cr) self.pool.get('purchase.requisition').write(cr, uid, [po.requisition_id.id], {'state':'done','date_end':time.strftime('%Y-%m-%d %H:%M:%S')}) From 86f8d9bc64aaef5b6e63b544aec863c4682ad68e Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Fri, 9 Jul 2010 17:24:22 +0530 Subject: [PATCH 04/16] [IMP]: base_action_rule: Improvement for computing regex on history and number of history bzr revid: rpa@tinyerp.com-20100709115422-hu6s5adz77qpzvk5 --- addons/base_action_rule/base_action_rule.py | 4 +++- .../base_action_rule_view.xml | 2 +- addons/crm/crm_action_rule.py | 20 +++++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/addons/base_action_rule/base_action_rule.py b/addons/base_action_rule/base_action_rule.py index be1a53046a7..b0fa217e747 100644 --- a/addons/base_action_rule/base_action_rule.py +++ b/addons/base_action_rule/base_action_rule.py @@ -105,7 +105,9 @@ the rule to mark CC(mail to any other person defined in actions)."), 'act_mail_to_email': fields.char('Mail to these Emails', size=128, \ help="Email-id of the persons whom mail is to be sent"), 'act_mail_body': fields.text('Mail body', help="Content of mail"), - 'regex_name': fields.char('Regular Expression on Model Name', size=128), + 'regex_name': fields.char('Regex on Resource Name', size=128, help="Regular expression for mathching name of the resource\ +\ne.g.: urgent.* will search for records having name starting with urgent\ +\nNote: This is case sensitive search."), 'server_action_id': fields.many2one('ir.actions.server', 'Server Action', help="Describes the action name.\neg:on which object which action to be taken on basis of which condition"), 'filter_id':fields.many2one('ir.filters', 'Filter', required=False), 'domain':fields.char('Domain', size=124, required=False, readonly=False), diff --git a/addons/base_action_rule/base_action_rule_view.xml b/addons/base_action_rule/base_action_rule_view.xml index c9164962439..36140e62649 100644 --- a/addons/base_action_rule/base_action_rule_view.xml +++ b/addons/base_action_rule/base_action_rule_view.xml @@ -24,7 +24,7 @@ - + diff --git a/addons/crm/crm_action_rule.py b/addons/crm/crm_action_rule.py index 1f11f2c4c0c..521a183b770 100644 --- a/addons/crm/crm_action_rule.py +++ b/addons/crm/crm_action_rule.py @@ -80,6 +80,26 @@ this if you want the rule to send an email to the partner."), if hasattr(obj, 'categ_id'): ok = ok and (not action.trg_categ_id or action.trg_categ_id.id==obj.categ_id.id) + #Cheking for history + regex = action.regex_history + result_history = True + if regex: + res = False + ptrn = re.compile(str(regex)) + for history in obj.message_ids: + _result = ptrn.search(str(history.name)) + if _result: + res = True + break + result_history = res + ok = ok and (not regex or result_history) + + res_count = True + if action.trg_max_history: + res_count = False + if len(obj.message_ids) >= action.trg_max_history: + res_count = True + ok = ok and res_count return ok def do_action(self, cr, uid, action, model_obj, obj, context={}): From 7303590f8beb0a4e0aba002afbae1d2c8b4f3aaa Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Fri, 9 Jul 2010 17:44:44 +0530 Subject: [PATCH 05/16] [REF]: base_action_rule: Replace mx.Datetime with datetime.datetime bzr revid: rpa@tinyerp.com-20100709121444-3kgw195rdgprmlz3 --- addons/base_action_rule/base_action_rule.py | 21 +++++++++++---------- addons/crm/crm_action_rule.py | 1 - 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/addons/base_action_rule/base_action_rule.py b/addons/base_action_rule/base_action_rule.py index b0fa217e747..79b883c0236 100644 --- a/addons/base_action_rule/base_action_rule.py +++ b/addons/base_action_rule/base_action_rule.py @@ -22,7 +22,8 @@ from datetime import datetime from osv import fields, osv, orm from tools.translate import _ -import mx.DateTime +from datetime import datetime +from datetime import timedelta import pooler import re import time @@ -354,23 +355,23 @@ the rule to mark CC(mail to any other person defined in actions)."), base = False if hasattr(obj, 'create_date') and action.trg_date_type=='create': - base = mx.DateTime.strptime(obj.create_date[:19], '%Y-%m-%d %H:%M:%S') + base = datetime.strptime(obj.create_date[:19], '%Y-%m-%d %H:%M:%S') elif hasattr(obj, 'create_date') and action.trg_date_type=='action_last': if hasattr(obj, 'date_action_last') and obj.date_action_last: - base = mx.DateTime.strptime(obj.date_action_last, '%Y-%m-%d %H:%M:%S') + base = datetime.strptime(obj.date_action_last, '%Y-%m-%d %H:%M:%S') else: - base = mx.DateTime.strptime(obj.create_date[:19], '%Y-%m-%d %H:%M:%S') + base = datetime.strptime(obj.create_date[:19], '%Y-%m-%d %H:%M:%S') elif hasattr(obj, 'date_deadline') and action.trg_date_type=='deadline' \ and obj.date_deadline: - base = mx.DateTime.strptime(obj.date_deadline, '%Y-%m-%d %H:%M:%S') + base = datetime.strptime(obj.date_deadline, '%Y-%m-%d %H:%M:%S') elif hasattr(obj, 'date') and action.trg_date_type=='date' and obj.date: - base = mx.DateTime.strptime(obj.date, '%Y-%m-%d %H:%M:%S') + base = datetime.strptime(obj.date, '%Y-%m-%d %H:%M:%S') if base: fnct = { - 'minutes': lambda interval: mx.DateTime.RelativeDateTime(minutes=interval), - 'day': lambda interval: mx.DateTime.RelativeDateTime(days=interval), - 'hour': lambda interval: mx.DateTime.RelativeDateTime(hours=interval), - 'month': lambda interval: mx.DateTime.RelativeDateTime(months=interval), + 'minutes': lambda interval: timedelta(minutes=interval), + 'day': lambda interval: timedelta(days=interval), + 'hour': lambda interval: timedelta(hours=interval), + 'month': lambda interval: timedelta(months=interval), } d = base + fnct[action.trg_date_range_type](action.trg_date_range) dt = d.strftime('%Y-%m-%d %H:%M:%S') diff --git a/addons/crm/crm_action_rule.py b/addons/crm/crm_action_rule.py index 521a183b770..1ca37a426a2 100644 --- a/addons/crm/crm_action_rule.py +++ b/addons/crm/crm_action_rule.py @@ -24,7 +24,6 @@ import re import os import base64 import tools -import mx.DateTime from tools.translate import _ from osv import fields From 790ec26efb1cfe273934c5bdfcddf223047059ff Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Fri, 9 Jul 2010 18:09:53 +0530 Subject: [PATCH 06/16] [IMP] Project_issue : Added project_id to list view bzr revid: jvo@tinyerp.com-20100709123953-tgmt4lsdc3packug --- addons/project_issue/project_issue_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml index 0bdee911cee..cbf24b18f76 100644 --- a/addons/project_issue/project_issue_view.xml +++ b/addons/project_issue/project_issue_view.xml @@ -154,9 +154,9 @@ - +