From c79f38f5cb9c1afa65f2c4549332e93b22950d47 Mon Sep 17 00:00:00 2001 From: Joan Sisquella Date: Mon, 20 Jan 2020 15:25:32 +0100 Subject: [PATCH] [MIG] stock_orderpoint_manual_procurement: Migration to 13.0 --- .../README.rst | 17 +++-- .../__manifest__.py | 7 +- .../demo/product.xml | 6 +- .../stock_orderpoint_manual_procurement.pot | 14 ++-- .../i18n/zh_CN.po | 4 +- .../models/stock_warehouse_orderpoint.py | 11 +-- .../readme/CONTRIBUTORS.rst | 5 +- ...orderpoint_manual_procurement_security.xml | 12 +-- .../static/description/index.html | 13 ++-- ...est_stock_orderpoint_manual_procurement.py | 14 ++-- .../views/stock_warehouse_orderpoint_view.xml | 20 ++--- .../wizards/make_procurement_orderpoint.py | 24 +++--- .../make_procurement_orderpoint_view.xml | 74 +++++++++++-------- 13 files changed, 117 insertions(+), 104 deletions(-) diff --git a/stock_orderpoint_manual_procurement/README.rst b/stock_orderpoint_manual_procurement/README.rst index 889f6097d..1a67e5213 100644 --- a/stock_orderpoint_manual_procurement/README.rst +++ b/stock_orderpoint_manual_procurement/README.rst @@ -14,13 +14,13 @@ Stock Orderpoint Manual Procurement :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github - :target: https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_orderpoint_manual_procurement + :target: https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_orderpoint_manual_procurement :alt: OCA/stock-logistics-warehouse .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_orderpoint_manual_procurement + :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-13-0/stock-logistics-warehouse-13-0-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/153/12.0 + :target: https://runbot.odoo-community.org/runbot/153/13.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -56,7 +56,7 @@ 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -66,15 +66,16 @@ Credits Authors ~~~~~~~ -* Eficent +* ForgeFlow Contributors ~~~~~~~~~~~~ -* Jordi Ballester Alomar -* Lois Rilo Antelo +* Jordi Ballester Alomar +* Lois Rilo Antelo * Bhavesh Odedra * Kitti Upariphutthiphong +* Joan Sisquella Andrés Maintainers ~~~~~~~~~~~ @@ -89,6 +90,6 @@ 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/stock-logistics-warehouse `_ project on GitHub. +This module is part of the `OCA/stock-logistics-warehouse `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_orderpoint_manual_procurement/__manifest__.py b/stock_orderpoint_manual_procurement/__manifest__.py index 1d394892e..7cb483876 100644 --- a/stock_orderpoint_manual_procurement/__manifest__.py +++ b/stock_orderpoint_manual_procurement/__manifest__.py @@ -1,13 +1,12 @@ -# Copyright 2016-17 Eficent Business and IT Consulting Services S.L. -# (http://www.eficent.com) +# Copyright 2016-20 ForgeFlow S.L. (https://www.forgeflow.com) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "Stock Orderpoint Manual Procurement", "summary": "Allows to create procurement orders from orderpoints instead " "of relying only on the scheduler.", - "version": "12.0.1.1.0", - "author": "Eficent, " "Odoo Community Association (OCA)", + "version": "13.0.1.0.0", + "author": "ForgeFlow, Odoo Community Association (OCA)", "website": "https://github.com/OCA/stock-logistics-warehouse", "category": "Warehouse Management", "depends": ["purchase_stock"], diff --git a/stock_orderpoint_manual_procurement/demo/product.xml b/stock_orderpoint_manual_procurement/demo/product.xml index a2831566c..bd9a8997f 100644 --- a/stock_orderpoint_manual_procurement/demo/product.xml +++ b/stock_orderpoint_manual_procurement/demo/product.xml @@ -1,8 +1,8 @@ - + - - + + 3 1 72 diff --git a/stock_orderpoint_manual_procurement/i18n/stock_orderpoint_manual_procurement.pot b/stock_orderpoint_manual_procurement/i18n/stock_orderpoint_manual_procurement.pot index 074a913ff..a958db69a 100644 --- a/stock_orderpoint_manual_procurement/i18n/stock_orderpoint_manual_procurement.pot +++ b/stock_orderpoint_manual_procurement/i18n/stock_orderpoint_manual_procurement.pot @@ -1,12 +1,12 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * stock_orderpoint_manual_procurement +# * stock_orderpoint_manual_procurement # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 13.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: <>\n" +"Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -105,7 +105,7 @@ msgid "Minimum Inventory Rule" msgstr "" #. module: stock_orderpoint_manual_procurement -#: code:addons/stock_orderpoint_manual_procurement/wizards/make_procurement_orderpoint.py:72 +#: code:addons/stock_orderpoint_manual_procurement/wizards/make_procurement_orderpoint.py:0 #, python-format msgid "No reordering rule found!" msgstr "" @@ -143,7 +143,7 @@ msgid "Quantity" msgstr "" #. module: stock_orderpoint_manual_procurement -#: code:addons/stock_orderpoint_manual_procurement/wizards/make_procurement_orderpoint.py:70 +#: code:addons/stock_orderpoint_manual_procurement/wizards/make_procurement_orderpoint.py:0 #, python-format msgid "Quantity must be positive." msgstr "" @@ -172,7 +172,8 @@ msgstr "" #. module: stock_orderpoint_manual_procurement #: model_terms:ir.ui.view,arch_db:stock_orderpoint_manual_procurement.view_make_procure_without_security #: model_terms:ir.ui.view,arch_db:stock_orderpoint_manual_procurement.view_make_procurment_buffer_wizard -msgid "Use this assistant to generate a procurement request for this\n" +msgid "" +"Use this assistant to generate a procurement request for this\n" " stock buffer. According to the product configuration,\n" " this may trigger a draft purchase order, a manufacturing\n" " order or a transfer picking." @@ -187,4 +188,3 @@ msgstr "" #: model:ir.model.fields,field_description:stock_orderpoint_manual_procurement.field_make_procurement_orderpoint_item__wiz_id msgid "Wizard" msgstr "" - diff --git a/stock_orderpoint_manual_procurement/i18n/zh_CN.po b/stock_orderpoint_manual_procurement/i18n/zh_CN.po index 1958753fb..e0cfed55b 100644 --- a/stock_orderpoint_manual_procurement/i18n/zh_CN.po +++ b/stock_orderpoint_manual_procurement/i18n/zh_CN.po @@ -108,7 +108,7 @@ msgid "Minimum Inventory Rule" msgstr "最小库存规则" #. module: stock_orderpoint_manual_procurement -#: code:addons/stock_orderpoint_manual_procurement/wizards/make_procurement_orderpoint.py:72 +#: code:addons/stock_orderpoint_manual_procurement/wizards/make_procurement_orderpoint.py:0 #, python-format msgid "No reordering rule found!" msgstr "找不到重新订购规则!" @@ -146,7 +146,7 @@ msgid "Quantity" msgstr "数量" #. module: stock_orderpoint_manual_procurement -#: code:addons/stock_orderpoint_manual_procurement/wizards/make_procurement_orderpoint.py:70 +#: code:addons/stock_orderpoint_manual_procurement/wizards/make_procurement_orderpoint.py:0 #, python-format msgid "Quantity must be positive." msgstr "数量必须为正数。" diff --git a/stock_orderpoint_manual_procurement/models/stock_warehouse_orderpoint.py b/stock_orderpoint_manual_procurement/models/stock_warehouse_orderpoint.py index ebcaae70a..81d8dc5d6 100644 --- a/stock_orderpoint_manual_procurement/models/stock_warehouse_orderpoint.py +++ b/stock_orderpoint_manual_procurement/models/stock_warehouse_orderpoint.py @@ -1,5 +1,4 @@ -# Copyright 2016-17 Eficent Business and IT Consulting Services S.L. -# (http://www.eficent.com) +# Copyright 2016-20 ForgeFlow S.L. (https://www.forgeflow.com) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from datetime import datetime @@ -7,10 +6,6 @@ from datetime import datetime from odoo import api, fields, models from odoo.tools import float_compare, float_round -from odoo.addons import decimal_precision as dp - -UNIT = dp.get_precision("Product Unit of Measure") - class StockWarehouseOrderpoint(models.Model): _inherit = "stock.warehouse.orderpoint" @@ -18,13 +13,12 @@ class StockWarehouseOrderpoint(models.Model): procure_recommended_qty = fields.Float( string="Procure Recommendation", compute="_compute_procure_recommended", - digits=UNIT, + digits="Product Unit of Measure", ) procure_recommended_date = fields.Date( string="Recommended Request Date", compute="_compute_procure_recommended" ) - @api.multi def _get_procure_recommended_qty(self, virtual_qty, op_qtys): self.ensure_one() procure_recommended_qty = 0.0 @@ -45,7 +39,6 @@ class StockWarehouseOrderpoint(models.Model): procure_recommended_qty = qty_rounded return procure_recommended_qty - @api.multi @api.depends("product_min_qty", "product_id", "qty_multiple") def _compute_procure_recommended(self): op_qtys = self._quantity_in_progress() diff --git a/stock_orderpoint_manual_procurement/readme/CONTRIBUTORS.rst b/stock_orderpoint_manual_procurement/readme/CONTRIBUTORS.rst index 72c4da711..2f6d749d2 100644 --- a/stock_orderpoint_manual_procurement/readme/CONTRIBUTORS.rst +++ b/stock_orderpoint_manual_procurement/readme/CONTRIBUTORS.rst @@ -1,4 +1,5 @@ -* Jordi Ballester Alomar -* Lois Rilo Antelo +* Jordi Ballester Alomar +* Lois Rilo Antelo * Bhavesh Odedra * Kitti Upariphutthiphong +* Joan Sisquella Andrés diff --git a/stock_orderpoint_manual_procurement/security/stock_orderpoint_manual_procurement_security.xml b/stock_orderpoint_manual_procurement/security/stock_orderpoint_manual_procurement_security.xml index 766864865..56bd905b4 100644 --- a/stock_orderpoint_manual_procurement/security/stock_orderpoint_manual_procurement_security.xml +++ b/stock_orderpoint_manual_procurement/security/stock_orderpoint_manual_procurement_security.xml @@ -1,10 +1,10 @@ - + - - Change quantity in manual procurements from reordering rules - - + Change quantity in manual procurements from reordering rules + + - diff --git a/stock_orderpoint_manual_procurement/static/description/index.html b/stock_orderpoint_manual_procurement/static/description/index.html index d4e565810..daec54b45 100644 --- a/stock_orderpoint_manual_procurement/static/description/index.html +++ b/stock_orderpoint_manual_procurement/static/description/index.html @@ -367,7 +367,7 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/stock-logistics-warehouse Translate me on Weblate Try me on Runbot

