Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][MIG] pos_payment_method_cashdro: migration to 16.0 #1161

Merged
merged 9 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 118 additions & 0 deletions pos_payment_method_cashdro/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
==========================
PoS Payment Method CashDro
==========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e4f16039547a5076c72bc8bac4fe707fc850c042c66e965d9b89a1aacb16b138
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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_cashdro
: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_cashdro
: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 allows to make payments with a Cashdro (https://www.cashdro.com) terminal
on the Point of Sale frontend.

**Table of contents**

.. contents::
:local:

Configuration
=============

To add a Cashdro payment terminal:

#. Go to *Point of Sale > Configuration > Payment Methods*
#. Choose a cash payment method or create a new one.
#. Select *Cashdro* in the *Use a Payment Terminal* field.
#. Configure the Cashdro terminal hostname and credentials.
#. Configure the desired, Cashdro terminal in the proper PoS configurations.

Note that if a single payment method was used for cash in different stores, it should
be splitted in as many phisical stores there are.

Usage
=====

With the proper configuration made:

#. Make a new PoS order and choose the cash payment method configured with the Cashdro
settings.
#. Click on *Send* to send the request to the Cashdro terminal that will ask the
customer for the amount to pay.
#. The cashier can cancel the amount request discarding the line clicking on the (x)
symbol.
#. When the customer pays the sale amount in the terminal, the Cashdro reports the
amount received and change delivered back.
#. The Point of Sale reflects it in the payment line and thus the order can be validated
now.

Known issues / Roadmap
======================

* Integrate cash control (money inputs / outputs).

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_cashdro%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
~~~~~~~

* Tecnativa

Contributors
~~~~~~~~~~~~

* `Acysos S.L. <https://www.acysos.com>`_:

* Ignacio Ibeas

* `Tecnativa <https://www.tecnativa.com>`_

* David Vidal

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.

This module is part of the `OCA/pos <https://github.com/OCA/pos/tree/16.0/pos_payment_method_cashdro>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions pos_payment_method_cashdro/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
20 changes: 20 additions & 0 deletions pos_payment_method_cashdro/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2021 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "PoS Payment Method CashDro",
"summary": "Allows to pay with CashDro Terminals on the Point of Sale",
"version": "16.0.1.0.0",
"category": "Point Of Sale",
"website": "https://github.com/OCA/pos",
"author": "Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"depends": [
"point_of_sale",
],
"data": [
"views/pos_payment_method_views.xml",
],
"assets": {
"point_of_sale.assets": ["pos_payment_method_cashdro/static/src/js/*.js"],
},
}
57 changes: 57 additions & 0 deletions pos_payment_method_cashdro/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_payment_method_cashdro
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-07-03 16:08+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\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.17\n"

#. module: pos_payment_method_cashdro
#: model:ir.model.fields,field_description:pos_payment_method_cashdro.field_pos_payment_method__cashdro_password
msgid "Cashdro Password"
msgstr "Password Cashdro"

#. module: pos_payment_method_cashdro
#: model:ir.model.fields,field_description:pos_payment_method_cashdro.field_pos_payment_method__cashdro_host
msgid "Cashdro Terminal Host Name or IP address"
msgstr "Nome host terminale Cashdro o indirizzo IP"

#. module: pos_payment_method_cashdro
#: model:ir.model.fields,field_description:pos_payment_method_cashdro.field_pos_payment_method__cashdro_user
msgid "Cashdro User"
msgstr "Utente Cashdro"

#. module: pos_payment_method_cashdro
#: model:ir.model.fields,field_description:pos_payment_method_cashdro.field_pos_payment_method__display_name
msgid "Display Name"
msgstr "Nome visualizzato"

#. module: pos_payment_method_cashdro
#: model:ir.model.fields,field_description:pos_payment_method_cashdro.field_pos_payment_method__id
msgid "ID"
msgstr "ID"

#. module: pos_payment_method_cashdro
#: model:ir.model.fields,help:pos_payment_method_cashdro.field_pos_payment_method__cashdro_host
msgid "It must be reachable by the PoS in the store"
msgstr "Deve essere raggiungibile dal POS nel negozio"

#. module: pos_payment_method_cashdro
#: model:ir.model.fields,field_description:pos_payment_method_cashdro.field_pos_payment_method____last_update
msgid "Last Modified on"
msgstr "Ultima modifica il"

#. module: pos_payment_method_cashdro
#: model:ir.model,name:pos_payment_method_cashdro.model_pos_payment_method
msgid "Point of Sale Payment Methods"
msgstr "Metodi di pagamento punto vendita"
54 changes: 54 additions & 0 deletions pos_payment_method_cashdro/i18n/pos_payment_method_cashdro.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_payment_method_cashdro
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.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_method_cashdro
#: model:ir.model.fields,field_description:pos_payment_method_cashdro.field_pos_payment_method__cashdro_password
msgid "Cashdro Password"
msgstr ""

#. module: pos_payment_method_cashdro
#: model:ir.model.fields,field_description:pos_payment_method_cashdro.field_pos_payment_method__cashdro_host
msgid "Cashdro Terminal Host Name or IP address"
msgstr ""

#. module: pos_payment_method_cashdro
#: model:ir.model.fields,field_description:pos_payment_method_cashdro.field_pos_payment_method__cashdro_user
msgid "Cashdro User"
msgstr ""

#. module: pos_payment_method_cashdro
#: model:ir.model.fields,field_description:pos_payment_method_cashdro.field_pos_payment_method__display_name
msgid "Display Name"
msgstr ""

#. module: pos_payment_method_cashdro
#: model:ir.model.fields,field_description:pos_payment_method_cashdro.field_pos_payment_method__id
msgid "ID"
msgstr ""

#. module: pos_payment_method_cashdro
#: model:ir.model.fields,help:pos_payment_method_cashdro.field_pos_payment_method__cashdro_host
msgid "It must be reachable by the PoS in the store"
msgstr ""

#. module: pos_payment_method_cashdro
#: model:ir.model.fields,field_description:pos_payment_method_cashdro.field_pos_payment_method____last_update
msgid "Last Modified on"
msgstr ""

#. module: pos_payment_method_cashdro
#: model:ir.model,name:pos_payment_method_cashdro.model_pos_payment_method
msgid "Point of Sale Payment Methods"
msgstr ""
2 changes: 2 additions & 0 deletions pos_payment_method_cashdro/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import pos_payment_method
from . import pos_session
35 changes: 35 additions & 0 deletions pos_payment_method_cashdro/models/pos_payment_method.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright 2021 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models


class PosPaymentMethod(models.Model):
_inherit = "pos.payment.method"

def _get_payment_terminal_selection(self):
return super()._get_payment_terminal_selection() + [("cashdro", "Cashdro")]

cashdro_host = fields.Char(
string="Cashdro Terminal Host Name or IP address",
help="It must be reachable by the PoS in the store",
)
cashdro_user = fields.Char()
cashdro_password = fields.Char()

def _onchange_journal_id(self):
"""Cash payment method force the `use_payment_terminal` to `False` as
it's assumed that a cash journal can't have a payment terminal. Let's keep
the method when it's needed"""
res = super()._onchange_journal_id()

Check warning on line 23 in pos_payment_method_cashdro/models/pos_payment_method.py

View check run for this annotation

Codecov / codecov/patch

pos_payment_method_cashdro/models/pos_payment_method.py#L23

Added line #L23 was not covered by tests
if self.use_payment_terminal != "cashdro" and not self.is_cash_count:
return res
self.use_payment_terminal = "cashdro"

Check warning on line 26 in pos_payment_method_cashdro/models/pos_payment_method.py

View check run for this annotation

Codecov / codecov/patch

pos_payment_method_cashdro/models/pos_payment_method.py#L25-L26

Added lines #L25 - L26 were not covered by tests
pedrobaeza marked this conversation as resolved.
Show resolved Hide resolved

def _compute_hide_use_payment_terminal(self):
"""Now that we have the option to choose a payment terminal for the cashdro
payments, we can show the terminal options for cash payment types."""
cash_payment_types = self.filtered(lambda x: x.type == "cash")
cash_payment_types.hide_use_payment_terminal = False
return super(

Check warning on line 33 in pos_payment_method_cashdro/models/pos_payment_method.py

View check run for this annotation

Codecov / codecov/patch

pos_payment_method_cashdro/models/pos_payment_method.py#L32-L33

Added lines #L32 - L33 were not covered by tests
PosPaymentMethod, self - cash_payment_types
)._compute_hide_use_payment_terminal()
14 changes: 14 additions & 0 deletions pos_payment_method_cashdro/models/pos_session.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2024 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import models


class PosSession(models.Model):
_inherit = "pos.session"

def _loader_params_pos_payment_method(self):
result = super()._loader_params_pos_payment_method()
result["search_params"]["fields"].extend(
["cashdro_host", "cashdro_user", "cashdro_password"]
)
return result
10 changes: 10 additions & 0 deletions pos_payment_method_cashdro/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
To add a Cashdro payment terminal:

#. Go to *Point of Sale > Configuration > Payment Methods*
#. Choose a cash payment method or create a new one.
#. Select *Cashdro* in the *Use a Payment Terminal* field.
#. Configure the Cashdro terminal hostname and credentials.
#. Configure the desired, Cashdro terminal in the proper PoS configurations.

Note that if a single payment method was used for cash in different stores, it should
be splitted in as many phisical stores there are.
7 changes: 7 additions & 0 deletions pos_payment_method_cashdro/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
* `Acysos S.L. <https://www.acysos.com>`_:

* Ignacio Ibeas

* `Tecnativa <https://www.tecnativa.com>`_

* David Vidal
2 changes: 2 additions & 0 deletions pos_payment_method_cashdro/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module allows to make payments with a Cashdro (https://www.cashdro.com) terminal
on the Point of Sale frontend.
1 change: 1 addition & 0 deletions pos_payment_method_cashdro/readme/ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Integrate cash control (money inputs / outputs).
12 changes: 12 additions & 0 deletions pos_payment_method_cashdro/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
With the proper configuration made:

#. Make a new PoS order and choose the cash payment method configured with the Cashdro
settings.
#. Click on *Send* to send the request to the Cashdro terminal that will ask the
customer for the amount to pay.
#. The cashier can cancel the amount request discarding the line clicking on the (x)
symbol.
#. When the customer pays the sale amount in the terminal, the Cashdro reports the
amount received and change delivered back.
#. The Point of Sale reflects it in the payment line and thus the order can be validated
now.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading