From f5ac39eeb1ad339cb84312563277cbdae33317a0 Mon Sep 17 00:00:00 2001 From: lreficent Date: Thu, 16 Mar 2017 10:06:40 +0100 Subject: [PATCH] [MIG] stock_orderpoint_uom to v10.0 --- stock_orderpoint_uom/README.rst | 3 ++- stock_orderpoint_uom/__init__.py | 2 +- .../{__openerp__.py => __manifest__.py} | 6 +++--- stock_orderpoint_uom/models/__init__.py | 3 +-- .../models/procurement_order.py | 21 ------------------- .../models/stock_warehouse_orderpoint.py | 19 +++++++++++++---- stock_orderpoint_uom/tests/__init__.py | 2 +- .../test_stock_orderpoint_procure_uom.py | 8 +++---- 8 files changed, 27 insertions(+), 37 deletions(-) rename stock_orderpoint_uom/{__openerp__.py => __manifest__.py} (78%) delete mode 100644 stock_orderpoint_uom/models/procurement_order.py diff --git a/stock_orderpoint_uom/README.rst b/stock_orderpoint_uom/README.rst index 61092330d..156b1d7ab 100644 --- a/stock_orderpoint_uom/README.rst +++ b/stock_orderpoint_uom/README.rst @@ -31,7 +31,7 @@ Procurement UoM. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/153/8.0 + :target: https://runbot.odoo-community.org/runbot/153/10.0 Bug Tracker =========== @@ -53,6 +53,7 @@ Contributors ------------ * Jordi Ballester Alomar +* Lois Rilo Maintainer diff --git a/stock_orderpoint_uom/__init__.py b/stock_orderpoint_uom/__init__.py index 08f93b3a4..b24d567fe 100644 --- a/stock_orderpoint_uom/__init__.py +++ b/stock_orderpoint_uom/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2016 Eficent Business and IT Consulting Services S.L. +# Copyright 2016-17 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). diff --git a/stock_orderpoint_uom/__openerp__.py b/stock_orderpoint_uom/__manifest__.py similarity index 78% rename from stock_orderpoint_uom/__openerp__.py rename to stock_orderpoint_uom/__manifest__.py index 2b381a532..bafbbca54 100644 --- a/stock_orderpoint_uom/__openerp__.py +++ b/stock_orderpoint_uom/__manifest__.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- -# Copyright 2016 Eficent Business and IT Consulting Services S.L. +# Copyright 2016-17 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": "Stock Orderpoint UoM", "summary": "Allows to create procurement orders in the UoM indicated in " "the orderpoint", - "version": "9.0.1.0.0", - "author": "Eficent Business and IT Consulting Services S.L," + "version": "10.0.1.0.0", + "author": "Eficent, " "Odoo Community Association (OCA)", "website": "https://www.odoo-community.org", "category": "Warehouse Management", diff --git a/stock_orderpoint_uom/models/__init__.py b/stock_orderpoint_uom/models/__init__.py index 508e43109..1007959bb 100644 --- a/stock_orderpoint_uom/models/__init__.py +++ b/stock_orderpoint_uom/models/__init__.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2016 Eficent Business and IT Consulting Services S.L. +# Copyright 2016-17 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). from . import stock_warehouse_orderpoint -from . import procurement_order diff --git a/stock_orderpoint_uom/models/procurement_order.py b/stock_orderpoint_uom/models/procurement_order.py deleted file mode 100644 index 250faf038..000000000 --- a/stock_orderpoint_uom/models/procurement_order.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2016 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). - -from openerp import api, models - - -class ProcurementOrder(models.Model): - _inherit = "procurement.order" - - @api.model - def _prepare_orderpoint_procurement(self, orderpoint, product_qty): - res = super(ProcurementOrder, self)._prepare_orderpoint_procurement( - orderpoint, product_qty) - if orderpoint.procure_uom_id: - res['product_qty'] = orderpoint.procure_uom_id._compute_qty( - orderpoint.product_id.uom_id.id, product_qty, - orderpoint.procure_uom_id.id) - res['product_uom'] = orderpoint.procure_uom_id.id - return res diff --git a/stock_orderpoint_uom/models/stock_warehouse_orderpoint.py b/stock_orderpoint_uom/models/stock_warehouse_orderpoint.py index 099ff5dcc..c12203739 100644 --- a/stock_orderpoint_uom/models/stock_warehouse_orderpoint.py +++ b/stock_orderpoint_uom/models/stock_warehouse_orderpoint.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- -# Copyright 2016 Eficent Business and IT Consulting Services S.L. +# Copyright 2016-17 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). -from openerp import api, fields, models, _ -from openerp.exceptions import UserError +from odoo import api, fields, models, _ +from odoo.exceptions import UserError -class StockWarehouseOrderpoint(models.Model): +class Orderpoint(models.Model): _inherit = "stock.warehouse.orderpoint" procure_uom_id = fields.Many2one(comodel_name='product.uom', @@ -25,3 +25,14 @@ class StockWarehouseOrderpoint(models.Model): 'the procurement Unit of Measure must be in the ' 'same category.')) return True + + @api.model + def _prepare_procurement_values(self, product_qty, + date=False, group=False): + res = super(Orderpoint, self)._prepare_procurement_values( + product_qty, date, group) + if self.procure_uom_id: + res['product_qty'] = self.product_uom._compute_quantity( + product_qty, self.procure_uom_id) + res['product_uom'] = self.procure_uom_id.id + return res diff --git a/stock_orderpoint_uom/tests/__init__.py b/stock_orderpoint_uom/tests/__init__.py index 8ab7b3f74..09e60ed30 100644 --- a/stock_orderpoint_uom/tests/__init__.py +++ b/stock_orderpoint_uom/tests/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2016 Eficent Business and IT Consulting Services S.L. +# Copyright 2016-17 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). diff --git a/stock_orderpoint_uom/tests/test_stock_orderpoint_procure_uom.py b/stock_orderpoint_uom/tests/test_stock_orderpoint_procure_uom.py index b59453679..06862ff53 100644 --- a/stock_orderpoint_uom/tests/test_stock_orderpoint_procure_uom.py +++ b/stock_orderpoint_uom/tests/test_stock_orderpoint_procure_uom.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- -# Copyright 2016 Eficent Business and IT Consulting Services S.L. +# Copyright 2016-17 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). -import openerp.tests.common as common -from openerp.tools import mute_logger -from openerp.exceptions import ValidationError +import odoo.tests.common as common +from odoo.tools import mute_logger +from odoo.exceptions import ValidationError class TestStockOrderpointProcureUom(common.TransactionCase):