summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérémy Hennecart <jeh@odoo.com>2020-08-27 07:04:30 +0000
committerJérémy Hennecart <jeh@odoo.com>2020-08-31 14:23:47 +0000
commit1a5cc55dfeb03ad7d4a63a0286d5d33eaca3cbe2 (patch)
tree5de10e8e0b068e7dcef5ce7d9ea46d72b5c58704
parentacbc97bfe290ef3c7b8f7a1160266e49485099ae (diff)
[FIX] crm: fix duplicate lead when mmr is desactived
Before when we tried to duplicate a lead without the mrr option active, a traceback was raised. If the MMR option was not activated, then the user was not be able to write on some field because he was lacking the corresponding group. In this case, the recurring_revenue and recurring_plan fields. Now, when copying a lead, we purposefully set those fields to 0/False to avoid a crash if the option is not enabled. task-2325629 closes odoo/odoo#56601 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
-rw-r--r--addons/crm/models/crm_lead.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/addons/crm/models/crm_lead.py b/addons/crm/models/crm_lead.py
index 129ff3356ee..8de8bb37dd1 100644
--- a/addons/crm/models/crm_lead.py
+++ b/addons/crm/models/crm_lead.py
@@ -635,6 +635,9 @@ class Lead(models.Model):
# Do not assign to an archived user
if not self.user_id.active:
default['user_id'] = False
+ if not self.env.user.has_group('crm.group_use_recurring_revenues'):
+ default['recurring_revenue'] = 0
+ default['recurring_plan'] = False
return super(Lead, self.with_context(context)).copy(default=default)
@api.model