diff --git a/repair_refurbish/views/repair_view.xml b/repair_refurbish/views/repair_view.xml index 9ec14e56f..27dea9e98 100644 --- a/repair_refurbish/views/repair_view.xml +++ b/repair_refurbish/views/repair_view.xml @@ -33,7 +33,7 @@ `_. +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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* ForgeFlow S.L. + +Contributors +~~~~~~~~~~~~ + +* Aaron Henriquez + +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 `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/repair_refurbish_repair_stock_move/__init__.py b/repair_refurbish_repair_stock_move/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/repair_refurbish_repair_stock_move/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/repair_refurbish_repair_stock_move/__manifest__.py b/repair_refurbish_repair_stock_move/__manifest__.py new file mode 100644 index 000000000..3a55d62df --- /dev/null +++ b/repair_refurbish_repair_stock_move/__manifest__.py @@ -0,0 +1,15 @@ +# Copyright 2023 ForgeFlow S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +{ + "name": "MRP Repair Refurbish & Repair Stock Move", + "summary": "Use refurbish and repair stock moves together", + "version": "14.0.1.0.0", + "category": "Repair", + "website": "https://github.com/OCA/manufacture", + "author": "ForgeFlow S.L., Odoo Community Association (OCA)", + "license": "AGPL-3", + "installable": True, + "auto_install": True, + "depends": ["repair_refurbish", "repair_stock_move"], + "development_status": "Alpha", +} diff --git a/repair_refurbish_repair_stock_move/models/__init__.py b/repair_refurbish_repair_stock_move/models/__init__.py new file mode 100644 index 000000000..2251f67dd --- /dev/null +++ b/repair_refurbish_repair_stock_move/models/__init__.py @@ -0,0 +1 @@ +from . import repair_order diff --git a/repair_refurbish_repair_stock_move/models/repair_order.py b/repair_refurbish_repair_stock_move/models/repair_order.py new file mode 100644 index 000000000..f29681763 --- /dev/null +++ b/repair_refurbish_repair_stock_move/models/repair_order.py @@ -0,0 +1,37 @@ +# Copyright 2023 ForgeFlow S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import models + + +class RepairOrder(models.Model): + _inherit = "repair.order" + + def create_refurbished_stock_move(self): + self.ensure_one() + move = self.env["stock.move"].create(self._get_refurbish_stock_move_dict()) + move.quantity_done = self.product_qty + self.refurbish_move_id = move.id + + def _prepare_repair_stock_move(self): + res = super()._prepare_repair_stock_move() + if not self.to_refurbish: + return res + else: + self.create_refurbished_stock_move() + res.update({"location_dest_id": self.location_dest_id.id}) + return res + + def action_repair_end(self): + for r in self.filtered(lambda l: l.to_refurbish): + r.refurbish_move_id._action_done() + return super().action_repair_end() + + def action_open_stock_moves(self): + res = super().action_open_stock_moves() + if self.refurbish_move_id: + all_move_ids = self.mapped("stock_move_ids").ids + [ + self.refurbish_move_id.id + ] + res.update({"domain": [("id", "in", all_move_ids)]}) + return res diff --git a/repair_refurbish_repair_stock_move/readme/CONTRIBUTORS.rst b/repair_refurbish_repair_stock_move/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..9fa71265b --- /dev/null +++ b/repair_refurbish_repair_stock_move/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Aaron Henriquez diff --git a/repair_refurbish_repair_stock_move/readme/DESCRIPTION.rst b/repair_refurbish_repair_stock_move/readme/DESCRIPTION.rst new file mode 100644 index 000000000..926a9bc10 --- /dev/null +++ b/repair_refurbish_repair_stock_move/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +Glue module. This makes repair_refurbish to work together with repair_stock_move diff --git a/repair_refurbish_repair_stock_move/static/description/index.html b/repair_refurbish_repair_stock_move/static/description/index.html new file mode 100644 index 000000000..c05334b22 --- /dev/null +++ b/repair_refurbish_repair_stock_move/static/description/index.html @@ -0,0 +1,419 @@ + + + + + + +MRP Repair Refurbish & Repair Stock Move + + + +
+

MRP Repair Refurbish & Repair Stock Move

+ + +

Beta License: AGPL-3 OCA/repair Translate me on Weblate

+

Glue module. This makes repair_refurbish to work together with repair_stock_move

+

Table of contents

+ +
+

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 smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • ForgeFlow S.L.
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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 project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/repair_stock_move/models/repair_order.py b/repair_stock_move/models/repair_order.py index 2aa7ed28c..235119abe 100644 --- a/repair_stock_move/models/repair_order.py +++ b/repair_stock_move/models/repair_order.py @@ -53,22 +53,24 @@ class RepairOrder(models.Model): and not rec.ignore_availability ) + def _prepare_repair_stock_move(self): + return { + "name": self.name, + "product_id": self.product_id.id, + "product_uom": self.product_uom.id or self.product_id.uom_id.id, + "product_uom_qty": self.product_qty, + "partner_id": self.address_id.id, + "location_id": self.location_id.id, + "location_dest_id": self.location_id.id, + "repair_id": self.id, + "origin": self.name, + "company_id": self.company_id.id, + } + def _create_repair_stock_move(self): self.ensure_one() - return self.env["stock.move"].create( - { - "name": self.name, - "product_id": self.product_id.id, - "product_uom": self.product_uom.id or self.product_id.uom_id.id, - "product_uom_qty": self.product_qty, - "partner_id": self.address_id.id, - "location_id": self.location_id.id, - "location_dest_id": self.location_id.id, - "repair_id": self.id, - "origin": self.name, - "company_id": self.company_id.id, - } - ) + move_dict = self._prepare_repair_stock_move() + return self.env["stock.move"].create(move_dict) def action_repair_confirm(self): res = super().action_repair_confirm() diff --git a/setup/repair_refurbish_repair_stock_move/odoo/addons/repair_refurbish_repair_stock_move b/setup/repair_refurbish_repair_stock_move/odoo/addons/repair_refurbish_repair_stock_move new file mode 120000 index 000000000..288ec239a --- /dev/null +++ b/setup/repair_refurbish_repair_stock_move/odoo/addons/repair_refurbish_repair_stock_move @@ -0,0 +1 @@ +../../../../repair_refurbish_repair_stock_move \ No newline at end of file diff --git a/setup/repair_refurbish_repair_stock_move/setup.py b/setup/repair_refurbish_repair_stock_move/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/repair_refurbish_repair_stock_move/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)