Purnendu Singh (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-fundrasing_payment_imp-psi into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-fundrasing_payment_imp-psi/+merge/108913

Hello,

In fundraising Payment mode field, there are some unnecessary data not related 
to fundraising that can be removed.
for that:

* add a field 'model_id' to the model 'crm.case.resource.type', similar to the 
field 'model_id' in the model 'crm.case.categ'
* adapt the code that uses the model 'crm.case.resource.type'
* adapt the data in the modules that use 'crm.case.resource.type'


Thanks,
Purnendu Singh
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-fundrasing_payment_imp-psi/+merge/108913
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-fundrasing_payment_imp-psi.
=== modified file 'crm/crm.py'
--- crm/crm.py	2012-06-01 12:15:47 +0000
+++ crm/crm.py	2012-06-06 10:32:36 +0000
@@ -184,7 +184,19 @@
     _columns = {
         'name': fields.char('Campaign Name', size=64, required=True, translate=True),
         'section_id': fields.many2one('crm.case.section', 'Sales Team'),
-    }
+        'object_id': fields.many2one('ir.model', 'Object Name'),
+    }
+
+    def _find_model_id(self, cr, uid, context=None):
+        """Finds id for case object"""
+        object_id = context and context.get('object_id', False) or False
+        ids = self.pool.get('ir.model').search(cr, uid, [('id', '=', object_id)])
+        return ids and ids[0] or False
+
+    _defaults = {
+         'object_id' : _find_model_id
+    }
+    
 
 
 def _links_get(self, cr, uid, context=None):

=== modified file 'crm/crm_lead.py'
--- crm/crm_lead.py	2012-06-04 08:26:46 +0000
+++ crm/crm_lead.py	2012-06-06 10:32:36 +0000
@@ -203,7 +203,7 @@
         'categ_id': fields.many2one('crm.case.categ', 'Category', \
             domain="['|',('section_id','=',section_id),('section_id','=',False), ('object_id.model', '=', 'crm.lead')]"),
         'type_id': fields.many2one('crm.case.resource.type', 'Campaign', \
-            domain="['|',('section_id','=',section_id),('section_id','=',False)]", help="From which campaign (seminar, marketing campaign, mass mailing, ...) did this contact come from?"),
+            domain="['|',('section_id','=',section_id),('section_id','=',False), ('object_id.model', '=', 'crm.lead')]"),
         'channel_id': fields.many2one('crm.case.channel', 'Channel', help="Communication channel (mail, direct, phone, ...)"),
         'contact_name': fields.char('Contact Name', size=64),
         'partner_name': fields.char("Customer Name", size=64,help='The name of the future partner company that will be created while converting the lead into opportunity', select=1),

=== modified file 'crm/crm_lead_data.xml'
--- crm/crm_lead_data.xml	2012-05-29 14:03:14 +0000
+++ crm/crm_lead_data.xml	2012-06-06 10:32:36 +0000
@@ -84,35 +84,43 @@
         <record model="crm.case.resource.type" id="type_lead1">
             <field name="name">Telesales</field>
             <field name="section_id" ref="section_sales_department"/>
+            <field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
         </record>
         <record model="crm.case.resource.type" id="type_lead2">
             <field name="name">Mail Campaign 1</field>
             <field name="section_id" ref="section_sales_department"/>
+            <field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
         </record>
         <record model="crm.case.resource.type" id="type_lead3">
             <field name="name">Mail Campaign 2</field>
             <field name="section_id" ref="section_sales_department"/>
+            <field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
         </record>
         <record model="crm.case.resource.type" id="type_lead4">
             <field name="name">Twitter Ads</field>
             <field name="section_id" ref="section_sales_department"/>
+            <field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
         </record>
         <record model="crm.case.resource.type" id="type_lead5">
             <field name="name">Google Adwords</field>
             <field name="section_id" ref="section_sales_department"/>
+            <field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
         </record>
         <record model="crm.case.resource.type" id="type_lead6">
             <field name="name">Google Adwords 2</field>
             <field name="section_id" ref="section_sales_department"/>
+            <field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
         </record>
         <record model="crm.case.resource.type" id="type_lead7">
             <field name="name">Television</field>
             <field name="section_id" ref="section_sales_department"/>
+            <field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
         </record>
         <record model="crm.case.resource.type" id="type_lead8">
             <field name="name">Newsletter</field>
             <field name="section_id" ref="section_sales_department"/>
