[MIG] maintenance_create_requests_from_project_task: Migration to 18.0
This commit is contained in:
92
maintenance_create_requests_from_project_task/README.md
Normal file
92
maintenance_create_requests_from_project_task/README.md
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
============================================
|
||||||
|
maintenance_create_requests_from_project_task
|
||||||
|
============================================
|
||||||
|
|
||||||
|
This module allows the bulk creation of maintenance requests directly from a
|
||||||
|
project task. It is particularly useful when a task requires maintenance
|
||||||
|
actions on multiple equipment items simultaneously.
|
||||||
|
|
||||||
|
Key features:
|
||||||
|
|
||||||
|
- **Bulk creation**: Create multiple maintenance requests at once from a task
|
||||||
|
- **Equipment filtering**: Use domain filters to select target equipment
|
||||||
|
- **Smart defaults**: Pre-fills equipment from the task's project
|
||||||
|
- **Request tracking**: View all maintenance requests linked to a task
|
||||||
|
|
||||||
|
# Installation
|
||||||
|
|
||||||
|
Use Odoo normal module installation procedure to install
|
||||||
|
`maintenance_create_requests_from_project_task`.
|
||||||
|
|
||||||
|
This module depends on:
|
||||||
|
- `maintenance`
|
||||||
|
- `maintenance_project`
|
||||||
|
- `project`
|
||||||
|
|
||||||
|
# Configuration
|
||||||
|
|
||||||
|
No specific configuration is required.
|
||||||
|
|
||||||
|
# Usage
|
||||||
|
|
||||||
|
## Creating Maintenance Requests from a Task
|
||||||
|
|
||||||
|
1. Go to Project > Tasks
|
||||||
|
2. Open a task
|
||||||
|
3. In the action menu (or via the server action), click "Create maintenance requests"
|
||||||
|
4. A wizard opens with:
|
||||||
|
- **Task**: The source task (read-only)
|
||||||
|
- **Title**: The name for all created maintenance requests
|
||||||
|
- **Equipment Domain**: Filter to select which equipment to target
|
||||||
|
- By default, shows equipment linked to the task's project
|
||||||
|
- Use the domain builder to refine the selection
|
||||||
|
- **Technician**: Assign a technician to all requests
|
||||||
|
- **Maintenance Type**: Corrective or Preventive
|
||||||
|
- **Priority**: From Very Low to High
|
||||||
|
- **Duration**: Estimated duration in hours
|
||||||
|
- **Scheduled Date**: When the maintenance should occur
|
||||||
|
- **Description**: Details about the maintenance work
|
||||||
|
5. Click "Create"
|
||||||
|
6. All matching equipment will have a maintenance request created
|
||||||
|
7. You are redirected to the list of created requests
|
||||||
|
|
||||||
|
## Viewing Linked Maintenance Requests
|
||||||
|
|
||||||
|
On the task form:
|
||||||
|
- A smart button shows the count of open (not done) maintenance requests
|
||||||
|
- Click it to view all maintenance requests linked to this task
|
||||||
|
|
||||||
|
## Equipment Domain Examples
|
||||||
|
|
||||||
|
- All equipment in the project: `[('project_id', '=', project_id)]`
|
||||||
|
- Only servers: `[('category_id.name', '=', 'Server')]`
|
||||||
|
- Equipment needing backup: `[('backup_activated', '=', True)]`
|
||||||
|
- Combine conditions: `[('project_id', '=', project_id), ('category_id.name', '=', 'Server')]`
|
||||||
|
|
||||||
|
# Known issues / Roadmap
|
||||||
|
|
||||||
|
- Add template support for common maintenance scenarios
|
||||||
|
- Add option to create a single request for multiple equipment
|
||||||
|
|
||||||
|
# Bug Tracker
|
||||||
|
|
||||||
|
Bugs are tracked on
|
||||||
|
[our issues website](https://git.elabore.coop/Elabore/maintenance-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
|
||||||
|
|
||||||
|
## Funders
|
||||||
|
|
||||||
|
The development of this module has been financially supported by:
|
||||||
|
|
||||||
|
- Elabore (https://elabore.coop)
|
||||||
|
|
||||||
|
## Maintainer
|
||||||
|
|
||||||
|
This module is maintained by Elabore.
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
=============================================
|
|
||||||
maintenance_create_requests_from_project_task
|
|
||||||
=============================================
|
|
||||||
|
|
||||||
Allow the creation of multiple maintenance requests from a projet task.
|
|
||||||
|
|
||||||
When user click on the button "Create maintenance requests", a wizard appears.
|
|
||||||
The wizard allows the user to configure the requests and to select the maintenance equipments concerned.
|
|
||||||
At wizard validation, one or several maintenance requests are created, one for each equipement selected.
|
|
||||||
|
|
||||||
Installation
|
|
||||||
============
|
|
||||||
|
|
||||||
Use Odoo normal module installation procedure to install
|
|
||||||
``maintenance_create_requests_from_project_task``.
|
|
||||||
|
|
||||||
Known issues / Roadmap
|
|
||||||
======================
|
|
||||||
|
|
||||||
None yet.
|
|
||||||
|
|
||||||
Bug Tracker
|
|
||||||
===========
|
|
||||||
|
|
||||||
Bugs are tracked on `our issues website <https://github.com/elabore-coop/maintenance-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
|
|
||||||
|
|
||||||
Funders
|
|
||||||
-------
|
|
||||||
|
|
||||||
The development of this module has been financially supported by:
|
|
||||||
* Elabore (https://elabore.coop)
|
|
||||||
|
|
||||||
|
|
||||||
Maintainer
|
|
||||||
----------
|
|
||||||
|
|
||||||
This module is maintained by Elabore.
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
"name": "maintenance_create_requests_from_project_task",
|
"name": "maintenance_create_requests_from_project_task",
|
||||||
"version": "16.0.1.0.0",
|
"version": "18.0.1.0.0",
|
||||||
"author": "Elabore",
|
"author": "Elabore",
|
||||||
"website": "https://elabore.coop",
|
"website": "https://elabore.coop",
|
||||||
"maintainer": "Stéphan Sainléger",
|
"maintainer": "Stéphan Sainléger",
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<button
|
<button
|
||||||
name="action_view_maintenance_request_ids"
|
name="action_view_maintenance_request_ids"
|
||||||
type="object"
|
type="object"
|
||||||
attrs="{'invisible': [('maintenance_request_count', '=', 0)]}"
|
invisible="maintenance_request_count == 0"
|
||||||
class="oe_stat_button"
|
class="oe_stat_button"
|
||||||
icon="fa-tasks"
|
icon="fa-tasks"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
from odoo import _, api, fields, models
|
from odoo import _, api, fields, models
|
||||||
|
from odoo.exceptions import UserError
|
||||||
from odoo.tools.safe_eval import safe_eval
|
from odoo.tools.safe_eval import safe_eval
|
||||||
|
|
||||||
|
|
||||||
@@ -77,7 +78,10 @@ class CreateMaintenanceRequestsWizard(models.TransientModel):
|
|||||||
)
|
)
|
||||||
if len(equipment_list) == 0:
|
if len(equipment_list) == 0:
|
||||||
raise UserError(
|
raise UserError(
|
||||||
"No equipment is matching the domain. Maintenance request creation is not possible."
|
_(
|
||||||
|
"No equipment is matching the domain. "
|
||||||
|
"Maintenance request creation is not possible."
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
vals_list = []
|
vals_list = []
|
||||||
@@ -104,7 +108,7 @@ class CreateMaintenanceRequestsWizard(models.TransientModel):
|
|||||||
|
|
||||||
def _get_action(self, maintenance_requests):
|
def _get_action(self, maintenance_requests):
|
||||||
"""
|
"""
|
||||||
Provide the action to go to the tree view of the maintenance requests created.
|
Provide the action to go to the list view of the maintenance requests created.
|
||||||
"""
|
"""
|
||||||
search_view_ref = self.env.ref(
|
search_view_ref = self.env.ref(
|
||||||
"maintenance.hr_equipment_request_view_search", False
|
"maintenance.hr_equipment_request_view_search", False
|
||||||
@@ -112,7 +116,7 @@ class CreateMaintenanceRequestsWizard(models.TransientModel):
|
|||||||
form_view_ref = self.env.ref(
|
form_view_ref = self.env.ref(
|
||||||
"maintenance.hr_equipment_request_view_form", False
|
"maintenance.hr_equipment_request_view_form", False
|
||||||
)
|
)
|
||||||
tree_view_ref = self.env.ref(
|
list_view_ref = self.env.ref(
|
||||||
"maintenance.hr_equipment_request_view_tree", False
|
"maintenance.hr_equipment_request_view_tree", False
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -121,6 +125,6 @@ class CreateMaintenanceRequestsWizard(models.TransientModel):
|
|||||||
"name": "Maintenance Requests",
|
"name": "Maintenance Requests",
|
||||||
"res_model": "maintenance.request",
|
"res_model": "maintenance.request",
|
||||||
"type": "ir.actions.act_window",
|
"type": "ir.actions.act_window",
|
||||||
"views": [(tree_view_ref.id, "tree"), (form_view_ref.id, "form")],
|
"views": [(list_view_ref.id, "list"), (form_view_ref.id, "form")],
|
||||||
"search_view_id": search_view_ref and [search_view_ref.id],
|
"search_view_id": search_view_ref and [search_view_ref.id],
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user