← Back to team overview

openerp-dev-web team mailing list archive

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

 

Ujjvala Collins (OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-automated_rules-action_tab-uco into lp:~openerp-dev/openobject-addons/trunk-automated_rules.

Requested reviews:
  OpenERP R&D Team (openerp-dev)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-automated_rules-action_tab-uco/+merge/53957

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

-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-automated_rules-action_tab-uco/+merge/53957
Your team OpenERP R&D Team is requested to review the proposed merge of lp:~openerp-dev/openobject-addons/trunk-automated_rules-action_tab-uco into lp:~openerp-dev/openobject-addons/trunk-automated_rules.
=== modified file 'crm_action_rule/crm_action_rule.py'
--- crm_action_rule/crm_action_rule.py	2011-03-15 11:48:39 +0000
+++ crm_action_rule/crm_action_rule.py	2011-03-18 08:50:50 +0000
@@ -37,7 +37,7 @@
         return crm.AVAILABLE_STATES
         
     _columns = {
-#        'model': fields.related('model_id','model',type='char', size=60),
+        'model': fields.char('Model', size=60),
         'crm_trg_section_id' : fields.many2one('crm.case.section', 'Sale Team'),
         'crm_trg_categ_id' : fields.many2one('crm.case.categ', 'Category',domain=[('object_id.model','=','crm.lead')]),
         'crm_trg_partner_id' : fields.many2one('res.partner', 'Partner'),
@@ -59,17 +59,13 @@
         'crm_trg_date_range_type' : 'hours',
     }
     
-#    def onchange_model(self, cr, uid, ids, model_id, context={}):
-#        
-#        vals = {'value':{}}
-#        if model_id:
-#            model_pool = self.pool.get('ir.model')
-#            model = model_pool.browse(cr, uid, model_id)
-#            if model.model == 'crm.lead':
-#                context.update({'crm_lead':True})
-#            else:
-#                context.update({'crm_lead':False})
-#        return vals
+    def onchange_model_id(self, cr, uid, ids, model_id, context=None):
+        vals = {'value':{}}
+        if model_id:
+            model_pool = self.pool.get('ir.model')
+            model = model_pool.browse(cr, uid, model_id, context=context)
+            vals['value'] = {'model': model.model}
+        return vals
 
     def _do_run(self, cr, uid, rule=None, model=None, domain=[], context=None):
         """

=== modified file 'crm_action_rule/crm_action_rule_view.xml'
--- crm_action_rule/crm_action_rule_view.xml	2011-03-15 11:48:39 +0000
+++ crm_action_rule/crm_action_rule_view.xml	2011-03-18 08:50:50 +0000
@@ -9,7 +9,8 @@
             <field name="arch" type="xml">
                 <data>
                     <xpath expr="//field[@name='model_id']" position="replace">
-                        <field name="model_id" />
+                        <field name="model_id" on_change="onchange_model_id(model_id)"/>
+                        <field name="model" invisible="1"/>
                     </xpath>
                     <xpath expr="/form/notebook/page[@string='Generic Rule']" position="before" >
                         <page string="CRM Condition"  >
@@ -45,7 +46,7 @@
                                 <field name="crm_trg_responsible_id"/>
                             </group>    
                         </page>
-                        <page string="CRM Action">
+                        <page string="CRM Action" attrs="{'invisible': [('model','!=','crm.lead')]}">
                             <separator string="Fields to Change" colspan="4" />
                             <group colspan="2" col="2">
                                 <field name="crm_to_responsible_id" widget="selection" />


Follow ups