forked from OCA/pos
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0b697c0
commit 659d43a
Showing
12 changed files
with
151 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright 2022 - Today Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
{ | ||
"name": "Point of Sale - Cashback Warning", | ||
"version": "12.0.1.0.1", | ||
"category": "Point of Sale", | ||
"author": "GRAP, Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/pos", | ||
"license": "AGPL-3", | ||
"maintainers": ["legalsylvain"], | ||
"depends": [ | ||
"point_of_sale", | ||
], | ||
"data": [ | ||
"views/templates.xml", | ||
], | ||
"qweb": [ | ||
'static/src/xml/pos.xml', | ||
], | ||
"images": [ | ||
"static/description/pos_cashback_warning.png", | ||
], | ||
"installable": True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * pos_cashback_warning | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 12.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2022-09-23 09:41+0000\n" | ||
"PO-Revision-Date: 2022-09-23 09:41+0000\n" | ||
"Last-Translator: <>\n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: pos_cashback_warning | ||
#. openerp-web | ||
#: code:addons/pos_cashback_warning/static/src/xml/pos.xml:11 | ||
#, python-format | ||
msgid "This will generate a cashback of" | ||
msgstr "Cela va générer un cashback de" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* Sylvain LE GAL <https://twitter.com/legalsylvain> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
This modules extends the Point of sale functionnalies to add a warning | ||
if confirming an order generate a cashback. | ||
|
||
By default, if the payment lines of an Odoo PoS order generate Change, | ||
the journal for the change will be the Cash journal. | ||
That is ok if the original payment line is a Cash payment, but if it's | ||
a payment by credit card, check, meal voucher, etc. confirming the | ||
transaction will generate a cashback. | ||
|
||
This module simply add a message in such case. | ||
|
||
.. image:: ../static/description/pos_cashback_warning.png | ||
|
||
|
||
**Note** : The cashback is an operation that consists, | ||
for a merchant to collect more money in check, credit card, etc. | ||
than the amount of the sale and give change in cash. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** *************************************************************************** | ||
Copyright (C) 2022 - Today: GRAP (http://www.grap.coop) | ||
@author: Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
******************************************************************************/ | ||
|
||
odoo.define('pos_cashback_warning.screens', function (require) { | ||
"use strict"; | ||
|
||
var screens = require("point_of_sale.screens"); | ||
var core = require("web.core"); | ||
var _t = core._t; | ||
|
||
screens.PaymentScreenWidget.include({ | ||
|
||
render_paymentlines: function() { | ||
var total_cash_received = 0.0 | ||
var extradue = 0.0; | ||
|
||
var order = this.pos.get_order(); | ||
if (order && order.get_total_with_tax() > 0.0) { | ||
// Note Copy from original function render_paymentlines | ||
// to recompute extradue value | ||
var lines = order.get_paymentlines(); | ||
var due = order.get_due(); | ||
if (due && lines.length && due !== order.get_due(lines[lines.length-1])) { | ||
extradue = due; | ||
} | ||
_.each(lines, function (line) { | ||
console.log("=> line.cashregister.journal.type", line.cashregister.journal.type); | ||
console.log("=> line.amount", line.amount); | ||
if (line.cashregister.journal.type === "cash") { | ||
total_cash_received += line.amount; | ||
} | ||
}); | ||
} | ||
if (extradue < 0.0 && (total_cash_received + extradue) < 0.0) { | ||
this.extradue_cashback = - (total_cash_received + extradue); | ||
} | ||
else { | ||
this.extradue_cashback = 0.0; | ||
} | ||
this._super(); | ||
}, | ||
|
||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright 2022 - Today Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
--> | ||
<templates id="template" xml:space="preserve"> | ||
|
||
<t t-extend="PaymentScreen-Paymentlines"> | ||
<t t-jquery=".paymentline.extra" t-operation="append"> | ||
<td colspan="4" t-if="widget.extradue_cashback > 0"> | ||
<i class='fa fa-warning'></i> | ||
This will generate a cashback of <t t-esc='widget.format_currency_no_symbol(widget.extradue_cashback)'/> | ||
</td> | ||
</t> | ||
</t> | ||
|
||
</templates> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
Copyright 2022 - Today Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
--> | ||
|
||
<odoo> | ||
<template id="assets" inherit_id="point_of_sale.assets"> | ||
<xpath expr="." position="inside"> | ||
<script type="text/javascript" src="/pos_cashback_warning/static/src/js/screens.js"></script> | ||
</xpath> | ||
</template> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../pos_cashback_warning |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |