From 6840765f5c0aededf5c465e6f007f1b5710e8b20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phan=20Sainl=C3=A9ger?= Date: Fri, 16 Jun 2023 12:47:08 +0200 Subject: [PATCH] [FIX] learning_base: remove learning value frm product detailed_type If we have to select "learning" value in the detailed_type field, this means that we can not select Event Ticket, then we can not sell the product as a ticket in an event. --- learning_base/__manifest__.py | 1 - learning_base/ir_module_category_records.xml | 8 - learning_base/models/product_template.py | 11 +- learning_base/views/product_template.xml | 169 ++++++++++--------- 4 files changed, 88 insertions(+), 101 deletions(-) delete mode 100644 learning_base/ir_module_category_records.xml diff --git a/learning_base/__manifest__.py b/learning_base/__manifest__.py index 208e952..1adbcbf 100644 --- a/learning_base/__manifest__.py +++ b/learning_base/__manifest__.py @@ -24,7 +24,6 @@ 'security/ir.model.access.csv', 'ir_actions_act_window_records.xml', 'ir_ui_menu_records.xml', - 'ir_module_category_records.xml', 'views/product_template.xml', 'views/event_event.xml', 'views/res_company.xml', diff --git a/learning_base/ir_module_category_records.xml b/learning_base/ir_module_category_records.xml deleted file mode 100644 index a0c3866..0000000 --- a/learning_base/ir_module_category_records.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - Formation - - - diff --git a/learning_base/models/product_template.py b/learning_base/models/product_template.py index 4ebed90..5802b15 100644 --- a/learning_base/models/product_template.py +++ b/learning_base/models/product_template.py @@ -17,11 +17,7 @@ class learningFinancialProgram(models.Model): class ProductTemplate(models.Model): _inherit = ['product.template'] - is_learning = fields.Boolean(compute='_compute_is_learning', store=True) - detailed_type = fields.Selection(selection_add=[ - ('learning', 'Training'), - ], ondelete={'learning': 'set service'}) - + is_learning = fields.Boolean(string='is learning') goal = fields.Html(string='Goal', translate=True) duration_html = fields.Html(string='Duration', translate=True) @@ -56,11 +52,6 @@ class ProductTemplate(models.Model): for record in self: record.count_session = len(self.env['event.event'].search([('learning_id', '=', record.id)])) - @api.depends('detailed_type') - def _compute_is_learning(self): - for record in self: - record.is_learning = record.detailed_type == 'learning' - def _detailed_type_mapping(self): type_mapping = super()._detailed_type_mapping() type_mapping['learning'] = 'service' diff --git a/learning_base/views/product_template.xml b/learning_base/views/product_template.xml index 5d644cb..5067210 100644 --- a/learning_base/views/product_template.xml +++ b/learning_base/views/product_template.xml @@ -3,98 +3,103 @@ License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> - - product.template.learning.form.inherit - product.template - - - -
- -
+ + product.template.learning.form.inherit + product.template + + - - - - - - - - - - - - - - - - - - - - +
+ +
-
- -