From c810905bdf5b966ff8a5696d6a1b8424111b4676 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Tue, 21 May 2013 14:22:42 +0200 Subject: [PATCH] [IMP] crm_lead: on_change_user don't change section_id if they is a default_section_id context value bzr revid: chm@openerp.com-20130521122242-53eu1fi506465o6c --- addons/crm/crm_lead.py | 4 ++-- addons/sale_crm/sale_crm_view.xml | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 61e8c75cea8..ee008c1eed3 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -366,8 +366,8 @@ class crm_lead(base_stage, format_address, osv.osv): def on_change_user(self, cr, uid, ids, user_id, context=None): """ When changing the user, also set a section_id or restrict section id to the ones user_id is member of. """ - section_id = False - if user_id: + section_id = self._get_default_section_id(cr, uid, context=context) or False + if user_id and not section_id: section_ids = self.pool.get('crm.case.section').search(cr, uid, ['|', ('user_id', '=', user_id), ('member_ids', '=', user_id)], context=context) if section_ids: section_id = section_ids[0] diff --git a/addons/sale_crm/sale_crm_view.xml b/addons/sale_crm/sale_crm_view.xml index a1758efe03d..3753bdff8e6 100644 --- a/addons/sale_crm/sale_crm_view.xml +++ b/addons/sale_crm/sale_crm_view.xml @@ -152,7 +152,8 @@ tree,form,calendar,graph { 'search_default_section_id': [active_id], - 'default_section_id': active_id, 'show_address': 1, + 'default_section_id': active_id, + 'show_address': 1, } [('state','in',('draft','sent','cancel'))] @@ -183,7 +184,7 @@ ('type', '=', 'out_invoice')] { 'search_default_section_id': [active_id], - 'default_section_id': active_id}, + 'default_section_id': active_id, 'default_type':'out_invoice', 'type':'out_invoice', 'journal_type': 'sale',