[IMP] helpdesk_user_default_ticket_team: document behaviour and convert README to markdown

- Add docstrings to ``_compute_user_id``, ``create`` and
  ``_define_user_id`` and clarify the inline comments describing the
  team-leader fallback rules.
- Convert ``README.rst`` to ``README.md``, documenting usage, the
  graceful handling of partners without a linked user, and how to run
  the test suite.
This commit is contained in:
Stéphan Sainléger
2026-06-25 15:39:54 +02:00
parent b58fb77f3a
commit 923a4f16c4
3 changed files with 133 additions and 75 deletions

View File

@@ -0,0 +1,92 @@
# helpdesk_user_default_ticket_team
Automate ticket team attribution when a ticket is created by a portal user.
This module extends the `helpdesk_mgmt` module by allowing to configure a
default helpdesk team per user. It provides:
- A new `default_helpdesk_ticket_team_id` field on the user form, located in
the Preferences tab.
- Automatic team assignment when a ticket is created:
- If the ticket has no team assigned and has a linked partner.
- The module looks up the user associated with the partner. A partner with
no linked user (e.g. a plain contact) is handled gracefully and left
untouched.
- If the user has a default helpdesk team configured, it is automatically
assigned to the ticket.
- If the assigned team has a default project, the ticket is also linked to
that project.
- Automatic user assignment when a team is selected:
- When a team is set or changed on a ticket, if the current assigned user
is not a member of that team, the team leader (`team_id.user_id`) is
automatically assigned instead.
- If the team has no leader configured, the assigned user is left unchanged
(to avoid creating unassigned tickets).
This is particularly useful for multi-company or multi-team environments where
portal users should always have their tickets routed to a specific team.
# Installation
Use Odoo normal module installation procedure to install
`helpdesk_user_default_ticket_team`.
This module depends on:
- `helpdesk_mgmt`: provides the base helpdesk ticket functionality.
- `helpdesk_mgmt_project`: provides the link between tickets and projects.
# Usage
1. Open a user form (Settings > Users & Companies > Users).
2. In the **Preferences** tab, set the **Default Helpdesk Team** field.
3. When that user (through its linked partner) creates a ticket without an
explicit team, the ticket is automatically routed to the configured team,
its default project, and the team leader.
# Testing
Automated tests live in `tests/test_helpdesk_ticket.py` and cover:
- The `_define_user_id` decision logic (no team, no current user, user not in
team, user in team, team without leader).
- The `create` auto-assignment (with/without partner, with/without default
team, explicit team not overridden, partner without linked user, batch
creation).
- The `_compute_user_id` recomputation when the team changes.
- The full portal creation flow (team + project + user) and the presence of
the `default_helpdesk_ticket_team_id` field on `res.users`.
Run them with:
```
odoo-bin -d <db> --test-enable --stop-after-init \
-i helpdesk_user_default_ticket_team
```
# Known issues / Roadmap
None yet.
# Bug Tracker
Bugs are tracked on [our issues website](https://git.elabore.coop/Elabore/helpdesk-tools/issues).
In case of trouble, please check there if your issue has already been
reported. If you spotted it first, help us smashing it by providing a
detailed and welcomed feedback.
# Credits
## Contributors
- Stéphan Sainléger - [Email](mailto:stephan.sainleger@elabore.coop)
## Funders
The development of this module has been financially supported by:
- Elabore (https://elabore.coop)
## Maintainer
This module is maintained by Elabore.