-
-
Notifications
You must be signed in to change notification settings - Fork 485
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[14.0][ADD] repair_component_operation
- Loading branch information
1 parent
cb82264
commit d7cf43a
Showing
24 changed files
with
1,490 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,87 @@ | ||
============================ | ||
Repair Components Operations | ||
============================ | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:429b077d581da45bd62df369a218c430a3c6373dfeeab5278b206e3bfaf06be8 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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-LGPL--3-blue.png | ||
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html | ||
:alt: License: LGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github | ||
:target: https://github.com/OCA/manufacture/tree/14.0/repair_component_operation | ||
:alt: OCA/manufacture | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/manufacture-14-0/manufacture-14-0-repair_component_operation | ||
: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/manufacture&target_branch=14.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module allows to operate the added components from a Repair Order, being able to move it to another location or making an scrap | ||
and take another from a desired location and link it to the current Repair Order. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Usage | ||
===== | ||
|
||
Go to Repair -> Configuration -> Settings -> Component Operations. | ||
Create a new Operation, select the desired outgoing operation and the desired incoming operation. | ||
Then fill the Locations and Routes (check in the routes that are selectable for repair operations in the route page). | ||
Once saved, go to the Repair Order and click on the button "Operate Component". | ||
Select the desired product (lot if needed) and the operation wanted. | ||
When Confirmed, in the Repair Order will be linked the pickings/scraps done. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/manufacture/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/manufacture/issues/new?body=module:%20repair_component_operation%0Aversion:%2014.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 | ||
~~~~~~~~~~~~ | ||
|
||
* David Jiménez <david.jimenez@forgeflow.com> | ||
|
||
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/manufacture <https://github.com/OCA/manufacture/tree/14.0/repair_component_operation>`_ 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,4 @@ | ||
# Copyright 2024 ForgeFlow S.L. (https://www.forgeflow.com) | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). | ||
from . import models | ||
from . import wizards |
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,21 @@ | ||
# Copyright 2024 ForgeFlow S.L. (https://www.forgeflow.com) | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). | ||
|
||
{ | ||
"name": "Repair Components Operations", | ||
"version": "14.0.1.0.0", | ||
"author": "ForgeFlow, Odoo Community Association (OCA)", | ||
"summary": "Allows to operate the components from a Repair", | ||
"website": "https://github.com/OCA/manufacture", | ||
"category": "Manufacturing", | ||
"depends": ["repair_stock", "stock_move_forced_lot"], | ||
"data": [ | ||
"security/ir.model.access.csv", | ||
"views/repair_component_operation_views.xml", | ||
"views/repair_order_views.xml", | ||
"views/stock_view.xml", | ||
"wizards/repair_component_operate_wizard.xml", | ||
], | ||
"license": "LGPL-3", | ||
"installable": True, | ||
} |
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 @@ | ||
from . import repair_component_operation | ||
from . import repair_order | ||
from . import stock_location_route | ||
from . import stock_scrap |
73 changes: 73 additions & 0 deletions
73
repair_component_operation/models/repair_component_operation.py
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,73 @@ | ||
# Copyright 2024 ForgeFlow S.L. (https://www.forgeflow.com) | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). | ||
from odoo import fields, models | ||
|
||
|
||
class RepairComponentOperation(models.Model): | ||
_name = "repair.component.operation" | ||
_description = "Repair Component Operation" | ||
_order = "sequence,id" | ||
|
||
name = fields.Char(help="Component Operation Reference", required=True) | ||
|
||
source_location_id = fields.Many2one( | ||
"stock.location", | ||
"Source Location", | ||
help="The Location where the components are.", | ||
) | ||
|
||
source_route_id = fields.Many2one( | ||
comodel_name="stock.location.route", | ||
string="Source Route", | ||
help="The Route used to pick the components.", | ||
domain=[("repair_component_selectable", "=", True)], | ||
) | ||
|
||
destination_location_id = fields.Many2one( | ||
"stock.location", | ||
"Destination Location", | ||
help="The Location where the components are going to be transferred.", | ||
) | ||
|
||
destination_route_id = fields.Many2one( | ||
comodel_name="stock.location.route", | ||
string="Destination Route", | ||
help="The Route used to transfer the components to the destination location.", | ||
domain=[("repair_component_selectable", "=", True)], | ||
) | ||
|
||
scrap_location_id = fields.Many2one( | ||
"stock.location", | ||
"Scrap Location", | ||
) | ||
|
||
incoming_operation = fields.Selection( | ||
selection=[ | ||
("no", "No"), | ||
("replace", "Pick Component from Source Route"), | ||
], | ||
default="no", | ||
required=True, | ||
) | ||
|
||
outgoing_operation = fields.Selection( | ||
selection=[ | ||
("no", "No"), | ||
("move", "Move to Destination Location"), | ||
("scrap", "Make a Scrap"), | ||
], | ||
default="no", | ||
required=True, | ||
) | ||
|
||
picking_type_id = fields.Many2one( | ||
"stock.picking.type", | ||
"Operation Type", | ||
# domain="[('code', '=', 'mrp_operation')]", | ||
) | ||
|
||
sequence = fields.Integer( | ||
string="Sequence", | ||
help="Gives the sequence order when displaying the list of component operations", | ||
) | ||
active = fields.Boolean(default=True) |
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,43 @@ | ||
# Copyright 2024 ForgeFlow S.L. (https://www.forgeflow.com) | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). | ||
from odoo import _, api, fields, models | ||
|
||
|
||
class RepairOrder(models.Model): | ||
_inherit = "repair.order" | ||
|
||
scrap_ids = fields.One2many("stock.scrap", "repair_id") | ||
scrap_count = fields.Integer(compute="_compute_scrap_count") | ||
|
||
@api.depends("scrap_ids") | ||
def _compute_scrap_count(self): | ||
for rec in self: | ||
rec.scrap_count = len(rec.scrap_ids) | ||
|
||
def button_open_scrap(self): | ||
self.ensure_one() | ||
action = self.env["ir.actions.actions"]._for_xml_id("stock.action_stock_scrap") | ||
action["domain"] = [("repair_id", "=", self.id)] | ||
action["context"] = dict(self._context, default_origin=self.name) | ||
return action | ||
|
||
def button_operate_components(self): | ||
return { | ||
"name": _("Operate Component"), | ||
"view_mode": "form", | ||
"res_model": "repair.component.operate", | ||
"view_id": self.env.ref( | ||
"repair_component_operation.view_repair_component_operate_form" | ||
).id, | ||
"type": "ir.actions.act_window", | ||
"context": { | ||
"default_repair_id": self.id, | ||
"product_ids": self.operations.filtered( | ||
lambda rl: rl.type == "add" | ||
).move_id.move_line_ids.product_id.mapped("id"), | ||
"lot_ids": self.operations.filtered( | ||
lambda rl: rl.type == "add" | ||
).move_id.move_line_ids.lot_id.mapped("id"), | ||
}, | ||
"target": "new", | ||
} |
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,11 @@ | ||
# Copyright 2024 ForgeFlow S.L. (https://www.forgeflow.com) | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). | ||
from odoo import fields, models | ||
|
||
|
||
class StockLocationRoute(models.Model): | ||
_inherit = "stock.location.route" | ||
|
||
repair_component_selectable = fields.Boolean( | ||
string="Selectable on Repair Components" | ||
) |
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,9 @@ | ||
# Copyright 2024 ForgeFlow S.L. (https://www.forgeflow.com) | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). | ||
from odoo import fields, models | ||
|
||
|
||
class StockScrap(models.Model): | ||
_inherit = "stock.scrap" | ||
|
||
repair_id = fields.Many2one("repair.order", readonly=1) |
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 @@ | ||
* David Jiménez <david.jimenez@forgeflow.com> |
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 @@ | ||
This module allows to operate the added components from a Repair Order, being able to move it to another location or making an scrap | ||
and take another from a desired location and link it to the current 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,6 @@ | ||
Go to Repair -> Configuration -> Settings -> Component Operations. | ||
Create a new Operation, select the desired outgoing operation and the desired incoming operation. | ||
Then fill the Locations and Routes (check in the routes that are selectable for repair operations in the route page). | ||
Once saved, go to the Repair Order and click on the button "Operate Component". | ||
Select the desired product (lot if needed) and the operation wanted. | ||
When Confirmed, in the Repair Order will be linked the pickings/scraps done. |
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,5 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
access_repair_component_operation_user,repair.component.operation.user,model_repair_component_operation,stock.group_stock_user,1,0,0,0 | ||
access_repair_component_operation_manager,repair.component.operation.manager,model_repair_component_operation,stock.group_stock_manager,1,1,1,1 | ||
access_repair_component_operate_user,repair.component.operate.user,model_repair_component_operate,stock.group_stock_user,1,1,1,0 | ||
access_repair_component_operate_manager,repair.component.operate.manager,model_repair_component_operate,stock.group_stock_manager,1,1,1,1 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.