Thibault Delavallée (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/7.0-fix-default-stage_id-tde into 
lp:openobject-addons/7.0.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/7.0-fix-default-stage_id-tde/+merge/141755

[FIX] crm, project, project_issue: default stage_id at creation should not 
overwrite values given at create if any. Cchanged a demo opportunity from US to 
UK, because base_action_rule was changing the salesperson, leading to some 
access rights isues with demo messages.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/7.0-fix-default-stage_id-tde/+merge/141755
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/7.0-fix-default-stage_id-tde.
=== modified file 'crm/crm_lead.py'
--- crm/crm_lead.py	2012-12-28 14:39:12 +0000
+++ crm/crm_lead.py	2013-01-03 13:58:22 +0000
@@ -87,15 +87,17 @@
     def create(self, cr, uid, vals, context=None):
         if context is None:
             context = {}
-        if not context.get('default_section_id', False) and vals.get('section_id', False):
+        if not vals.get('stage_id') and vals.get('section_id'):
             ctx = context.copy()
             ctx['default_section_id'] = vals['section_id']
             vals['stage_id'] = self._get_default_stage_id(cr, uid, context=ctx)
+        elif not vals.get('stage_id') and context.get('default_section_id'):
+            vals['stage_id'] = self._get_default_stage_id(cr, uid, context=context)
         return super(crm_lead, self).create(cr, uid, vals, context=context)
 
     def _get_default_section_id(self, cr, uid, context=None):
         """ Gives default section by checking if present in the context """
-        return (self._resolve_section_id_from_context(cr, uid, context=context) or False)
+        return self._resolve_section_id_from_context(cr, uid, context=context) or False
 
     def _get_default_stage_id(self, cr, uid, context=None):
         """ Gives default stage_id """

=== modified file 'crm/crm_lead_demo.xml'
--- crm/crm_lead_demo.xml	2012-12-13 14:23:14 +0000
+++ crm/crm_lead_demo.xml	2013-01-03 13:58:22 +0000
@@ -402,9 +402,9 @@
             <field name="contact_name">Leland Martinez</field>
             <field name="email_from">i...@deltapc.com</field>
             <field name="partner_name">Delta PC</field>
-            <field name="city">Fremont</field>
+            <field name="city">London</field>
             <field name="street">3661 Station Street</field>
-            <field name="country_id" ref="base.us"/>
+            <field name="country_id" ref="base.uk"/>
             <field name="partner_id" ref="base.res_partner_4"/>
             <field name="type_id" ref="type_lead8"/>
             <field name="categ_ids" eval="[(6, 0, [categ_oppor4,categ_oppor6])]"/>

=== modified file 'project/project.py'
--- project/project.py	2012-12-28 14:37:29 +0000
+++ project/project.py	2013-01-03 13:58:22 +0000
@@ -1091,10 +1091,12 @@
     def create(self, cr, uid, vals, context=None):
         if context is None:
             context = {}
-        if not context.get('default_project_id', False) and vals.get('project_id', False):
+        if not vals.get('stage_id') and vals.get('project_id'):
             ctx = context.copy()
             ctx['default_project_id'] = vals['project_id']
             vals['stage_id'] = self._get_default_stage_id(cr, uid, context=ctx)
+        elif not vals.get('stage_id') and context.get('default_project_id'):
+            vals['stage_id'] = self._get_default_stage_id(cr, uid, context=context)
         task_id = super(task, self).create(cr, uid, vals, context=context)
         self._store_history(cr, uid, [task_id], context=context)
         return task_id

=== modified file 'project_issue/project_issue.py'
--- project_issue/project_issue.py	2012-12-28 14:37:29 +0000
+++ project_issue/project_issue.py	2013-01-03 13:58:22 +0000
@@ -67,10 +67,12 @@
     def create(self, cr, uid, vals, context=None):
         if context is None:
             context = {}
-        if not context.get('default_project_id', False) and vals.get('project_id', False):
+        if not vals.get('stage_id') and vals.get('project_id'):
             ctx = context.copy()
             ctx['default_project_id'] = vals['project_id']
             vals['stage_id'] = self._get_default_stage_id(cr, uid, context=ctx)
+        elif not vals.get('stage_id') and context.get('default_project_id'):
+            vals['stage_id'] = self._get_default_stage_id(cr, uid, context=context)
         return super(project_issue, self).create(cr, uid, vals, context=context)
 
     def _get_default_project_id(self, cr, uid, context=None):

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : openerp-dev-gtk@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to