From d1e4683b67fc52004ed3a05571487c81033701e8 Mon Sep 17 00:00:00 2001 From: Gil Arasa Verge Date: Fri, 11 Oct 2024 15:07:20 +0200 Subject: [PATCH] [MIG] helpdesk_mgmt: Migration to 17.0 Co-authored-by: Chandni Prajapati Khamar --- helpdesk_mgmt/README.rst | 8 +- helpdesk_mgmt/__manifest__.py | 2 +- helpdesk_mgmt/controllers/myaccount.py | 2 +- helpdesk_mgmt/data/helpdesk_data.xml | 1 - helpdesk_mgmt/models/helpdesk_ticket.py | 20 ++--- helpdesk_mgmt/models/ir_http.py | 2 +- helpdesk_mgmt/readme/USAGE.md | 4 +- helpdesk_mgmt/static/description/index.html | 80 ++++++++++--------- helpdesk_mgmt/tests/common.py | 5 +- helpdesk_mgmt/tests/test_helpdesk_portal.py | 2 +- helpdesk_mgmt/tests/test_helpdesk_ticket.py | 4 +- .../views/helpdesk_dashboard_views.xml | 66 ++++++--------- .../views/helpdesk_ticket_category_views.xml | 2 +- .../views/helpdesk_ticket_channel_views.xml | 2 +- .../views/helpdesk_ticket_stage_views.xml | 7 +- .../views/helpdesk_ticket_tag_views.xml | 4 +- .../views/helpdesk_ticket_team_views.xml | 5 +- helpdesk_mgmt/views/helpdesk_ticket_views.xml | 73 +++++++---------- .../views/res_config_settings_views.xml | 70 ++++++---------- helpdesk_mgmt/views/res_partner_views.xml | 2 +- 20 files changed, 150 insertions(+), 211 deletions(-) diff --git a/helpdesk_mgmt/README.rst b/helpdesk_mgmt/README.rst index f671734d55..7ec359b0bc 100644 --- a/helpdesk_mgmt/README.rst +++ b/helpdesk_mgmt/README.rst @@ -139,7 +139,7 @@ Usage 2. In the Kanban view, click in the kanban card of a team to see their tickets and create new ones. -|image1| +|Tickets_Kanban| To create a new ticket from the kanban view: @@ -154,10 +154,10 @@ To create a new ticket from the kanban view: 8. Add a description. 9. You can also attach files to the ticket. -|image2| +|Tickets01| -.. |image1| image:: https://raw.githubusercontent.com/OCA/helpdesk/17.0/helpdesk_mgmt/static/description/Tickets_Kanban.PNG -.. |image2| image:: https://raw.githubusercontent.com/OCA/helpdesk/17.0/helpdesk_mgmt/static/description/Tickets01.PNG +.. |Tickets_Kanban| image:: https://raw.githubusercontent.com/OCA/helpdesk/17.0/helpdesk_mgmt/static/description/Tickets_Kanban.PNG +.. |Tickets01| image:: https://raw.githubusercontent.com/OCA/helpdesk/17.0/helpdesk_mgmt/static/description/Tickets01.PNG Known issues / Roadmap ====================== diff --git a/helpdesk_mgmt/__manifest__.py b/helpdesk_mgmt/__manifest__.py index 156a332f9d..3054565e7c 100644 --- a/helpdesk_mgmt/__manifest__.py +++ b/helpdesk_mgmt/__manifest__.py @@ -4,7 +4,7 @@ "name": "Helpdesk Management", "summary": """ Helpdesk""", - "version": "16.0.2.6.2", + "version": "17.0.1.0.0", "license": "AGPL-3", "category": "After-Sales", "author": "AdaptiveCity, " diff --git a/helpdesk_mgmt/controllers/myaccount.py b/helpdesk_mgmt/controllers/myaccount.py index 48f559828e..05a1b5ac51 100644 --- a/helpdesk_mgmt/controllers/myaccount.py +++ b/helpdesk_mgmt/controllers/myaccount.py @@ -259,4 +259,4 @@ def _ticket_get_order(self, order, groupby): field_name = groupby_mapping.get(groupby, "") if not field_name: return order - return "%s, %s" % (field_name, order) + return f"{field_name}, {order}" diff --git a/helpdesk_mgmt/data/helpdesk_data.xml b/helpdesk_mgmt/data/helpdesk_data.xml index fc2d671043..b1f20f1dc3 100644 --- a/helpdesk_mgmt/data/helpdesk_data.xml +++ b/helpdesk_mgmt/data/helpdesk_data.xml @@ -320,7 +320,6 @@ help - diff --git a/helpdesk_mgmt/models/helpdesk_ticket.py b/helpdesk_mgmt/models/helpdesk_ticket.py index 57ee374290..33111948b5 100644 --- a/helpdesk_mgmt/models/helpdesk_ticket.py +++ b/helpdesk_mgmt/models/helpdesk_ticket.py @@ -30,11 +30,11 @@ def _read_group_stage_ids(self, stages, domain, order): ("id", "in", stages.ids), ("team_ids", "=", False), ] - default_team_id = self.default_get(["team_id"]).get("team_id") + default_team_id = self.default_get(["team_id"]) if default_team_id: search_domain = [ "|", - ("team_ids", "=", default_team_id), + ("team_ids", "=", default_team_id["team_id"]), ] + search_domain return stages.search(search_domain, order=order) @@ -46,10 +46,7 @@ def _read_group_stage_ids(self, stages, domain, order): string="Assigned user", tracking=True, index=True, - compute="_compute_user_id", - store=True, - readonly=False, - domain="team_id and [('share', '=', False),('id', 'in', user_ids)] or [('share', '=', False)]", # noqa: B950 + domain="team_id and [('share', '=', False),('id', 'in', user_ids)] or [('share', '=', False)]", # noqa: B950,E501 ) user_ids = fields.Many2many( comodel_name="res.users", related="team_id.user_ids", string="Users" @@ -132,11 +129,10 @@ def _read_group_stage_ids(self, stages, domain, order): ) active = fields.Boolean(default=True) - def name_get(self): - res = [] - for rec in self: - res.append((rec.id, rec.number + " - " + rec.name)) - return res + @api.depends("name") + def _compute_display_name(self): + for ticket in self: + ticket.display_name = f"{ticket.number} - {ticket.name}" def assign_to_me(self): self.write({"user_id": self.env.user.id}) @@ -217,7 +213,7 @@ def _track_template(self, tracking): { # Need to set mass_mail so that the email will always be sent "composition_mode": "mass_mail", - "auto_delete_message": True, + "auto_delete_keep_log": False, "subtype_id": self.env["ir.model.data"]._xmlid_to_res_id( "mail.mt_note" ), diff --git a/helpdesk_mgmt/models/ir_http.py b/helpdesk_mgmt/models/ir_http.py index e26bfdbf9f..eefd3ca92c 100644 --- a/helpdesk_mgmt/models/ir_http.py +++ b/helpdesk_mgmt/models/ir_http.py @@ -8,5 +8,5 @@ class IrHttp(models.AbstractModel): @classmethod def _get_translation_frontend_modules_name(cls): - mods = super(IrHttp, cls)._get_translation_frontend_modules_name() + mods = super()._get_translation_frontend_modules_name() return mods + ["helpdesk_mgmt"] diff --git a/helpdesk_mgmt/readme/USAGE.md b/helpdesk_mgmt/readme/USAGE.md index b5c32931a8..2b72f5d7b8 100644 --- a/helpdesk_mgmt/readme/USAGE.md +++ b/helpdesk_mgmt/readme/USAGE.md @@ -3,7 +3,7 @@ 2. In the Kanban view, click in the kanban card of a team to see their tickets and create new ones. -![](../static/description/Tickets_Kanban.PNG) +![Tickets_Kanban](../static/description/Tickets_Kanban.PNG) To create a new ticket from the kanban view: @@ -18,4 +18,4 @@ To create a new ticket from the kanban view: 8. Add a description. 9. You can also attach files to the ticket. -![](../static/description/Tickets01.PNG) +![Tickets01](../static/description/Tickets01.PNG) diff --git a/helpdesk_mgmt/static/description/index.html b/helpdesk_mgmt/static/description/index.html index 768a4243b5..ae40bca217 100644 --- a/helpdesk_mgmt/static/description/index.html +++ b/helpdesk_mgmt/static/description/index.html @@ -369,7 +369,7 @@

