From cb8718a77b423908aea29b11e41673eee4e19b9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Gil=20Sorribes?= Date: Fri, 21 Dec 2018 15:53:36 +0100 Subject: [PATCH] [11.0][ADD] Add the module mrp_production_originating_user --- .../README.rst | 75 ++++ .../__init__.py | 3 + .../__manifest__.py | 22 + .../models/__init__.py | 4 + .../models/mrp_production.py | 11 + .../models/procurement.py | 23 + .../readme/CONTRIBUTORS.rst | 1 + .../readme/DESCRIPTION.rst | 3 + .../readme/USAGE.rst | 0 .../static/description/index.html | 399 ++++++++++++++++++ 10 files changed, 541 insertions(+) create mode 100644 mrp_stock_orderpoint_manual_procurement/README.rst create mode 100644 mrp_stock_orderpoint_manual_procurement/__init__.py create mode 100644 mrp_stock_orderpoint_manual_procurement/__manifest__.py create mode 100644 mrp_stock_orderpoint_manual_procurement/models/__init__.py create mode 100644 mrp_stock_orderpoint_manual_procurement/models/mrp_production.py create mode 100644 mrp_stock_orderpoint_manual_procurement/models/procurement.py create mode 100644 mrp_stock_orderpoint_manual_procurement/readme/CONTRIBUTORS.rst create mode 100644 mrp_stock_orderpoint_manual_procurement/readme/DESCRIPTION.rst create mode 100644 mrp_stock_orderpoint_manual_procurement/readme/USAGE.rst create mode 100644 mrp_stock_orderpoint_manual_procurement/static/description/index.html diff --git a/mrp_stock_orderpoint_manual_procurement/README.rst b/mrp_stock_orderpoint_manual_procurement/README.rst new file mode 100644 index 000000000..6a0070b0e --- /dev/null +++ b/mrp_stock_orderpoint_manual_procurement/README.rst @@ -0,0 +1,75 @@ +======================================= +MRP Stock Orderpoint Manual Procurement +======================================= + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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%2Fmanufacture-lightgray.png?logo=github + :target: https://github.com/OCA/manufacture/tree/11.0/mrp_stock_orderpoint_manual_procurement + :alt: OCA/manufacture +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/manufacture-11-0/manufacture-11-0-mrp_stock_orderpoint_manual_procurement + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/129/11.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module updates the value of the user_id field in a Manufacturing Order. In the case +the MO has been created as a result of a manual procurement the user_id will show the user +that triggered it. + +**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 +~~~~~~~ + +* Eficent + +Contributors +~~~~~~~~~~~~ + +* Adria Gil Sorribes + +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/mrp_stock_orderpoint_manual_procurement/__init__.py b/mrp_stock_orderpoint_manual_procurement/__init__.py new file mode 100644 index 000000000..4b76c7b2d --- /dev/null +++ b/mrp_stock_orderpoint_manual_procurement/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import models diff --git a/mrp_stock_orderpoint_manual_procurement/__manifest__.py b/mrp_stock_orderpoint_manual_procurement/__manifest__.py new file mode 100644 index 000000000..7855b78eb --- /dev/null +++ b/mrp_stock_orderpoint_manual_procurement/__manifest__.py @@ -0,0 +1,22 @@ +# Copyright 2018 Eficent Business and IT Consulting Services S.L. +# (http://www.eficent.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +{ + "name": "MRP Stock Orderpoint Manual Procurement", + "summary": "Updates the value of MO Responsible and keeps track" + "of changes regarding this field", + "version": "11.0.1.0.0", + "author": "Eficent, " + "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/manufacture", + "category": "MRP", + "depends": [ + "mrp", + "stock_orderpoint_manual_procurement", + ], + "data": [], + "license": "AGPL-3", + 'installable': True, + 'application': False, + 'auto_install': True +} diff --git a/mrp_stock_orderpoint_manual_procurement/models/__init__.py b/mrp_stock_orderpoint_manual_procurement/models/__init__.py new file mode 100644 index 000000000..2cafca2ee --- /dev/null +++ b/mrp_stock_orderpoint_manual_procurement/models/__init__.py @@ -0,0 +1,4 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import procurement +from . import mrp_production diff --git a/mrp_stock_orderpoint_manual_procurement/models/mrp_production.py b/mrp_stock_orderpoint_manual_procurement/models/mrp_production.py new file mode 100644 index 000000000..189c96bcc --- /dev/null +++ b/mrp_stock_orderpoint_manual_procurement/models/mrp_production.py @@ -0,0 +1,11 @@ +# Copyright 2017 Eficent Business and IT Consulting Services S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class MrpProduction(models.Model): + """ Manufacturing Orders """ + _inherit = 'mrp.production' + + user_id = fields.Many2one(track_visibility='always') diff --git a/mrp_stock_orderpoint_manual_procurement/models/procurement.py b/mrp_stock_orderpoint_manual_procurement/models/procurement.py new file mode 100644 index 000000000..08052069a --- /dev/null +++ b/mrp_stock_orderpoint_manual_procurement/models/procurement.py @@ -0,0 +1,23 @@ +# Copyright 2017 Eficent Business and IT Consulting Services S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import models + + +class ProcurementRule(models.Model): + _inherit = 'procurement.rule' + + def _prepare_mo_vals(self, product_id, product_qty, + product_uom, location_id, name, + origin, values, bom): + + res = super(ProcurementRule, self)._prepare_mo_vals(product_id, + product_qty, + product_uom, + location_id, name, + origin, values, + bom) + requested_uid = values.get('requested_uid', None) + if requested_uid: + res.update({'user_id': requested_uid.id}) + return res diff --git a/mrp_stock_orderpoint_manual_procurement/readme/CONTRIBUTORS.rst b/mrp_stock_orderpoint_manual_procurement/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..b7a7d159e --- /dev/null +++ b/mrp_stock_orderpoint_manual_procurement/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Adria Gil Sorribes \ No newline at end of file diff --git a/mrp_stock_orderpoint_manual_procurement/readme/DESCRIPTION.rst b/mrp_stock_orderpoint_manual_procurement/readme/DESCRIPTION.rst new file mode 100644 index 000000000..e645a5398 --- /dev/null +++ b/mrp_stock_orderpoint_manual_procurement/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This module updates the value of the user_id field in a Manufacturing Order. In the case +the MO has been created as a result of a manual procurement the user_id will show the user +that triggered it. \ No newline at end of file diff --git a/mrp_stock_orderpoint_manual_procurement/readme/USAGE.rst b/mrp_stock_orderpoint_manual_procurement/readme/USAGE.rst new file mode 100644 index 000000000..e69de29bb diff --git a/mrp_stock_orderpoint_manual_procurement/static/description/index.html b/mrp_stock_orderpoint_manual_procurement/static/description/index.html new file mode 100644 index 000000000..1183647c6 --- /dev/null +++ b/mrp_stock_orderpoint_manual_procurement/static/description/index.html @@ -0,0 +1,399 @@ + + + + + + +MRP Stock Orderpoint Manual Procurement + + + +
+

MRP Stock Orderpoint Manual Procurement

+ + +

Beta License: AGPL-3 OCA/manufacture Translate me on Weblate Try me on Runbot

+

This module updates the value of the user_id field in a Manufacturing Order. In the case +the MO has been created as a result of a manual procurement the user_id will show the user +that triggered it.

+

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

+
    +
  • Eficent
  • +
+
+
+

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

+

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

+
+
+
+ +