diff --git a/mrp_raw_material_from_config/README.rst b/mrp_raw_material_from_config/README.rst new file mode 100644 index 000000000..b42c14981 --- /dev/null +++ b/mrp_raw_material_from_config/README.rst @@ -0,0 +1,68 @@ +============================ +MRP Raw Material From Config +============================ + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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%2Fak--odoo--incubator-lightgray.png?logo=github + :target: https://github.com/OCA/ak-odoo-incubator/tree/16.0/mrp_raw_material_from_config + :alt: OCA/ak-odoo-incubator +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/ak-odoo-incubator-16-0/ak-odoo-incubator-16-0-mrp_raw_material_from_config + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/ak-odoo-incubator&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Compute MO's raw material from lot configuration + +**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 +~~~~~~~ + +* Akretion + +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/ak-odoo-incubator `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mrp_raw_material_from_config/__init__.py b/mrp_raw_material_from_config/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/mrp_raw_material_from_config/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/mrp_raw_material_from_config/__manifest__.py b/mrp_raw_material_from_config/__manifest__.py new file mode 100644 index 000000000..d7ec962b9 --- /dev/null +++ b/mrp_raw_material_from_config/__manifest__.py @@ -0,0 +1,15 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + "name": "MRP Raw Material From Config", + "version": "16.0.1.0.0", + "category": "Manufacture", + "author": "Akretion,Odoo Community Association (OCA)", + "website": "https://github.com/akretion/ak-odoo-incubator", + "license": "AGPL-3", + "depends": [ + "sale_lot_config", + "mrp_restrict_lot", + ], + "installable": True, +} diff --git a/mrp_raw_material_from_config/models/__init__.py b/mrp_raw_material_from_config/models/__init__.py new file mode 100644 index 000000000..a9e5f13e4 --- /dev/null +++ b/mrp_raw_material_from_config/models/__init__.py @@ -0,0 +1 @@ +from . import mrp_production diff --git a/mrp_raw_material_from_config/models/mrp_production.py b/mrp_raw_material_from_config/models/mrp_production.py new file mode 100644 index 000000000..1bb593f94 --- /dev/null +++ b/mrp_raw_material_from_config/models/mrp_production.py @@ -0,0 +1,32 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import models + + +class MrpProduction(models.Model): + _inherit = "mrp.production" + + def _get_raw_material_from_config(self, original_moves_vals): + self.ensure_one() + return original_moves_vals + + def _get_moves_raw_values(self): + moves_vals = super()._get_moves_raw_values() + production_move_vals = {x: [] for x in self} + for move_vals in moves_vals: + # manage case of onchange. we can't browse an NewId coming from an onchang + # but we always have only 1 MO if we come from an onchange. + if len(self) == 1: + current_mo = self + else: + current_mo = self.browse(move_vals["raw_material_production_id"]) + production_move_vals[current_mo].append(move_vals) + + final_moves_vals = [] + + for production, prod_moves_vals in production_move_vals.items(): + final_prod_moves_vals = production._get_raw_material_from_config( + prod_moves_vals + ) + final_moves_vals += final_prod_moves_vals + return final_moves_vals diff --git a/mrp_raw_material_from_config/readme/DESCRIPTION.rst b/mrp_raw_material_from_config/readme/DESCRIPTION.rst new file mode 100644 index 000000000..0d20492e3 --- /dev/null +++ b/mrp_raw_material_from_config/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +Compute MO's raw material from lot configuration diff --git a/mrp_raw_material_from_config/static/description/index.html b/mrp_raw_material_from_config/static/description/index.html new file mode 100644 index 000000000..e8d1f82dd --- /dev/null +++ b/mrp_raw_material_from_config/static/description/index.html @@ -0,0 +1,412 @@ + + + + + + +MRP Raw Material From Config + + + +
+

MRP Raw Material From Config

+ + +

Beta License: AGPL-3 OCA/ak-odoo-incubator Translate me on Weblate Try me on Runboat

+

Compute MO’s raw material from lot configuration

+

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

+
    +
  • Akretion
  • +
+
+
+

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/ak-odoo-incubator project on GitHub.

+

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

+
+
+
+ + diff --git a/setup/mrp_raw_material_from_config/odoo/addons/mrp_raw_material_from_config b/setup/mrp_raw_material_from_config/odoo/addons/mrp_raw_material_from_config new file mode 120000 index 000000000..3c7853cda --- /dev/null +++ b/setup/mrp_raw_material_from_config/odoo/addons/mrp_raw_material_from_config @@ -0,0 +1 @@ +../../../../mrp_raw_material_from_config \ No newline at end of file diff --git a/setup/mrp_raw_material_from_config/setup.py b/setup/mrp_raw_material_from_config/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_raw_material_from_config/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)