From 5e19179427c4e76032f25fff228d87fbb50ad6b2 Mon Sep 17 00:00:00 2001 From: az-flectra Date: Thu, 19 Jul 2018 17:01:58 +0530 Subject: [PATCH] Added Upstream Patch for crm --- addons/crm/__init__.py | 8 ++++++++ addons/crm/__manifest__.py | 1 + addons/crm/models/crm_lead.py | 3 ++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/addons/crm/__init__.py b/addons/crm/__init__.py index 968c635d..108d85ce 100644 --- a/addons/crm/__init__.py +++ b/addons/crm/__init__.py @@ -5,3 +5,11 @@ from . import controllers from . import models from . import report from . import wizard + +from flectra import api, SUPERUSER_ID + + +def uninstall_hook(cr, registry): + env = api.Environment(cr, SUPERUSER_ID, {}) + teams = env['crm.team'].search([('dashboard_graph_model', '=', 'crm.opportunity.report')]) + teams.update({'dashboard_graph_model': None}) diff --git a/addons/crm/__manifest__.py b/addons/crm/__manifest__.py index 4204bd98..2d8f2c42 100644 --- a/addons/crm/__manifest__.py +++ b/addons/crm/__manifest__.py @@ -58,4 +58,5 @@ 'installable': True, 'application': True, 'auto_install': False, + 'uninstall_hook': 'uninstall_hook', } diff --git a/addons/crm/models/crm_lead.py b/addons/crm/models/crm_lead.py index 5f135a53..72f8e4e4 100644 --- a/addons/crm/models/crm_lead.py +++ b/addons/crm/models/crm_lead.py @@ -542,7 +542,8 @@ class Lead(models.Model): for field in fields: value = getattr(self, field.name, False) if field.ttype == 'selection': - value = dict(field.get_values(self.env)).get(value, value) + selections = self.fields_get()[field.name]['selection'] + value = next((v[1] for v in selections if v[0] == value), value) elif field.ttype == 'many2one': if value: value = value.sudo().name_get()[0][1]