# -*- coding: utf-8 -*- from odoo import api, fields, models, _ class WheelchairConfigFlowNodeOption(models.Model): _name = 'fusion.wc.config.flow.node.option' _description = 'Configuration Flow Node Option' _order = 'sequence, id' node_id = fields.Many2one('fusion.wc.config.flow.node', string='Node', required=True, ondelete='cascade', index=True) name = fields.Char(string='Name', required=True) sequence = fields.Integer(default=10) # Link to actual section product option section_option_id = fields.Many2one('fusion.wc.section.option', string='Section Option', help='Link this choice to a wheelchair section product option') # Effects when this option is selected enables_option_ids = fields.Many2many( 'fusion.wc.section.option', 'wc_flow_node_opt_enables_rel', 'node_option_id', 'option_id', string='Enables Options', help='Section options to enable when this choice is selected') disables_option_ids = fields.Many2many( 'fusion.wc.section.option', 'wc_flow_node_opt_disables_rel', 'node_option_id', 'option_id', string='Disables Options', help='Section options to disable when this choice is selected') requires_option_ids = fields.Many2many( 'fusion.wc.section.option', 'wc_flow_node_opt_requires_rel', 'node_option_id', 'option_id', string='Requires Options', help='Section options that become required when this choice is selected') # Port key for connections — auto-generated from sequence port_key = fields.Char(string='Port Key', compute='_compute_port_key', store=True) @api.depends('sequence', 'node_id') def _compute_port_key(self): for record in self: record.port_key = 'opt_%d' % (record.sequence or 0)