[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

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

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="ir_module_category_formation_r0" model="ir.module.category">
<field name="name">Formation</field>
</record>
</data>
</openerp>

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'

View File

@@ -19,8 +19,13 @@
</button>
</div>
<field name="detailed_type" position="after">
<field name="is_learning" />
</field>
<page name="sales" position="after">
<page string="Learning" attrs="{'invisible':[('detailed_type','!=','learning')]}" name="Learning">
<page string="Learning" attrs="{'invisible':[('is_learning','=', False)]}"
name="Learning">
<group name="Informations">
<group>
<field name="domain_id" />