From 34d8a9ac16e8a2034019db075b0b78eae370b873 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Tue, 11 Aug 2020 18:52:44 +0200 Subject: [PATCH] [FIX+IMP] mrp_sale_info: Isolate procurement group + tests --- mrp_sale_info/README.rst | 17 +++++---- mrp_sale_info/__manifest__.py | 3 +- mrp_sale_info/models/__init__.py | 2 -- mrp_sale_info/models/mrp_production.py | 6 +++- mrp_sale_info/models/stock_rule.py | 7 ++-- mrp_sale_info/readme/CONTRIBUTORS.rst | 14 +++++--- mrp_sale_info/readme/DESCRIPTION.rst | 3 +- mrp_sale_info/static/description/index.html | 17 ++++++--- mrp_sale_info/tests/__init__.py | 3 ++ mrp_sale_info/tests/test_mrp_sale_info.py | 39 +++++++++++++++++++++ 10 files changed, 85 insertions(+), 26 deletions(-) create mode 100644 mrp_sale_info/tests/__init__.py create mode 100644 mrp_sale_info/tests/test_mrp_sale_info.py diff --git a/mrp_sale_info/README.rst b/mrp_sale_info/README.rst index 1d957b70b..b6ae67b4f 100644 --- a/mrp_sale_info/README.rst +++ b/mrp_sale_info/README.rst @@ -25,7 +25,8 @@ MRP Sale Info |badge1| |badge2| |badge3| |badge4| |badge5| -This module extends the functionality of sale_mrp and adds related fields to Manufacturing Orders and Work Orders: +This module extends the functionality of Odoo for adding related fields to +Manufacturing Orders and Work Orders: * Sale order * Customer @@ -63,11 +64,15 @@ Authors Contributors ~~~~~~~~~~~~ -* Rafael Blasco -* Antonio Espinosa -* Oihane Crucelaegui -* Pedro M. Baeza -* Ana Juaristi +* `AvanzOsc `_: + + * Oihane Crucelaegui + * Ana Juaristi +* `Tecnativa `_: + + * Antonio Espinosa + * Rafael Blasco + * Pedro M. Baeza * Rubén Bravo Maintainers diff --git a/mrp_sale_info/__manifest__.py b/mrp_sale_info/__manifest__.py index 4690c3a69..1bff5fff9 100644 --- a/mrp_sale_info/__manifest__.py +++ b/mrp_sale_info/__manifest__.py @@ -1,5 +1,6 @@ # Copyright 2016 Antiun Ingenieria S.L. - Javier Iniesta # Copyright 2019 Rubén Bravo +# Copyright 2020 Tecnativa - Pedro M. Baeza # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { "name": "MRP Sale Info", @@ -15,8 +16,6 @@ 'installable': True, "depends": [ "mrp", - "sale_mrp", - "stock", "sale_stock", ], "data": [ diff --git a/mrp_sale_info/models/__init__.py b/mrp_sale_info/models/__init__.py index 86876ac3e..ab9fed971 100644 --- a/mrp_sale_info/models/__init__.py +++ b/mrp_sale_info/models/__init__.py @@ -1,5 +1,3 @@ -# Copyright 2016 Antiun Ingenieria S.L. - Javier Iniesta -# Copyright 2019 Rubén Bravo # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import mrp_production diff --git a/mrp_sale_info/models/mrp_production.py b/mrp_sale_info/models/mrp_production.py index 70685823e..c6a0bc054 100644 --- a/mrp_sale_info/models/mrp_production.py +++ b/mrp_sale_info/models/mrp_production.py @@ -1,5 +1,6 @@ # Copyright 2016 Antiun Ingenieria S.L. - Javier Iniesta # Copyright 2019 Rubén Bravo +# Copyright 2020 Tecnativa - Pedro M. Baeza # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import fields, models @@ -8,9 +9,12 @@ from odoo import fields, models class MrpProduction(models.Model): _inherit = "mrp.production" + source_procurement_group_id = fields.Many2one( + comodel_name='procurement.group', readonly=True, + ) sale_id = fields.Many2one( comodel_name='sale.order', string='Sale order', readonly=True, - store=True, related='procurement_group_id.sale_id') + store=True, related='source_procurement_group_id.sale_id') partner_id = fields.Many2one( comodel_name='res.partner', related='sale_id.partner_id', string='Customer', store=True) diff --git a/mrp_sale_info/models/stock_rule.py b/mrp_sale_info/models/stock_rule.py index a5f45bfc1..f01c845f3 100644 --- a/mrp_sale_info/models/stock_rule.py +++ b/mrp_sale_info/models/stock_rule.py @@ -1,4 +1,5 @@ # Copyright 2019 Rubén Bravo +# Copyright 2020 Tecnativa - Pedro M. Baeza # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) from odoo import models @@ -13,8 +14,6 @@ class StockRule(models.Model): product_id, product_qty, product_uom, location_id, name, origin, values, bom ) - res.update({ - 'procurement_group_id': values.get( - 'group_id').id if values.get('group_id', False) else False, - }) + res["source_procurement_group_id"] = values.get( + "group_id").id if values.get('group_id', False) else False return res diff --git a/mrp_sale_info/readme/CONTRIBUTORS.rst b/mrp_sale_info/readme/CONTRIBUTORS.rst index 5e01a9e1f..df5ff81b9 100644 --- a/mrp_sale_info/readme/CONTRIBUTORS.rst +++ b/mrp_sale_info/readme/CONTRIBUTORS.rst @@ -1,6 +1,10 @@ -* Rafael Blasco -* Antonio Espinosa -* Oihane Crucelaegui -* Pedro M. Baeza -* Ana Juaristi +* `AvanzOsc `_: + + * Oihane Crucelaegui + * Ana Juaristi +* `Tecnativa `_: + + * Antonio Espinosa + * Rafael Blasco + * Pedro M. Baeza * Rubén Bravo diff --git a/mrp_sale_info/readme/DESCRIPTION.rst b/mrp_sale_info/readme/DESCRIPTION.rst index 96287accf..71735399c 100644 --- a/mrp_sale_info/readme/DESCRIPTION.rst +++ b/mrp_sale_info/readme/DESCRIPTION.rst @@ -1,4 +1,5 @@ -This module extends the functionality of sale_mrp and adds related fields to Manufacturing Orders and Work Orders: +This module extends the functionality of Odoo for adding related fields to +Manufacturing Orders and Work Orders: * Sale order * Customer diff --git a/mrp_sale_info/static/description/index.html b/mrp_sale_info/static/description/index.html index 1dae47924..fa984cca8 100644 --- a/mrp_sale_info/static/description/index.html +++ b/mrp_sale_info/static/description/index.html @@ -3,7 +3,7 @@ - + MRP Sale Info