diff --git a/stock_secondary_unit/README.rst b/stock_secondary_unit/README.rst index 5d27fbffd..db88f9c1e 100644 --- a/stock_secondary_unit/README.rst +++ b/stock_secondary_unit/README.rst @@ -7,7 +7,7 @@ Stock Secondary Unit !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:592c2a28d87ad4487df90a96904d06388620f0305840bff125f0dbd5c0dcb91a + !! source digest: sha256:223ef04b21ff22ef2ebf18865952a5de5099e9a5c643632debfcf530c7e2fea7 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png @@ -17,13 +17,13 @@ Stock Secondary Unit :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/15.0/stock_secondary_unit + :target: https://github.com/OCA/stock-logistics-warehouse/tree/16.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-15-0/stock-logistics-warehouse-15-0-stock_secondary_unit + :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-16-0/stock-logistics-warehouse-16-0-stock_secondary_unit :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-warehouse&target_branch=15.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-warehouse&target_branch=16.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -54,7 +54,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 to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -91,6 +91,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 4ae4d3be8..7ac653761 100644 --- a/stock_secondary_unit/__manifest__.py +++ b/stock_secondary_unit/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Stock Secondary Unit", "summary": "Get product quantities in a secondary unit", - "version": "15.0.2.1.0", + "version": "16.0.1.0.0", "development_status": "Production/Stable", "category": "stock", "website": "https://github.com/OCA/stock-logistics-warehouse", diff --git a/stock_secondary_unit/models/stock_move.py b/stock_secondary_unit/models/stock_move.py index 16580bf47..22cd108aa 100644 --- a/stock_secondary_unit/models/stock_move.py +++ b/stock_secondary_unit/models/stock_move.py @@ -12,7 +12,11 @@ class StockMove(models.Model): } product_uom_qty = fields.Float( - store=True, readonly=False, compute="_compute_product_uom_qty", copy=True + store=True, + readonly=False, + compute="_compute_product_uom_qty", + copy=True, + precompute=True, ) @api.depends("secondary_uom_qty", "secondary_uom_id") @@ -42,7 +46,9 @@ class StockMoveLine(models.Model): _name = "stock.move.line" _secondary_unit_fields = {"qty_field": "qty_done", "uom_field": "product_uom_id"} - qty_done = fields.Float(store=True, readonly=False, compute="_compute_qty_done") + qty_done = fields.Float( + store=True, readonly=False, compute="_compute_qty_done", precompute=True + ) @api.model def create(self, vals): diff --git a/stock_secondary_unit/static/description/index.html b/stock_secondary_unit/static/description/index.html index fce2e24bf..ca8934cf0 100644 --- a/stock_secondary_unit/static/description/index.html +++ b/stock_secondary_unit/static/description/index.html @@ -1,3 +1,4 @@ + @@ -366,9 +367,9 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:592c2a28d87ad4487df90a96904d06388620f0305840bff125f0dbd5c0dcb91a +!! source digest: sha256:223ef04b21ff22ef2ebf18865952a5de5099e9a5c643632debfcf530c7e2fea7 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Production/Stable License: AGPL-3 OCA/stock-logistics-warehouse Translate me on Weblate Try me on Runboat

+

Production/Stable License: AGPL-3 OCA/stock-logistics-warehouse Translate me on Weblate Try me on Runboat

This module extends the functionality of stock module to allow define other units with their conversion factor.

Table of contents

@@ -401,7 +402,7 @@ other units with their conversion factor.

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 to smash it by providing a detailed and welcomed -feedback.

+feedback.

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

@@ -433,7 +434,7 @@ If you spotted it first, help us to smash 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_secondary_unit/tests/test_stock_secondary_unit.py b/stock_secondary_unit/tests/test_stock_secondary_unit.py index 3251db343..3899ac44b 100644 --- a/stock_secondary_unit/tests/test_stock_secondary_unit.py +++ b/stock_secondary_unit/tests/test_stock_secondary_unit.py @@ -2,21 +2,14 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo.tests import Form, TransactionCase, tagged +from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT + @tagged("-at_install", "post_install") class TestProductSecondaryUnit(TransactionCase): @classmethod def setUpClass(cls): super().setUpClass() - # Remove this variable in v16 and put instead: - # from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT - DISABLED_MAIL_CONTEXT = { - "tracking_disable": True, - "mail_create_nolog": True, - "mail_create_nosubscribe": True, - "mail_notrack": True, - "no_reset_password": True, - } cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT)) # Active multiple units of measure security group for user cls.env.user.groups_id = [(4, cls.env.ref("uom.group_uom").id)] @@ -148,10 +141,10 @@ class TestProductSecondaryUnit(TransactionCase): delivery_order = StockPicking.create(do_vals) delivery_order.action_confirm() # Move is merged into 1 line for both stock.move and stock.move.line - self.assertEqual(len(delivery_order.move_lines), 1) + self.assertEqual(len(delivery_order.move_ids), 1) self.assertEqual(len(delivery_order.move_line_ids), 1) # Qty merged to 20, and secondary unit qty is 40line - uom_qty = sum(delivery_order.move_lines.mapped("product_uom_qty")) + uom_qty = sum(delivery_order.move_ids.mapped("product_uom_qty")) secondary_uom_qty = sum( delivery_order.move_line_ids.mapped("secondary_uom_qty") ) @@ -218,7 +211,7 @@ class TestProductSecondaryUnit(TransactionCase): move.secondary_uom_id = product.product_tmpl_id.secondary_uom_ids[1] picking = picking_form.save() picking.action_confirm() - self.assertEqual(len(picking.move_lines), 2) + self.assertEqual(len(picking.move_ids), 2) def test_secondary_unit_merge_move_same_uom(self): product = self.product_template.product_variant_ids[0] @@ -238,5 +231,5 @@ class TestProductSecondaryUnit(TransactionCase): move.secondary_uom_id = product.product_tmpl_id.secondary_uom_ids[0] picking = picking_form.save() picking.action_confirm() - self.assertEqual(len(picking.move_lines), 1) - self.assertEqual(picking.move_lines.secondary_uom_qty, 2) + self.assertEqual(len(picking.move_ids), 1) + self.assertEqual(picking.move_ids.secondary_uom_qty, 2) diff --git a/stock_secondary_unit/views/product_views.xml b/stock_secondary_unit/views/product_views.xml index 2f9b234aa..40bc4b378 100644 --- a/stock_secondary_unit/views/product_views.xml +++ b/stock_secondary_unit/views/product_views.xml @@ -6,10 +6,9 @@ Product template Secondary Unit product.template - - + -