diff --git a/pos_payment_change/README.rst b/pos_payment_change/README.rst new file mode 100644 index 0000000000..f131f00135 --- /dev/null +++ b/pos_payment_change/README.rst @@ -0,0 +1,147 @@ +=============================== +Point Of Sale - Change Payments +=============================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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_change + :alt: OCA/pos +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/pos-15-0/pos-15-0-pos_payment_change + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/184/16.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends the functionnality of the Odoo Point of Sale to +allow the cashier to change the payments of a PoS order. + +This feature is usefull when the user realized that he did a mistake, +just after he marked the order as paid, or during the close of the session, +Only if entries has not been generated. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +* Go to Point of Sale > Configuration > Point of Sale +* Edit your point of sale, and select a value for the field + 'Payment Change Policy'. + +Two options are available: + +* 'Refund and Resale': Odoo will refund the current + Pos Order to cancel it, and create a new PoS Order + with the correct payment lines + +* 'Update Payments': Odoo will change payment lines. + +.. figure:: https://raw.githubusercontent.com/OCA/pos/16.0/pos_payment_change/static/description/pos_config_form.png + + +**Note** +In some countries the 'Update Payments' Option +is not allowed by law, because orders history shouldn't not be altered. + +For that purpose, a constrains is present to check the value of this +field. If the module ``l10n_fr_certification`` is installed and if the +current company has an inalterable accounting, it will not be possible +to select the value 'Update Payments'. + +Usage +===== + +* Go to a PoS Order + +* Click on the button 'Change Payments' + +.. figure:: https://raw.githubusercontent.com/OCA/pos/16.0/pos_payment_change/static/description/pos_order_form.png + +* In the pop up wizard, select the real payment(s) that have been + used to pay the order + +.. figure:: https://raw.githubusercontent.com/OCA/pos/16.0/pos_payment_change/static/description/pos_payment_change_wizard_form.png + +* Then click on the button 'Change Payments' + +**Note** + +If the option 'Refund and Resale' is selected, changing the payments will +display the three PoS orders. the oringal one, the refund one, and the new one. + +.. figure:: https://raw.githubusercontent.com/OCA/pos/16.0/pos_payment_change/static/description/pos_order_tree.png + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* GRAP + +Contributors +~~~~~~~~~~~~ + +* Sylvain LE GAL +* Julien WESTE +* Foram Shah +* Manuel Regidor + +Other credits +~~~~~~~~~~~~~ + +The development of this module has been financially supported by: + +* GRAP, Groupement Régional Alimentaire de proximité (www.grap.coop) +* Vracoop (www.vracoop.fr) + +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 `__: + +|maintainer-legalsylvain| + +This module is part of the `OCA/pos `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/pos_payment_change/__init__.py b/pos_payment_change/__init__.py new file mode 100644 index 0000000000..aee8895e7a --- /dev/null +++ b/pos_payment_change/__init__.py @@ -0,0 +1,2 @@ +from . import models +from . import wizards diff --git a/pos_payment_change/__manifest__.py b/pos_payment_change/__manifest__.py new file mode 100644 index 0000000000..094688efd5 --- /dev/null +++ b/pos_payment_change/__manifest__.py @@ -0,0 +1,23 @@ +# Copyright (C) 2013 - 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": "Point Of Sale - Change Payments", + "version": "16.0.1.0.0", + "summary": "Allow cashier to change order payments, as long as" + " the session is not closed.", + "category": "Point Of Sale", + "author": "GRAP, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/pos", + "license": "AGPL-3", + "depends": ["point_of_sale"], + "maintainers": ["legalsylvain"], + "development_status": "Beta", + "data": [ + "security/ir.model.access.csv", + "wizards/view_pos_payment_change_wizard.xml", + "views/view_pos_config.xml", + "views/view_pos_order.xml", + ], + "installable": True, +} diff --git a/pos_payment_change/i18n/de.po b/pos_payment_change/i18n/de.po new file mode 100644 index 0000000000..994a9b0b12 --- /dev/null +++ b/pos_payment_change/i18n/de.po @@ -0,0 +1,240 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_payment_change +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-04-08 07:52+0000\n" +"Last-Translator: André Volksdorf \n" +"Language-Team: none\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: pos_payment_change +#: code:addons/pos_payment_change/models/pos_order.py:79 +#, python-format +msgid " (Refund Order: %(refund_order)s ; Resale Order: %(resale_order)s)" +msgstr " (Rückerstattungsauftrag: %(refund_order)s ; Wiederverkaufsauftrag: %(resale_order)s)" + +#. module: pos_payment_change +#: model_terms:ir.ui.view,arch_db:pos_payment_change.view_pos_config_form +msgid "Payment Change Policy" +msgstr "Richtlinie für Zahlungsänderungen" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__amount +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__amount +msgid "Amount" +msgstr "Betrag" + +#. module: pos_payment_change +#: model_terms:ir.ui.view,arch_db:pos_payment_change.view_pos_payment_change_wizard_form +msgid "Cancel" +msgstr "Abbrechen" + +#. module: pos_payment_change +#: model:ir.actions.act_window,name:pos_payment_change.action_pos_payment_change_wizard +#: model_terms:ir.ui.view,arch_db:pos_payment_change.view_pos_order_form +#: model_terms:ir.ui.view,arch_db:pos_payment_change.view_pos_payment_change_wizard_form +msgid "Change Payments" +msgstr "Zahlung ändern" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__company_currency_id +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__company_currency_id +msgid "Company Currency" +msgstr "Währung" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__create_uid +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__create_uid +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__create_uid +msgid "Created by" +msgstr "Erstellt von" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__create_date +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__create_date +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__create_date +msgid "Created on" +msgstr "Erstellt am" + +#. module: pos_payment_change +#: code:addons/pos_payment_change/wizards/pos_payment_change_wizard.py:69 +#, python-format +msgid "" +"Differences between the two values for the POS Order '%(name)s':" +"\n" +" * Total of all the new payments %(total)s;" +" * Total of the POS Order %(amount_total)s;" +"\n" +"Please change the payments." +msgstr "" +"Differenzen zwischen den beiden Werten für den POS-Auftrag '%(name)s':\n" +"\n" +" * Summe aller neuen Zahlungen %(total)s;\n" +" * Summe des POS-Auftrags %(amount_total)s;\n" +"\n" +"Bitte ändern Sie die Zahlungen." + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__display_name +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__display_name +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__display_name +msgid "Display Name" +msgstr "Anzeigename" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__id +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__id +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__id +msgid "ID" +msgstr "ID" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__new_journal_id +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__old_journal_id +msgid "Journal" +msgstr "Journal" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard____last_update +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line____last_update +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line____last_update +msgid "Last Modified on" +msgstr "Zuletzt geändert am" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__write_uid +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__write_uid +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__write_uid +msgid "Last Updated by" +msgstr "Zuletzt aktualisiert von" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__write_date +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__write_date +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__write_date +msgid "Last Updated on" +msgstr "Zuletzt aktualisiert am" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__new_line_ids +msgid "New Payment Lines" +msgstr "Neue Zahlungslinien" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__old_line_ids +msgid "Old Payment Lines" +msgstr "Alte Zahlungslinien" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__order_id +msgid "Order" +msgstr "Auftrag" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_config__payment_change_policy +msgid "Payment Change Policy" +msgstr "Richtlinie für Zahlungsänderungen" + +#. module: pos_payment_change +#: model:ir.model.fields,help:pos_payment_change.field_pos_config__payment_change_policy +msgid "Payment Change Policy when users want to change the payment lines of a given PoS Order.\n" +"* 'Refund and Resale': Odoo will refund the current Pos Order to cancel it, and create a new PoS Order with the correct payment lines.\n" +"* 'Update Payments': Odoo will change payment lines.\n" +"\n" +"Note : In some countries the 'Update Payments' Option is not allowed by law, because orders history shouldn't not be altered." +msgstr "" +"Richtlinie für Zahlungsänderungen, wenn Benutzer die Zahlungszeilen eines " +"bestimmten PoS-Auftrags ändern möchten.\n" +"* 'Rückerstattung und Wiederverkauf': Odoo erstattet den aktuellen PoS-" +"Auftrag zurück, um ihn zu stornieren, und erstellt einen neuen PoS-Auftrag " +"mit den korrekten Zahlungszeilen.\n" +"* 'Zahlungen aktualisieren': Odoo wird die Zahlungszeilen ändern.\n" +"\n" +"Hinweis: In einigen Ländern ist die Option 'Zahlungen aktualisieren' " +"gesetzlich nicht erlaubt, da die Bestellhistorie nicht verändert werden darf." + +#. module: pos_payment_change +#: model:ir.model,name:pos_payment_change.model_pos_payment_change_wizard +msgid "PoS Payment Change Wizard" +msgstr "PoS-Zahlungsänderungs-Assistent" + +#. module: pos_payment_change +#: model:ir.model,name:pos_payment_change.model_pos_payment_change_wizard_new_line +msgid "PoS Payment Change Wizard New Line" +msgstr "PoS-Zahlungsänderungsassistent Neue Zeile" + +#. module: pos_payment_change +#: model:ir.model,name:pos_payment_change.model_pos_payment_change_wizard_old_line +msgid "PoS Payment Change Wizard Old Line" +msgstr "PoS-Zahlungsänderungsassistent Alte Zeile" + +#. module: pos_payment_change +#: model:ir.model,name:pos_payment_change.model_pos_config +msgid "Point of Sale Configuration" +msgstr "Konfiguration der Verkaufsstelle" + +#. module: pos_payment_change +#: model:ir.model,name:pos_payment_change.model_pos_order +msgid "Point of Sale Orders" +msgstr "Bestellungen am Point of Sale" + +#. module: pos_payment_change +#: selection:pos.config,payment_change_policy:0 +msgid "Refund and Resale" +msgstr "Rückerstattung und Wiederverkauf" + +#. module: pos_payment_change +#: code:addons/pos_payment_change/models/pos_order.py:43 +#, python-format +msgid "The payments of the Order %(order)s (Ref: %(ref)s have been changed by %(user_name)s on %(today)s" +msgstr "Die Zahlungen des Auftrags %(order)s (Ref: %(ref)s) wurden von %(user_name)s bei %(today)s geändert." + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__amount_total +#: model_terms:ir.ui.view,arch_db:pos_payment_change.view_pos_payment_change_wizard_form +msgid "Total" +msgstr "Gesamt" + +#. module: pos_payment_change +#: code:addons/pos_payment_change/models/pos_config.py:43 +#, python-format +msgid "Unable to use the 'Update Payments' options for companies that have unalterable accounting." +msgstr "" +"Die Optionen 'Zahlungen aktualisieren' können nicht für Firmen mit " +"unveränderlicher Buchhaltung verwendet werden." + +#. module: pos_payment_change +#: selection:pos.config,payment_change_policy:0 +msgid "Update Payments" +msgstr "Zahlungen aktualisieren" + +#. module: pos_payment_change +#: model:ir.model.fields,help:pos_payment_change.field_pos_payment_change_wizard_new_line__company_currency_id +#: model:ir.model.fields,help:pos_payment_change.field_pos_payment_change_wizard_old_line__company_currency_id +msgid "Utility field to express amount currency" +msgstr "Utility-Feld zur Angabe der Betragswährung" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__wizard_id +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__wizard_id +msgid "Wizard" +msgstr "Assistent" + +#. module: pos_payment_change +#: code:addons/pos_payment_change/models/pos_order.py:97 +#, python-format +msgid "" +"You can not change payments of the POS '%(name)s' because the associated session " +"'%(session)s' has been closed!" +msgstr "" +"Sie können Zahlungen der Kasse '%(name)s' nicht ändern, da die zugehörige Sitzung " +"'%(session)s' geschlossen wurde!" diff --git a/pos_payment_change/i18n/es.po b/pos_payment_change/i18n/es.po new file mode 100644 index 0000000000..f5ef49c96f --- /dev/null +++ b/pos_payment_change/i18n/es.po @@ -0,0 +1,246 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_payment_change +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-10-26 11:08+0000\n" +"Last-Translator: Daniel Martinez Vila \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 3.10\n" + +#. module: pos_payment_change +#: code:addons/pos_payment_change/models/pos_order.py:79 +#, python-format +msgid " (Refund Order: %(refund_order)s ; Resale Order: %(resale_order)s)" +msgstr " (Orden de reembolso: %(refund_order)s ; Orden de reventa: %(resale_order)s)" + +#. module: pos_payment_change +#: model_terms:ir.ui.view,arch_db:pos_payment_change.view_pos_config_form +msgid "Payment Change Policy" +msgstr "Política de cambio de pago" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__amount +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__amount +msgid "Amount" +msgstr "Importe" + +#. module: pos_payment_change +#: model_terms:ir.ui.view,arch_db:pos_payment_change.view_pos_payment_change_wizard_form +msgid "Cancel" +msgstr "Cancelar" + +#. module: pos_payment_change +#: model:ir.actions.act_window,name:pos_payment_change.action_pos_payment_change_wizard +#: model_terms:ir.ui.view,arch_db:pos_payment_change.view_pos_order_form +#: model_terms:ir.ui.view,arch_db:pos_payment_change.view_pos_payment_change_wizard_form +msgid "Change Payments" +msgstr "Cambiar pagos" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__company_currency_id +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__company_currency_id +msgid "Company Currency" +msgstr "Moneda de la compañía" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__create_uid +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__create_uid +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__create_uid +msgid "Created by" +msgstr "Creado por" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__create_date +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__create_date +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__create_date +msgid "Created on" +msgstr "Creado el" + +#. module: pos_payment_change +#: code:addons/pos_payment_change/wizards/pos_payment_change_wizard.py:69 +#, python-format +msgid "" +"Differences between the two values for the POS Order '%(name)s':" +"\n" +" * Total of all the new payments %(total)s;" +" * Total of the POS Order %(amount_total)s;" +"\n" +"Please change the payments." +msgstr "" +"Diferencias entre los dos valores para la orden PdV '%(name)s':\n" +"\n" +" * Total de todos los nuevos pagos %(total)s;\n" +" * Total del pedido del punto de venta %(amount_total)s;\n" +"\n" +"Por favor cambie los pagos." + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__display_name +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__display_name +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__display_name +msgid "Display Name" +msgstr "Nombre a mostrar" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__id +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__id +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__id +msgid "ID" +msgstr "ID" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__new_journal_id +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__old_journal_id +msgid "Journal" +msgstr "Diario" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard____last_update +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line____last_update +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line____last_update +msgid "Last Modified on" +msgstr "Última modificación en" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__write_uid +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__write_uid +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__write_uid +msgid "Last Updated by" +msgstr "Última actualización por" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__write_date +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__write_date +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__write_date +msgid "Last Updated on" +msgstr "Última actualización el" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__new_line_ids +msgid "New Payment Lines" +msgstr "Nuevas líneas de pago" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__old_line_ids +msgid "Old Payment Lines" +msgstr "Viejas líneas de pago" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__order_id +msgid "Order" +msgstr "Orden" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_config__payment_change_policy +msgid "Payment Change Policy" +msgstr "Política de cambio de pago" + +#. module: pos_payment_change +#: model:ir.model.fields,help:pos_payment_change.field_pos_config__payment_change_policy +msgid "" +"Payment Change Policy when users want to change the payment lines of a given " +"PoS Order.\n" +"* 'Refund and Resale': Odoo will refund the current Pos Order to cancel it, " +"and create a new PoS Order with the correct payment lines.\n" +"* 'Update Payments': Odoo will change payment lines.\n" +"\n" +"Note : In some countries the 'Update Payments' Option is not allowed by law, " +"because orders history shouldn't not be altered." +msgstr "" +"Política de cambio de pago cuando los usuarios desean cambiar las líneas de " +"pago de un pedido PdV determinado.\n" +"* 'Reembolso y reventa': Odoo reembolsará el pedido de posición actual para " +"cancelarlo y creará un nuevo pedido de PoS con las líneas de pago " +"correctas.\n" +"* 'Actualizar pagos': Odoo cambiará las líneas de pago.\n" +"\n" +"Nota: En algunos países, la opción 'Actualizar pagos' no está permitida por " +"ley, ya que el historial de pedidos no debe modificarse." + +#. module: pos_payment_change +#: model:ir.model,name:pos_payment_change.model_pos_payment_change_wizard +msgid "PoS Payment Change Wizard" +msgstr "Asistente de cambio de pago del PdV" + +#. module: pos_payment_change +#: model:ir.model,name:pos_payment_change.model_pos_payment_change_wizard_new_line +msgid "PoS Payment Change Wizard New Line" +msgstr "Asistente de cambio de pago de una nueva línea del PdV" + +#. module: pos_payment_change +#: model:ir.model,name:pos_payment_change.model_pos_payment_change_wizard_old_line +msgid "PoS Payment Change Wizard Old Line" +msgstr "Asistente de cambio de pago de una línea antigua del PdV" + +#. module: pos_payment_change +#: model:ir.model,name:pos_payment_change.model_pos_config +msgid "Point of Sale Configuration" +msgstr "Configuración del punto de venta" + +#. module: pos_payment_change +#: model:ir.model,name:pos_payment_change.model_pos_order +msgid "Point of Sale Orders" +msgstr "Pedidos de Punto de Venta" + +#. module: pos_payment_change +#: selection:pos.config,payment_change_policy:0 +msgid "Refund and Resale" +msgstr "Reembolso y reventa" + +#. module: pos_payment_change +#: code:addons/pos_payment_change/models/pos_order.py:43 +#, python-format +msgid "The payments of the Order %(order)s (Ref: %(ref)s have been changed by %(user_name)s on %(today)s" +msgstr "Los pagos de la orden %(order)s (Ref: %(ref)s) han sido modificados por %(user_name)s en %(today)s." + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__amount_total +#: model_terms:ir.ui.view,arch_db:pos_payment_change.view_pos_payment_change_wizard_form +msgid "Total" +msgstr "Total" + +#. module: pos_payment_change +#: code:addons/pos_payment_change/models/pos_config.py:43 +#, python-format +msgid "" +"Unable to use the 'Update Payments' options for companies that have " +"unalterable accounting." +msgstr "" +"No se pueden usar las opciones de 'Actualizar pagos' para empresas que " +"tienen contabilidad inalterable." + +#. module: pos_payment_change +#: selection:pos.config,payment_change_policy:0 +msgid "Update Payments" +msgstr "Actualizar pagos" + +#. module: pos_payment_change +#: model:ir.model.fields,help:pos_payment_change.field_pos_payment_change_wizard_new_line__company_currency_id +#: model:ir.model.fields,help:pos_payment_change.field_pos_payment_change_wizard_old_line__company_currency_id +msgid "Utility field to express amount currency" +msgstr "Campo de utilidad para expresar la cantidad de la moneda" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__wizard_id +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__wizard_id +msgid "Wizard" +msgstr "Asistente" + +#. module: pos_payment_change +#: code:addons/pos_payment_change/models/pos_order.py:97 +#, python-format +msgid "" +"You can not change payments of the POS '%(name)s' because the associated session " +"'%(session)s' has been closed!" +msgstr "" +"¡No puede cambiar los pagos del PdV '%(name)s' porque la sesión asociada '%(session)s' se " +"ha cerrado!" diff --git a/pos_payment_change/i18n/fr.po b/pos_payment_change/i18n/fr.po new file mode 100644 index 0000000000..22631e44ef --- /dev/null +++ b/pos_payment_change/i18n/fr.po @@ -0,0 +1,248 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_payment_change +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-05-18 17:33+0000\n" +"PO-Revision-Date: 2020-05-18 17:33+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_payment_change +#: code:addons/pos_payment_change/models/pos_order.py:79 +#, python-format +msgid " (Refund Order: %(refund_order)s ; Resale Order: %(resale_order)s)" +msgstr " (Remboursement: %(refund_order)s ; Revente : %(resale_order)s)" + +#. module: pos_payment_change +#: model_terms:ir.ui.view,arch_db:pos_payment_change.view_pos_config_form +msgid "Payment Change Policy" +msgstr "Méthode de changement de paiement" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__amount +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__amount +msgid "Amount" +msgstr "Montant" + +#. module: pos_payment_change +#: model_terms:ir.ui.view,arch_db:pos_payment_change.view_pos_payment_change_wizard_form +msgid "Cancel" +msgstr "Annuler" + +#. module: pos_payment_change +#: model:ir.actions.act_window,name:pos_payment_change.action_pos_payment_change_wizard +#: model_terms:ir.ui.view,arch_db:pos_payment_change.view_pos_order_form +#: model_terms:ir.ui.view,arch_db:pos_payment_change.view_pos_payment_change_wizard_form +msgid "Change Payments" +msgstr "Changer les paiements" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__company_currency_id +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__company_currency_id +msgid "Company Currency" +msgstr "" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__create_uid +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__create_uid +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__create_uid +msgid "Created by" +msgstr "Créé par" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__create_date +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__create_date +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__create_date +msgid "Created on" +msgstr "Créé le" + +#. module: pos_payment_change +#: code:addons/pos_payment_change/wizards/pos_payment_change_wizard.py:69 +#, python-format +msgid "" +"Differences between the two values for the POS Order '%(name)s':" +"\n" +" * Total of all the new payments %(total)s;" +" * Total of the POS Order %(amount_total)s;" +"\n" +"Please change the payments." +msgstr "" +"Différences entre les deux valeurs pour la vente '%(name)s':\n" +"\n" +" * Total des nouveaux paiements %(total)s;\n" +" * Total de la vente %(amount_total)s;\n" +"\n" +"Veuillez changer les paiements." + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__display_name +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__display_name +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__display_name +msgid "Display Name" +msgstr "Nom affiché" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__id +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__id +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__id +msgid "ID" +msgstr "ID" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__new_journal_id +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__old_journal_id +msgid "Journal" +msgstr "Journal" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard____last_update +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line____last_update +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line____last_update +msgid "Last Modified on" +msgstr "Dernière modification le" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__write_uid +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__write_uid +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__write_uid +msgid "Last Updated by" +msgstr "Dernière mise à jour par" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__write_date +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__write_date +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__write_date +msgid "Last Updated on" +msgstr "Dernière mise à jour le" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__new_line_ids +msgid "New Payment Lines" +msgstr "Nouveaux paiements" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__old_line_ids +msgid "Old Payment Lines" +msgstr "Anciens paiements" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__order_id +msgid "Order" +msgstr "Commande" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_config__payment_change_policy +msgid "Payment Change Policy" +msgstr "Méthode de changement de paiement" + +#. module: pos_payment_change +#: model:ir.model.fields,help:pos_payment_change.field_pos_config__payment_change_policy +msgid "" +"Payment Change Policy when users want to change the payment lines of a given " +"PoS Order.\n" +"* 'Refund and Resale': Odoo will refund the current Pos Order to cancel it, " +"and create a new PoS Order with the correct payment lines.\n" +"* 'Update Payments': Odoo will change payment lines.\n" +"\n" +"Note : In some countries the 'Update Payments' Option is not allowed by law, " +"because orders history shouldn't not be altered." +msgstr "" +"Méthode de changement de paiement quand les utilisateurs veulent changer des " +"lignes de paiement d'une vente en caisse.\n" +"* 'Retourner et revendre': Odoo va réaliser un retour du la vente pour " +"l'annuler, puis recréera une nouvelle vente, avec les paiements corrects.\n" +"* 'Modifier les paiements': Odoo va changer les lignes de paiements.\n" +"\n" +"Note : dans certains pays, l'option 'Modifier les paiements' n'est pas " +"autorisé par la loi, parce que l'historique des ventes ne doit pas être " +"altéré." + +#. module: pos_payment_change +#: model:ir.model,name:pos_payment_change.model_pos_payment_change_wizard +msgid "PoS Payment Change Wizard" +msgstr "Assistant de changement de paiement du Point de Vente" + +#. module: pos_payment_change +#: model:ir.model,name:pos_payment_change.model_pos_payment_change_wizard_new_line +msgid "PoS Payment Change Wizard New Line" +msgstr "" +"Nouvelle ligne de l'ssistant de changement de paiement du Point de Vente" + +#. module: pos_payment_change +#: model:ir.model,name:pos_payment_change.model_pos_payment_change_wizard_old_line +msgid "PoS Payment Change Wizard Old Line" +msgstr "" +"Ancienne ligne de l'ssistant de changement de paiement du Point de Vente" + +#. module: pos_payment_change +#: model:ir.model,name:pos_payment_change.model_pos_config +msgid "Point of Sale Configuration" +msgstr "Paramétrage du point de vente" + +#. module: pos_payment_change +#: model:ir.model,name:pos_payment_change.model_pos_order +msgid "Point of Sale Orders" +msgstr "Commandes du point de vente" + +#. module: pos_payment_change +#: selection:pos.config,payment_change_policy:0 +msgid "Refund and Resale" +msgstr "Retourner et revendre" + +#. module: pos_payment_change +#: code:addons/pos_payment_change/models/pos_order.py:43 +#, python-format +msgid "The payments of the Order %(order)s (Ref: %(ref)s have been changed by %(user_name)s on %(today)s" +msgstr "Les paiements de la commande %(order)s (Réf: %(ref)s) ont été changés par %(user_name)s à %(today)s." + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__amount_total +#: model_terms:ir.ui.view,arch_db:pos_payment_change.view_pos_payment_change_wizard_form +msgid "Total" +msgstr "Total" + +#. module: pos_payment_change +#: code:addons/pos_payment_change/models/pos_config.py:43 +#, python-format +msgid "" +"Unable to use the 'Update Payments' options for companies that have " +"unalterable accounting." +msgstr "" +"Impossible d'utiliser l'option 'Modifier les paiements' pour les sociétés " +"qui ont une comptabilité inaltérable." + +#. module: pos_payment_change +#: selection:pos.config,payment_change_policy:0 +msgid "Update Payments" +msgstr "Modifier les paiements" + +#. module: pos_payment_change +#: model:ir.model.fields,help:pos_payment_change.field_pos_payment_change_wizard_new_line__company_currency_id +#: model:ir.model.fields,help:pos_payment_change.field_pos_payment_change_wizard_old_line__company_currency_id +msgid "Utility field to express amount currency" +msgstr "" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__wizard_id +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__wizard_id +msgid "Wizard" +msgstr "Assistant" + +#. module: pos_payment_change +#: code:addons/pos_payment_change/models/pos_order.py:97 +#, python-format +msgid "" +"You can not change payments of the POS '%(name)s' because the associated session " +"'%(session)s' has been closed!" +msgstr "" +"Vous ne pouvez pas changer les paiements de la Vente '%(name)s' car la session " +"associée '%(session)s' a été clôturé !" diff --git a/pos_payment_change/i18n/pos_payment_change.pot b/pos_payment_change/i18n/pos_payment_change.pot new file mode 100644 index 0000000000..295c79832e --- /dev/null +++ b/pos_payment_change/i18n/pos_payment_change.pot @@ -0,0 +1,223 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_payment_change +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \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_payment_change +#: code:addons/pos_payment_change/models/pos_order.py:0 +#, python-format +msgid " (Refund Order: %(refund_order)s ; Resale Order: %(resale_order)s)" +msgstr "" + +#. module: pos_payment_change +#: model_terms:ir.ui.view,arch_db:pos_payment_change.view_pos_config_form +msgid "Payment Change Policy" +msgstr "" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__amount +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__amount +msgid "Amount" +msgstr "" + +#. module: pos_payment_change +#: model_terms:ir.ui.view,arch_db:pos_payment_change.view_pos_payment_change_wizard_form +msgid "Cancel" +msgstr "" + +#. module: pos_payment_change +#: model:ir.actions.act_window,name:pos_payment_change.action_pos_payment_change_wizard +#: model_terms:ir.ui.view,arch_db:pos_payment_change.view_pos_order_form +#: model_terms:ir.ui.view,arch_db:pos_payment_change.view_pos_payment_change_wizard_form +msgid "Change Payments" +msgstr "" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__company_currency_id +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__company_currency_id +msgid "Company Currency" +msgstr "" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__create_uid +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__create_uid +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__create_uid +msgid "Created by" +msgstr "" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__create_date +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__create_date +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__create_date +msgid "Created on" +msgstr "" + +#. module: pos_payment_change +#: code:addons/pos_payment_change/wizards/pos_payment_change_wizard.py:0 +#, python-format +msgid "" +"Differences between the two values for the POS Order '%(name)s':\n" +"\n" +" * Total of all the new payments %(total)s;\n" +" * Total of the POS Order %(amount_total)s;\n" +"\n" +"Please change the payments." +msgstr "" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__display_name +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__display_name +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__display_name +msgid "Display Name" +msgstr "" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__id +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__id +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__id +msgid "ID" +msgstr "" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard____last_update +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line____last_update +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line____last_update +msgid "Last Modified on" +msgstr "" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__write_uid +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__write_uid +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__write_date +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__write_date +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__write_date +msgid "Last Updated on" +msgstr "" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__new_line_ids +msgid "New Payment Lines" +msgstr "" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__old_line_ids +msgid "Old Payment Lines" +msgstr "" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__order_id +msgid "Order" +msgstr "" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_config__payment_change_policy +msgid "Payment Change Policy" +msgstr "" + +#. module: pos_payment_change +#: model:ir.model.fields,help:pos_payment_change.field_pos_config__payment_change_policy +msgid "" +"Payment Change Policy when users want to change the payment lines of a given PoS Order.\n" +"* 'Refund and Resale': Odoo will refund the current Pos Order to cancel it, and create a new PoS Order with the correct payment lines.\n" +"* 'Update Payments': Odoo will change payment lines.\n" +"\n" +"Note : In some countries the 'Update Payments' Option is not allowed by law, because orders history shouldn't not be altered." +msgstr "" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__new_payment_method_id +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__old_payment_method_id +msgid "Payment Method" +msgstr "" + +#. module: pos_payment_change +#: model:ir.model,name:pos_payment_change.model_pos_payment_change_wizard +msgid "PoS Payment Change Wizard" +msgstr "" + +#. module: pos_payment_change +#: model:ir.model,name:pos_payment_change.model_pos_payment_change_wizard_new_line +msgid "PoS Payment Change Wizard New Line" +msgstr "" + +#. module: pos_payment_change +#: model:ir.model,name:pos_payment_change.model_pos_payment_change_wizard_old_line +msgid "PoS Payment Change Wizard Old Line" +msgstr "" + +#. module: pos_payment_change +#: model:ir.model,name:pos_payment_change.model_pos_config +msgid "Point of Sale Configuration" +msgstr "" + +#. module: pos_payment_change +#: model:ir.model,name:pos_payment_change.model_pos_order +msgid "Point of Sale Orders" +msgstr "" + +#. module: pos_payment_change +#: model:ir.model.fields.selection,name:pos_payment_change.selection__pos_config__payment_change_policy__refund +msgid "Refund and Resale" +msgstr "" + +#. module: pos_payment_change +#: code:addons/pos_payment_change/models/pos_order.py:0 +#, python-format +msgid "" +"The payments of the Order %(order)s (Ref: %(ref)s have been changed by " +"%(user_name)s on %(today)s" +msgstr "" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard__amount_total +#: model_terms:ir.ui.view,arch_db:pos_payment_change.view_pos_payment_change_wizard_form +msgid "Total" +msgstr "" + +#. module: pos_payment_change +#: code:addons/pos_payment_change/models/pos_config.py:0 +#, python-format +msgid "" +"Unable to use the 'Update Payments' options for companies that have " +"unalterable accounting." +msgstr "" + +#. module: pos_payment_change +#: model:ir.model.fields.selection,name:pos_payment_change.selection__pos_config__payment_change_policy__update +msgid "Update Payments" +msgstr "" + +#. module: pos_payment_change +#: model:ir.model.fields,help:pos_payment_change.field_pos_payment_change_wizard_new_line__company_currency_id +#: model:ir.model.fields,help:pos_payment_change.field_pos_payment_change_wizard_old_line__company_currency_id +msgid "Utility field to express amount currency" +msgstr "" + +#. module: pos_payment_change +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_new_line__wizard_id +#: model:ir.model.fields,field_description:pos_payment_change.field_pos_payment_change_wizard_old_line__wizard_id +msgid "Wizard" +msgstr "" + +#. module: pos_payment_change +#: code:addons/pos_payment_change/models/pos_order.py:0 +#, python-format +msgid "" +"You can not change payments of the POS '%(name)s' because the associated " +"session '%(session)s' has been closed!" +msgstr "" diff --git a/pos_payment_change/models/__init__.py b/pos_payment_change/models/__init__.py new file mode 100644 index 0000000000..234b311eae --- /dev/null +++ b/pos_payment_change/models/__init__.py @@ -0,0 +1,2 @@ +from . import pos_config +from . import pos_order diff --git a/pos_payment_change/models/pos_config.py b/pos_payment_change/models/pos_config.py new file mode 100644 index 0000000000..2e34a153ea --- /dev/null +++ b/pos_payment_change/models/pos_config.py @@ -0,0 +1,51 @@ +# Copyright (C) 2020 - 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 PosConfig(models.Model): + _inherit = "pos.config" + + _PAYMENT_CHANGE_POLICY_SELECTION = [ + ("refund", "Refund and Resale"), + ("update", "Update Payments"), + ] + + payment_change_policy = fields.Selection( + selection=_PAYMENT_CHANGE_POLICY_SELECTION, + default="refund", + required=True, + help="Payment Change Policy when users want" + " to change the payment lines of a given PoS Order.\n" + "* 'Refund and Resale': Odoo will refund the current" + " Pos Order to cancel it, and create a new PoS Order" + " with the correct payment lines.\n" + "* 'Update Payments': Odoo will change payment lines.\n\n" + "Note : In some countries the 'Update Payments' Option" + " is not allowed by law, because orders history shouldn't" + " not be altered.", + ) + + @api.constrains("payment_change_policy") + def _check_payment_change_policy(self): + # Check if certification module is installed + # and if yes, if 'update payments' option is allowed + module_states = ( + self.env["ir.module.module"] + .sudo() + .search([("name", "=", "l10n_fr_certification")]) + .mapped("state") + ) + if "installed" not in module_states: + return + for config in self.filtered(lambda x: x.payment_change_policy == "update"): + if config.company_id._is_accounting_unalterable(): + raise ValidationError( + _( + "Unable to use the 'Update Payments' options" + " for companies that have unalterable accounting." + ) + ) diff --git a/pos_payment_change/models/pos_order.py b/pos_payment_change/models/pos_order.py new file mode 100644 index 0000000000..bfa89ff20f --- /dev/null +++ b/pos_payment_change/models/pos_order.py @@ -0,0 +1,101 @@ +# Copyright (C) 2015 - Today: GRAP (http://www.grap.coop) +# @author: Julien WESTE +# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from datetime import datetime + +from odoo import _, fields, models +from odoo.exceptions import Warning as UserError +from odoo.tools import float_is_zero + + +class PosOrder(models.Model): + _inherit = "pos.order" + + def change_payment(self, payment_lines): + """ + Change payment of a given order. + payment_lines should be a list of data that are + the argument of the Odoo Core function add_payment() + Return a list of order ids, depending on the + payment_change_policy of the related pos_config. + """ + self.ensure_one() + orders = self + + # Removing zero lines + precision = self.pricelist_id.currency_id.decimal_places + payment_lines = [ + x + for x in payment_lines + if not float_is_zero(x["amount"], precision_digits=precision) + ] + + self._check_payment_change_allowed() + + comment = _( + "The payments of the Order %(order)s (Ref: %(ref)s have" + " been changed by %(user_name)s on %(today)s", + order=self.name, + ref=self.pos_reference, + user_name=self.env.user.name, + today=datetime.today(), + ) + + if self.config_id.payment_change_policy == "update": + self.payment_ids.with_context().unlink() + + # Create new payment + for line in payment_lines: + self.add_payment(line) + + elif self.config_id.payment_change_policy == "refund": + # Refund order and mark it as paid + # with same payment method as the original one + refund_result = self.refund() + refund_order = self.browse(refund_result["res_id"]) + for payment in self.payment_ids: + refund_order.add_payment( + { + "pos_order_id": refund_order.id, + "payment_method_id": payment.payment_method_id.id, + "amount": -payment.amount, + "payment_date": fields.Date.context_today(self), + } + ) + + refund_order.action_pos_order_paid() + + # Resale order and mark it as paid + # with the new payment + resale_order = self.copy(default={"pos_reference": self.pos_reference}) + for line in payment_lines: + line.update({"pos_order_id": resale_order.id}) + resale_order.add_payment(line) + resale_order.action_pos_order_paid() + + orders += refund_order + resale_order + comment += _( + " (Refund Order: %(refund_order)s ; Resale Order: %(resale_order)s)", + refund_order=refund_order.name, + resale_order=resale_order.name, + ) + + for order in orders: + order.note = "%s\n%s" % (order.note or "", comment) + return orders + + def _check_payment_change_allowed(self): + """Return True if the user can change the payment of a POS, depending + of the state of the current session.""" + closed_orders = self.filtered(lambda x: x.session_id.state == "closed") + if len(closed_orders): + raise UserError( + _( + "You can not change payments of the POS '%(name)s' because" + " the associated session '%(session)s' has been closed!", + name=", ".join(closed_orders.mapped("name")), + session=", ".join(closed_orders.mapped("session_id.name")), + ) + ) diff --git a/pos_payment_change/readme/CONFIGURE.rst b/pos_payment_change/readme/CONFIGURE.rst new file mode 100644 index 0000000000..fd1eba8dbb --- /dev/null +++ b/pos_payment_change/readme/CONFIGURE.rst @@ -0,0 +1,23 @@ +* Go to Point of Sale > Configuration > Point of Sale +* Edit your point of sale, and select a value for the field + 'Payment Change Policy'. + +Two options are available: + +* 'Refund and Resale': Odoo will refund the current + Pos Order to cancel it, and create a new PoS Order + with the correct payment lines + +* 'Update Payments': Odoo will change payment lines. + +.. figure:: ../static/description/pos_config_form.png + + +**Note** +In some countries the 'Update Payments' Option +is not allowed by law, because orders history shouldn't not be altered. + +For that purpose, a constrains is present to check the value of this +field. If the module ``l10n_fr_certification`` is installed and if the +current company has an inalterable accounting, it will not be possible +to select the value 'Update Payments'. diff --git a/pos_payment_change/readme/CONTRIBUTORS.rst b/pos_payment_change/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..300d09239b --- /dev/null +++ b/pos_payment_change/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* Sylvain LE GAL +* Julien WESTE +* Foram Shah +* Manuel Regidor diff --git a/pos_payment_change/readme/CREDITS.rst b/pos_payment_change/readme/CREDITS.rst new file mode 100644 index 0000000000..4832a8457f --- /dev/null +++ b/pos_payment_change/readme/CREDITS.rst @@ -0,0 +1,4 @@ +The development of this module has been financially supported by: + +* GRAP, Groupement Régional Alimentaire de proximité (www.grap.coop) +* Vracoop (www.vracoop.fr) diff --git a/pos_payment_change/readme/DESCRIPTION.rst b/pos_payment_change/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..f725ca719c --- /dev/null +++ b/pos_payment_change/readme/DESCRIPTION.rst @@ -0,0 +1,6 @@ +This module extends the functionnality of the Odoo Point of Sale to +allow the cashier to change the payments of a PoS order. + +This feature is usefull when the user realized that he did a mistake, +just after he marked the order as paid, or during the close of the session, +Only if entries has not been generated. diff --git a/pos_payment_change/readme/USAGE.rst b/pos_payment_change/readme/USAGE.rst new file mode 100644 index 0000000000..604022c883 --- /dev/null +++ b/pos_payment_change/readme/USAGE.rst @@ -0,0 +1,19 @@ +* Go to a PoS Order + +* Click on the button 'Change Payments' + +.. figure:: ../static/description/pos_order_form.png + +* In the pop up wizard, select the real payment(s) that have been + used to pay the order + +.. figure:: ../static/description/pos_payment_change_wizard_form.png + +* Then click on the button 'Change Payments' + +**Note** + +If the option 'Refund and Resale' is selected, changing the payments will +display the three PoS orders. the oringal one, the refund one, and the new one. + +.. figure:: ../static/description/pos_order_tree.png diff --git a/pos_payment_change/security/ir.model.access.csv b/pos_payment_change/security/ir.model.access.csv new file mode 100644 index 0000000000..913b1232b5 --- /dev/null +++ b/pos_payment_change/security/ir.model.access.csv @@ -0,0 +1,4 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_pos_payment_change_wizard,access_pos_payment_change_wizard,model_pos_payment_change_wizard,base.group_user,1,1,1,1 +access_pos_payment_change_wizard_new_line,access_pos_payment_change_wizard_new_line,model_pos_payment_change_wizard_new_line,base.group_user,1,1,1,1 +access_pos_payment_change_wizard_old_line,access_pos_payment_change_wizard_old_line,model_pos_payment_change_wizard_old_line,base.group_user,1,1,1,1 diff --git a/pos_payment_change/static/description/icon.png b/pos_payment_change/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/pos_payment_change/static/description/icon.png differ diff --git a/pos_payment_change/static/description/index.html b/pos_payment_change/static/description/index.html new file mode 100644 index 0000000000..cb6a49fef1 --- /dev/null +++ b/pos_payment_change/static/description/index.html @@ -0,0 +1,490 @@ + + + + + + +Point Of Sale - Change Payments + + + +
+

