| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- # -*- coding: utf-8 -*-
- # Part of Odoo. See LICENSE file for full copyright and licensing details.
- from odoo import api, fields, models, _
- class HelpdeskAffectedModule(models.Model):
- _name = 'helpdesk.affected.module'
- _description = 'Affected Module Catalog'
- _rec_name = 'name'
- _order = 'name'
- name = fields.Char(
- string=_('Name'),
- required=True,
- translate=True,
- help=_("Module name (translatable)")
- )
- code = fields.Char(
- string=_('Code'),
- required=True,
- index=True,
- help=_("Technical code of the module (e.g., 'account', 'sale')")
- )
- active = fields.Boolean(
- string=_('Active'),
- default=True,
- help=_("If unchecked, this module will be hidden from selection")
- )
- is_main_application = fields.Boolean(
- string=_('Main Application'),
- default=False,
- help=_("Check if this is a main Odoo application (not an extension module)")
- )
- description = fields.Text(
- string=_('Description'),
- help=_("Module description")
- )
- _sql_constraints = [
- ('code_unique', 'UNIQUE(code)', 'The module code must be unique!'),
- ]
- def name_get(self):
- """Override name_get to show translated name"""
- # Odoo automatically handles translation based on context lang
- # when field has translate=True, so we just return the name
- result = []
- for record in self:
- result.append((record.id, record.name))
- return result
|