Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][ADD] helpdesk_product #520

Merged
merged 9 commits into from
Apr 8, 2024
Empty file added helpdesk_product/README.rst
Empty file.
1 change: 1 addition & 0 deletions helpdesk_product/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
14 changes: 14 additions & 0 deletions helpdesk_product/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "Helpdesk Product",
"summary": "Add the option to select product in the tickets.",
"author": "ForgeFlow, " "Odoo Community Association (OCA)",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"category": "After-Sales",
"website": "https://github.com/OCA/helpdesk",
"depends": ["helpdesk_mgmt", "product"],
"data": ["views/product_view.xml", "views/helpdesk_ticket_view.xml"],
"demo": ["demo/helpdesk_product_demo.xml"],
"development_status": "Beta",
"auto_install": True,
}
24 changes: 24 additions & 0 deletions helpdesk_product/demo/helpdesk_product_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<!-- Tickets -->
<record id="helpdesk_ticket_8" model="helpdesk.ticket">
<field eval="&quot;Poor quality product&quot;" name="name" />
<field eval="&quot;Poor quality product&quot;" name="description" />
<field eval="&quot;2&quot;" name="priority" />
<field name="user_id" ref="base.user_root" />
<field name="partner_id" ref="base.res_partner_10" />
<field name="team_id" ref="helpdesk_mgmt.helpdesk_team_2" />
<field name="stage_id" ref="helpdesk_mgmt.helpdesk_ticket_stage_in_progress" />
<field name="product_id" ref="product.product_product_10" />
</record>
<record id="helpdesk_ticket_9" model="helpdesk.ticket">
<field eval="&quot;Product needs maintenance&quot;" name="name" />
<field eval="&quot;Product needs maintenance&quot;" name="description" />
<field eval="&quot;1&quot;" name="priority" />
<field name="channel_id" ref="helpdesk_mgmt.helpdesk_ticket_channel_other" />
<field name="user_id" ref="base.user_root" />
<field name="team_id" ref="helpdesk_mgmt.helpdesk_team_2" />
<field name="stage_id" ref="helpdesk_mgmt.helpdesk_ticket_stage_awaiting" />
<field name="product_id" ref="product.product_product_9" />
</record>
</odoo>
1 change: 1 addition & 0 deletions helpdesk_product/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import helpdesk_ticket, product
7 changes: 7 additions & 0 deletions helpdesk_product/models/helpdesk_ticket.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from odoo import fields, models


class HelpdeskTicket(models.Model):
_inherit = "helpdesk.ticket"

product_id = fields.Many2one(string="Product", comodel_name="product.product")
9 changes: 9 additions & 0 deletions helpdesk_product/models/product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from odoo import fields, models


class Product(models.Model):
_inherit = "product.template"

ticket_active = fields.Boolean(
"Available for Helpdesk Tickets", default=True, required=True
)
3 changes: 3 additions & 0 deletions helpdesk_product/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `ForgeFlow <https://www.forgeflow.com>`_:

* Maria Buscallà <[email protected]>
1 change: 1 addition & 0 deletions helpdesk_product/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module adds the option to select product in the helpdesk tickets.
67 changes: 67 additions & 0 deletions helpdesk_product/views/helpdesk_ticket_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version='1.0' encoding='utf-8' ?>
<odoo>

<!-- VIEW FORM TICKET -->
<record id="ticket_view_form" model="ir.ui.view">
<field name="name">helpdesk.ticket.form</field>
<field name="model">helpdesk.ticket</field>
<field name="inherit_id" ref="helpdesk_mgmt.ticket_view_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='channel_id']" position="after">
<field name="product_id" domain="[('ticket_active', '=', True)]" />
</xpath>
</field>
</record>

<!-- TREE TICKET HELPDESK -->
<record id="ticket_view_tree" model="ir.ui.view">
<field name="name">helpdesk.ticket.tree</field>
<field name="model">helpdesk.ticket</field>
<field name="inherit_id" ref="helpdesk_mgmt.ticket_view_tree" />
<field name="arch" type="xml">
<field name="user_id" position="after">
<field name="product_id" optional="show" />
</field>
</field>
</record>

<!-- SEARCH TICKET HELPDESK -->
<record id="helpdesk_ticket_view_search" model="ir.ui.view">
<field name="name">helpdesk.ticket.search</field>
<field name="model">helpdesk.ticket</field>
<field name="inherit_id" ref="helpdesk_mgmt.helpdesk_ticket_view_search" />
<field name="arch" type="xml">
<field name="user_id" position="after">
<field name="product_id" />
</field>

<search>
<filter
string="Product Related"
name="product_filter"
domain="[('product_id', '!=', False )]"
/>

<filter
string="Product"
name="by_product"
domain="[]"
context="{'group_by':'product_id'}"
/>
</search>
</field>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could add some shortcuts:

  • Filter for tickets with product.
  • Group by product

</record>

<!-- PRODUCT MENU -->
<menuitem
action="product_template_action_helpdesk"
id="action_menu_view_products"
parent="helpdesk_mgmt.helpdesk_ticket_main_menu"
name="Products"
sequence="12"
/>




</odoo>
57 changes: 57 additions & 0 deletions helpdesk_product/views/product_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version='1.0' encoding='utf-8' ?>
<odoo>

<!-- VIEW PRODUCT TEMPLATE-->
<record id="product_view_template" model="ir.ui.view">
<field name="name">product.template.common.form</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view" />
<field name="arch" type="xml">
<field name="product_tooltip" position="before">
<field name="ticket_active" />
</field>
</field>
</record>

<record id="product_template_search_view_helpdesk" model="ir.ui.view">
<field name="name">product.template.search</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_search_view" />
<field name="arch" type="xml">
<search>
<filter
string="Available for Helpdesk"
name="helpdesk_active"
domain="[('ticket_active', '=', True )]"
/>

</search>
</field>
</record>




<!-- ACTION WINDOW FOR PRODUCT IN HELPDESK -->
<record id="product_template_action_helpdesk" model="ir.actions.act_window">
<field name="name">Products</field>
<field name="res_model">product.template</field>
<field name="type">ir.actions.act_window</field>
<field name="view_mode">kanban,tree,form,activity</field>
<field name="search_view_id" ref="product_template_search_view_helpdesk" />
<field name="context">{'search_default_helpdesk_active': 1}</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new product
</p><p>
You currently have no products available for Helpdesk Tickets.
<br />
A product can be either a physical product or a service that you sell to your customers.
</p>
</field>
</record>




</odoo>
1 change: 1 addition & 0 deletions setup/helpdesk_product/odoo/addons/helpdesk_product
6 changes: 6 additions & 0 deletions setup/helpdesk_product/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
Loading