Skip to content

Commit 3e64c0d

Browse files
authored
Merge pull request #729 from OCA/14.0
Syncing from upstream OCA/pos (14.0)
2 parents 759ff85 + cc4eb52 commit 3e64c0d

File tree

6 files changed

+48
-24
lines changed

6 files changed

+48
-24
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ addon | version | maintainers | summary
4545
[pos_order_to_sale_order](pos_order_to_sale_order/) | 14.0.1.0.1 | <a href='https://github.com/legalsylvain'><img src='https://github.com/legalsylvain.png' width='32' height='32' style='border-radius:50%;' alt='legalsylvain'/></a> | PoS Order To Sale Order
4646
[pos_partner_birthdate](pos_partner_birthdate/) | 14.0.1.0.2 | <a href='https://github.com/ecino'><img src='https://github.com/ecino.png' width='32' height='32' style='border-radius:50%;' alt='ecino'/></a> | Adds the birthdate in the customer screen of POS
4747
[pos_partner_firstname](pos_partner_firstname/) | 14.0.1.0.1 | <a href='https://github.com/robyf70'><img src='https://github.com/robyf70.png' width='32' height='32' style='border-radius:50%;' alt='robyf70'/></a> | POS Support of partner firstname
48-
[pos_payment_change](pos_payment_change/) | 14.0.1.0.3 | <a href='https://github.com/legalsylvain'><img src='https://github.com/legalsylvain.png' width='32' height='32' style='border-radius:50%;' alt='legalsylvain'/></a> | Allow cashier to change order payments, as long as the session is not closed.
48+
[pos_payment_change](pos_payment_change/) | 14.0.1.0.4 | <a href='https://github.com/legalsylvain'><img src='https://github.com/legalsylvain.png' width='32' height='32' style='border-radius:50%;' alt='legalsylvain'/></a> | Allow cashier to change order payments, as long as the session is not closed.
4949
[pos_payment_method_cashdro](pos_payment_method_cashdro/) | 14.0.1.0.1 | | Allows to pay with CashDro Terminals on the Point of Sale
5050
[pos_payment_terminal](pos_payment_terminal/) | 14.0.2.1.0 | | Point of sale: support generic payment terminal
5151
[pos_picking_delayed](pos_picking_delayed/) | 14.0.1.0.0 | <a href='https://github.com/legalsylvain'><img src='https://github.com/legalsylvain.png' width='32' height='32' style='border-radius:50%;' alt='legalsylvain'/></a> | Delay the creation of the picking when PoS order is created

pos_payment_change/README.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
.. image:: https://odoo-community.org/readme-banner-image
2+
:target: https://odoo-community.org/get-involved?utm_source=readme
3+
:alt: Odoo Community Association
4+
15
===============================
26
Point Of Sale - Change Payments
37
===============================
@@ -7,13 +11,13 @@ Point Of Sale - Change Payments
711
!! This file is generated by oca-gen-addon-readme !!
812
!! changes will be overwritten. !!
913
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10-
!! source digest: sha256:6f1462f67df774d51a30919678de62e275d7e3561144dde4841a3cc6893f9cf7
14+
!! source digest: sha256:c9b4a4005c440c55b6be25f3cf7f0e7fd90cfe24a84d18585ace211aa7b58ae9
1115
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1216
1317
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
1418
:target: https://odoo-community.org/page/development-status
1519
:alt: Beta
16-
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
20+
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
1721
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1822
:alt: License: AGPL-3
1923
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github

pos_payment_change/__manifest__.py

Lines changed: 1 addition & 1 deletion
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": "14.0.1.0.3",
6+
"version": "14.0.1.0.4",
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/models/pos_order.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,20 @@ def change_payment(self, payment_lines):
6363
"pos_order_id": refund_order.id,
6464
"payment_method_id": payment.payment_method_id.id,
6565
"amount": -payment.amount,
66-
"payment_date": fields.Date.context_today(self),
66+
"payment_date": self._get_datetime_payment_change_policy(),
6767
}
6868
)
6969

7070
refund_order.action_pos_order_paid()
7171

7272
# Resale order and mark it as paid
7373
# with the new payment
74-
resale_order = self.copy(default={"pos_reference": self.pos_reference})
74+
resale_order = self.copy(
75+
default={
76+
"pos_reference": self.pos_reference,
77+
"date_order": self._get_datetime_payment_change_policy(),
78+
}
79+
)
7580
for line in payment_lines:
7681
line.update({"pos_order_id": resale_order.id})
7782
resale_order.add_payment(line)
@@ -101,3 +106,9 @@ def _check_payment_change_allowed(self):
101106
)
102107
)
103108
)
109+
110+
def _get_datetime_payment_change_policy(self):
111+
if self.config_id.payment_change_policy == "update":
112+
return self.date_order
113+
else:
114+
return fields.Datetime.now()

pos_payment_change/static/description/index.html

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
<head>
44
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
55
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
6-
<title>Point Of Sale - Change Payments</title>
6+
<title>README.rst</title>
77
<style type="text/css">
88

