-
-
Notifications
You must be signed in to change notification settings - Fork 619
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] pos_payment_method_change_policy : new module to add different …
…ways to handle Change in Point of Sale
- Loading branch information
1 parent
8433fcb
commit 6a2f8ae
Showing
29 changed files
with
1,013 additions
and
0 deletions.
There are no files selected for viewing
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,140 @@ | ||
========================= | ||
PoS Order - Change Policy | ||
========================= | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:cc274cc1eb92e238f44e229799bbddf365ee2c8550cfe52d38b211cf5504cb80 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Beta | ||
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
: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/16.0/pos_payment_method_change_policy | ||
:alt: OCA/pos | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/pos-16-0/pos-16-0-pos_payment_method_change_policy | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
:target: https://runboat.odoo-community.org/builds?repo=OCA/pos&target_branch=16.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module improves the 'Change' feature in Odoo Point of Sale, | ||
when a customer pays more that the amount of the PoS Order: | ||
|
||
.. figure:: https://raw.githubusercontent.com/OCA/pos/16.0/pos_payment_method_change_policy/static/description/cash_1_payment_screen.png | ||
|
||
By default, a "Change" line is added on the receipt: | ||
|
||
.. figure:: https://raw.githubusercontent.com/OCA/pos/16.0/pos_payment_method_change_policy/static/description/cash_2_bill.png | ||
|
||
from an accounting point of view, it adds a second payment line in 'Cash' method | ||
with a negative amount corresponding to the surplus: | ||
|
||
.. figure:: https://raw.githubusercontent.com/OCA/pos/16.0/pos_payment_method_change_policy/static/description/cash_3_back_office.png | ||
|
||
In some countries and for some payment methods, this is not the right way to proceed. | ||
|
||
This module adds extra "Change Policy" option to manage differently the giving of change. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Configuration | ||
============= | ||
|
||
**Exceptional Profit Product** | ||
|
||
* Create a dedicated 'No change' Product. | ||
The type of the product should be 'Service' and the product should available in PoS. | ||
Generally, no VAT is applied on such product. | ||
|
||
* Go to the payment method form. | ||
|
||
* set 'Change Option' as 'Exceptional Profit Product' | ||
|
||
* set the new product in the 'Change Product field' | ||
|
||
.. figure:: https://raw.githubusercontent.com/OCA/pos/16.0/pos_payment_method_change_policy/static/description/payment_screen_profit_policy.png | ||
|
||
Usage | ||
===== | ||
|
||
**Exceptional Profit Product** | ||
|
||
A dedicated warning will be displayed: | ||
|
||
.. figure:: https://raw.githubusercontent.com/OCA/pos/16.0/pos_payment_method_change_policy/static/description/profit_policy_1_payment_screen.png | ||
|
||
By default, a new sale order line is added on the receipt: | ||
|
||
.. figure:: https://raw.githubusercontent.com/OCA/pos/16.0/pos_payment_method_change_policy/static/description/profit_policy_2_bill.png | ||
|
||
So, from an accounting point of view, it adds a new line that will | ||
impact a profit and loss account: | ||
|
||
.. figure:: https://raw.githubusercontent.com/OCA/pos/16.0/pos_payment_method_change_policy/static/description/profit_policy_3_back_office.png | ||
|
||
Known issues / Roadmap | ||
====================== | ||
|
||
* Implement the ability to print a voucher. | ||
|
||
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 to smash it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/pos/issues/new?body=module:%20pos_payment_method_change_policy%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. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
~~~~~~~ | ||
|
||
* GRAP | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
||
This module is maintained by the OCA. | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
mission is to support the collaborative development of Odoo features and | ||
promote its widespread use. | ||
|
||
.. |maintainer-legalsylvain| image:: https://github.com/legalsylvain.png?size=40px | ||
:target: https://github.com/legalsylvain | ||
:alt: legalsylvain | ||
|
||
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/16.0/pos_payment_method_change_policy>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
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 @@ | ||
from . import models |
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,26 @@ | ||
# Copyright (C) 2023 - 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). | ||
|
||
{ | ||
"name": "PoS Order - Change Policy", | ||
"summary": "Adds alternative way to handle Change in Point of Sale.", | ||
"version": "16.0.1.0.0", | ||
"category": "Point Of Sale", | ||
"author": "GRAP,Odoo Community Association (OCA)", | ||
"maintainers": ["legalsylvain"], | ||
"website": "https://github.com/OCA/pos", | ||
"license": "AGPL-3", | ||
"depends": ["point_of_sale"], | ||
"data": ["views/view_pos_payment_method.xml"], | ||
"demo": ["demo/product_product.xml"], | ||
"assets": { | ||
"point_of_sale.assets": [ | ||
"pos_payment_method_change_policy/static/src/xml/PaymentScreen.xml", | ||
"pos_payment_method_change_policy/static/src/scss/style.scss", | ||
"pos_payment_method_change_policy/static/src/js/models.esm.js", | ||
"pos_payment_method_change_policy/static/src/js/PaymentScreen.esm.js", | ||
], | ||
}, | ||
"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,16 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<!-- | ||
Copyright (C) 2023 - 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> | ||
|
||
<record id="profit_product" model="product.product"> | ||
<field name="name">No Change Product</field> | ||
<field name="type">service</field> | ||
<field name="available_in_pos" eval="True" /> | ||
<field name="taxes_id" eval="[(6, 0, [])]" /> | ||
</record> | ||
|
||
</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,81 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * pos_margin | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2023-01-22 22:22+0000\n" | ||
"PO-Revision-Date: 2023-01-22 22:22+0000\n" | ||
"Last-Translator: \n" | ||
"Language-Team: \n" | ||
"Language: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: pos_margin | ||
#: model:ir.model,name:pos_margin.model_res_config_settings | ||
msgid "Config Settings" | ||
msgstr "Opciones de configuración" | ||
|
||
#. module: pos_margin | ||
#: model:ir.model.fields,field_description:pos_margin.field_pos_config__iface_display_margin | ||
#: model:ir.model.fields,field_description:pos_margin.field_res_config_settings__pos_iface_display_margin | ||
msgid "Diplay Margin" | ||
msgstr "Mostrar margen" | ||
|
||
#. module: pos_margin | ||
#: model:ir.model.fields,help:pos_margin.field_pos_config__iface_display_margin | ||
#: model:ir.model.fields,help:pos_margin.field_res_config_settings__pos_iface_display_margin | ||
#: model_terms:ir.ui.view,arch_db:pos_margin.res_config_settings_view_form_margin_inherit | ||
msgid "Display Margin and Margin Rate in the frontend" | ||
msgstr "Mostrar margen y tasa de margen en el frontend" | ||
|
||
#. module: pos_margin | ||
#: model:ir.model.fields,field_description:pos_margin.field_report_pos_order__margin_rate | ||
msgid "Margin Rate (%)" | ||
msgstr "Tasa de Margen (%)" | ||
|
||
#. module: pos_margin | ||
#: model_terms:ir.ui.view,arch_db:pos_margin.view_pos_order_tree_inherit | ||
msgid "Margin Total" | ||
msgstr "Margen total" | ||
|
||
#. module: pos_margin | ||
#. odoo-javascript | ||
#: code:addons/pos_margin/static/src/xml/pos_margin.xml:0 | ||
#, python-format | ||
msgid "Margin:" | ||
msgstr "Margen:" | ||
|
||
#. module: pos_margin | ||
#: model:ir.model,name:pos_margin.model_pos_config | ||
msgid "Point of Sale Configuration" | ||
msgstr "Configuración del TPV" | ||
|
||
#. module: pos_margin | ||
#: model:ir.model,name:pos_margin.model_report_pos_order | ||
msgid "Point of Sale Orders Report" | ||
msgstr "Informe de Órdenes del Punto de Venta" | ||
|
||
#~ msgid "Cost Price" | ||
#~ msgstr "Precio de coste" | ||
|
||
#~ msgid "" | ||
#~ "It gives profitability by calculating the difference between the Unit " | ||
#~ "Price and the cost price." | ||
#~ msgstr "" | ||
#~ "Indica el beneficio calculando la diferencia entre el precio unitario y " | ||
#~ "el precio de coste." | ||
|
||
#~ msgid "Margin" | ||
#~ msgstr "Margen" | ||
|
||
#~ msgid "Point of Sale Order Lines" | ||
#~ msgstr "Líneas de Orden de Punto de Venta" | ||
|
||
#~ msgid "Point of Sale Orders" | ||
#~ msgstr "Pedidos del TPV" |
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,2 @@ | ||
from . import pos_payment_method | ||
from . import pos_session |
47 changes: 47 additions & 0 deletions
47
pos_payment_method_change_policy/models/pos_payment_method.py
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) 2023 - 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). | ||
|
||
from odoo import _, api, fields, models | ||
from odoo.exceptions import ValidationError | ||
|
||
|
||
class PosPaymentMethod(models.Model): | ||
_inherit = "pos.payment.method" | ||
|
||
change_product_id = fields.Many2one( | ||
comodel_name="product.product", | ||
domain=[("type", "=", "service"), ("available_in_pos", "=", True)], | ||
help="This product will be used if customer" | ||
" pays more that the amount of the receipt," | ||
" to add an extra order line when confirming" | ||
" order.", | ||
) | ||
|
||
change_policy = fields.Selection( | ||
selection=[ | ||
("cash", "Cash"), | ||
("profit_product", "Exceptional Profit Product"), | ||
], | ||
required=True, | ||
default="cash", | ||
help="Method of managing the giving of change.\n" | ||
" * 'Cash': (Default). the cashier will give back" | ||
" money in cash method." | ||
" * 'profit_product': an extra PoS Order Line will" | ||
" be added in the PoS Order of the surplus amount." | ||
" This will be an exceptional gain for the seller," | ||
" and a loss for the customer.", | ||
) | ||
|
||
@api.constrains("change_policy", "change_product_id") | ||
def check_change_product_id(self): | ||
if self.filtered( | ||
lambda x: x.change_policy == "profit_product" and not x.change_product_id | ||
): | ||
raise ValidationError( | ||
_( | ||
"The field 'Change Product' is required" | ||
" if the 'Change policy' is set to 'Exceptional Profit Product'." | ||
) | ||
) |
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,14 @@ | ||
# Copyright (C) 2023 - 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). | ||
|
||
from odoo import models | ||
|
||
|
||
class PosSession(models.Model): | ||
_inherit = "pos.session" | ||
|
||
def _loader_params_pos_payment_method(self): | ||
res = super()._loader_params_pos_payment_method() | ||
res["search_params"]["fields"] += ["change_policy", "change_product_id"] | ||
return res |
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 @@ | ||
**Exceptional Profit Product** | ||
|
||
* Create a dedicated 'No change' Product. | ||
The type of the product should be 'Service' and the product should available in PoS. | ||
Generally, no VAT is applied on such product. | ||
|
||
* Go to the payment method form. | ||
|
||
* set 'Change Option' as 'Exceptional Profit Product' | ||
|
||
* set the new product in the 'Change Product field' | ||
|
||
.. figure:: ../static/description/payment_screen_profit_policy.png |
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 module improves the 'Change' feature in Odoo Point of Sale, | ||
when a customer pays more that the amount of the PoS Order: | ||
|
||
.. figure:: ../static/description/cash_1_payment_screen.png | ||
|
||
By default, a "Change" line is added on the receipt: | ||
|
||
.. figure:: ../static/description/cash_2_bill.png | ||
|
||
from an accounting point of view, it adds a second payment line in 'Cash' method | ||
with a negative amount corresponding to the surplus: | ||
|
||
.. figure:: ../static/description/cash_3_back_office.png | ||
|
||
In some countries and for some payment methods, this is not the right way to proceed. | ||
|
||
This module adds extra "Change Policy" option to manage differently the giving of change. |
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 @@ | ||
* Implement the ability to print a voucher. |
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,14 @@ | ||
**Exceptional Profit Product** | ||
|
||
A dedicated warning will be displayed: | ||
|
||
.. figure:: ../static/description/profit_policy_1_payment_screen.png | ||
|
||
By default, a new sale order line is added on the receipt: | ||
|
||
.. figure:: ../static/description/profit_policy_2_bill.png | ||
|
||
So, from an accounting point of view, it adds a new line that will | ||
impact a profit and loss account: | ||
|
||
.. figure:: ../static/description/profit_policy_3_back_office.png |
Binary file added
BIN
+28.3 KB
pos_payment_method_change_policy/static/description/cash_1_payment_screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+16.3 KB
pos_payment_method_change_policy/static/description/cash_3_back_office.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.