Skip to content

Commit c7b097d

Browse files
committed
[WIP] pos_payment_change: Migration to 16.0
1 parent a08b348 commit c7b097d

File tree

4 files changed

+31
-17
lines changed

4 files changed

+31
-17
lines changed

pos_payment_change/README.rst

+8-8
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ Point Of Sale - Change Payments
1414
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1515
:alt: License: AGPL-3
1616
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github
17-
:target: https://github.com/OCA/pos/tree/15.0/pos_payment_change
17+
:target: https://github.com/OCA/pos/tree/16.0/pos_payment_change
1818
:alt: OCA/pos
1919
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
2020
:target: https://translation.odoo-community.org/projects/pos-15-0/pos-15-0-pos_payment_change
2121
:alt: Translate me on Weblate
2222
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
23-
:target: https://runbot.odoo-community.org/runbot/184/15.0
23+
:target: https://runbot.odoo-community.org/runbot/184/16.0
2424
:alt: Try me on Runbot
2525

2626
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -52,7 +52,7 @@ Two options are available:
5252

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

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

5757

5858
**Note**
@@ -71,12 +71,12 @@ Usage
7171

7272
* Click on the button 'Change Payments'
7373

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

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

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

8181
* Then click on the button 'Change Payments'
8282

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

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

9090
Bug Tracker
9191
===========
9292

9393
Bugs are tracked on `GitHub Issues <https://github.com/OCA/pos/issues>`_.
9494
In case of trouble, please check there if your issue has already been reported.
9595
If you spotted it first, help us smashing it by providing a detailed and welcomed
96-
`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**>`_.
96+
`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**>`_.
9797

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

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

143143
|maintainer-legalsylvain|
144144

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

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

pos_payment_change/__manifest__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
44
{
55
"name": "Point Of Sale - Change Payments",
6-
"version": "15.0.1.0.0",
6+
"version": "16.0.1.0.0",
77
"summary": "Allow cashier to change order payments, as long as"
88
" the session is not closed.",
99
"category": "Point Of Sale",

pos_payment_change/static/description/index.html

+7-7
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ <h1 class="title">Point Of Sale - Change Payments</h1>
367367
!! This file is generated by oca-gen-addon-readme !!
368368
!! changes will be overwritten. !!
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
370-
<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>
370+
<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>
371371
<p>This module extends the functionnality of the Odoo Point of Sale to
372372
allow the cashier to change the payments of a PoS order.</p>
373373
<p>This feature is usefull when the user realized that he did a mistake,
@@ -403,7 +403,7 @@ <h1><a class="toc-backref" href="#id1">Configuration</a></h1>
403403
<li>‘Update Payments’: Odoo will change payment lines.</li>
404404
</ul>
405405
<div class="figure">
406-
<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" />
406+
<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" />
407407
</div>
408408
<p><strong>Note</strong>
409409
In some countries the ‘Update Payments’ Option
@@ -420,14 +420,14 @@ <h1><a class="toc-backref" href="#id2">Usage</a></h1>
420420
<li>Click on the button ‘Change Payments’</li>
421421
</ul>
422422
<div class="figure">
423-
<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" />
423+
<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" />
424424
</div>
425425
<ul class="simple">
426426
<li>In the pop up wizard, select the real payment(s) that have been
427427
used to pay the order</li>
428428
</ul>
429429
<div class="figure">
430-
<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" />
430+
<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" />
431431
</div>
432432
<ul class="simple">
433433
<li>Then click on the button ‘Change Payments’</li>
@@ -436,15 +436,15 @@ <h1><a class="toc-backref" href="#id2">Usage</a></h1>
436436
<p>If the option ‘Refund and Resale’ is selected, changing the payments will
437437
display the three PoS orders. the oringal one, the refund one, and the new one.</p>
438438
<div class="figure">
439-
<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" />
439+
<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" />
440440
</div>
441441
</div>
442442
<div class="section" id="bug-tracker">
443443
<h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1>
444444
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/pos/issues">GitHub Issues</a>.
445445
In case of trouble, please check there if your issue has already been reported.
446446
If you spotted it first, help us smashing it by providing a detailed and welcomed
447-
<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>
447+
<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>
448448
<p>Do not contact contributors directly about support or help with technical issues.</p>
449449
</div>
450450
<div class="section" id="credits">
@@ -481,7 +481,7 @@ <h2><a class="toc-backref" href="#id8">Maintainers</a></h2>
481481
promote its widespread use.</p>
482482
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
483483
<p><a class="reference external" href="https://github.com/legalsylvain"><img alt="legalsylvain" src="https://github.com/legalsylvain.png?size=40px" /></a></p>
484-
<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>
484+
<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>
485485
<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>
486486
</div>
487487
</div>

pos_payment_change/tests/test_module.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def _initialize_journals_open_session(self):
5151
self.bank_payment_method.id,
5252
self.cash_payment_method.id,
5353
]
54-
self.pos_config.open_session_cb()
54+
self.pos_config.open_ui()
5555
self.session = self.pos_config.current_session_id
5656

5757
def _sale(self, payment_method_1, price_1, payment_method_2=False, price_2=0.0):
@@ -181,3 +181,17 @@ def test_02_payment_change_policy_refund(self):
181181
len(self.PosOrder.search([])),
182182
"In 'Refund' mode, changing payment should generate" " two new PoS Orders",
183183
)
184+
185+
def test_03_payment_change_closed_orders(self):
186+
self.pos_config.payment_change_policy = "update"
187+
188+
self._initialize_journals_open_session()
189+
# Make a sale with 35 in cash journal and 65 in check
190+
order = self._sale(self.cash_payment_method, 35, self.bank_payment_method, 65)
191+
192+
self.session.state = "closed"
193+
194+
with self.assertRaises(UserError):
195+
self._change_payment(
196+
order, self.cash_payment_method, 10, self.bank_payment_method, 90
197+
)

0 commit comments

Comments
 (0)