99
/*
1010
:Author: David Goodger ([email protected])
11-
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
11+
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
1212
:Copyright: This stylesheet has been placed in the public domain.
1313
1414
Default cascading style sheet for the HTML output of Docutils.
15+
Despite the name, some widely supported CSS2 features are used.
1516
1617
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
1718
customize this style sheet.
@@ -274,7 +275,7 @@
274275
margin-left: 2em ;
275276
margin-right: 2em }
276277

277-
pre.code .ln { color: grey; } /* line numbers */
278+
pre.code .ln { color: gray; } /* line numbers */
278279
pre.code, code { background-color: #eeeeee }
279280
pre.code .comment, code .comment { color: #5C6576 }
280281
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
@@ -300,7 +301,7 @@
300301
span.pre {
301302
white-space: pre }
302303

303-
span.problematic {
304+
span.problematic, pre.problematic {
304305
color: red }
305306

306307
span.section-subtitle {
@@ -359,16 +360,21 @@
359360
</style>
360361
</head>
361362
<body>
362-
<div class="document" id="point-of-sale-change-payments">
363-
<h1 class="title">Point Of Sale - Change Payments</h1>
363+
<div class="document">
364364

365+
366+
<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
367+
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
368+
</a>
369+
<div class="section" id="point-of-sale-change-payments">
370+
<h1>Point Of Sale - Change Payments</h1>
365371
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
366372
!! This file is generated by oca-gen-addon-readme !!
367373
!! changes will be overwritten. !!
368374
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
369-
!! source digest: sha256:6f1462f67df774d51a30919678de62e275d7e3561144dde4841a3cc6893f9cf7
375+
!! source digest: sha256:c9b4a4005c440c55b6be25f3cf7f0e7fd90cfe24a84d18585ace211aa7b58ae9
370376
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
371-
<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/14.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 image-reference" href="https://translation.odoo-community.org/projects/pos-14-0/pos-14-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 image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/pos&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
377+
<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/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/pos/tree/14.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 image-reference" href="https://translation.odoo-community.org/projects/pos-14-0/pos-14-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 image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/pos&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
372378
<p>This module extends the functionnality of the Odoo Point of Sale to
373379
allow the cashier to change the payments of a PoS order.</p>
374380
<p>This feature is usefull when the user realized that he did a mistake,
@@ -390,7 +396,7 @@ <h1 class="title">Point Of Sale - Change Payments</h1>
390396
</ul>
391397
</div>
392398
<div class="section" id="configuration">
393-
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
399+
<h2><a class="toc-backref" href="#toc-entry-1">Configuration</a></h2>
394400
<ul class="simple">
395401
<li>Go to Point of Sale &gt; Configuration &gt; Point of Sale</li>
396402
<li>Edit your point of sale, and select a value for the field
@@ -415,7 +421,7 @@ <h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
415421
to select the value ‘Update Payments’.</p>
416422
</div>
417423
<div class="section" id="usage">
418-
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
424+
<h2><a class="toc-backref" href="#toc-entry-2">Usage</a></h2>
419425
<ul class="simple">
420426
<li>Go to a PoS Order</li>
421427
<li>Click on the button ‘Change Payments’</li>
@@ -441,41 +447,43 @@ <h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
441447
</div>
442448
</div>
443449
<div class="section" id="bug-tracker">
444-
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
450+
<h2><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h2>
445451
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/pos/issues">GitHub Issues</a>.
446452
In case of trouble, please check there if your issue has already been reported.
447453
If you spotted it first, help us to smash it by providing a detailed and welcomed
448454
<a class="reference external" href="https://github.com/OCA/pos/issues/new?body=module:%20pos_payment_change%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
449455
<p>Do not contact contributors directly about support or help with technical issues.</p>
450456
</div>
451457
<div class="section" id="credits">
452-
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
458+
<h2><a class="toc-backref" href="#toc-entry-4">Credits</a></h2>
453459
<div class="section" id="authors">
454-
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
460+
<h3><a class="toc-backref" href="#toc-entry-5">Authors</a></h3>
455461
<ul class="simple">
456462
<li>GRAP</li>
457463
</ul>
458464
</div>
459465
<div class="section" id="contributors">
460-
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
466+
<h3><a class="toc-backref" href="#toc-entry-6">Contributors</a></h3>
461467
<ul class="simple">
462468
<li>Sylvain LE GAL &lt;<a class="reference external" href="https://twitter.com/legalsylvain">https://twitter.com/legalsylvain</a>&gt;</li>
463469
<li>Julien WESTE</li>
464470
<li>Foram Shah &lt;<a class="reference external" href="mailto:foram.shah&#64;initos.com">foram.shah&#64;initos.com</a>&gt;</li>
465471
</ul>
466472
</div>
467473
<div class="section" id="other-credits">
468-
<h2><a class="toc-backref" href="#toc-entry-7">Other credits</a></h2>
474+
<h3><a class="toc-backref" href="#toc-entry-7">Other credits</a></h3>
469475
<p>The development of this module has been financially supported by:</p>
470476
<ul class="simple">
471477
<li>GRAP, Groupement Régional Alimentaire de proximité (www.grap.coop)</li>
472478
<li>Vracoop (www.vracoop.fr)</li>
473479
</ul>
474480
</div>
475481
<div class="section" id="maintainers">
476-
<h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
482+
<h3><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h3>
477483
<p>This module is maintained by the OCA.</p>
478-
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
484+
<a class="reference external image-reference" href="https://odoo-community.org">
485+
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
486+
</a>
479487
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
480488
mission is to support the collaborative development of Odoo features and
481489
promote its widespread use.</p>
@@ -486,5 +494,6 @@ <h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
486494
</div>
487495
</div>
488496
</div>
497+
</div>
489498
</body>
490499
</html>

pos_payment_change/wizards/pos_payment_change_wizard.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def button_change_payment(self):
8888
"pos_order_id": order.id,
8989
"payment_method_id": line.new_payment_method_id.id,
9090
"amount": line.amount,
91-
"payment_date": fields.Date.context_today(self),
91+
"payment_date": order._get_datetime_payment_change_policy(),
9292
}
9393
for line in self.new_line_ids
9494
]

0 commit comments

Comments
 (0)