Skip to content

Commit

Permalink
[MIG] pos_payment_change: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
julenfl committed Feb 22, 2023
1 parent a08b348 commit dea747e
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 17 deletions.
16 changes: 8 additions & 8 deletions pos_payment_change/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ Point Of Sale - Change Payments
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github
:target: https://github.com/OCA/pos/tree/15.0/pos_payment_change
:target: https://github.com/OCA/pos/tree/16.0/pos_payment_change
:alt: OCA/pos
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/pos-15-0/pos-15-0-pos_payment_change
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/184/15.0
:target: https://runbot.odoo-community.org/runbot/184/16.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -52,7 +52,7 @@ Two options are available:

* 'Update Payments': Odoo will change payment lines.

.. figure:: https://raw.githubusercontent.com/OCA/pos/15.0/pos_payment_change/static/description/pos_config_form.png
.. figure:: https://raw.githubusercontent.com/OCA/pos/16.0/pos_payment_change/static/description/pos_config_form.png


**Note**
Expand All @@ -71,12 +71,12 @@ Usage

* Click on the button 'Change Payments'

.. figure:: https://raw.githubusercontent.com/OCA/pos/15.0/pos_payment_change/static/description/pos_order_form.png
.. figure:: https://raw.githubusercontent.com/OCA/pos/16.0/pos_payment_change/static/description/pos_order_form.png

* In the pop up wizard, select the real payment(s) that have been
used to pay the order

.. figure:: https://raw.githubusercontent.com/OCA/pos/15.0/pos_payment_change/static/description/pos_payment_change_wizard_form.png
.. figure:: https://raw.githubusercontent.com/OCA/pos/16.0/pos_payment_change/static/description/pos_payment_change_wizard_form.png

* Then click on the button 'Change Payments'

Expand All @@ -85,15 +85,15 @@ Usage
If the option 'Refund and Resale' is selected, changing the payments will
display the three PoS orders. the oringal one, the refund one, and the new one.

.. figure:: https://raw.githubusercontent.com/OCA/pos/15.0/pos_payment_change/static/description/pos_order_tree.png
.. figure:: https://raw.githubusercontent.com/OCA/pos/16.0/pos_payment_change/static/description/pos_order_tree.png

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/pos/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/pos/issues/new?body=module:%20pos_payment_change%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/pos/issues/new?body=module:%20pos_payment_change%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Expand Down Expand Up @@ -142,6 +142,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-legalsylvain|

