Skip to content

Commit

Permalink
[FIX] helpdesk_mgmt_templates: fix bugs on UI
Browse files Browse the repository at this point in the history
Add new field for categories in ticket for domain in UI
Remove the editable bottom for Categories Tree View and add  Form view for categories to improve UX creating big templates.
  • Loading branch information
dessanhemrayev committed Aug 8, 2024
1 parent 9392f29 commit d2a93f2
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 4 deletions.
5 changes: 4 additions & 1 deletion helpdesk_mgmt_templates/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"author": "Cetmix OÜ, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/helpdesk",
"depends": ["helpdesk_mgmt"],
"data": ["views/helpdesk_ticket_category_views.xml"],
"data": [
"views/helpdesk_ticket_views.xml",
"views/helpdesk_ticket_category_views.xml",
],
"application": False,
}
8 changes: 8 additions & 0 deletions helpdesk_mgmt_templates/models/helpdesk_ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ class HelpdeskTicket(models.Model):
_inherit = "helpdesk.ticket"

description = fields.Html(store=True, compute="_compute_description")
helpdesk_ticket_category_ids = fields.Many2many(
"helpdesk.ticket.category", compute="_compute_helpdesk_ticket_category"
)

@api.depends("team_id")
def _compute_helpdesk_ticket_category(self):
for rec in self:
rec.helpdesk_ticket_category_ids = rec.team_id.category_ids.ids

Check warning on line 19 in helpdesk_mgmt_templates/models/helpdesk_ticket.py

View check run for this annotation

Codecov / codecov/patch

helpdesk_mgmt_templates/models/helpdesk_ticket.py#L19

Added line #L19 was not covered by tests

@api.depends("category_id")
def _compute_description(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
<field name="name">view.helpdesk_category.tree</field>
<field name="model">helpdesk.ticket.category</field>
<field name="inherit_id" ref="helpdesk_mgmt.view_helpdesk_category_tree" />
<field name="priority">99</field>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="template_description" optional="show" />
</field>
<xpath expr="//tree" position="attributes">
<attribute name="editable" />
</xpath>
</field>
</record>
<record id="view_helpdesk_category_form" model="ir.ui.view">
Expand Down
19 changes: 19 additions & 0 deletions helpdesk_mgmt_templates/views/helpdesk_ticket_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version='1.0' encoding='utf-8' ?>
<odoo>
<record id="ticket_view_form" model="ir.ui.view">
<field name="name">helpdesk.ticket.view.form</field>
<field name="model">helpdesk.ticket</field>
<field name="inherit_id" ref="helpdesk_mgmt.ticket_view_form" />
<field name="priority">99</field>
<field name="arch" type="xml">
<field name="category_id" position="before">
<field name="helpdesk_ticket_category_ids" invisible="1" />
</field>
<field name="category_id" position="attributes">
<attribute
name="domain"
>[('id', 'in', helpdesk_ticket_category_ids)]</attribute>
</field>
</field>
</record>
</odoo>

0 comments on commit d2a93f2

Please sign in to comment.