From e19decc57fb93820d8e5dbed0e15b8eef0c131ef Mon Sep 17 00:00:00 2001 From: Antoni Marroig Campomar Date: Wed, 20 Nov 2024 15:42:16 +0100 Subject: [PATCH] [MIG] pos_analytic_by_config: Migration to 18.0 --- pos_analytic_by_config/README.rst | 10 ++++----- pos_analytic_by_config/__manifest__.py | 2 +- .../static/description/index.html | 6 +++--- .../tests/test_pos_analytic_by_config.py | 21 ++++++++++++------- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/pos_analytic_by_config/README.rst b/pos_analytic_by_config/README.rst index 9b1484d39b..3d01730701 100644 --- a/pos_analytic_by_config/README.rst +++ b/pos_analytic_by_config/README.rst @@ -17,13 +17,13 @@ POS Analytic Config :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--analytic-lightgray.png?logo=github - :target: https://github.com/OCA/account-analytic/tree/17.0/pos_analytic_by_config + :target: https://github.com/OCA/account-analytic/tree/18.0/pos_analytic_by_config :alt: OCA/account-analytic .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/account-analytic-17-0/account-analytic-17-0-pos_analytic_by_config + :target: https://translation.odoo-community.org/projects/account-analytic-18-0/account-analytic-18-0-pos_analytic_by_config :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/account-analytic&target_branch=17.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/account-analytic&target_branch=18.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -69,7 +69,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. @@ -112,6 +112,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/account-analytic `_ project on GitHub. +This module is part of the `OCA/account-analytic `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/pos_analytic_by_config/__manifest__.py b/pos_analytic_by_config/__manifest__.py index 4649d0d37b..0d6d2022f4 100644 --- a/pos_analytic_by_config/__manifest__.py +++ b/pos_analytic_by_config/__manifest__.py @@ -7,7 +7,7 @@ "author": "ACSONE SA/NV, Tecnativa, Odoo Community Association (OCA)", "website": "https://github.com/OCA/account-analytic", "category": "Point Of Sale, Accounting", - "version": "17.0.1.0.0", + "version": "18.0.1.0.0", "license": "AGPL-3", "depends": ["point_of_sale"], "data": [ diff --git a/pos_analytic_by_config/static/description/index.html b/pos_analytic_by_config/static/description/index.html index 795b9ecd75..7479512429 100644 --- a/pos_analytic_by_config/static/description/index.html +++ b/pos_analytic_by_config/static/description/index.html @@ -369,7 +369,7 @@

POS Analytic Config

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:2f84d31df29ec4fe16b6edf8fef7c20679377c5798656455ce2540aa48f0b176 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/account-analytic Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/account-analytic Translate me on Weblate Try me on Runboat

This module allows to generate analytic distributions from the PoS orders.

Table of contents

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

@@ -459,7 +459,7 @@

Maintainers

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/account-analytic project on GitHub.

+

This module is part of the OCA/account-analytic project on GitHub.

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

diff --git a/pos_analytic_by_config/tests/test_pos_analytic_by_config.py b/pos_analytic_by_config/tests/test_pos_analytic_by_config.py index 339513f858..2b833f0c4b 100644 --- a/pos_analytic_by_config/tests/test_pos_analytic_by_config.py +++ b/pos_analytic_by_config/tests/test_pos_analytic_by_config.py @@ -1,6 +1,7 @@ # Copyright 2015 ACSONE SA/NV # Copyright 2024 Tecnativa - David Vidal # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + from odoo.tests import tagged from odoo.addons.point_of_sale.tests.common import TestPointOfSaleCommon, TestPoSCommon @@ -46,8 +47,8 @@ def setUpClass(cls): def _create_order(self): order_data = self.create_ui_order_data([(self.product_a, 1)]) - order = self.env["pos.order"].create_from_ui([order_data]) - self.pos_order = self.env["pos.order"].browse(order[0]["id"]) + order = self.env["pos.order"].sync_from_ui([order_data]) + self.pos_order = self.env["pos.order"].browse(int(order["pos.order"][0]["id"])) def _close_session(self, amount_paid): self.session.post_closing_cash_details(amount_paid) @@ -58,13 +59,17 @@ def test_order_simple_receipt(self): self._create_order() aml_domain = [ ("account_id", "=", self.sales_account.id), - ("analytic_distribution", "=", {f"{self.analytic_account.id}": 100.0}), ] # There aren't lines with the analytic account yet - self.assertFalse(self.env["account.move.line"].search(aml_domain)) + self.assertFalse( + self.env["account.move.line"].search(aml_domain).analytic_distribution + ) self._close_session(self.pos_order.amount_total) # There they are - self.assertEqual(len(self.env["account.move.line"].search(aml_domain)), 1) + self.assertEqual( + self.env["account.move.line"].search(aml_domain).analytic_distribution, + {str(self.analytic_account.id): 100.0}, + ) def test_order_invoice(self): """Tickets with invoice are posted prior to session reconcilation""" @@ -73,7 +78,6 @@ def test_order_invoice(self): aml_domain = [ ("account_id", "=", self.sales_account.id), ("product_id", "=", self.product_a.id), - ("analytic_distribution", "=", {f"{self.analytic_account.id}": 100.0}), ] lines = self.env["account.move.line"].search(aml_domain) # There aren't lines with the analytic account yet @@ -81,4 +85,7 @@ def test_order_invoice(self): self.pos_order.action_pos_order_invoice() lines = self.env["account.move.line"].search(aml_domain) # There they are - self.assertEqual(len(lines), 1) + self.assertEqual( + self.env["account.move.line"].search(aml_domain).analytic_distribution, + {str(self.analytic_account.id): 100.0}, + )