From 59a66f88d3fccdd267307fe6dda06ab8430219ec Mon Sep 17 00:00:00 2001 From: Carmen Bianca Bakker Date: Thu, 7 Apr 2022 10:25:20 +0200 Subject: [PATCH 001/149] [ADD] pos_customer_wallet Signed-off-by: Carmen Bianca Bakker Signed-off-by: Carmen Bianca BAKKER --- pos_customer_wallet/__init__.py | 0 pos_customer_wallet/__manifest__.py | 22 +++++++++++++++++++++ pos_customer_wallet/readme/CONTRIBUTORS.rst | 3 +++ pos_customer_wallet/readme/DESCRIPTION.rst | 0 4 files changed, 25 insertions(+) create mode 100644 pos_customer_wallet/__init__.py create mode 100644 pos_customer_wallet/__manifest__.py create mode 100644 pos_customer_wallet/readme/CONTRIBUTORS.rst create mode 100644 pos_customer_wallet/readme/DESCRIPTION.rst diff --git a/pos_customer_wallet/__init__.py b/pos_customer_wallet/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/pos_customer_wallet/__manifest__.py b/pos_customer_wallet/__manifest__.py new file mode 100644 index 000000000..d5fef998b --- /dev/null +++ b/pos_customer_wallet/__manifest__.py @@ -0,0 +1,22 @@ +# Copyright 2022 Coop IT Easy SCRLfs +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Point of Sale Customer Wallet", + "summary": """ + Enable usage of the Customer Wallet in the Point of Sale.""", + "version": "12.0.1.0.0", + "category": "Point of Sale", + "website": "https://coopiteasy.be", + "author": "Coop IT Easy SCRLfs", + "license": "AGPL-3", + "application": False, + "depends": [ + "point_of_sale", + "account_customer_wallet", + ], + "excludes": [], + "data": [], + "demo": [], + "qweb": [], +} diff --git a/pos_customer_wallet/readme/CONTRIBUTORS.rst b/pos_customer_wallet/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..9f39efbc5 --- /dev/null +++ b/pos_customer_wallet/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* `Coop IT Easy SCRLfs `_: + + * Carmen Bianca Bakker diff --git a/pos_customer_wallet/readme/DESCRIPTION.rst b/pos_customer_wallet/readme/DESCRIPTION.rst new file mode 100644 index 000000000..e69de29bb From 95bc4867430423b14450b9682345718c7edbc1d9 Mon Sep 17 00:00:00 2001 From: Carmen Bianca Bakker Date: Thu, 7 Apr 2022 17:04:03 +0200 Subject: [PATCH 002/149] [ADD] pos_customer_wallet: Display wallet balance on POS payment screen Signed-off-by: Carmen Bianca Bakker Signed-off-by: Carmen Bianca BAKKER --- pos_customer_wallet/__manifest__.py | 8 +++++-- pos_customer_wallet/static/src/css/pos.css | 25 ++++++++++++++++++++ pos_customer_wallet/static/src/js/models.js | 7 ++++++ pos_customer_wallet/static/src/js/screens.js | 18 ++++++++++++++ pos_customer_wallet/static/src/xml/pos.xml | 24 +++++++++++++++++++ pos_customer_wallet/templates/assets.xml | 16 +++++++++++++ 6 files changed, 96 insertions(+), 2 deletions(-) create mode 100644 pos_customer_wallet/static/src/css/pos.css create mode 100644 pos_customer_wallet/static/src/js/models.js create mode 100644 pos_customer_wallet/static/src/js/screens.js create mode 100644 pos_customer_wallet/static/src/xml/pos.xml create mode 100644 pos_customer_wallet/templates/assets.xml diff --git a/pos_customer_wallet/__manifest__.py b/pos_customer_wallet/__manifest__.py index d5fef998b..9de9821b4 100644 --- a/pos_customer_wallet/__manifest__.py +++ b/pos_customer_wallet/__manifest__.py @@ -16,7 +16,11 @@ "account_customer_wallet", ], "excludes": [], - "data": [], + "data": [ + "templates/assets.xml", + ], "demo": [], - "qweb": [], + "qweb": [ + "static/src/xml/pos.xml", + ], } diff --git a/pos_customer_wallet/static/src/css/pos.css b/pos_customer_wallet/static/src/css/pos.css new file mode 100644 index 000000000..c5be97470 --- /dev/null +++ b/pos_customer_wallet/static/src/css/pos.css @@ -0,0 +1,25 @@ +.balance-container { + display: inline-block; + width: 50%; + box-sizing: border-box; + padding: 16px; + padding-top: 0; + padding-left: 0; + float: right; +} + +.balance-header { + text-align: center; + margin-top: 0; +} + +.balance-header:empty { + margin: 0; +} + +.balance { + text-align: center; + font-size: 40px; + color: #43996e; + text-shadow: 0px 2px white, 0px 2px 2px rgba(0, 0, 0, 0.27); +} diff --git a/pos_customer_wallet/static/src/js/models.js b/pos_customer_wallet/static/src/js/models.js new file mode 100644 index 000000000..fb21ffafb --- /dev/null +++ b/pos_customer_wallet/static/src/js/models.js @@ -0,0 +1,7 @@ +odoo.define("pos_customer_wallet.models", function (require) { + "use strict"; + + var models = require("point_of_sale.models"); + + models.load_fields("res.partner", ["customer_wallet_balance"]); +}); diff --git a/pos_customer_wallet/static/src/js/screens.js b/pos_customer_wallet/static/src/js/screens.js new file mode 100644 index 000000000..3d943a8a1 --- /dev/null +++ b/pos_customer_wallet/static/src/js/screens.js @@ -0,0 +1,18 @@ +odoo.define("pos_customer_wallet.screens", function (require) { + "use strict"; + var core = require("web.core"); + var screens = require("point_of_sale.screens"); + + var _t = core._t; + + screens.PaymentScreenWidget.include({ + customer_changed: function () { + this._super(); + var client = this.pos.get_client(); + this.$(".balance").text( + client ? this.format_currency(client.customer_wallet_balance) : "" + ); + this.$(".balance-header").text(client ? _t("Customer Wallet Balance") : ""); + }, + }); +}); diff --git a/pos_customer_wallet/static/src/xml/pos.xml b/pos_customer_wallet/static/src/xml/pos.xml new file mode 100644 index 000000000..a1955d178 --- /dev/null +++ b/pos_customer_wallet/static/src/xml/pos.xml @@ -0,0 +1,24 @@ + + diff --git a/pos_customer_wallet/templates/assets.xml b/pos_customer_wallet/templates/assets.xml new file mode 100644 index 000000000..b6a6b42a5 --- /dev/null +++ b/pos_customer_wallet/templates/assets.xml @@ -0,0 +1,16 @@ + + +