Conversation
| <field name="inherit_id" ref="helpdesk_mgmt.helpdesk_ticket_view_search"/> | ||
| <field name="arch" type="xml"> | ||
| <search> | ||
| <field name="name" string="Name Equipment" filter_domain="[('equipment_ids.name', 'ilike', self)]"/> |
There was a problem hiding this comment.
Please also add groups management to search field
| <button class="oe_stat_button" type="object" name="action_view_tickets_equipment" string="Tickets" icon="fa-life-ring"> | ||
| <field name="num_tickets" string="Tickets" widget="statinfo" groups="helpdesk_mgmt.group_helpdesk_user"/> | ||
| </button> |
There was a problem hiding this comment.
Please move groups management to whole button.
|
|
||
| allow_ticket = fields.Boolean(string="Allow Tickets", default=False) | ||
|
|
||
| num_tickets = fields.Integer(string="Tickets", compute="_compute_num_tickets", store=True) |
There was a problem hiding this comment.
Please rename field to a more Odoo standard conventions one:
| num_tickets = fields.Integer(string="Tickets", compute="_compute_num_tickets", store=True) | |
| ticket_count = fields.Integer(string="Ticket count", compute="_compute_ticket_count", store=True) |
| class MaintenanceEquipment(models.Model): | ||
| _inherit = "maintenance.equipment" | ||
|
|
||
| ticket_ids = fields.Many2many('helpdesk.ticket', string = "Tickets") |
There was a problem hiding this comment.
python attributes should be defined without spaces:
| ticket_ids = fields.Many2many('helpdesk.ticket', string = "Tickets") | |
| ticket_ids = fields.Many2many('helpdesk.ticket', string="Tickets") |
| <field name="inherit_id" ref="maintenance.hr_equipment_view_kanban" /> | ||
| <field name="arch" type="xml"> | ||
| <xpath expr="//t[@t-name='kanban-box']//field[@name='activity_ids']" position="before"> | ||
| <field name="num_tickets" string=" Tickets" widget="statinfo" groups="helpdesk_mgmt.group_helpdesk_user"/> |
There was a problem hiding this comment.
Typo in label:
| <field name="num_tickets" string=" Tickets" widget="statinfo" groups="helpdesk_mgmt.group_helpdesk_user"/> | |
| <field name="num_tickets" string="Tickets" widget="statinfo" groups="helpdesk_mgmt.group_helpdesk_user"/> |
| <field name="inherit_id" ref="helpdesk_mgmt.ticket_view_tree" /> | ||
| <field name="arch" type="xml"> | ||
| <xpath expr="//field[@name='number']" position="after"> | ||
| <field name="has_equipment" groups="base_maintenance_group.group_maintenance_user"/> |
There was a problem hiding this comment.
Please set hidden by default:
| <field name="has_equipment" groups="base_maintenance_group.group_maintenance_user"/> | |
| <field name="has_equipment" groups="base_maintenance_group.group_maintenance_user" optional="hide"/> |
| <field name="inherit_id" ref="maintenance.hr_equipment_view_tree" /> | ||
| <field name="arch" type="xml"> | ||
| <xpath expr="//field[@name='name']" position="after"> | ||
| <field name="num_tickets" string="Tickets" groups="helpdesk_mgmt.group_helpdesk_user"/> |
There was a problem hiding this comment.
Please set optional:
| <field name="num_tickets" string="Tickets" groups="helpdesk_mgmt.group_helpdesk_user"/> | |
| <field name="num_tickets" string="Tickets" groups="helpdesk_mgmt.group_helpdesk_user" optional="show"/> |
|
LGTM, only see that it would be necessary to add the translations |
462ea83 to
4da8242
Compare
| class MaintenanceEquipment(models.Model): | ||
| _inherit = "maintenance.equipment" | ||
|
|
||
| ticket_ids = fields.Many2many('helpdesk.ticket', string="Tickets") |
There was a problem hiding this comment.
This works fine, but we should code it in a more secure way. Please look a this example
and
, in order to explicity link ticket_ids here and equipment_ids in ticket model. This is because other addons could create some alternative Many2many relations between these two models, that can cause conflict.
Moreover, both fields should be marked as copy=False, because e.g. when a ticket and/or an equipment are duplicated, relations shouldn't be kept.
Anb ticket_ids should be readonly IMO (not tested, I don't know if it can be a source of problems).
Links Odoo's
maintenancewith OCA'shelpdek_mgmt.