diff --git a/mrp_stock_orderpoint_manual_procurement/README.rst b/mrp_stock_orderpoint_manual_procurement/README.rst index 6a0070b0e..385ab99e9 100644 --- a/mrp_stock_orderpoint_manual_procurement/README.rst +++ b/mrp_stock_orderpoint_manual_procurement/README.rst @@ -25,15 +25,21 @@ MRP Stock Orderpoint Manual Procurement |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. +This module updates a new field *Requested by* in Manufacturing Orders +in the case the MO has been created as a result of a manual procurement from +an orderpoint. **Table of contents** .. contents:: :local: +Usage +===== + +Go to an orderpoint an do a manual procurement for a manufactured product. +Your user will be set as *Requeste by* in the newly created MO. + Bug Tracker =========== @@ -56,6 +62,7 @@ Contributors ~~~~~~~~~~~~ * Adria Gil Sorribes +* Lois Rilo Antelo Maintainers ~~~~~~~~~~~ diff --git a/mrp_stock_orderpoint_manual_procurement/__manifest__.py b/mrp_stock_orderpoint_manual_procurement/__manifest__.py index 7855b78eb..cd961da0a 100644 --- a/mrp_stock_orderpoint_manual_procurement/__manifest__.py +++ b/mrp_stock_orderpoint_manual_procurement/__manifest__.py @@ -9,12 +9,14 @@ "author": "Eficent, " "Odoo Community Association (OCA)", "website": "https://github.com/OCA/manufacture", - "category": "MRP", + "category": "Manufacturing", "depends": [ "mrp", "stock_orderpoint_manual_procurement", ], - "data": [], + "data": [ + "views/mrp_production_view.xml", + ], "license": "AGPL-3", 'installable': True, 'application': False, diff --git a/mrp_stock_orderpoint_manual_procurement/models/mrp_production.py b/mrp_stock_orderpoint_manual_procurement/models/mrp_production.py index 189c96bcc..e4932a66d 100644 --- a/mrp_stock_orderpoint_manual_procurement/models/mrp_production.py +++ b/mrp_stock_orderpoint_manual_procurement/models/mrp_production.py @@ -1,11 +1,13 @@ -# Copyright 2017 Eficent Business and IT Consulting Services S.L. +# Copyright 2019 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') + requested_by = fields.Many2one( + comodel_name='res.users', + track_visibility='always', + ) diff --git a/mrp_stock_orderpoint_manual_procurement/models/procurement.py b/mrp_stock_orderpoint_manual_procurement/models/procurement.py index 08052069a..0379a4b42 100644 --- a/mrp_stock_orderpoint_manual_procurement/models/procurement.py +++ b/mrp_stock_orderpoint_manual_procurement/models/procurement.py @@ -1,4 +1,4 @@ -# Copyright 2017 Eficent Business and IT Consulting Services S.L. +# Copyright 2019 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 @@ -7,17 +7,12 @@ 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) + 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 = self.env.context.get('requested_uid') if requested_uid: - res.update({'user_id': requested_uid.id}) + res.update({'requested_by': 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 index b7a7d159e..76e4c541c 100644 --- a/mrp_stock_orderpoint_manual_procurement/readme/CONTRIBUTORS.rst +++ b/mrp_stock_orderpoint_manual_procurement/readme/CONTRIBUTORS.rst @@ -1 +1,2 @@ -* Adria Gil Sorribes \ No newline at end of file +* Adria Gil Sorribes +* Lois Rilo Antelo diff --git a/mrp_stock_orderpoint_manual_procurement/readme/DESCRIPTION.rst b/mrp_stock_orderpoint_manual_procurement/readme/DESCRIPTION.rst index e645a5398..a6b7f9bfe 100644 --- a/mrp_stock_orderpoint_manual_procurement/readme/DESCRIPTION.rst +++ b/mrp_stock_orderpoint_manual_procurement/readme/DESCRIPTION.rst @@ -1,3 +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 +This module updates a new field *Requested by* in Manufacturing Orders +in the case the MO has been created as a result of a manual procurement from +an orderpoint. \ 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 index e69de29bb..7967b7304 100644 --- a/mrp_stock_orderpoint_manual_procurement/readme/USAGE.rst +++ b/mrp_stock_orderpoint_manual_procurement/readme/USAGE.rst @@ -0,0 +1,2 @@ +Go to an orderpoint an do a manual procurement for a manufactured product. +Your user will be set as *Requeste by* in the newly created MO. diff --git a/mrp_stock_orderpoint_manual_procurement/static/description/icon.png b/mrp_stock_orderpoint_manual_procurement/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/mrp_stock_orderpoint_manual_procurement/static/description/icon.png differ diff --git a/mrp_stock_orderpoint_manual_procurement/static/description/index.html b/mrp_stock_orderpoint_manual_procurement/static/description/index.html index 1183647c6..213e1435b 100644 --- a/mrp_stock_orderpoint_manual_procurement/static/description/index.html +++ b/mrp_stock_orderpoint_manual_procurement/static/description/index.html @@ -3,13 +3,13 @@ - + MRP Stock Orderpoint Manual Procurement