diff --git a/product_cost_price_avco_sync/README.rst b/product_cost_price_avco_sync/README.rst index d51af20f2759..61fdaf283313 100644 --- a/product_cost_price_avco_sync/README.rst +++ b/product_cost_price_avco_sync/README.rst @@ -7,7 +7,7 @@ Product cost price avco sync !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:9eb6a763cc30fe3f2fc95c5be5d6451faa46ac5a6b45723ce306e46445fb8db1 + !! source digest: sha256:f07176b3a7502ceb2553fc8c5613eb3680f27cd6fa3a28d492b55a6fcee661c1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png @@ -17,13 +17,13 @@ Product cost price avco sync :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--workflow-lightgray.png?logo=github - :target: https://github.com/OCA/stock-logistics-workflow/tree/15.0/product_cost_price_avco_sync + :target: https://github.com/OCA/stock-logistics-workflow/tree/16.0/product_cost_price_avco_sync :alt: OCA/stock-logistics-workflow .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/stock-logistics-workflow-15-0/stock-logistics-workflow-15-0-product_cost_price_avco_sync + :target: https://translation.odoo-community.org/projects/stock-logistics-workflow-16-0/stock-logistics-workflow-16-0-product_cost_price_avco_sync :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-workflow&target_branch=15.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-workflow&target_branch=16.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -42,7 +42,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. @@ -87,6 +87,6 @@ Current `maintainers `__: |maintainer-carlosdauden| |maintainer-sergio-teruel| -This module is part of the `OCA/stock-logistics-workflow `_ project on GitHub. +This module is part of the `OCA/stock-logistics-workflow `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/product_cost_price_avco_sync/__manifest__.py b/product_cost_price_avco_sync/__manifest__.py index b9ba4a572793..df6620d9a8e0 100644 --- a/product_cost_price_avco_sync/__manifest__.py +++ b/product_cost_price_avco_sync/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Product cost price avco sync", "summary": "Set product cost price from updated moves", - "version": "15.0.1.0.2", + "version": "16.0.1.0.0", "development_status": "Production/Stable", "category": "Stock", "website": "https://github.com/OCA/stock-logistics-workflow", diff --git a/product_cost_price_avco_sync/static/description/index.html b/product_cost_price_avco_sync/static/description/index.html index 60d56da8a69b..6966069ffd43 100644 --- a/product_cost_price_avco_sync/static/description/index.html +++ b/product_cost_price_avco_sync/static/description/index.html @@ -367,9 +367,9 @@

Product cost price avco sync

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:9eb6a763cc30fe3f2fc95c5be5d6451faa46ac5a6b45723ce306e46445fb8db1 +!! source digest: sha256:f07176b3a7502ceb2553fc8c5613eb3680f27cd6fa3a28d492b55a6fcee661c1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

+

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

This module allows to sync cost price products with average cost method from stock moves price unit.

Table of contents

@@ -389,7 +389,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.

@@ -423,7 +423,7 @@

Maintainers

promote its widespread use.

Current maintainers:

carlosdauden sergio-teruel

-

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

+

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

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

