From 3b9810bcce7f7770f97f5fdc47562b12cc3c5b8e Mon Sep 17 00:00:00 2001 From: Joan Mateu Jordi Date: Fri, 13 May 2022 12:54:07 +0200 Subject: [PATCH] [ADD][15.0] Add module of mrp_finished_products --- mrp_finished_backorder_product/README.rst | 0 mrp_finished_backorder_product/__init__.py | 3 ++ .../__manifest__.py | 16 +++++++++ .../models/__init__.py | 3 ++ .../models/mrp_production.py | 25 +++++++++++++ .../readme/CONTRIBUTORS.rst | 2 ++ .../readme/DESCRIPTION.rst | 1 + .../views/mrp_production_views.xml | 36 +++++++++++++++++++ .../addons/mrp_finished_backorder_product | 1 + setup/mrp_finished_backorder_product/setup.py | 6 ++++ 10 files changed, 93 insertions(+) create mode 100644 mrp_finished_backorder_product/README.rst create mode 100644 mrp_finished_backorder_product/__init__.py create mode 100644 mrp_finished_backorder_product/__manifest__.py create mode 100644 mrp_finished_backorder_product/models/__init__.py create mode 100644 mrp_finished_backorder_product/models/mrp_production.py create mode 100644 mrp_finished_backorder_product/readme/CONTRIBUTORS.rst create mode 100644 mrp_finished_backorder_product/readme/DESCRIPTION.rst create mode 100644 mrp_finished_backorder_product/views/mrp_production_views.xml create mode 120000 setup/mrp_finished_backorder_product/odoo/addons/mrp_finished_backorder_product create mode 100644 setup/mrp_finished_backorder_product/setup.py diff --git a/mrp_finished_backorder_product/README.rst b/mrp_finished_backorder_product/README.rst new file mode 100644 index 000000000..e69de29bb diff --git a/mrp_finished_backorder_product/__init__.py b/mrp_finished_backorder_product/__init__.py new file mode 100644 index 000000000..2bc1433e7 --- /dev/null +++ b/mrp_finished_backorder_product/__init__.py @@ -0,0 +1,3 @@ +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +from . import models diff --git a/mrp_finished_backorder_product/__manifest__.py b/mrp_finished_backorder_product/__manifest__.py new file mode 100644 index 000000000..2f157f843 --- /dev/null +++ b/mrp_finished_backorder_product/__manifest__.py @@ -0,0 +1,16 @@ +# Copyright 2022 ForgeFlow S.L. (https://www.forgeflow.com) +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +{ + "name": "MRP Finished Backorder Product", + "version": "15.0.1.0.0", + "author": "ForgeFlow, Odoo Community Association (OCA)", + "summary": "Be able to see the summary of the finished manufactured orders ", + "website": "https://github.com/OCA/manufacture", + "category": "Manufacturing", + "depends": ["mrp"], + "data": ["views/mrp_production_views.xml"], + "license": "LGPL-3", + "installable": True, + "development_status": "Beta", +} diff --git a/mrp_finished_backorder_product/models/__init__.py b/mrp_finished_backorder_product/models/__init__.py new file mode 100644 index 000000000..f138ba557 --- /dev/null +++ b/mrp_finished_backorder_product/models/__init__.py @@ -0,0 +1,3 @@ +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +from . import mrp_production diff --git a/mrp_finished_backorder_product/models/mrp_production.py b/mrp_finished_backorder_product/models/mrp_production.py new file mode 100644 index 000000000..7bdb7ea18 --- /dev/null +++ b/mrp_finished_backorder_product/models/mrp_production.py @@ -0,0 +1,25 @@ +# Copyright 2022 ForgeFlow S.L. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + + +from odoo import api, fields, models + + +class MrpProduction(models.Model): + _inherit = "mrp.production" + finished_move_from_backorder_ids = fields.One2many( + "stock.move.line", + compute="_compute_finished_backorders", + string="Finished Backorders", + ) + + @api.depends("move_finished_ids.move_line_ids") + def _compute_finished_backorders(self): + for production in self: + production.finished_move_from_backorder_ids = self.env["stock.move.line"] + backorders = production.procurement_group_id.mrp_production_ids + for backorder in backorders: + backorder.mapped("finished_move_line_ids").production_id = backorder + production.finished_move_from_backorder_ids |= ( + backorder.finished_move_line_ids + ) diff --git a/mrp_finished_backorder_product/readme/CONTRIBUTORS.rst b/mrp_finished_backorder_product/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..ff185555c --- /dev/null +++ b/mrp_finished_backorder_product/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Joan Mateu +* Maria de Luna diff --git a/mrp_finished_backorder_product/readme/DESCRIPTION.rst b/mrp_finished_backorder_product/readme/DESCRIPTION.rst new file mode 100644 index 000000000..c001488a4 --- /dev/null +++ b/mrp_finished_backorder_product/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module collects the functionality hat was in previous versions and adds a tab to see the finished manufacturing orders. diff --git a/mrp_finished_backorder_product/views/mrp_production_views.xml b/mrp_finished_backorder_product/views/mrp_production_views.xml new file mode 100644 index 000000000..71acb598a --- /dev/null +++ b/mrp_finished_backorder_product/views/mrp_production_views.xml @@ -0,0 +1,36 @@ + + + + mrp.production.form.finished + mrp.production + + + + + + + + + + + + + + + + + + diff --git a/setup/mrp_finished_backorder_product/odoo/addons/mrp_finished_backorder_product b/setup/mrp_finished_backorder_product/odoo/addons/mrp_finished_backorder_product new file mode 120000 index 000000000..3e47e36d9 --- /dev/null +++ b/setup/mrp_finished_backorder_product/odoo/addons/mrp_finished_backorder_product @@ -0,0 +1 @@ +../../../../mrp_finished_backorder_product \ No newline at end of file diff --git a/setup/mrp_finished_backorder_product/setup.py b/setup/mrp_finished_backorder_product/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_finished_backorder_product/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)