From cc13374b7942f2de20acad40a7dca91e95098da6 Mon Sep 17 00:00:00 2001 From: TraiTran Date: Mon, 9 Sep 2024 09:23:08 +0700 Subject: [PATCH] [MIG] pos_cash_move_reason: Migration to 17.0 --- pos_cash_move_reason/README.rst | 9 +- pos_cash_move_reason/__manifest__.py | 3 +- pos_cash_move_reason/readme/CONFIGURE.md | 4 +- pos_cash_move_reason/readme/CONTRIBUTORS.md | 1 + pos_cash_move_reason/security/res_groups.xml | 11 --- .../static/description/index.html | 91 +++++++++---------- .../tests/test_pos_cash_move_reason.py | 10 +- .../views/view_pos_move_reason.xml | 10 +- .../views/view_pos_session.xml | 8 +- .../wizard/wizard_pos_move_reason.xml | 9 +- 10 files changed, 65 insertions(+), 91 deletions(-) delete mode 100644 pos_cash_move_reason/security/res_groups.xml diff --git a/pos_cash_move_reason/README.rst b/pos_cash_move_reason/README.rst index 30630ca551..d21a631966 100644 --- a/pos_cash_move_reason/README.rst +++ b/pos_cash_move_reason/README.rst @@ -53,22 +53,22 @@ Configuration - Go to 'Point of Sale' / 'Configuration' / 'Move Reason' -|image1| +|pos_cash_move_tree| - Create or update your PoS move Reasons. - for each reason, you can mention the concerned journal(s), (Generally the Cash Journal), and if it is a reason to 'put in' and / or to 'take out' Money. -|image2| +|pos_cash_move_form| **Note** You should have checked first 'Used in Point of Sale' for the Journals you want to enable the feature. -.. |image1| image:: https://raw.githubusercontent.com/OCA/pos/17.0/pos_cash_move_reason/static/description/pos_cash_move_tree.png -.. |image2| image:: https://raw.githubusercontent.com/OCA/pos/17.0/pos_cash_move_reason/static/description/pos_cash_move_form.png +.. |pos_cash_move_tree| image:: https://raw.githubusercontent.com/OCA/pos/17.0/pos_cash_move_reason/static/description/pos_cash_move_tree.png +.. |pos_cash_move_form| image:: https://raw.githubusercontent.com/OCA/pos/17.0/pos_cash_move_reason/static/description/pos_cash_move_form.png Usage ===== @@ -149,6 +149,7 @@ Contributors - Sylvain LE GAL - Dhara Solanki +- Tran Thanh Trai Maintainers ----------- diff --git a/pos_cash_move_reason/__manifest__.py b/pos_cash_move_reason/__manifest__.py index 42396603cc..c4b27737ed 100644 --- a/pos_cash_move_reason/__manifest__.py +++ b/pos_cash_move_reason/__manifest__.py @@ -6,12 +6,11 @@ "author": "ACSONE SA/NV," "GRAP," "Odoo Community Association (OCA)", "website": "https://github.com/OCA/pos", "category": "Point Of sale", - "version": "16.0.1.0.0", + "version": "17.0.1.0.0", "license": "AGPL-3", "depends": ["point_of_sale"], "data": [ "security/ir_rule.xml", - "security/res_groups.xml", "security/ir.model.access.csv", "views/view_pos_move_reason.xml", "views/view_pos_session.xml", diff --git a/pos_cash_move_reason/readme/CONFIGURE.md b/pos_cash_move_reason/readme/CONFIGURE.md index 587cf0deb5..40a0d05988 100644 --- a/pos_cash_move_reason/readme/CONFIGURE.md +++ b/pos_cash_move_reason/readme/CONFIGURE.md @@ -1,13 +1,13 @@ - Go to 'Point of Sale' / 'Configuration' / 'Move Reason' -![](../static/description/pos_cash_move_tree.png) +![pos_cash_move_tree](../static/description/pos_cash_move_tree.png) - Create or update your PoS move Reasons. - for each reason, you can mention the concerned journal(s), (Generally the Cash Journal), and if it is a reason to 'put in' and / or to 'take out' Money. -![](../static/description/pos_cash_move_form.png) +![pos_cash_move_form](../static/description/pos_cash_move_form.png) **Note** diff --git a/pos_cash_move_reason/readme/CONTRIBUTORS.md b/pos_cash_move_reason/readme/CONTRIBUTORS.md index 17c0087b86..f1ac3b5459 100644 --- a/pos_cash_move_reason/readme/CONTRIBUTORS.md +++ b/pos_cash_move_reason/readme/CONTRIBUTORS.md @@ -1,2 +1,3 @@ - Sylvain LE GAL \<\> - Dhara Solanki \<\> +- Tran Thanh Trai \<\> diff --git a/pos_cash_move_reason/security/res_groups.xml b/pos_cash_move_reason/security/res_groups.xml deleted file mode 100644 index a3c394470d..0000000000 --- a/pos_cash_move_reason/security/res_groups.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Use Old PoS 'Put or Take Money' Actions - - diff --git a/pos_cash_move_reason/static/description/index.html b/pos_cash_move_reason/static/description/index.html index 5630473c32..8d6f0b2b12 100644 --- a/pos_cash_move_reason/static/description/index.html +++ b/pos_cash_move_reason/static/description/index.html @@ -1,4 +1,3 @@ - @@ -9,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -275,7 +275,7 @@ margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -301,7 +301,7 @@ span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -369,19 +369,19 @@

