[IMP] survey_crm_generation_training:
use user_id of survey in created new lead
This commit is contained in:
@@ -1,15 +1,22 @@
|
|||||||
# Copyright 2022 Tecnativa - David Vidal
|
# Copyright 2022 Tecnativa - David Vidal
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
from odoo import fields, models, _
|
from odoo import fields, models, _, Command
|
||||||
|
|
||||||
|
|
||||||
class SurveyUserInput(models.Model):
|
class SurveyUserInput(models.Model):
|
||||||
_inherit = "survey.user_input"
|
_inherit = "survey.user_input"
|
||||||
|
|
||||||
def _create_opportunity_post_process(self):
|
def _prepare_opportunity(self):
|
||||||
"""After lead creation from survey answer (module survey_crm_generation),
|
res = super(SurveyUserInput, self)._prepare_opportunity()
|
||||||
if answer (survey_user_input) contains event_type_ids, copy it in lead.
|
|
||||||
"""
|
#if answer (survey_user_input) contains event_type_ids, copy it in lead.
|
||||||
self.opportunity_id.event_type_ids = self.event_type_ids.ids
|
res["event_type_ids"] = [Command.set(self.event_type_ids.ids)]
|
||||||
|
|
||||||
|
|
||||||
|
# use survey responsible as seller instead of manager of sale department
|
||||||
|
if self.survey_id.user_id:
|
||||||
|
res["user_id"] = self.survey_id.user_id.id
|
||||||
|
|
||||||
|
|
||||||
|
return res
|
||||||
|
|
||||||
return super(SurveyUserInput, self)._create_opportunity_post_process()
|
|
||||||
|
Reference in New Issue
Block a user