Point Of Sale - Change Payments

+ + +

Beta License: AGPL-3 OCA/pos Translate me on Weblate Try me on Runbot

+

This module extends the functionnality of the Odoo Point of Sale to +allow the cashier to change the payments of a PoS order.

+

This feature is usefull when the user realized that he did a mistake, +just after he marked the order as paid, or during the close of the session, +Only if entries has not been generated.

+

Table of contents

+ +
+

Configuration

+
    +
  • Go to Point of Sale > Configuration > Point of Sale
  • +
  • Edit your point of sale, and select a value for the field +‘Payment Change Policy’.
  • +
+

Two options are available:

+
    +
  • ‘Refund and Resale’: Odoo will refund the current +Pos Order to cancel it, and create a new PoS Order +with the correct payment lines
  • +
  • ‘Update Payments’: Odoo will change payment lines.
  • +
+
+https://raw.githubusercontent.com/OCA/pos/16.0/pos_payment_change/static/description/pos_config_form.png +
+

Note +In some countries the ‘Update Payments’ Option +is not allowed by law, because orders history shouldn’t not be altered.

+

For that purpose, a constrains is present to check the value of this +field. If the module l10n_fr_certification is installed and if the +current company has an inalterable accounting, it will not be possible +to select the value ‘Update Payments’.