POS cash in-out reason

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:9be2d1beeded5d8b52824fb2442f7c89f0db512626cb33386044d8c060115f83 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

-

This module allow to define some reasons for the functionality of -“Put Money In” and “Take Money Out” available in point of sale session.

-

So, with this module it’s possible to impact directly an expense or income -account which is defined on the related reasons and create according -accounting entries.

+

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

+

This module allow to define some reasons for the functionality of “Put +Money In” and “Take Money Out” available in point of sale session.

+

So, with this module it’s possible to impact directly an expense or +income account which is defined on the related reasons and create +according accounting entries.

Typical Use Case (not exhaustive)

    -
  • You want to track Bank deposit moves, using an intermediate -bank account named ‘Cash Awaiting Bank Deposit’. -(In France, for instance, “581 - Espèce en attente d’encaissement”)
  • -
  • You want to allow payments from Cash Journal to pay recurring -little expenses. (Gasoline, parking meter, etc.)
  • +
  • You want to track Bank deposit moves, using an intermediate bank +account named ‘Cash Awaiting Bank Deposit’. (In France, for instance, +“581 - Espèce en attente d’encaissement”)
  • +
  • You want to allow payments from Cash Journal to pay recurring little +expenses. (Gasoline, parking meter, etc.)

Table of contents

@@ -409,21 +409,17 @@

Configuration

  • Go to ‘Point of Sale’ / ‘Configuration’ / ‘Move Reason’
-
-PoS Move Reasons List -
+

pos_cash_move_tree

  • Create or update your PoS move Reasons.
  • -
  • for each reason, you can mention the concerned journal(s), (Generally the -Cash Journal), and if it is a reason to ‘put in’ and / or to ‘take out’ -Money.
  • +
  • for each reason, you can mention the concerned journal(s), (Generally +the Cash Journal), and if it is a reason to ‘put in’ and / or to +‘take out’ Money.
-
-PoS Move Reason -
+

pos_cash_move_form

Note

-

You should have checked first ‘Used in Point of Sale’ for the Journals you want -to enable the feature.

+

You should have checked first ‘Used in Point of Sale’ for the Journals +you want to enable the feature.

Usage

@@ -431,31 +427,25 @@

