Skip to content

Commit

Permalink
[MIG] pos_cash_move_reason: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
traitrantrobz authored and chaule97 committed Jan 13, 2025
1 parent b022f14 commit cc13374
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 91 deletions.
9 changes: 5 additions & 4 deletions pos_cash_move_reason/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
=====
Expand Down Expand Up @@ -149,6 +149,7 @@ Contributors

- Sylvain LE GAL <https://twitter.com/legalsylvain>
- Dhara Solanki <[email protected]>
- Tran Thanh Trai <[email protected]>

Maintainers
-----------
Expand Down
3 changes: 1 addition & 2 deletions pos_cash_move_reason/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions pos_cash_move_reason/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -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**

Expand Down
1 change: 1 addition & 0 deletions pos_cash_move_reason/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
- Sylvain LE GAL \<<https://twitter.com/legalsylvain>\>
- Dhara Solanki \<<[email protected]>\>
- Tran Thanh Trai \<<[email protected]>\>
11 changes: 0 additions & 11 deletions pos_cash_move_reason/security/res_groups.xml

This file was deleted.

91 changes: 42 additions & 49 deletions pos_cash_move_reason/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand All @@ -9,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
: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.
Expand Down Expand Up @@ -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 }
Expand All @@ -301,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -369,19 +369,19 @@ <h1 class="title">POS cash in-out reason</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:9be2d1beeded5d8b52824fb2442f7c89f0db512626cb33386044d8c060115f83
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/pos/tree/15.0/pos_cash_move_reason"><img alt="OCA/pos" src="https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/pos-15-0/pos-15-0-pos_cash_move_reason"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/pos&amp;target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allow to define some reasons for the functionality of
“Put Money In” and “Take Money Out” available in point of sale session.</p>
<p>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.</p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/pos/tree/17.0/pos_cash_move_reason"><img alt="OCA/pos" src="https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/pos-17-0/pos-17-0-pos_cash_move_reason"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/pos&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allow to define some reasons for the functionality of “Put
Money In” and “Take Money Out” available in point of sale session.</p>
<p>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.</p>
<p><strong>Typical Use Case (not exhaustive)</strong></p>
<ul class="simple">
<li>You want to track <strong>Bank deposit</strong> moves, using an intermediate
bank account named ‘Cash Awaiting Bank Deposit’.
(In France, for instance, “581 - Espèce en attente d’encaissement”)</li>
<li>You want to allow payments from Cash Journal to pay recurring
little expenses. (Gasoline, parking meter, etc.)</li>
<li>You want to track <strong>Bank deposit</strong> moves, using an intermediate bank
account named ‘Cash Awaiting Bank Deposit’. (In France, for instance,
“581 - Espèce en attente d’encaissement”)</li>
<li>You want to allow payments from Cash Journal to pay recurring little
expenses. (Gasoline, parking meter, etc.)</li>
</ul>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
Expand Down Expand Up @@ -409,65 +409,55 @@ <h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
<ul class="simple">
<li>Go to ‘Point of Sale’ / ‘Configuration’ / ‘Move Reason’</li>
</ul>
<div class="figure">
<img alt="PoS Move Reasons List" src="https://raw.githubusercontent.com/OCA/pos/15.0/pos_cash_move_reason/static/description/pos_cash_move_tree.png" />
</div>
<p><img alt="pos_cash_move_tree" src="https://raw.githubusercontent.com/OCA/pos/17.0/pos_cash_move_reason/static/description/pos_cash_move_tree.png" /></p>
<ul class="simple">
<li>Create or update your PoS move Reasons.</li>
<li>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.</li>
<li>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.</li>
</ul>
<div class="figure">
<img alt="PoS Move Reason" src="https://raw.githubusercontent.com/OCA/pos/15.0/pos_cash_move_reason/static/description/pos_cash_move_form.png" />
</div>
<p><img alt="pos_cash_move_form" src="https://raw.githubusercontent.com/OCA/pos/17.0/pos_cash_move_reason/static/description/pos_cash_move_form.png" /></p>
<p><strong>Note</strong></p>
<p>You should have checked first ‘Used in Point of Sale’ for the Journals you want
to enable the feature.</p>
<p>You should have checked first ‘Used in Point of Sale’ for the Journals
you want to enable the feature.</p>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<ul class="simple">
<li>Go to your current session</li>
<li>Click on the button “Put Money In” or “Take Money Out”</li>
</ul>
<div class="figure">
<img alt="https://raw.githubusercontent.com/OCA/pos/15.0/pos_cash_move_reason/static/description/pos_session_form.png" src="https://raw.githubusercontent.com/OCA/pos/15.0/pos_cash_move_reason/static/description/pos_session_form.png" />
</div>
<p><img alt="image1" src="https://raw.githubusercontent.com/OCA/pos/17.0/pos_cash_move_reason/static/description/pos_session_form.png" /></p>
<ul class="simple">
<li>Select the reason, the journal, the amount, and optionaly an extra
description</li>
</ul>
<div class="figure">
<img alt="https://raw.githubusercontent.com/OCA/pos/15.0/pos_cash_move_reason/static/description/wizard_pos_move_reason_form.png" src="https://raw.githubusercontent.com/OCA/pos/15.0/pos_cash_move_reason/static/description/wizard_pos_move_reason_form.png" />
</div>
<p><img alt="image2" src="https://raw.githubusercontent.com/OCA/pos/17.0/pos_cash_move_reason/static/description/wizard_pos_move_reason_form.png" /></p>
<ul class="simple">
<li>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.</li>
<li>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.</li>
</ul>
<div class="figure">
<img alt="https://raw.githubusercontent.com/OCA/pos/15.0/pos_cash_move_reason/static/description/account_move_form.png" src="https://raw.githubusercontent.com/OCA/pos/15.0/pos_cash_move_reason/static/description/account_move_form.png" />
</div>
<p><img alt="image3" src="https://raw.githubusercontent.com/OCA/pos/17.0/pos_cash_move_reason/static/description/account_move_form.png" /></p>
</div>
<div class="section" id="known-issues-roadmap">
<h1><a class="toc-backref" href="#toc-entry-3">Known issues / Roadmap</a></h1>
<p>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 <tt class="docutils literal">pos.session</tt>
(the two buttons “Take Money Out” and “Put Money In”)</p>
<p>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
<tt class="docutils literal">pos.session</tt> (the two buttons “Take Money Out” and “Put Money In”)</p>
</div>
<div class="section" id="changelog">
<h1><a class="toc-backref" href="#toc-entry-4">Changelog</a></h1>
<div class="section" id="section-1">
<h2><a class="toc-backref" href="#toc-entry-5">12.0.3.0.0 (2019-08-13)</a></h2>
<ul class="simple">
<li>[MIG] Port module to version 12.0.</li>
<li>[REF] Don’t use <tt class="docutils literal">product.product</tt> model for Reasons, because Odoo remove
the fields <tt class="docutils literal">expense_pdt</tt> <tt class="docutils literal">and income_pdt</tt> from the model.
<li>[REF] Don’t use <tt class="docutils literal">product.product</tt> model for Reasons, because Odoo
remove the fields <tt class="docutils literal">expense_pdt</tt> <tt class="docutils literal">and income_pdt</tt> from the model.
Use instead a new model <tt class="docutils literal">pos.move.reason</tt> for this purpose.</li>
<li>[REF] Doesn’t inherit from <tt class="docutils literal">cash.box.in</tt> and <tt class="docutils literal">cash.box.out</tt> model,
as there are bad designed and doesn’t allow clean inheritance.
<li>[REF] Doesn’t inherit from <tt class="docutils literal">cash.box.in</tt> and <tt class="docutils literal">cash.box.out</tt>
model, as there are bad designed and doesn’t allow clean inheritance.
Instead, use new transient model <tt class="docutils literal">wizard.pos.move.reason</tt>.</li>
</ul>
</div>
Expand All @@ -489,7 +479,7 @@ <h1><a class="toc-backref" href="#toc-entry-8">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/pos/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/pos/issues/new?body=module:%20pos_cash_move_reason%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/pos/issues/new?body=module:%20pos_cash_move_reason%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand All @@ -506,16 +496,19 @@ <h2><a class="toc-backref" href="#toc-entry-11">Contributors</a></h2>
<ul class="simple">
<li>Sylvain LE GAL &lt;<a class="reference external" href="https://twitter.com/legalsylvain">https://twitter.com/legalsylvain</a>&gt;</li>
<li>Dhara Solanki &lt;<a class="reference external" href="mailto:dhara.solanki&#64;initos.com">dhara.solanki&#64;initos.com</a>&gt;</li>
<li>Tran Thanh Trai &lt;<a class="reference external" href="mailto:traitt&#64;trobz.com">traitt&#64;trobz.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-12">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/pos/tree/15.0/pos_cash_move_reason">OCA/pos</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/pos/tree/17.0/pos_cash_move_reason">OCA/pos</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
10 changes: 5 additions & 5 deletions pos_cash_move_reason/tests/test_pos_cash_move_reason.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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(
Expand All @@ -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")
10 changes: 4 additions & 6 deletions pos_cash_move_reason/views/view_pos_move_reason.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,14 @@
<field name="is_income_reason" />
<field
name="income_account_id"
attrs="{
'required': [('is_income_reason', '=', True)],
'invisible': [('is_income_reason', '=', False)]}"
required="is_income_reason"
invisible="not is_income_reason"
/>
<field name="is_expense_reason" />
<field
name="expense_account_id"
attrs="{
'required': [('is_expense_reason', '=', True)],
'invisible': [('is_expense_reason', '=', False)]}"
required="is_expense_reason"
invisible="not is_expense_reason"
/>
</group>
</sheet>
Expand Down
8 changes: 2 additions & 6 deletions pos_cash_move_reason/views/view_pos_session.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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')"
>
<div class="o_field_widget o_stat_info">
<span class="o_stat_text">Put</span>
Expand All @@ -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')"
>
<div class="o_field_widget o_stat_info">
<span class="o_stat_text">Take</span>
Expand Down
Loading

0 comments on commit cc13374

Please sign in to comment.