[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.
This commit is contained in:
Stéphan Sainléger
2023-06-16 12:47:08 +02:00
parent 9d0549db19
commit 6840765f5c
4 changed files with 88 additions and 101 deletions

View File

@@ -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'