[MERGE] merge with main branch
bzr revid: mra@mra-laptop-20100726095018-0qfuh4ggasugornw
This commit is contained in:
@@ -60,7 +60,8 @@ class base_action_rule(osv.osv):
|
||||
return [('', '')]
|
||||
|
||||
_columns = {
|
||||
'name': fields.many2one('ir.model', 'Object', required=True),
|
||||
'name': fields.char('Rule Name', size=64, required=True),
|
||||
'model_id': fields.many2one('ir.model', 'Object', required=True),
|
||||
'create_date': fields.datetime('Create Date', readonly=1),
|
||||
'active': fields.boolean('Active', help="If the active field is set to False,\
|
||||
it will allow you to hide the rule without removing it."),
|
||||
@@ -125,6 +126,7 @@ the rule to mark CC(mail to any other person defined in actions)."),
|
||||
_order = 'sequence'
|
||||
|
||||
def onchange_model_id(self, cr, uid, ids, name):
|
||||
#This is not a good solution as it will affect the domain only on onchange
|
||||
res = {'domain':{'filter_id':[]}}
|
||||
if name:
|
||||
model_name = self.pool.get('ir.model').read(cr, uid, [name], ['model'])
|
||||
@@ -138,7 +140,7 @@ the rule to mark CC(mail to any other person defined in actions)."),
|
||||
def pre_action(self, cr, uid, ids, model, context=None):
|
||||
# Searching for action rules
|
||||
cr.execute("SELECT model.model, rule.id FROM base_action_rule rule \
|
||||
LEFT JOIN ir_model model on (model.id = rule.name) \
|
||||
LEFT JOIN ir_model model on (model.id = rule.model_id) \
|
||||
where active")
|
||||
res = cr.fetchall()
|
||||
# Check if any rule matching with current object
|
||||
@@ -175,7 +177,7 @@ the rule to mark CC(mail to any other person defined in actions)."),
|
||||
if not context:
|
||||
context = {}
|
||||
for action_rule in self.browse(cr, uid, ids, context=context):
|
||||
model = action_rule.name.model
|
||||
model = action_rule.model_id.model
|
||||
obj_pool = self.pool.get(model)
|
||||
obj_pool.__setattr__('create', self._create(obj_pool.create, model, context=context))
|
||||
obj_pool.__setattr__('write', self._write(obj_pool.write, model, context=context))
|
||||
@@ -257,7 +259,7 @@ the rule to mark CC(mail to any other person defined in actions)."),
|
||||
@param context: A standard dictionary for contextual values """
|
||||
ok = True
|
||||
if action.filter_id:
|
||||
if action.name.model == action.filter_id.model_id:
|
||||
if action.model_id.model == action.filter_id.model_id:
|
||||
context.update(eval(action.filter_id.context))
|
||||
obj_ids = obj._table.search(cr, uid, eval(action.filter_id.domain), context=context)
|
||||
if not obj.id in obj_ids:
|
||||
@@ -280,8 +282,6 @@ the rule to mark CC(mail to any other person defined in actions)."),
|
||||
ok = ok and (not action.trg_state_from or action.trg_state_from==obj.state)
|
||||
if state_to:
|
||||
ok = ok and (not action.trg_state_to or action.trg_state_to==state_to)
|
||||
elif action.trg_state_to:
|
||||
ok = False
|
||||
reg_name = action.regex_name
|
||||
result_name = True
|
||||
if reg_name:
|
||||
@@ -355,7 +355,7 @@ the rule to mark CC(mail to any other person defined in actions)."),
|
||||
if not scrit:
|
||||
scrit = []
|
||||
for action in self.browse(cr, uid, ids):
|
||||
model_obj = self.pool.get(action.name.model)
|
||||
model_obj = self.pool.get(action.model_id.model)
|
||||
for obj in objects:
|
||||
ok = self.do_check(cr, uid, action, obj, context=context)
|
||||
if not ok:
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
<record id="ir_cron_crm_action" model="ir.cron">
|
||||
|
||||
<record id="ir_cron_crm_action" model="ir.cron">
|
||||
<field name="name">Check Action Rules</field>
|
||||
<field name="interval_number">4</field>
|
||||
<field name="interval_type">hours</field>
|
||||
@@ -10,10 +11,7 @@
|
||||
<field eval="'base.action.rule'" name="model"/>
|
||||
<field eval="'_check'" name="function"/>
|
||||
<field eval="'()'" name="args"/>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -14,10 +14,11 @@
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Action Rule">
|
||||
<field name="name" select="1" on_change="onchange_model_id(name)"/>
|
||||
<field name="active"/>
|
||||
<field name="name"/>
|
||||
<field name="model_id" select="1" on_change="onchange_model_id(model_id)"/>
|
||||
<field name="filter_id" />
|
||||
<field name="sequence"/>
|
||||
<field name="filter_id"/>
|
||||
<field name="active"/>
|
||||
<notebook colspan="4">
|
||||
<page string="Conditions">
|
||||
<group col="2" colspan="2" name="model">
|
||||
|
||||
@@ -134,7 +134,6 @@ class project(osv.osv):
|
||||
'warn_header': fields.text('Mail Header', help="Header added at the beginning of the email for the warning message sent to the customer when a task is closed."),
|
||||
'warn_footer': fields.text('Mail Footer', help="Footer added at the beginning of the email for the warning message sent to the customer when a task is closed."),
|
||||
'type_ids': fields.many2many('project.task.type', 'project_task_type_rel', 'project_id', 'type_id', 'Tasks Stages'),
|
||||
'project_escalation_id': fields.many2one('project.project','Project Escalation', help='If any issue is escalated from the current Project, it will be listed under the project selected here.'),
|
||||
}
|
||||
|
||||
_order = "sequence"
|
||||
@@ -153,16 +152,8 @@ class project(osv.osv):
|
||||
return False
|
||||
return True
|
||||
|
||||
def _check_escalation(self, cr, uid, ids):
|
||||
project_obj = self.browse(cr, uid, ids[0])
|
||||
if project_obj.project_escalation_id:
|
||||
if project_obj.project_escalation_id.id == project_obj.id:
|
||||
return False
|
||||
return True
|
||||
|
||||
_constraints = [
|
||||
(_check_dates, 'Error! project start-date must be lower then project end-date.', ['date_start', 'date']),
|
||||
(_check_escalation, 'Error! You cannot assign escalation to the same project!', ['project_escalation_id'])
|
||||
(_check_dates, 'Error! project start-date must be lower then project end-date.', ['date_start', 'date'])
|
||||
]
|
||||
|
||||
def set_template(self, cr, uid, ids, context=None):
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
<group col="2" colspan="2" name="misc">
|
||||
<separator colspan="2" string="Miscelleanous"/>
|
||||
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
|
||||
<field name="project_escalation_id"/>
|
||||
<field name="warn_manager"/>
|
||||
</group>
|
||||
<newline/>
|
||||
@@ -166,7 +165,7 @@
|
||||
<field name="view_id" ref="view_project"/>
|
||||
<field name="search_view_id" ref="view_project_project_filter"/>
|
||||
<field name="context">{'search_default_Current':1}</field>
|
||||
<field name="help"> Consult and define yours projects here. A project content a set of related activities that will be performed by your company. Any project can be put into a hierarchy, as a child of a Parent Project. This allows you to design large project structure very useful for work organization.</field>
|
||||
<field name="help">Consult and define your projects here. A project contains a set of related activities that will be performed by your company. Any project can be put into a hierarchy, as a child of a Parent Project. This allows you to design large project structure very useful for work organization.</field>
|
||||
</record>
|
||||
<menuitem action="open_view_project_all" id="menu_open_view_project_all" parent="menu_project_management" sequence="1"/>
|
||||
|
||||
|
||||
@@ -181,7 +181,7 @@ class project_issue(osv.osv, crm.crm_case):
|
||||
method=True, multi='day_open', type="float", store=True),
|
||||
'day_close': fields.function(_compute_day, string='Days to Close', \
|
||||
method=True, multi='day_close', type="float", store=True),
|
||||
'assigned_to': fields.related('task_id', 'user_id', type='many2one', relation='res.users', string='Assigned to', help='This is the current user to whom the related task have been assigned', readonly=True),
|
||||
'assigned_to': fields.many2one('res.users', 'Assigned to', help='This is the current user to whom the related task have been assigned'),
|
||||
'working_hours_open': fields.function(_compute_day, string='Working Hours to Open the Issue', \
|
||||
method=True, multi='working_days_open', type="float", store=True),
|
||||
'working_hours_close': fields.function(_compute_day, string='Working Hours to Close the Issue', \
|
||||
@@ -406,8 +406,21 @@ project_issue()
|
||||
class project(osv.osv):
|
||||
_inherit = "project.project"
|
||||
_columns = {
|
||||
'resource_calendar_id': fields.many2one('resource.calendar', 'Working Time', help="Timetable working hours to adjust the gantt diagram report"),
|
||||
'resource_calendar_id' : fields.many2one('resource.calendar', 'Working Time', help="Timetable working hours to adjust the gantt diagram report"),
|
||||
'project_escalation_id' : fields.many2one('project.project','Project Escalation', help='If any issue is escalated from the current Project, it will be listed under the project selected here.'),
|
||||
'reply_to' : fields.char('Reply-To Email Address', size=256)
|
||||
}
|
||||
|
||||
def _check_escalation(self, cr, uid, ids):
|
||||
project_obj = self.browse(cr, uid, ids[0])
|
||||
if project_obj.project_escalation_id:
|
||||
if project_obj.project_escalation_id.id == project_obj.id:
|
||||
return False
|
||||
return True
|
||||
|
||||
_constraints = [
|
||||
(_check_escalation, 'Error! You cannot assign escalation to the same project!', ['project_escalation_id'])
|
||||
]
|
||||
project()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -286,5 +286,23 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
# ------------------------------------------------------
|
||||
# Project
|
||||
# ------------------------------------------------------
|
||||
|
||||
<record id="view_project_form_inherited" model="ir.ui.view">
|
||||
<field name="name">project.project.form.inherited</field>
|
||||
<field name="model">project.project</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="project.edit_project"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="priority" position="before">
|
||||
<field name="resource_calendar_id"/>
|
||||
<field name="project_escalation_id"/>
|
||||
<field name="reply_to"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
Reference in New Issue
Block a user