This module is part of the `OCA/pos <https://github.com/OCA/pos/tree/15.0/pos_payment_change>`_ project on GitHub.
This module is part of the `OCA/pos <https://github.com/OCA/pos/tree/16.0/pos_payment_change>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion pos_payment_change/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Point Of Sale - Change Payments",
"version": "15.0.1.0.0",
"version": "16.0.1.0.0",
"summary": "Allow cashier to change order payments, as long as"
" the session is not closed.",
"category": "Point Of Sale",
Expand Down
14 changes: 7 additions & 7 deletions pos_payment_change/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Point Of Sale - Change Payments</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" 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" 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" href="https://github.com/OCA/pos/tree/15.0/pos_payment_change"><img alt="OCA/pos" src="https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/pos-15-0/pos-15-0-pos_payment_change"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/184/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" 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" 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" href="https://github.com/OCA/pos/tree/16.0/pos_payment_change"><img alt="OCA/pos" src="https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/pos-15-0/pos-15-0-pos_payment_change"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/184/16.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module extends the functionnality of the Odoo Point of Sale to
allow the cashier to change the payments of a PoS order.</p>
<p>This feature is usefull when the user realized that he did a mistake,
Expand Down Expand Up @@ -403,7 +403,7 @@ <h1><a class="toc-backref" href="#id1">Configuration</a></h1>
<li>‘Update Payments’: Odoo will change payment lines.</li>
</ul>
<div class="figure">
<img alt="https://raw.githubusercontent.com/OCA/pos/15.0/pos_payment_change/static/description/pos_config_form.png" src="https://raw.githubusercontent.com/OCA/pos/15.0/pos_payment_change/static/description/pos_config_form.png" />
<img alt="https://raw.githubusercontent.com/OCA/pos/16.0/pos_payment_change/static/description/pos_config_form.png" src="https://raw.githubusercontent.com/OCA/pos/16.0/pos_payment_change/static/description/pos_config_form.png" />
</div>
<p><strong>Note</strong>
In some countries the ‘Update Payments’ Option
Expand All @@ -420,14 +420,14 @@ <h1><a class="toc-backref" href="#id2">Usage</a></h1>
<li>Click on the button ‘Change Payments’</li>
</ul>
<div class="figure">
<img alt="https://raw.githubusercontent.com/OCA/pos/15.0/pos_payment_change/static/description/pos_order_form.png" src="https://raw.githubusercontent.com/OCA/pos/15.0/pos_payment_change/static/description/pos_order_form.png" />
<img alt="https://raw.githubusercontent.com/OCA/pos/16.0/pos_payment_change/static/description/pos_order_form.png" src="https://raw.githubusercontent.com/OCA/pos/16.0/pos_payment_change/static/description/pos_order_form.png" />
</div>
<ul class="simple">
<li>In the pop up wizard, select the real payment(s) that have been
used to pay the order</li>
</ul>
<div class="figure">
<img alt="https://raw.githubusercontent.com/OCA/pos/15.0/pos_payment_change/static/description/pos_payment_change_wizard_form.png" src="https://raw.githubusercontent.com/OCA/pos/15.0/pos_payment_change/static/description/pos_payment_change_wizard_form.png" />
<img alt="https://raw.githubusercontent.com/OCA/pos/16.0/pos_payment_change/static/description/pos_payment_change_wizard_form.png" src="https://raw.githubusercontent.com/OCA/pos/16.0/pos_payment_change/static/description/pos_payment_change_wizard_form.png" />
</div>
<ul class="simple">
<li>Then click on the button ‘Change Payments’</li>
Expand All @@ -436,15 +436,15 @@ <h1><a class="toc-backref" href="#id2">Usage</a></h1>
<p>If the option ‘Refund and Resale’ is selected, changing the payments will
display the three PoS orders. the oringal one, the refund one, and the new one.</p>
<div class="figure">
<img alt="https://raw.githubusercontent.com/OCA/pos/15.0/pos_payment_change/static/description/pos_order_tree.png" src="https://raw.githubusercontent.com/OCA/pos/15.0/pos_payment_change/static/description/pos_order_tree.png" />
<img alt="https://raw.githubusercontent.com/OCA/pos/16.0/pos_payment_change/static/description/pos_order_tree.png" src="https://raw.githubusercontent.com/OCA/pos/16.0/pos_payment_change/static/description/pos_order_tree.png" />
</div>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id3">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 smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/pos/issues/new?body=module:%20pos_payment_change%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_payment_change%0Aversion:%2016.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 Down Expand Up @@ -481,7 +481,7 @@ <h2><a class="toc-backref" href="#id8">Maintainers</a></h2>
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external" href="https://github.com/legalsylvain"><img alt="legalsylvain" src="https://github.com/legalsylvain.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/pos/tree/15.0/pos_payment_change">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/16.0/pos_payment_change">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
16 changes: 15 additions & 1 deletion pos_payment_change/tests/test_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _initialize_journals_open_session(self):
self.bank_payment_method.id,
self.cash_payment_method.id,
]
self.pos_config.open_session_cb()
self.pos_config.open_ui()
self.session = self.pos_config.current_session_id

def _sale(self, payment_method_1, price_1, payment_method_2=False, price_2=0.0):
Expand Down Expand Up @@ -181,3 +181,17 @@ def test_02_payment_change_policy_refund(self):
len(self.PosOrder.search([])),
"In 'Refund' mode, changing payment should generate" " two new PoS Orders",
)

def test_03_payment_change_closed_orders(self):
self.pos_config.payment_change_policy = "update"

self._initialize_journals_open_session()
# Make a sale with 35 in cash journal and 65 in check
order = self._sale(self.cash_payment_method, 35, self.bank_payment_method, 65)

self.session.state = "closed"

with self.assertRaises(UserError):
self._change_payment(
order, self.cash_payment_method, 10, self.bank_payment_method, 90
)

0 comments on commit dea747e

Please sign in to comment.