This module extends the repair management functionality in Odoo, providing additional
options for handling the repair process in a more customizable and efficient way.
It allows the configuration of repair steps based on specific business requirements
diff --git a/repair_picking_after_done/__manifest__.py b/repair_picking_after_done/__manifest__.py
index 47ee87e91..187a9e474 100644
--- a/repair_picking_after_done/__manifest__.py
+++ b/repair_picking_after_done/__manifest__.py
@@ -3,12 +3,12 @@
{
"name": "Repair picking after done",
- "version": "14.0.1.0.1",
+ "version": "14.0.1.0.2",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/manufacture",
"summary": "Transfer repaired move to another location directly from repaire order",
"category": "Repair",
- "depends": ["repair_type"],
+ "depends": ["repair_type", "repair_stock"],
"data": [
"security/ir.model.access.csv",
"views/repair.xml",
diff --git a/repair_picking_after_done/migration/14.0.1.0.2/pre-migration.py b/repair_picking_after_done/migration/14.0.1.0.2/pre-migration.py
new file mode 100644
index 000000000..fc21d2634
--- /dev/null
+++ b/repair_picking_after_done/migration/14.0.1.0.2/pre-migration.py
@@ -0,0 +1,8 @@
+# Copyright 2024 ForgeFlow, S.L.
+# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
+
+
+def migrate(env, version):
+ repairs = env["repair.order"].search([])
+ for repair in repairs:
+ repair.picking_ids.move_ids.write({"repair_id": repair.id})
diff --git a/repair_picking_after_done/models/repair.py b/repair_picking_after_done/models/repair.py
index 27e054956..892d09bb4 100644
--- a/repair_picking_after_done/models/repair.py
+++ b/repair_picking_after_done/models/repair.py
@@ -1,13 +1,12 @@
# Copyright (C) 2022 ForgeFlow S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
-from odoo import _, fields, models
+from odoo import fields, models
class Repair(models.Model):
_inherit = "repair.order"
- picking_ids = fields.Many2many("stock.picking", string="Transfers")
remaining_quantity = fields.Float(
"Remaining quantity to be transferred", compute="_compute_remaining_quantity"
)
@@ -38,17 +37,3 @@ class Repair(models.Model):
},
"target": "new",
}
-
- def action_open_transfers(self):
- self.ensure_one()
- domain = [("id", "in", self.picking_ids.ids)]
- action = {
- "name": _("Transfers"),
- "view_type": "tree",
- "view_mode": "list,form",
- "res_model": "stock.picking",
- "type": "ir.actions.act_window",
- "context": self.env.context,
- "domain": domain,
- }
- return action
diff --git a/repair_picking_after_done/static/description/index.html b/repair_picking_after_done/static/description/index.html
index 472e33034..ff399e1c3 100644
--- a/repair_picking_after_done/static/description/index.html
+++ b/repair_picking_after_done/static/description/index.html
@@ -1,4 +1,3 @@
-
diff --git a/repair_picking_after_done/views/repair.xml b/repair_picking_after_done/views/repair.xml
index 7b3fcf412..8ed2c13b5 100644
--- a/repair_picking_after_done/views/repair.xml
+++ b/repair_picking_after_done/views/repair.xml
@@ -6,6 +6,7 @@
+
-
-
-
-
-
diff --git a/repair_picking_after_done/wizards/repair_move_transfer.py b/repair_picking_after_done/wizards/repair_move_transfer.py
index 2a1cd7a93..6ac038a52 100644
--- a/repair_picking_after_done/wizards/repair_move_transfer.py
+++ b/repair_picking_after_done/wizards/repair_move_transfer.py
@@ -46,6 +46,7 @@ class MrpInventoryProcure(models.TransientModel):
"picking_type_id": self._get_picking_type().id,
"product_uom_qty": self.quantity,
"product_uom": self.repair_order_id.move_id.product_uom.id,
+ "repair_id": self.repair_order_id.id,
}
def action_create_transfer(self):
@@ -69,4 +70,4 @@ class MrpInventoryProcure(models.TransientModel):
stock_move.move_line_ids[0]._assign_production_lot(
self.repair_order_id.lot_id
)
- self.repair_order_id.write({"picking_ids": [(4, picking.id)]})
+ self.repair_order_id._compute_picking_ids()
diff --git a/repair_stock/README.rst b/repair_stock/README.rst
new file mode 100644
index 000000000..f35986067
--- /dev/null
+++ b/repair_stock/README.rst
@@ -0,0 +1,78 @@
+============
+Repair Stock
+============
+
+..
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ !! This file is generated by oca-gen-addon-readme !!
+ !! changes will be overwritten. !!
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ !! source digest: sha256:576ed4d5c0c1e57002a5f0fbd364f753297c27ebe3e35595ae64c9cd000b216d
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+.. |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%2Fmanufacture-lightgray.png?logo=github
+ :target: https://github.com/OCA/manufacture/tree/14.0/repair_stock
+ :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_stock
+ :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 acts as a base for the stock related modules for repairs.
+It adds some common features that may be overriding between them,
+as the compute for the pickings or the smart button for the transfers.
+
+**Table of contents**
+
+.. contents::
+ :local:
+
+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 `_.
+
+Do not contact contributors directly about support or help with technical issues.
+
+Credits
+=======
+
+Authors
+~~~~~~~
+
+* ForgeFlow
+
+Contributors
+~~~~~~~~~~~~
+
+* David Jimenez
+
+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 `_ project on GitHub.
+
+You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/repair_stock/__init__.py b/repair_stock/__init__.py
new file mode 100644
index 000000000..0ee8b5073
--- /dev/null
+++ b/repair_stock/__init__.py
@@ -0,0 +1,2 @@
+from . import models
+from . import tests
diff --git a/repair_stock/__manifest__.py b/repair_stock/__manifest__.py
new file mode 100644
index 000000000..c029bc2f8
--- /dev/null
+++ b/repair_stock/__manifest__.py
@@ -0,0 +1,15 @@
+# Copyright 2024 ForgeFlow S.L. (https://www.forgeflow.com)
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
+
+{
+ "name": "Repair Stock",
+ "version": "14.0.1.0.0",
+ "author": "ForgeFlow, Odoo Community Association (OCA)",
+ "category": "Repair",
+ "website": "https://github.com/OCA/manufacture",
+ "depends": ["repair_stock_move"],
+ "data": [
+ "views/repair_order_view.xml",
+ ],
+ "license": "AGPL-3",
+}
diff --git a/repair_stock/models/__init__.py b/repair_stock/models/__init__.py
new file mode 100644
index 000000000..316313ecf
--- /dev/null
+++ b/repair_stock/models/__init__.py
@@ -0,0 +1,3 @@
+# Copyright 2024 ForgeFlow S.L. (https://www.forgeflow.com)
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
+from . import repair
diff --git a/repair_stock/models/repair.py b/repair_stock/models/repair.py
new file mode 100644
index 000000000..61811cf72
--- /dev/null
+++ b/repair_stock/models/repair.py
@@ -0,0 +1,38 @@
+# 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"
+
+ picking_ids = fields.Many2many(
+ comodel_name="stock.picking",
+ compute="_compute_picking_ids",
+ copy=False,
+ string="Transfers",
+ )
+ picking_count = fields.Integer(
+ string="Transfers", copy=False, compute="_compute_picking_ids"
+ )
+
+ def action_view_pickings(self):
+ self.ensure_one()
+ action = self.env["ir.actions.actions"]._for_xml_id(
+ "stock.action_picking_tree_all"
+ )
+ action["domain"] = [("id", "in", self.picking_ids.ids)]
+ return action
+
+ def _compute_picking_ids(self):
+ for order in self:
+ moves = self.env["stock.move"].search(
+ [
+ "|",
+ ("repair_id", "=", order.id),
+ ("repair_line_id", "in", order.operations.ids),
+ ]
+ )
+ order.picking_ids = moves.mapped("picking_id")
+ order.picking_count = len(moves.mapped("picking_id"))
diff --git a/repair_stock/readme/CONTRIBUTORS.rst b/repair_stock/readme/CONTRIBUTORS.rst
new file mode 100644
index 000000000..11b57a1e5
--- /dev/null
+++ b/repair_stock/readme/CONTRIBUTORS.rst
@@ -0,0 +1 @@
+* David Jimenez
diff --git a/repair_stock/readme/DESCRIPTION.rst b/repair_stock/readme/DESCRIPTION.rst
new file mode 100644
index 000000000..0efcc233d
--- /dev/null
+++ b/repair_stock/readme/DESCRIPTION.rst
@@ -0,0 +1,3 @@
+This module acts as a base for the stock related modules for repairs.
+It adds some common features that may be overriding between them,
+as the compute for the pickings or the smart button for the transfers.
diff --git a/repair_stock/static/description/icon.png b/repair_stock/static/description/icon.png
new file mode 100644
index 000000000..3a0328b51
Binary files /dev/null and b/repair_stock/static/description/icon.png differ
diff --git a/repair_stock/static/description/index.html b/repair_stock/static/description/index.html
new file mode 100644
index 000000000..6cbf9d01b
--- /dev/null
+++ b/repair_stock/static/description/index.html
@@ -0,0 +1,422 @@
+
+
+
+
+
+Repair Stock
+
+
+
+
+
Repair Stock
+
+
+
+
This module acts as a base for the stock related modules for repairs.
+It adds some common features that may be overriding between them,
+as the compute for the pickings or the smart button for the transfers.
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.
+
Do not contact contributors directly about support or help with technical issues.
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 project on GitHub.