diff --git a/product_cost_price_avco_sync/tests/test_product_cost_price_avco_sync.py b/product_cost_price_avco_sync/tests/test_product_cost_price_avco_sync.py index 186666dac40e..d78dc5b42ca6 100644 --- a/product_cost_price_avco_sync/tests/test_product_cost_price_avco_sync.py +++ b/product_cost_price_avco_sync/tests/test_product_cost_price_avco_sync.py @@ -6,6 +6,8 @@ from odoo.tests.common import TransactionCase, tagged +from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT + _logger = logging.getLogger(__name__) @@ -14,15 +16,6 @@ class TestProductCostPriceAvcoSync(TransactionCase): @classmethod def setUpClass(cls): super(TestProductCostPriceAvcoSync, cls).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)) cls.StockPicking = cls.env["stock.picking"] cls.supplier_location = cls.env.ref("stock.stock_location_suppliers") @@ -48,7 +41,7 @@ def setUpClass(cls): "picking_type_id": cls.picking_type_in.id, "location_id": cls.supplier_location.id, "location_dest_id": cls.stock_location.id, - "move_lines": [ + "move_ids": [ ( 0, 0, @@ -70,7 +63,7 @@ def setUpClass(cls): "picking_type_id": cls.picking_type_out.id, "location_id": cls.stock_location.id, "location_dest_id": cls.customer_location.id, - "move_lines": [ + "move_ids": [ ( 0, 0, @@ -88,7 +81,7 @@ def setUpClass(cls): ) def _test_sync_cost_price(self): - move_in = self.picking_in.move_lines[:1] + move_in = self.picking_in.move_ids[:1] move_in.product_uom_qty = 100 move_in.price_unit = 5.0 move_in.quantity_done = move_in.product_uom_qty @@ -104,20 +97,20 @@ def _test_sync_cost_price(self): sleep(1) picking_in_2 = self.picking_in.copy() - move_in_2 = picking_in_2.move_lines[:1] + move_in_2 = picking_in_2.move_ids[:1] move_in_2.product_uom_qty = 10.0 move_in_2.quantity_done = move_in_2.product_uom_qty picking_in_2._action_done() move_in_2.date = "2019-10-02 00:00:00" sleep(1) - move_out = self.picking_out.move_lines[:1] + move_out = self.picking_out.move_ids[:1] move_out.quantity_done = move_out.product_uom_qty self.picking_out._action_done() move_out.date = "2019-10-03 00:00:00" picking_out_2 = self.picking_out.copy() - move_out_2 = picking_out_2.move_lines[:1] + move_out_2 = picking_out_2.move_ids[:1] move_out_2.quantity_done = move_out_2.product_uom_qty picking_out_2._action_done() move_out_2.date = "2019-10-04 00:00:00" @@ -154,31 +147,31 @@ def _test_sync_cost_price(self): def _test_sync_cost_price_and_history(self): company_id = self.picking_in.company_id.id - move_in = self.picking_in.move_lines[:1] + move_in = self.picking_in.move_ids[:1] move_in.quantity_done = move_in.product_uom_qty self.picking_in._action_done() move_in.date = "2019-10-01 00:00:00" - move_out = self.picking_out.move_lines[:1] + move_out = self.picking_out.move_ids[:1] move_out.quantity_done = move_out.product_uom_qty self.picking_out._action_done() move_out.date = "2019-10-01 01:00:00" picking_in_2 = self.picking_in.copy() - move_in_2 = picking_in_2.move_lines[:1] + move_in_2 = picking_in_2.move_ids[:1] move_in_2.quantity_done = move_in_2.product_uom_qty picking_in_2._action_done() move_in_2.date = "2019-10-01 02:00:00" picking_out_2 = self.picking_out.copy() - move_out_2 = picking_out_2.move_lines[:1] + move_out_2 = picking_out_2.move_ids[:1] move_out_2.product_uom_qty = 15 move_out_2.quantity_done = move_out_2.product_uom_qty picking_out_2._action_done() move_out_2.date = "2019-10-01 03:00:00" picking_in_3 = self.picking_in.copy() - move_in_3 = picking_in_3.move_lines[:1] + move_in_3 = picking_in_3.move_ids[:1] move_in_3.quantity_done = move_in_3.product_uom_qty move_in_3.price_unit = 2.0 picking_in_3._action_done() @@ -215,13 +208,13 @@ def _test_sync_cost_price_and_history(self): self.assertEqual(svl_count, 4) # TODO: Miralo que no se si es así def _test_sync_cost_price_multi_moves_done_at_same_time(self): - move_in = self.picking_in.move_lines[:1] + move_in = self.picking_in.move_ids[:1] move_in.product_uom_qty = 10 move_in.price_unit = 10.0 move_in.quantity_done = move_in.product_uom_qty picking_in_2 = self.picking_in.copy() - move_in_2 = picking_in_2.move_lines[:1] + move_in_2 = picking_in_2.move_ids[:1] move_in_2.product_uom_qty = 10.0 move_in_2.price_unit = 5.0 move_in_2.quantity_done = move_in_2.product_uom_qty @@ -245,13 +238,13 @@ def _test_sync_cost_price_multi_moves_done_at_same_time(self): def _test_change_quantiy_price(self): """Write quantity and price to zero in a stock valuation layer""" self.picking_in.action_assign() - move_in = self.picking_in.move_lines[:1] + move_in = self.picking_in.move_ids[:1] self.picking_in.move_line_ids.qty_done = move_in.product_uom_qty self.picking_in._action_done() picking_in_2 = self.picking_in.copy() picking_in_2.action_assign() - move_in_2 = picking_in_2.move_lines[:1] + move_in_2 = picking_in_2.move_ids[:1] move_in_2.product_uom_qty = 10.0 move_in_2.quantity_done = move_in_2.product_uom_qty picking_in_2._action_done() @@ -300,7 +293,7 @@ def create_picking(self, p_type="IN", qty=1.0, confirmed=True): "picking_type_id": picking_type.id, "location_id": location_id.id, "location_dest_id": location_dest_id.id, - "move_lines": [ + "move_ids": [ ( 0, 0, @@ -319,7 +312,7 @@ def create_picking(self, p_type="IN", qty=1.0, confirmed=True): ) if confirmed: picking.action_assign() - move = picking.move_lines[:1] + move = picking.move_ids[:1] picking.move_line_ids.qty_done = move.product_uom_qty picking._action_done() return picking, move @@ -455,29 +448,6 @@ def test_change_quantiy_price_xx(self): quant.quantity, quant.product_id.standard_price ) ) - # Change qty before cost - move_in_01.with_context(keep_avco_inventory=True).quantity_done = 0.0 - self.print_svl( - "After force quantity to 0 in first IN move Quant:{} Cost:{}".format( - quant.quantity, quant.product_id.standard_price - ) - ) - move_in_01.stock_valuation_layer_ids.unit_cost = 0.0 - self.print_svl( - "After force unit cost to 0 in first IN move Quant:{}".format( - quant.quantity - ) - ) - - # Restore to initial values - move_in_01.with_context(keep_avco_inventory=True).quantity_done = 10.0 - move_in_01.stock_valuation_layer_ids.unit_cost = 2.0 - self.print_svl( - "After restore initial values Quant:{} Standard Price:{}".format( - quant.quantity, quant.product_id.standard_price - ) - ) - # Change cost before quantity move_in_01.stock_valuation_layer_ids.unit_cost = 0.0 self.print_svl( @@ -485,22 +455,14 @@ def test_change_quantiy_price_xx(self): quant.quantity ) ) - move_in_01.quantity_done = 0.0 + # Change qty after cost + move_in_01.with_context(keep_avco_inventory=True).quantity_done = 0.0 self.print_svl( "After force quantity to 0 in first IN move Quant:{} Cost:{}".format( quant.quantity, quant.product_id.standard_price ) ) - # Restore to initial values - move_in_01.stock_valuation_layer_ids.unit_cost = 2.0 - move_in_01.quantity_done = 10.0 - self.print_svl( - "After restore initial values Quant:{} Standard Price:{}".format( - quant.quantity, quant.product_id.standard_price - ) - ) - def print_svl(self, char_info=""): msg_list = ["{}".format(char_info)] total_qty = total_value = 0.0