-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2e4601f
commit 43c127e
Showing
16 changed files
with
811 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
============== | ||
Repair Service | ||
============== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:ac26551a9ce89d1e4c4a02728cea444025c7f7ebc7ed6fa7553f91d625a9840a | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Beta | ||
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Frepair-lightgray.png?logo=github | ||
:target: https://github.com/OCA/repair/tree/17.0/repair_service | ||
:alt: OCA/repair | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/repair-17-0/repair-17-0-repair_service | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
:target: https://runboat.odoo-community.org/builds?repo=OCA/repair&target_branch=17.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module introduces repair services. It adds a new "Services" tab in | ||
the repair orders, where users can add and manage services associated | ||
with the repair. Once the repair order is confirmed and a sale order is | ||
created, these services can be automatically added as sale order lines. | ||
Moreover, if the repair order has the "Under Warranty" field checked, | ||
the module ensures that the corresponding sale order lines price are set | ||
to a value of 0, reflecting the warranty coverage. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Use Cases / Context | ||
=================== | ||
|
||
This functionality is similar to the "Operations" tab that existed in | ||
previous versions in core Odoo. This tab allowed users to manage | ||
services and operations in the repair orders. This module reintroduces | ||
that functionality and adds these services as sale order lines when the | ||
sale order is generated. | ||
|
||
Usage | ||
===== | ||
|
||
When creating or editing a repair order, you will find a new "Services" | ||
tab within the repair order form. In this tab, you can input and manage | ||
the services performed as part of the repair order. Once the repair | ||
order is confirmed, when you creating a sale order from the repair | ||
order, the services listed in the "Services" tab will be automatically | ||
added as sale order lines. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/repair/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 <https://github.com/OCA/repair/issues/new?body=module:%20repair_service%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
------- | ||
|
||
* ForgeFlow | ||
|
||
Contributors | ||
------------ | ||
|
||
- `ForgeFlow <https://forgeflow.com>`__: | ||
|
||
- Andreu Orensanz <[email protected]> | ||
|
||
Maintainers | ||
----------- | ||
|
||
This module is maintained by the OCA. | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
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/repair <https://github.com/OCA/repair/tree/17.0/repair_service>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright 2024 ForgeFlow S.L. (https://www.forgeflow.com) | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
|
||
{ | ||
"name": "Repair Service", | ||
"summary": """ | ||
Adds services to repair orders, so that they can be added | ||
as sale order lines. | ||
""", | ||
"version": "17.0.1.0.0", | ||
"category": "Repair", | ||
"website": "https://github.com/OCA/repair", | ||
"author": "ForgeFlow, Odoo Community Association (OCA)", | ||
"license": "AGPL-3", | ||
"depends": ["repair"], | ||
"data": ["security/ir.model.access.csv", "views/repair_views.xml"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from . import repair_service | ||
from . import repair_order |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright 2024 ForgeFlow S.L. (https://www.forgeflow.com) | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class RepairOrder(models.Model): | ||
_inherit = "repair.order" | ||
|
||
repair_service_ids = fields.One2many( | ||
"repair.service", "repair_id", "Services", copy=True | ||
) | ||
|
||
def action_create_sale_order(self): | ||
action = super().action_create_sale_order() | ||
self.repair_service_ids._create_repair_sale_order_line() | ||
return action |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Copyright 2024 ForgeFlow S.L. (https://www.forgeflow.com) | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class RepairService(models.Model): | ||
_name = "repair.service" | ||
|
||
repair_id = fields.Many2one( | ||
"repair.order", "Repair Order Reference", ondelete="cascade", required=True | ||
) | ||
display_name = fields.Text( | ||
"Description", | ||
required=True, | ||
compute="_compute_name", | ||
store=True, | ||
precompute=True, | ||
) | ||
product_id = fields.Many2one( | ||
"product.product", "Product", domain=[("type", "=", "service")], required=True | ||
) | ||
product_uom_category_id = fields.Many2one(related="product_id.uom_id.category_id") | ||
product_uom = fields.Many2one( | ||
"uom.uom", | ||
required=True, | ||
domain="[('category_id', '=', product_uom_category_id)]", | ||
readonly=False, | ||
precompute=True, | ||
compute="_compute_product_uom", | ||
store=True, | ||
) | ||
product_uom_qty = fields.Float( | ||
"Quantity", digits="Product Unit of Measure", required=True, default=1.0 | ||
) | ||
|
||
@api.depends("product_id") | ||
def _compute_name(self): | ||
for service in self: | ||
service.display_name = service.product_id.name | ||
|
||
@api.depends("product_id") | ||
def _compute_product_uom(self): | ||
for service in self: | ||
service.product_uom = service.product_id.uom_id | ||
|
||
def _create_repair_sale_order_line(self): | ||
if not self: | ||
return | ||
so_line_vals = [] | ||
for service in self: | ||
if not service.repair_id.sale_order_id: | ||
continue | ||
product_qty = ( | ||
service.product_uom_qty | ||
if service.repair_id.state != "done" | ||
else service.product_uom_qty | ||
) | ||
so_line_vals.append( | ||
{ | ||
"order_id": service.repair_id.sale_order_id.id, | ||
"product_id": service.product_id.id, | ||
"product_uom_qty": product_qty, | ||
} | ||
) | ||
if service.repair_id.under_warranty: | ||
so_line_vals[-1]["price_unit"] = 0.0 | ||
elif service.product_id.lst_price: | ||
so_line_vals[-1]["price_unit"] = service.product_id.lst_price | ||
self.env["sale.order.line"].create(so_line_vals) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[build-system] | ||
requires = ["whool"] | ||
build-backend = "whool.buildapi" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This functionality is similar to the "Operations" tab that existed in previous versions in core Odoo. This tab allowed users to manage services and operations in the repair orders. This module reintroduces that functionality and adds these services as sale order lines when the sale order is generated. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
- [ForgeFlow](https://forgeflow.com): | ||
|
||
> - Andreu Orensanz \<<[email protected]>\> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This module introduces repair services. It adds a new "Services" tab in the repair orders, where users can add and manage services associated with the repair. Once the repair order is confirmed and a sale order is created, these services can be automatically added as sale order lines. Moreover, if the repair order has the "Under Warranty" field checked, the module ensures that the corresponding sale order lines price are set to a value of 0, reflecting the warranty coverage. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
When creating or editing a repair order, you will find a new "Services" tab within the repair order form. In this tab, you can input and manage the services performed as part of the repair order. Once the repair order is confirmed, when you creating a sale order from the repair order, the services listed in the "Services" tab will be automatically added as sale order lines. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
access_repair_service_user,repair.service user,model_repair_service,stock.group_stock_user,1,1,1,1 |
Oops, something went wrong.