Usage

  • Go to your current session
  • Click on the button “Put Money In” or “Take Money Out”
  • -
    -https://raw.githubusercontent.com/OCA/pos/15.0/pos_cash_move_reason/static/description/pos_session_form.png -
    +

    image1

    • Select the reason, the journal, the amount, and optionaly an extra description
    -
    -https://raw.githubusercontent.com/OCA/pos/15.0/pos_cash_move_reason/static/description/wizard_pos_move_reason_form.png -
    +

    image2

      -
    • When closing the session, an account move will be created, with two lines, -one with the default journal account, and one with the expense / income -reason account.
    • +
    • When closing the session, an account move will be created, with two +lines, one with the default journal account, and one with the expense +/ income reason account.
    -
    -https://raw.githubusercontent.com/OCA/pos/15.0/pos_cash_move_reason/static/description/account_move_form.png -
    +

    image3

    Known issues / Roadmap

    -

    As it is not possible to disable actions on Odoo, a new technical group is -added by this module, named ‘Use Old PoS ‘Put or Take Money’ Actions’, to -hide native obsolete actions available on the model pos.session -(the two buttons “Take Money Out” and “Put Money In”)

    +

    As it is not possible to disable actions on Odoo, a new technical group +is added by this module, named ‘Use Old PoS ‘Put or Take Money’ +Actions’, to hide native obsolete actions available on the model +pos.session (the two buttons “Take Money Out” and “Put Money In”)

    Changelog

    @@ -463,11 +453,11 @@

    Changelog

    12.0.3.0.0 (2019-08-13)

    • [MIG] Port module to version 12.0.
    • -
    • [REF] Don’t use product.product model for Reasons, because Odoo remove -the fields expense_pdt and income_pdt from the model. +
    • [REF] Don’t use product.product model for Reasons, because Odoo +remove the fields expense_pdt and income_pdt from the model. Use instead a new model pos.move.reason for this purpose.
    • -
    • [REF] Doesn’t inherit from cash.box.in and cash.box.out model, -as there are bad designed and doesn’t allow clean inheritance. +
    • [REF] Doesn’t inherit from cash.box.in and cash.box.out +model, as there are bad designed and doesn’t allow clean inheritance. Instead, use new transient model wizard.pos.move.reason.
    @@ -489,7 +479,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.

    @@ -506,16 +496,19 @@

    Contributors

    Maintainers

    This module is maintained by the OCA.

    -Odoo Community Association + +Odoo Community Association +

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

    +

    This module is part of the OCA/pos project on GitHub.

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

    diff --git a/pos_cash_move_reason/tests/test_pos_cash_move_reason.py b/pos_cash_move_reason/tests/test_pos_cash_move_reason.py index 3018d7e7bb..9fee028256 100644 --- a/pos_cash_move_reason/tests/test_pos_cash_move_reason.py +++ b/pos_cash_move_reason/tests/test_pos_cash_move_reason.py @@ -14,13 +14,14 @@ def setUpClass(cls): cls.WizardReason = cls.env["wizard.pos.move.reason"] cls.AccountMoveLine = cls.env["account.move.line"] - cls.config = cls.env.ref("point_of_sale.pos_config_main").copy() + cls.config = cls.env.ref("point_of_sale.pos_config_main") cls.cash_journal = cls.env["account.journal"].search( [ ("type", "=", "cash"), ("company_id", "=", cls.env.ref("base.main_company").id), - ] - )[0] + ], + limit=1, + ) cls.deposit_reason = cls.env.ref("pos_cash_move_reason.bank_out_reason") def test_onchange_expense_reason(self): @@ -70,7 +71,6 @@ def test_take_invalid_amount(self): session = self.PosSession.search( [("state", "=", "opening_control"), ("config_id", "=", self.config.id)] ) - # Enter Invalid money with self.assertRaises(UserError): self.WizardReason.with_context( @@ -88,7 +88,7 @@ def test_take_invalid_amount(self): def test_button_put_money(self): self.config._action_to_open_ui() session = self.PosSession.search( - [("state", "=", "opened"), ("config_id", "=", self.config.id)] + [("state", "=", "opening_control"), ("config_id", "=", self.config.id)] ) wiz = session.button_move_income() self.assertEqual(wiz["context"]["default_move_type"], "income") diff --git a/pos_cash_move_reason/views/view_pos_move_reason.xml b/pos_cash_move_reason/views/view_pos_move_reason.xml index 294cb61156..f52d5d2f3f 100644 --- a/pos_cash_move_reason/views/view_pos_move_reason.xml +++ b/pos_cash_move_reason/views/view_pos_move_reason.xml @@ -43,16 +43,14 @@ diff --git a/pos_cash_move_reason/views/view_pos_session.xml b/pos_cash_move_reason/views/view_pos_session.xml index 6fc140f53b..4af711ae46 100644 --- a/pos_cash_move_reason/views/view_pos_session.xml +++ b/pos_cash_move_reason/views/view_pos_session.xml @@ -13,9 +13,7 @@ name="button_move_income" type="object" icon="fa-level-down" - attrs="{'invisible': ['|', - ('display_move_reason_income', '=', False), - ('state', 'not in', ['opened', 'closing_control'])]}" + invisible="not display_move_reason_income or state not in ('opened', 'closing_control')" >
    Put @@ -28,9 +26,7 @@ name="button_move_expense" type="object" icon="fa-level-up" - attrs="{'invisible': ['|', - ('display_move_reason_expense', '=', False), - ('state', 'not in', ['opened', 'closing_control'])]}" + invisible="not display_move_reason_expense or state not in ('opened', 'closing_control')" >
    Take diff --git a/pos_cash_move_reason/wizard/wizard_pos_move_reason.xml b/pos_cash_move_reason/wizard/wizard_pos_move_reason.xml index 5a8a6b2bcd..67594b3e49 100644 --- a/pos_cash_move_reason/wizard/wizard_pos_move_reason.xml +++ b/pos_cash_move_reason/wizard/wizard_pos_move_reason.xml @@ -6,20 +6,17 @@
    - +