Helpdesk Management

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:a5c1fe41ebe60837c24f33363511111603fcee2f9387b84bd2fe69aaaafb5938 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/helpdesk Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/helpdesk Translate me on Weblate Try me on Runboat

This module adds Helpdesk functionality in Odoo.

Table of contents

@@ -407,44 +407,43 @@

Configuration

Channels

    -
  1. Go to Helpdesk > Configuration > Channels to edit or create new channels.
  2. +
  3. Go to Helpdesk > Configuration > Channels to edit or create new +channels.
  4. Edit or create a channel.
  5. Set the name for the channel.
  6. You can also Activate or Deactivate channels.
-
-Channels -
+

image1

Categories

    -
  1. Go to Helpdesk > Configuration > Categories to edit or create new categories.
  2. +
  3. Go to Helpdesk > Configuration > Categories to edit or create new +categories.
  4. Edit or create a new category.
  5. Set the name for the category.
  6. You can also Activate or Deactivate categories.
-
-Categories -
+

image2

Stages

    -
  1. Go to Helpdesk > Configuration > Stages to edit or create new stages.
  2. +
  3. Go to Helpdesk > Configuration > Stages to edit or create new +stages.
  4. Edit or create a new stage.
  5. Set the name for the stage.
  6. Set the sequence order for the stage.
  7. You can select an Email template.
  8. -
  9. Mark the Unattended checkbox if the stage contains unattended tickets.
  10. +
  11. Mark the Unattended checkbox if the stage contains unattended +tickets.
  12. Mark the Closed checkbox if the stage contains closed tickets.
  13. You can add a description for the stage.
  14. You can also Activate or Deactivate stages.