+
+
+

Usage

+
    +
  • Go to a PoS Order
  • +
  • Click on the button ‘Change Payments’
  • +
+
+https://raw.githubusercontent.com/OCA/pos/16.0/pos_payment_change/static/description/pos_order_form.png +
+
    +
  • In the pop up wizard, select the real payment(s) that have been +used to pay the order
  • +
+
+https://raw.githubusercontent.com/OCA/pos/16.0/pos_payment_change/static/description/pos_payment_change_wizard_form.png +
+
    +
  • Then click on the button ‘Change Payments’
  • +
+

Note

+

If the option ‘Refund and Resale’ is selected, changing the payments will +display the three PoS orders. the oringal one, the refund one, and the new one.

+
+https://raw.githubusercontent.com/OCA/pos/16.0/pos_payment_change/static/description/pos_order_tree.png +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • GRAP
  • +
+
+
+

Contributors

+ +
+
+

Other credits

+

The development of this module has been financially supported by:

+
    +
  • GRAP, Groupement Régional Alimentaire de proximité (www.grap.coop)
  • +
  • Vracoop (www.vracoop.fr)
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

Current maintainer:

+

legalsylvain

+

This module is part of the OCA/pos project on GitHub.

+

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

+
+
+
+ + diff --git a/pos_payment_change/static/description/pos_config_form.png b/pos_payment_change/static/description/pos_config_form.png new file mode 100644 index 0000000000..8723af0425 Binary files /dev/null and b/pos_payment_change/static/description/pos_config_form.png differ diff --git a/pos_payment_change/static/description/pos_order_form.png b/pos_payment_change/static/description/pos_order_form.png new file mode 100644 index 0000000000..f7565d67b0 Binary files /dev/null and b/pos_payment_change/static/description/pos_order_form.png differ diff --git a/pos_payment_change/static/description/pos_order_tree.png b/pos_payment_change/static/description/pos_order_tree.png new file mode 100644 index 0000000000..71236fc7a1 Binary files /dev/null and b/pos_payment_change/static/description/pos_order_tree.png differ diff --git a/pos_payment_change/static/description/pos_payment_change_wizard_form.png b/pos_payment_change/static/description/pos_payment_change_wizard_form.png new file mode 100644 index 0000000000..5f0a44a44b Binary files /dev/null and b/pos_payment_change/static/description/pos_payment_change_wizard_form.png differ diff --git a/pos_payment_change/tests/__init__.py b/pos_payment_change/tests/__init__.py new file mode 100644 index 0000000000..d9b96c4fa5 --- /dev/null +++ b/pos_payment_change/tests/__init__.py @@ -0,0 +1 @@ +from . import test_module diff --git a/pos_payment_change/tests/test_module.py b/pos_payment_change/tests/test_module.py new file mode 100644 index 0000000000..207a502aa2 --- /dev/null +++ b/pos_payment_change/tests/test_module.py @@ -0,0 +1,197 @@ +# Copyright (C) 2018 - 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 fields +from odoo.exceptions import UserError +from odoo.tests.common import TransactionCase + + +class TestModule(TransactionCase): + """Tests for 'Point of Sale - Change Payment' Module""" + + def setUp(self): + super().setUp() + self.PosSession = self.env["pos.session"] + self.PosOrder = self.env["pos.order"] + self.PosPaymentMethod = self.env["pos.payment.method"] + self.PosPayment = self.env["pos.payment"] + self.PosMakePayment = self.env["pos.make.payment"] + self.PosPaymentChangeWizard = self.env["pos.payment.change.wizard"] + self.PosPaymentChangeWizardNewLine = self.env[ + "pos.payment.change.wizard.new.line" + ] + self.product = self.env.ref("product.product_product_3") + self.pos_config = self.env.ref("point_of_sale.pos_config_main").copy() + + def _initialize_journals_open_session(self): + account_id = self.env.company.account_default_pos_receivable_account_id + self.bank_payment_method = self.PosPaymentMethod.create( + { + "name": "Bank", + "receivable_account_id": account_id.id, + } + ) + self.cash_payment_method = self.PosPaymentMethod.create( + { + "name": "Cash", + "is_cash_count": True, + "receivable_account_id": account_id.id, + "journal_id": self.env["account.journal"] + .search( + [("type", "=", "cash"), ("company_id", "=", self.env.company.id)], + limit=1, + ) + .id, + } + ) + + # create new session and open it + self.pos_config.payment_method_ids = [ + self.bank_payment_method.id, + self.cash_payment_method.id, + ] + self.pos_config.open_ui() + self.session = self.pos_config.current_session_id + + def _sale(self, payment_method_1, price_1, payment_method_2=False, price_2=0.0): + price = price_1 + price_2 + line_vals = { + "name": "OL/0001", + "product_id": self.product.id, + "qty": 1.0, + "price_unit": price, + "price_subtotal": price, + "price_subtotal_incl": price, + } + order = self.PosOrder.create( + { + "session_id": self.session.id, + "amount_tax": 0, + "amount_total": price, + "amount_paid": price, + "amount_return": 0, + "lines": [[0, False, line_vals]], + } + ) + order.add_payment( + { + "pos_order_id": order.id, + "amount": price_1, + "payment_date": fields.Date.today(), + "payment_method_id": payment_method_1.id, + } + ) + if payment_method_2: + order.add_payment( + { + "pos_order_id": order.id, + "amount": price_2, + "payment_date": fields.Date.today(), + "payment_method_id": payment_method_2.id, + } + ) + order.action_pos_order_paid() + return order + + def _change_payment( + self, order, payment_method_1, amount_1, payment_method_2=False, amount_2=0.0 + ): + # Switch to check journal + wizard = self.PosPaymentChangeWizard.with_context(active_id=order.id).create({}) + self.PosPaymentChangeWizardNewLine.with_context(active_id=order.id).create( + { + "wizard_id": wizard.id, + "new_payment_method_id": payment_method_1.id, + "amount": amount_1, + } + ) + if payment_method_2: + self.PosPaymentChangeWizardNewLine.with_context(active_id=order.id).create( + { + "wizard_id": wizard.id, + "new_payment_method_id": payment_method_2.id, + "amount": amount_2, + } + ) + wizard.button_change_payment() + + # Test Section + def test_01_payment_change_policy_update(self): + self.pos_config.payment_change_policy = "update" + + self._initialize_journals_open_session() + # Make a sale with 35 in cash journal and 65 in check + order = self._sale(self.cash_payment_method, 35, self.bank_payment_method, 65) + + order_qty = len(self.PosOrder.search([])) + + with self.assertRaises(UserError): + # Should not work if total is not correct + self._change_payment( + order, self.cash_payment_method, 10, self.cash_payment_method, 10 + ) + + self._change_payment( + order, self.cash_payment_method, 10, self.bank_payment_method, 90 + ) + + self.bank_payment = self.session.order_ids.mapped("payment_ids").filtered( + lambda x: x.payment_method_id == self.bank_payment_method + ) + self.cash_payment = self.session.order_ids.mapped("payment_ids").filtered( + lambda x: x.payment_method_id == self.cash_payment_method + ) + # check Session + self.assertEqual( + self.cash_payment.amount, + 10, + "Bad recompute of the balance for the statement cash", + ) + + self.assertEqual( + self.bank_payment.amount, + 90, + "Bad recompute of the balance for the statement check", + ) + + # Check Order quantity + self.assertEqual( + order_qty, + len(self.PosOrder.search([])), + "In 'Update' mode, changing payment should not create" " other PoS Orders", + ) + + def test_02_payment_change_policy_refund(self): + self.pos_config.payment_change_policy = "refund" + + self._initialize_journals_open_session() + # Make a sale with 35 in cash journal and 65 in check + order = self._sale(self.cash_payment_method, 35, self.bank_payment_method, 65) + + order_qty = len(self.PosOrder.search([])) + + self._change_payment( + order, self.cash_payment_method, 50, self.bank_payment_method, 50 + ) + + # Check Order quantity + self.assertEqual( + order_qty + 2, + len(self.PosOrder.search([])), + "In 'Refund' mode, changing payment should generate" " two new PoS Orders", + ) + + def test_03_payment_change_closed_orders(self): + self.pos_config.payment_change_policy = "update" + + self._initialize_journals_open_session() + # Make a sale with 35 in cash journal and 65 in check + order = self._sale(self.cash_payment_method, 35, self.bank_payment_method, 65) + + self.session.state = "closed" + + with self.assertRaises(UserError): + self._change_payment( + order, self.cash_payment_method, 10, self.bank_payment_method, 90 + ) diff --git a/pos_payment_change/views/view_pos_config.xml b/pos_payment_change/views/view_pos_config.xml new file mode 100644 index 0000000000..6ec422b38b --- /dev/null +++ b/pos_payment_change/views/view_pos_config.xml @@ -0,0 +1,33 @@ + + + + + + pos.config + + + +
+
+ Payment Change Policy +
+ +
+
+
+
+
+
+ +
diff --git a/pos_payment_change/views/view_pos_order.xml b/pos_payment_change/views/view_pos_order.xml new file mode 100644 index 0000000000..bde665be8a --- /dev/null +++ b/pos_payment_change/views/view_pos_order.xml @@ -0,0 +1,24 @@ + + + + + + pos.order + + + + + + diff --git a/pos_payment_change/wizards/__init__.py b/pos_payment_change/wizards/__init__.py new file mode 100644 index 0000000000..6aff511ae0 --- /dev/null +++ b/pos_payment_change/wizards/__init__.py @@ -0,0 +1,3 @@ +from . import pos_payment_change_wizard +from . import pos_payment_change_wizard_new_line +from . import pos_payment_change_wizard_old_line diff --git a/pos_payment_change/wizards/pos_payment_change_wizard.py b/pos_payment_change/wizards/pos_payment_change_wizard.py new file mode 100644 index 0000000000..646176b1ec --- /dev/null +++ b/pos_payment_change/wizards/pos_payment_change_wizard.py @@ -0,0 +1,108 @@ +# Copyright (C) 2015-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 UserError +from odoo.tools import float_compare + + +class PosPaymentChangeWizard(models.TransientModel): + _name = "pos.payment.change.wizard" + _description = "PoS Payment Change Wizard" + + # Column Section + order_id = fields.Many2one(comodel_name="pos.order", string="Order", readonly=True) + + old_line_ids = fields.One2many( + comodel_name="pos.payment.change.wizard.old.line", + inverse_name="wizard_id", + string="Old Payment Lines", + readonly=True, + ) + + new_line_ids = fields.One2many( + comodel_name="pos.payment.change.wizard.new.line", + inverse_name="wizard_id", + string="New Payment Lines", + ) + + amount_total = fields.Float(string="Total", readonly=True) + + # View Section + @api.model + def default_get(self, fields): + PosOrder = self.env["pos.order"] + res = super().default_get(fields) + order = PosOrder.browse(self._context.get("active_id")) + old_lines_vals = [] + for payment in order.payment_ids: + old_lines_vals.append( + ( + 0, + 0, + { + "old_payment_method_id": payment.payment_method_id.id, + "amount": payment.amount, + }, + ) + ) + res.update( + { + "order_id": order.id, + "amount_total": order.amount_total, + "old_line_ids": old_lines_vals, + } + ) + return res + + # View section + def button_change_payment(self): + self.ensure_one() + order = self.order_id + + # Check if the total is correct + total = sum(self.mapped("new_line_ids.amount")) + if ( + float_compare( + total, + self.amount_total, + precision_rounding=self.order_id.currency_id.rounding, + ) + != 0 + ): + raise UserError( + _( + "Differences between the two values for the POS" + " Order '%(name)s':\n\n" + " * Total of all the new payments %(total)s;\n" + " * Total of the POS Order %(amount_total)s;\n\n" + "Please change the payments.", + name=order.name, + total=total, + amount_total=order.amount_total, + ) + ) + + # Change payment + new_payments = [ + { + "pos_order_id": order.id, + "payment_method_id": line.new_payment_method_id.id, + "amount": line.amount, + "payment_date": fields.Date.context_today(self), + } + for line in self.new_line_ids + ] + + orders = order.change_payment(new_payments) + + if len(orders) == 1: + # if policy is 'update', only close the pop up + action = {"type": "ir.actions.act_window_close"} + else: + # otherwise (refund policy), displays the 3 orders + action = self.env.ref("point_of_sale.action_pos_pos_form").read()[0] + action["domain"] = [("id", "in", orders.ids)] + + return action diff --git a/pos_payment_change/wizards/pos_payment_change_wizard_new_line.py b/pos_payment_change/wizards/pos_payment_change_wizard_new_line.py new file mode 100644 index 0000000000..8fcfefc032 --- /dev/null +++ b/pos_payment_change/wizards/pos_payment_change_wizard_new_line.py @@ -0,0 +1,55 @@ +# Copyright (C) 2015 - 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 + + +class PosPaymentChangeWizardLine(models.TransientModel): + _name = "pos.payment.change.wizard.new.line" + _description = "PoS Payment Change Wizard New Line" + + wizard_id = fields.Many2one( + comodel_name="pos.payment.change.wizard", + required=True, + ) + + new_payment_method_id = fields.Many2one( + comodel_name="pos.payment.method", + string="Payment Method", + required=True, + domain=lambda s: s._domain_new_payment_method_id(), + ) + + company_currency_id = fields.Many2one( + comodel_name="res.currency", + store=True, + related="new_payment_method_id.company_id.currency_id", + string="Company Currency", + readonly=True, + help="Utility field to express amount currency", + ) + + amount = fields.Monetary( + required=True, + default=0.0, + currency_field="company_currency_id", + ) + + @api.model + def _domain_new_payment_method_id(self): + PosOrder = self.env["pos.order"] + order = PosOrder.browse(self.env.context.get("active_id")) + return [("id", "in", order.mapped("session_id.payment_method_ids").ids)] + + # View Section + @api.model + def default_get(self, fields): + res = super().default_get(fields) + if "new_line_ids" not in self._context: + return res + balance = self._context.get("amount_total", 0.0) + for line in self.wizard_id.old_line_ids: + balance -= line.get("amount") + res.update({"amount": balance}) + return res diff --git a/pos_payment_change/wizards/pos_payment_change_wizard_old_line.py b/pos_payment_change/wizards/pos_payment_change_wizard_old_line.py new file mode 100644 index 0000000000..911357dc01 --- /dev/null +++ b/pos_payment_change/wizards/pos_payment_change_wizard_old_line.py @@ -0,0 +1,38 @@ +# Copyright (C) 2015 - 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 fields, models + + +class PosPaymentChangeWizardOldLine(models.TransientModel): + _name = "pos.payment.change.wizard.old.line" + _description = "PoS Payment Change Wizard Old Line" + + wizard_id = fields.Many2one( + comodel_name="pos.payment.change.wizard", + required=True, + ) + + old_payment_method_id = fields.Many2one( + comodel_name="pos.payment.method", + string="Payment Method", + required=True, + readonly=True, + ) + + company_currency_id = fields.Many2one( + comodel_name="res.currency", + store=True, + related="old_payment_method_id.company_id.currency_id", + string="Company Currency", + readonly=True, + help="Utility field to express amount currency", + ) + + amount = fields.Monetary( + required=True, + readonly=True, + default=0.0, + currency_field="company_currency_id", + ) diff --git a/pos_payment_change/wizards/view_pos_payment_change_wizard.xml b/pos_payment_change/wizards/view_pos_payment_change_wizard.xml new file mode 100644 index 0000000000..e947a8254e --- /dev/null +++ b/pos_payment_change/wizards/view_pos_payment_change_wizard.xml @@ -0,0 +1,54 @@ + + + + + + pos.payment.change.wizard + +
+ + + + + + + + + + + + + + + + + +
+
+
+
+
+ + + Change Payments + pos.payment.change.wizard + form + new + + +
diff --git a/setup/pos_payment_change/odoo/addons/pos_payment_change b/setup/pos_payment_change/odoo/addons/pos_payment_change new file mode 120000 index 0000000000..6758108b45 --- /dev/null +++ b/setup/pos_payment_change/odoo/addons/pos_payment_change @@ -0,0 +1 @@ +../../../../pos_payment_change \ No newline at end of file diff --git a/setup/pos_payment_change/setup.py b/setup/pos_payment_change/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/pos_payment_change/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)