From 5954b01fbe1f38fb88f4013f1a6bebae43f583d5 Mon Sep 17 00:00:00 2001 From: AaronHForgeFlow Date: Thu, 4 May 2023 15:42:13 +0200 Subject: [PATCH 1/4] [IMP] repair_refurbish: company default in lots --- repair_refurbish/views/repair_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 @@ Date: Thu, 4 May 2023 15:46:51 +0200 Subject: [PATCH 2/4] [IMP]repair_stock_move: hook to modify stock move vals --- repair_stock_move/models/repair_order.py | 30 +++++++++++++----------- 1 file changed, 16 insertions(+), 14 deletions(-) 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() From ebebec4dedf357c582e252a6f96050c8d827e3cc Mon Sep 17 00:00:00 2001 From: AaronHForgeFlow Date: Thu, 4 May 2023 16:05:15 +0200 Subject: [PATCH 3/4] [ADD] repair_refurbish_repair_stock_move in v15 --- repair_refurbish_repair_stock_move/README.rst | 70 +++ .../__init__.py | 1 + .../__manifest__.py | 15 + .../models/__init__.py | 1 + .../models/repair_order.py | 37 ++ .../readme/CONTRIBUTORS.rst | 1 + .../readme/DESCRIPTION.rst | 1 + .../static/description/index.html | 419 ++++++++++++++++++ .../addons/repair_refurbish_repair_stock_move | 1 + .../setup.py | 6 + 10 files changed, 552 insertions(+) create mode 100644 repair_refurbish_repair_stock_move/README.rst create mode 100644 repair_refurbish_repair_stock_move/__init__.py create mode 100644 repair_refurbish_repair_stock_move/__manifest__.py create mode 100644 repair_refurbish_repair_stock_move/models/__init__.py create mode 100644 repair_refurbish_repair_stock_move/models/repair_order.py create mode 100644 repair_refurbish_repair_stock_move/readme/CONTRIBUTORS.rst create mode 100644 repair_refurbish_repair_stock_move/readme/DESCRIPTION.rst create mode 100644 repair_refurbish_repair_stock_move/static/description/index.html create mode 120000 setup/repair_refurbish_repair_stock_move/odoo/addons/repair_refurbish_repair_stock_move create mode 100644 setup/repair_refurbish_repair_stock_move/setup.py diff --git a/repair_refurbish_repair_stock_move/README.rst b/repair_refurbish_repair_stock_move/README.rst new file mode 100644 index 000000000..b8e2f2dcb --- /dev/null +++ b/repair_refurbish_repair_stock_move/README.rst @@ -0,0 +1,70 @@ +======================================== +MRP Repair Refurbish & Repair Stock Move +======================================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/15.0/repair_refurbish_repair_stock_move + :alt: OCA/repair +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/repair-15-0/repair-15-0-repair_refurbish_repair_stock_move + :alt: Translate me on Weblate + +|badge1| |badge2| |badge3| |badge4| + +Glue module. This makes repair_refurbish to work together with repair_stock_move + +**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 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..00b50bb4b --- /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": "15.0.1.0.0", + "category": "Repair", + "website": "https://github.com/OCA/repair", + "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/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, +) From a1be85ee2afeb12b378fe9581047f3e4b6b75f3b Mon Sep 17 00:00:00 2001 From: AaronHForgeFlow Date: Fri, 5 May 2023 17:36:59 +0200 Subject: [PATCH 4/4] [MIG] repair_refurbish_repair_stock_move: backport from 15.0 --- repair_refurbish_repair_stock_move/__manifest__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/repair_refurbish_repair_stock_move/__manifest__.py b/repair_refurbish_repair_stock_move/__manifest__.py index 00b50bb4b..3a55d62df 100644 --- a/repair_refurbish_repair_stock_move/__manifest__.py +++ b/repair_refurbish_repair_stock_move/__manifest__.py @@ -3,9 +3,9 @@ { "name": "MRP Repair Refurbish & Repair Stock Move", "summary": "Use refurbish and repair stock moves together", - "version": "15.0.1.0.0", + "version": "14.0.1.0.0", "category": "Repair", - "website": "https://github.com/OCA/repair", + "website": "https://github.com/OCA/manufacture", "author": "ForgeFlow S.L., Odoo Community Association (OCA)", "license": "AGPL-3", "installable": True,