-
-Stages -
-

You can also sort the stage sequence if you move up or down the stages in the list view.

+

image3

+

You can also sort the stage sequence if you move up or down the stages +in the list view.

Teams

@@ -455,29 +454,31 @@

Teams

  • Add the teams members.
  • You can also Activate or Deactivate teams.
  • -
    -Teams -
    +

    image4

    Tags

      -
    1. Go to Helpdesk > Configuration > Ticket Tags to edit or create new tags.
    2. +
    3. Go to Helpdesk > Configuration > Ticket Tags to edit or create new +tags.
    4. Edit or create a new tag.
    5. Set the name for the tag.
    6. Set the color index for the tag.
    7. You can also Activate or Deactivate tags.
    -
    -Ticket Tags -
    +

    image5

    Permissions

    -

    There are restrictions to read tickets according to the user’s permissions set in Helpdesk.

    +

    There are restrictions to read tickets according to the user’s +permissions set in Helpdesk.

      -
    1. User: Personal tickets: User is able to see their tickets (those that are assigned to their user) or those that are no team nor user is assigned.
    2. -
    3. User: Team tickets: User is able to see all the tickets that are assigned to the teams to which he/she belongs or the tickets that are not assigned to any team nor user.
    4. +
    5. User: Personal tickets: User is able to see their tickets (those +that are assigned to their user) or those that are no team nor user +is assigned.
    6. +
    7. User: Team tickets: User is able to see all the tickets that are +assigned to the teams to which he/she belongs or the tickets that are +not assigned to any team nor user.
    8. User: User is able to see all the tickets.
    @@ -485,15 +486,16 @@

    Permissions

    Usage

      -
    1. Go to Helpdesk or Helpdesk > Dashboard to see the tickets dashboard
    2. -
    3. In the Kanban view, click in the kanban card of a team to see their tickets and create new ones.
    4. +
    5. Go to Helpdesk or Helpdesk > Dashboard to see the tickets +dashboard
    6. +
    7. In the Kanban view, click in the kanban card of a team to see their +tickets and create new ones.
    -
    -Kanban view -
    +

    Tickets_Kanban

    To create a new ticket from the kanban view:

      -
    1. Press Create button or click on the plus icon at the top of the column of a stage.
    2. +
    3. Press Create button or click on the plus icon at the top of the +column of a stage.
    4. Set the name or subject for the ticket.
    5. Select the team that will manage the ticket.
    6. You can select a user to assign the ticket.
    7. @@ -503,16 +505,16 @@

      Usage

    8. Add a description.
    9. You can also attach files to the ticket.
    -
    -Create a new ticket -
    +

    Tickets01

    Known issues / Roadmap

      -
    • Add a tour feature similar to what the project module defines to discover projects / tasks.
    • -
    • Update portal tests defined in tests/test_portal.py to rely on tour specs (in JS) -in order to replicate the navigation behavior of portal users.
    • +
    • Add a tour feature similar to what the project module defines to +discover projects / tasks.
    • +
    • Update portal tests defined in tests/test_portal.py to rely on +tour specs (in JS) in order to replicate the navigation behavior of +portal users.
    @@ -520,7 +522,7 @@

    Bug Tracker

    Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -feedback.

    +feedback.

    Do not contact contributors directly about support or help with technical issues.

    @@ -600,7 +602,7 @@

    Maintainers

    OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

    -

    This module is part of the OCA/helpdesk project on GitHub.

    +

    This module is part of the OCA/helpdesk project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    diff --git a/helpdesk_mgmt/tests/common.py b/helpdesk_mgmt/tests/common.py index a41e5f35f4..b483085551 100644 --- a/helpdesk_mgmt/tests/common.py +++ b/helpdesk_mgmt/tests/common.py @@ -52,8 +52,9 @@ def setUpClass(cls): def _create_ticket(self, team, user=False): ticket = self.env["helpdesk.ticket"].create( { - "name": "Ticket %s (%s)" - % (team.name, user.login if user else "unassigned"), + "name": "Ticket {} ({})".format( + team.name, user.login if user else "unassigned" + ), "description": "Description", "team_id": team.id, "user_id": user.id if user else False, diff --git a/helpdesk_mgmt/tests/test_helpdesk_portal.py b/helpdesk_mgmt/tests/test_helpdesk_portal.py index a6a12a0635..38cf9487e7 100644 --- a/helpdesk_mgmt/tests/test_helpdesk_portal.py +++ b/helpdesk_mgmt/tests/test_helpdesk_portal.py @@ -54,7 +54,7 @@ def _create_ticket(self, partner, ticket_title, **values): def _submit_ticket(self, **values): data = { - "category": self.env.ref("helpdesk_mgmt.helpdesk_category_1").id, + "category": self.env.ref("helpdesk_mgmt.helpdesk_category_1_demo").id, "csrf_token": http.Request.csrf_token(self), "subject": self.new_ticket_title, "description": "\n".join(self.new_ticket_desc_lines), diff --git a/helpdesk_mgmt/tests/test_helpdesk_ticket.py b/helpdesk_mgmt/tests/test_helpdesk_ticket.py index 69aaf9c340..80ddc258be 100644 --- a/helpdesk_mgmt/tests/test_helpdesk_ticket.py +++ b/helpdesk_mgmt/tests/test_helpdesk_ticket.py @@ -135,7 +135,7 @@ def test_helpdesk_ticket_message_new(self): try: t = Ticket.message_new(msg_dict) except Exception as error: - self.fail("%s: %s" % (type(error), error)) + self.fail(f"{type(error)}: {error}") self.assertEqual(t.name, title, "The ticket should have the correct title.") title = "New title" @@ -143,7 +143,7 @@ def test_helpdesk_ticket_message_new(self): try: t.message_update(msg_dict, update_vals) except Exception as error: - self.fail("%s: %s" % (type(error), error)) + self.fail(f"{type(error)}: {error}") self.assertEqual( t.name, title, "The ticket should have the correct (new) title." ) diff --git a/helpdesk_mgmt/views/helpdesk_dashboard_views.xml b/helpdesk_mgmt/views/helpdesk_dashboard_views.xml index b8325fb702..03561e5354 100644 --- a/helpdesk_mgmt/views/helpdesk_dashboard_views.xml +++ b/helpdesk_mgmt/views/helpdesk_dashboard_views.xml @@ -12,6 +12,28 @@ + +
    + +
    @@ -25,15 +47,6 @@
    -
    - - - -
    To Do - +
    @@ -100,39 +113,6 @@
    -
    diff --git a/helpdesk_mgmt/views/helpdesk_ticket_category_views.xml b/helpdesk_mgmt/views/helpdesk_ticket_category_views.xml index c9195f9d66..6c5af531a6 100644 --- a/helpdesk_mgmt/views/helpdesk_ticket_category_views.xml +++ b/helpdesk_mgmt/views/helpdesk_ticket_category_views.xml @@ -36,7 +36,7 @@ name="web_ribbon" title="Archived" bg_color="bg-danger" - attrs="{'invisible': [('active', '=', True)]}" + invisible="active" />
    diff --git a/helpdesk_mgmt/views/helpdesk_ticket_channel_views.xml b/helpdesk_mgmt/views/helpdesk_ticket_channel_views.xml index 48c1092662..368f4bbe82 100644 --- a/helpdesk_mgmt/views/helpdesk_ticket_channel_views.xml +++ b/helpdesk_mgmt/views/helpdesk_ticket_channel_views.xml @@ -36,7 +36,7 @@ name="web_ribbon" title="Archived" bg_color="bg-danger" - attrs="{'invisible': [('active', '=', True)]}" + invisible="active" />