Dhruti Shastri has proposed merging 
lp:~openerp-dev/openobject-addons/6.1-opw-575218-dhs into 
lp:openobject-addons/6.1.

Requested reviews:
  Naresh(OpenERP) (nch-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-575218-dhs/+merge/108295


"At Marketing/Campaigns/Campaigns I face the following issue:
* When I click ""Create"" specify a ""Name"" and 
""Resource"" in the form then without saving the record, I proceed to 
create an Activity Line. I enter required data and when I try to save 
the line, I get the warning ""The following fields are invalid: * 
Campaign"".
* In the GTK-client, when I attempt the same as above, I get no warning, 
but the activity line form does not close/dismiss.

If I first save the campaign without creating a line, then try to create 
an activity line, all goes well."
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-575218-dhs/+merge/108295
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.1-opw-575218-dhs.
=== modified file 'marketing_campaign/marketing_campaign.py'
--- marketing_campaign/marketing_campaign.py	2012-01-31 13:36:57 +0000
+++ marketing_campaign/marketing_campaign.py	2012-06-01 07:12:39 +0000
@@ -448,6 +448,11 @@
         'condition': lambda *a: 'True',
     }
 
+    def onchange_campaign_id(self, cr, uid, ids, campaign_id=False, context=None):
+        if campaign_id is False:
+            raise osv.except_osv(_('Error'), _('You cannot create Activities before generating Campaign!'))
+        return {'campaign_id':campaign_id}
+
     def search(self, cr, uid, args, offset=0, limit=None, order=None,
                                         context=None, count=False):
         if context == None:

=== modified file 'marketing_campaign/marketing_campaign_view.xml'
--- marketing_campaign/marketing_campaign_view.xml	2012-03-09 01:13:12 +0000
+++ marketing_campaign/marketing_campaign_view.xml	2012-06-01 07:12:39 +0000
@@ -249,7 +249,7 @@
                     <field name="signal" groups="base.group_extended"/>
                     <field name="start"/>
                     <field name="object_id" invisible="1"/>
-                    <field name="campaign_id" invisible="1"/>
+                    <field name="campaign_id" invisible="1" on_change="onchange_campaign_id(campaign_id)"/>
                 </group>
                 <group colspan="2" col="2">
                     <separator string="Cost / Revenue" colspan="2"/>

_______________________________________________
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