-        </record>
+            <field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
+	   </record>
 
         <!--  crm categories -->
         <record model="crm.case.categ" id="categ_oppor1">

=== modified file 'crm/crm_lead_view.xml'
--- crm/crm_lead_view.xml	2012-06-04 12:20:53 +0000
+++ crm/crm_lead_view.xml	2012-06-06 10:32:36 +0000
@@ -133,7 +133,7 @@
                         <field name="company_id"
                             groups="base.group_multi_company"
                             widget="selection" colspan="2" />
-                        <field name="type_id" select="1" widget="selection"/>
+                        <field name="type_id" select="1" widget="selection" domain="[('object_id.model', '=', 'crm.lead')]"/>
                         <field name="channel_id" select="1" widget="selection"/>
                         <field name="referred"/>
                         <field name="state" groups="base.group_no_one"/>

=== modified file 'crm/crm_view.xml'
--- crm/crm_view.xml	2012-05-24 09:10:24 +0000
+++ crm/crm_view.xml	2012-06-06 10:32:36 +0000
@@ -210,6 +210,7 @@
                 <tree string="Case Category">
                     <field name="name"/>
                     <field name="section_id"/>
+					
                 </tree>
             </field>
         </record>
@@ -224,6 +225,7 @@
                 <tree string="Campaign">
                     <field name="name"/>
                     <field name="section_id"/>
+					
                 </tree>
             </field>
         </record>
@@ -238,6 +240,7 @@
                 <form string="Campaign">
                     <field name="name" select="1"/>
                     <field name="section_id"/>
+                    <field name="object_id"  invisible="1" />
                 </form>
             </field>
         </record>

=== modified file 'crm_fundraising/crm_fundraising.py'
--- crm_fundraising/crm_fundraising.py	2012-06-01 14:40:59 +0000
+++ crm_fundraising/crm_fundraising.py	2012-06-06 10:32:36 +0000
@@ -66,7 +66,8 @@
             'partner_mobile': fields.char('Mobile', size=32),
             'stage_id': fields.many2one ('crm.case.stage', 'Stage', domain="[('section_ids', '=', section_id)]"), 
             'type_id': fields.many2one('crm.case.resource.type', 'Campaign', \
-                             domain="[('section_id','=',section_id)]"),
+                                domain="[('section_id','=',section_id),\
+                                ('object_id.model', '=', 'crm.fundraising')]"),
             'duration': fields.float('Duration'),
             'ref': fields.reference('Reference', selection=crm._links_get, size=128),
             'ref2': fields.reference('Reference 2', selection=crm._links_get, size=128),

=== modified file 'crm_fundraising/crm_fundraising_data.xml'
--- crm_fundraising/crm_fundraising_data.xml	2011-01-14 00:11:01 +0000
+++ crm_fundraising/crm_fundraising_data.xml	2012-06-06 10:32:36 +0000
@@ -33,21 +33,25 @@
     <record model="crm.case.resource.type" id="type_fund1">
         <field name="name">Cash</field>
         <field name="section_id" ref="crm.section_sales_department"/>
+        <field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>
     </record>
 
     <record model="crm.case.resource.type" id="type_fund2">
         <field name="name">Cheque</field>
         <field name="section_id" ref="crm.section_sales_department"/>
+        <field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>
     </record>
 
     <record model="crm.case.resource.type" id="type_fund3">
         <field name="name">Credit Card</field>
         <field name="section_id" ref="crm.section_sales_department"/>
+        <field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>
     </record>
 
     <record model="crm.case.resource.type" id="type_fund4">
         <field name="name">Demand Draft</field>
         <field name="section_id" ref="crm.section_sales_department"/>
+        <field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>
     </record>
 
 </data>

=== modified file 'crm_fundraising/crm_fundraising_view.xml'
--- crm_fundraising/crm_fundraising_view.xml	2012-06-04 12:11:39 +0000
+++ crm_fundraising/crm_fundraising_view.xml	2012-06-06 10:32:36 +0000
@@ -78,7 +78,7 @@
                         <field name="user_id" string="Responsible"/>
                         <field name="date"/>
                         <field name="categ_id" select="1" widget="selection" domain="[('object_id.model', '=', 'crm.fundraising')]"/>
-                        <field name="type_id" string="Payment Mode" select="1" widget="selection"/>
+                        <field name="type_id" string="Payment Mode" select="1" widget="selection" domain="[('object_id.model', '=', 'crm.fundraising')]"/>
                     </group>
                     <notebook colspan="4">
                         <page string="Funds">

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to