From bbfacb4883896144dce9d0008658addeaac25069 Mon Sep 17 00:00:00 2001 From: ps-tubtim Date: Wed, 18 Dec 2019 17:13:00 +0700 Subject: [PATCH] [MIG] stock_secondary_unit: Migration to 13.0 --- stock_secondary_unit/README.rst | 15 +-- stock_secondary_unit/__manifest__.py | 4 +- stock_secondary_unit/i18n/es.po | 1 - .../i18n/stock_secondary_unit.pot | 7 +- stock_secondary_unit/models/product.py | 19 ++-- stock_secondary_unit/models/stock_move.py | 6 +- stock_secondary_unit/readme/CONTRIBUTORS.rst | 1 + .../report/report_deliveryslip.xml | 36 ++++--- .../static/description/index.html | 7 +- .../tests/test_stock_secondary_unit.py | 9 +- stock_secondary_unit/views/product_views.xml | 99 ++++++++++++------- .../views/stock_move_views.xml | 37 +++++-- .../views/stock_picking_views.xml | 29 +++--- 13 files changed, 160 insertions(+), 110 deletions(-) mode change 100755 => 100644 stock_secondary_unit/report/report_deliveryslip.xml mode change 100755 => 100644 stock_secondary_unit/views/product_views.xml mode change 100755 => 100644 stock_secondary_unit/views/stock_move_views.xml mode change 100755 => 100644 stock_secondary_unit/views/stock_picking_views.xml diff --git a/stock_secondary_unit/README.rst b/stock_secondary_unit/README.rst index 4fc4c5c55..15a928c44 100644 --- a/stock_secondary_unit/README.rst +++ b/stock_secondary_unit/README.rst @@ -7,20 +7,20 @@ Stock Secondary Unit !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png +.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png :target: https://odoo-community.org/page/development-status - :alt: Beta + :alt: Production/Stable .. |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%2Fstock--logistics--warehouse-lightgray.png?logo=github - :target: https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_secondary_unit + :target: https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_secondary_unit :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_secondary_unit + :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-13-0/stock-logistics-warehouse-13-0-stock_secondary_unit :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| @@ -51,7 +51,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. @@ -69,6 +69,7 @@ Contributors * Carlos Dauden * Sergio Teruel * Kitti Upariphutthiphong +* Pimolnat Suntian Maintainers ~~~~~~~~~~~ @@ -83,6 +84,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_secondary_unit/__manifest__.py b/stock_secondary_unit/__manifest__.py index 8754a85b8..b8837a32d 100644 --- a/stock_secondary_unit/__manifest__.py +++ b/stock_secondary_unit/__manifest__.py @@ -3,8 +3,8 @@ { "name": "Stock Secondary Unit", "summary": "Get product quantities in a secondary unit", - "version": "13.0.1.0.2", - "development_status": "Beta", + "version": "13.0.1.0.0", + "development_status": "Production/Stable", "category": "stock", "website": "https://github.com/OCA/stock-logistics-warehouse", "author": "Tecnativa, Odoo Community Association (OCA)", diff --git a/stock_secondary_unit/i18n/es.po b/stock_secondary_unit/i18n/es.po index 94b0eb80e..8d6d0a8b3 100644 --- a/stock_secondary_unit/i18n/es.po +++ b/stock_secondary_unit/i18n/es.po @@ -97,7 +97,6 @@ msgstr "" #. module: stock_secondary_unit #: model:ir.model,name:stock_secondary_unit.model_stock_product_secondary_unit #, fuzzy -#| msgid "Secondary unit" msgid "Stock Product Secondary Unit" msgstr "Unidad Secundaria" diff --git a/stock_secondary_unit/i18n/stock_secondary_unit.pot b/stock_secondary_unit/i18n/stock_secondary_unit.pot index bf6fa6ff4..af04cff9f 100644 --- a/stock_secondary_unit/i18n/stock_secondary_unit.pot +++ b/stock_secondary_unit/i18n/stock_secondary_unit.pot @@ -1,12 +1,12 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * stock_secondary_unit +# * stock_secondary_unit # 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" @@ -97,4 +97,3 @@ msgstr "" #: model:ir.model,name:stock_secondary_unit.model_stock_secondary_unit_mixin msgid "Stock Secondary Unit Mixin" msgstr "" - diff --git a/stock_secondary_unit/models/product.py b/stock_secondary_unit/models/product.py index a75fc54e6..25b35cb84 100644 --- a/stock_secondary_unit/models/product.py +++ b/stock_secondary_unit/models/product.py @@ -3,8 +3,6 @@ from odoo import fields, models from odoo.tools.float_utils import float_round -from odoo.addons import decimal_precision as dp - class StockProductSecondaryUnit(models.AbstractModel): _name = "stock.product.secondary.unit" @@ -13,15 +11,20 @@ class StockProductSecondaryUnit(models.AbstractModel): secondary_unit_qty_available = fields.Float( string="Quantity On Hand (2Unit)", compute="_compute_secondary_unit_qty_available", - digits=dp.get_precision("Product Unit of Measure"), + digits="Product Unit of Measure", ) def _compute_secondary_unit_qty_available(self): - for product in self.filtered("stock_secondary_uom_id"): - qty = product.qty_available / (product.stock_secondary_uom_id.factor or 1.0) - product.secondary_unit_qty_available = float_round( - qty, precision_rounding=product.uom_id.rounding - ) + for product in self: + if not product.stock_secondary_uom_id: + product.secondary_unit_qty_available = 0.0 + else: + qty = product.qty_available / ( + product.stock_secondary_uom_id.factor or 1.0 + ) + product.secondary_unit_qty_available = float_round( + qty, precision_rounding=product.uom_id.rounding + ) class ProductTemplate(models.Model): diff --git a/stock_secondary_unit/models/stock_move.py b/stock_secondary_unit/models/stock_move.py index 3cf670d63..49821a399 100644 --- a/stock_secondary_unit/models/stock_move.py +++ b/stock_secondary_unit/models/stock_move.py @@ -3,8 +3,6 @@ from odoo import api, fields, models from odoo.tools.float_utils import float_round -from odoo.addons import decimal_precision as dp - class StockSecondaryUnitMixin(models.AbstractModel): _name = "stock.secondary.unit.mixin" @@ -14,7 +12,7 @@ class StockSecondaryUnitMixin(models.AbstractModel): comodel_name="product.secondary.unit", string="Second unit" ) secondary_uom_qty = fields.Float( - string="Secondary Qty", digits=dp.get_precision("Product Unit of Measure") + string="Secondary Qty", digits="Product Unit of Measure" ) @@ -23,7 +21,7 @@ class StockMove(models.Model): _name = "stock.move" def _merge_moves_fields(self): - res = super(StockMove, self)._merge_moves_fields() + res = super()._merge_moves_fields() res["secondary_uom_qty"] = self[-1:].secondary_uom_qty return res diff --git a/stock_secondary_unit/readme/CONTRIBUTORS.rst b/stock_secondary_unit/readme/CONTRIBUTORS.rst index 3b07d85d5..d35178a8f 100644 --- a/stock_secondary_unit/readme/CONTRIBUTORS.rst +++ b/stock_secondary_unit/readme/CONTRIBUTORS.rst @@ -1,3 +1,4 @@ * Carlos Dauden * Sergio Teruel * Kitti Upariphutthiphong +* Pimolnat Suntian diff --git a/stock_secondary_unit/report/report_deliveryslip.xml b/stock_secondary_unit/report/report_deliveryslip.xml old mode 100755 new mode 100644 index b7c7ee700..8aba6e52a --- a/stock_secondary_unit/report/report_deliveryslip.xml +++ b/stock_secondary_unit/report/report_deliveryslip.xml @@ -1,27 +1,39 @@ - + - -