[IMP] big refactoring :

use event_type instead of product_product
This commit is contained in:
clementthomas
2024-01-09 11:55:20 +01:00
parent a47ac870c1
commit c3acf2065e
7 changed files with 22 additions and 26 deletions

View File

@@ -19,7 +19,7 @@ Customize lead creation from survey according to trainings
"category": "",
"depends": ["event","survey_crm_generation","survey_event_registration_generation","survey_event_base"],
"data": [
"views/crm_lead_views.xml"
"views/crm_lead_views.xml",
],
"installable": True,
"auto_install":True

View File

@@ -26,11 +26,7 @@ msgstr ""
" Réponses\n"
" </span>"
#. module: survey_crm_generation_training
#: model:ir.model.fields,field_description:survey_crm_generation_training.field_crm_lead__event_products_ids
#: model_terms:ir.ui.view,arch_db:survey_crm_generation_training.view_crm_case_opportunities_filter_survey_crm_generation_training
msgid "Event product"
msgstr "Produit de formation"
#. module: survey_crm_generation_training
#: model:ir.model,name:survey_crm_generation_training.model_crm_lead

View File

@@ -6,7 +6,7 @@ from odoo import fields, models
class CrmLead(models.Model):
_inherit = "crm.lead"
event_products_ids = fields.Many2many('product.product', string='Event product')
event_type_ids = fields.Many2many('event.type', string='Formation')
def action_view_survey_user_input_id(self):

View File

@@ -8,8 +8,8 @@ class SurveyUserInput(models.Model):
def _create_opportunity_post_process(self):
"""After lead creation from survey answer (module survey_crm_generation),
if answer (survey_user_input) contains event_products_ids, copy it in lead.
if answer (survey_user_input) contains event_type_ids, copy it in lead.
"""
self.opportunity_id.event_products_ids = self.event_products_ids.ids
self.opportunity_id.event_type_ids = self.event_type_ids.ids
return super(SurveyUserInput, self)._create_opportunity_post_process()

View File

@@ -6,10 +6,10 @@
<field name="model">crm.lead</field>
<field name="arch" type="xml">
<filter name="salesperson" position="before">
<filter string="Event product" name="event_product" context="{'group_by':'event_products_ids'}" />
<filter string="Event type" name="event_type" context="{'group_by':'event_type_ids'}" />
</filter>
<field name="tag_ids" position="before">
<field name="event_products_ids" />
<field name="event_type_ids" />
</field>
</field>
</record>
@@ -37,9 +37,7 @@
</div>
<field name="survey_user_input_id" position="after">
<field
name="event_products_ids"
readonly="1"
attrs="{'invisible': [('event_products_ids', '=', False)]}"
name="event_type_ids"
widget="many2many_tags"
/>
</field>
@@ -54,8 +52,10 @@
<field name="inherit_id" ref="crm.crm_case_tree_view_oppor" />
<field name="arch" type="xml">
<field name="name" position="after">
<field name="event_products_ids" widget="many2many_tags" />
<field name="event_type_ids" widget="many2many_tags" />
</field>
</field>
</record>
</odoo>