+

Beta License: AGPL-3 OCA/stock-logistics-warehouse Translate me on Weblate Try me on Runbot

This module allows users to manually start procurements from the list of reordering rules, based on the quantity that is recommended to be procured.

Table of contents

@@ -403,7 +403,7 @@ procurement unit of measure indicated in the reordering rule.

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.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -411,16 +411,17 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

Authors

    -
  • Eficent
  • +
  • ForgeFlow

Contributors

@@ -430,7 +431,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

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/stock-logistics-warehouse project on GitHub.

+

This module is part of the OCA/stock-logistics-warehouse project on GitHub.

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

diff --git a/stock_orderpoint_manual_procurement/tests/test_stock_orderpoint_manual_procurement.py b/stock_orderpoint_manual_procurement/tests/test_stock_orderpoint_manual_procurement.py index 81e37700a..2d500d5db 100644 --- a/stock_orderpoint_manual_procurement/tests/test_stock_orderpoint_manual_procurement.py +++ b/stock_orderpoint_manual_procurement/tests/test_stock_orderpoint_manual_procurement.py @@ -1,5 +1,4 @@ -# Copyright 2016-17 Eficent Business and IT Consulting Services S.L. -# (http://www.eficent.com) +# Copyright 2016-20 ForgeFlow S.L. (https://www.forgeflow.com) # Copyright 2016 Serpent Consulting Services Pvt. Ltd. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). @@ -58,7 +57,7 @@ class TestStockWarehouseOrderpoint(common.TransactionCase): # Add default quantity quantity = 20.00 - self._update_product_qty(self.product, self.location, quantity) + self._update_product_qty(self.product, quantity) # Create Reordering Rule self.reorder = self.create_orderpoint() @@ -97,12 +96,12 @@ class TestStockWarehouseOrderpoint(common.TransactionCase): ) return product - def _update_product_qty(self, product, location, quantity): + def _update_product_qty(self, product, quantity): """Update Product quantity.""" change_product_qty = self.stock_change_model.create( { - "location_id": location.id, "product_id": product.id, + "product_tmpl_id": product.product_tmpl_id.id, "new_quantity": quantity, } ) @@ -111,7 +110,7 @@ class TestStockWarehouseOrderpoint(common.TransactionCase): def create_orderpoint(self): """Create a Reordering Rule""" - reorder = self.reordering_rule_model.sudo(self.user).create( + reorder = self.reordering_rule_model.with_user(self.user).create( { "name": "Order-point", "product_id": self.product.id, @@ -130,7 +129,7 @@ class TestStockWarehouseOrderpoint(common.TransactionCase): "active_id": self.reorder.id, } wizard = ( - self.make_procurement_orderpoint_model.sudo(self.user) + self.make_procurement_orderpoint_model.with_user(self.user) .with_context(context) .create({}) ) @@ -153,6 +152,7 @@ class TestStockWarehouseOrderpoint(common.TransactionCase): [("orderpoint_id", "=", self.reorder.id), ("order_id", "=", purchase.id)] ) self.assertEquals(len(purchase_line), 1) + self.reorder._compute_procure_recommended() self.assertNotEqual( self.reorder.procure_recommended_qty, purchase_line.product_qty ) diff --git a/stock_orderpoint_manual_procurement/views/stock_warehouse_orderpoint_view.xml b/stock_orderpoint_manual_procurement/views/stock_warehouse_orderpoint_view.xml index 1088e2840..834331ffc 100644 --- a/stock_orderpoint_manual_procurement/views/stock_warehouse_orderpoint_view.xml +++ b/stock_orderpoint_manual_procurement/views/stock_warehouse_orderpoint_view.xml @@ -1,20 +1,20 @@ - + - stock.warehouse.orderpoint.tree stock.warehouse.orderpoint - + - - -