[MERGE] merge with trunk
bzr revid: mra@mra-laptop-20100709124658-tlj8unequ1p867nz
This commit is contained in:
@@ -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
|
||||
@@ -105,7 +106,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),
|
||||
@@ -352,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')
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<page string="Conditions">
|
||||
<group col="2" colspan="2" name="model">
|
||||
<separator colspan="4" string="Conditions on Model Fields"/>
|
||||
<field name="regex_name" string="Regex on Model Name" colspan="2"/>
|
||||
<field name="regex_name" colspan="2"/>
|
||||
<field name="trg_user_id"/>
|
||||
</group>
|
||||
<group col="2" colspan="2" name="partner">
|
||||
|
||||
@@ -24,7 +24,6 @@ import re
|
||||
import os
|
||||
import base64
|
||||
import tools
|
||||
import mx.DateTime
|
||||
|
||||
from tools.translate import _
|
||||
from osv import fields
|
||||
@@ -80,6 +79,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={}):
|
||||
|
||||
@@ -154,9 +154,9 @@
|
||||
<tree string="Issue Tracker Tree" colors="red:state=='open';blue:state=='pending';grey:state in ('cancel', 'done')">
|
||||
<field name="id"/>
|
||||
<field name="create_date"/>
|
||||
<field name="project_id" invisible="1"/>
|
||||
<field name="name"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="project_id" />
|
||||
<field name="priority" string="Severity"/>
|
||||
<field name="stage_id" string="Resolution"/>
|
||||
<button icon="gtk-go-back" string="" name="stage_previous" type="object"
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -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')})
|
||||
|
||||
Reference in New Issue
Block a user