Merge lp:~openerp-dev/openobject-addons/trunk-automated_rules-action_tab-uco into lp:~openerp-dev/openobject-addons/trunk-automated_rules

Proposed by Ujjvala Collins
Status: Merged
Merged at revision: 4436
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-automated_rules-action_tab-uco
Merge into: lp:~openerp-dev/openobject-addons/trunk-automated_rules
Diff against target: 60 lines (+11/-14)
2 files modified
crm_action_rule/crm_action_rule.py (+8/-12)
crm_action_rule/crm_action_rule_view.xml (+3/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-automated_rules-action_tab-uco
Reviewer Review Type Date Requested Status
OpenERP R&D Team Pending
Review via email: mp+53957@code.launchpad.net

Description of the change

Backlog 3 : crm_automated_rules
-------------------------------------------------------
[CRM Action tab]
* Tab should appear only when the object selected is crm.lead (for Lead and opportunity)
* Tab shoud appear before generic rules

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'crm_action_rule/crm_action_rule.py'
2--- crm_action_rule/crm_action_rule.py 2011-03-15 11:48:39 +0000
3+++ crm_action_rule/crm_action_rule.py 2011-03-18 08:50:50 +0000
4@@ -37,7 +37,7 @@
5 return crm.AVAILABLE_STATES
6
7 _columns = {
8-# 'model': fields.related('model_id','model',type='char', size=60),
9+ 'model': fields.char('Model', size=60),
10 'crm_trg_section_id' : fields.many2one('crm.case.section', 'Sale Team'),
11 'crm_trg_categ_id' : fields.many2one('crm.case.categ', 'Category',domain=[('object_id.model','=','crm.lead')]),
12 'crm_trg_partner_id' : fields.many2one('res.partner', 'Partner'),
13@@ -59,17 +59,13 @@
14 'crm_trg_date_range_type' : 'hours',
15 }
16
17-# def onchange_model(self, cr, uid, ids, model_id, context={}):
18-#
19-# vals = {'value':{}}
20-# if model_id:
21-# model_pool = self.pool.get('ir.model')
22-# model = model_pool.browse(cr, uid, model_id)
23-# if model.model == 'crm.lead':
24-# context.update({'crm_lead':True})
25-# else:
26-# context.update({'crm_lead':False})
27-# return vals
28+ def onchange_model_id(self, cr, uid, ids, model_id, context=None):
29+ vals = {'value':{}}
30+ if model_id:
31+ model_pool = self.pool.get('ir.model')
32+ model = model_pool.browse(cr, uid, model_id, context=context)
33+ vals['value'] = {'model': model.model}
34+ return vals
35
36 def _do_run(self, cr, uid, rule=None, model=None, domain=[], context=None):
37 """
38
39=== modified file 'crm_action_rule/crm_action_rule_view.xml'
40--- crm_action_rule/crm_action_rule_view.xml 2011-03-15 11:48:39 +0000
41+++ crm_action_rule/crm_action_rule_view.xml 2011-03-18 08:50:50 +0000
42@@ -9,7 +9,8 @@
43 <field name="arch" type="xml">
44 <data>
45 <xpath expr="//field[@name='model_id']" position="replace">
46- <field name="model_id" />
47+ <field name="model_id" on_change="onchange_model_id(model_id)"/>
48+ <field name="model" invisible="1"/>
49 </xpath>
50 <xpath expr="/form/notebook/page[@string='Generic Rule']" position="before" >
51 <page string="CRM Condition" >
52@@ -45,7 +46,7 @@
53 <field name="crm_trg_responsible_id"/>
54 </group>
55 </page>
56- <page string="CRM Action">
57+ <page string="CRM Action" attrs="{'invisible': [('model','!=','crm.lead')]}">
58 <separator string="Fields to Change" colspan="4" />
59 <group colspan="2" col="2">
60 <field name="crm_to_responsible_id" widget="selection" />

Subscribers

People subscribed via source and target branches

to all changes: