Skip to content

Commit

Permalink
[ADD] new module pos_payment_decription to see payment details in pos…
Browse files Browse the repository at this point in the history
….order tree view
  • Loading branch information
legalsylvain committed Jul 25, 2024
1 parent 43e02e6 commit 27e2860
Show file tree
Hide file tree
Showing 13 changed files with 654 additions and 0 deletions.
86 changes: 86 additions & 0 deletions pos_payment_description/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
=======================
PoS Payment Description
=======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:7d6be53e7b27835c15ec630b02f9966d08e3c97d9dd5166519987037f50eeeae
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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_description
: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_description
: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 shows payment details on Pos order tree view.

.. figure:: https://raw.githubusercontent.com/OCA/pos/16.0/pos_payment_description/static/description/pos_order_tree.png

**Table of contents**

.. contents::
:local:

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_description%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
~~~~~~~

* GRAP

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

* Sylvain LE GAL (https://twitter.com/legalsylvain)

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-legalsylvain| image:: https://github.com/legalsylvain.png?size=40px
:target: https://github.com/legalsylvain
:alt: legalsylvain

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-legalsylvain|

This module is part of the `OCA/pos <https://github.com/OCA/pos/tree/16.0/pos_payment_description>`_ 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_description/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
19 changes: 19 additions & 0 deletions pos_payment_description/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (C) 2024 - Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "PoS Payment Description",
"summary": "Payment description on order tree view",
"version": "16.0.1.0.0",
"category": "Point Of Sale",
"author": "GRAP, Odoo Community Association (OCA)",
"maintainers": ["legalsylvain"],
"website": "https://github.com/OCA/pos",
"license": "AGPL-3",
"depends": ["point_of_sale"],
"data": [
"views/view_pos_order.xml",
],
"installable": True,
}
32 changes: 32 additions & 0 deletions pos_payment_description/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_payment_description
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-25 10:54+0000\n"
"PO-Revision-Date: 2024-07-25 10:54+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: pos_payment_description
#: model:ir.model.fields,field_description:pos_payment_description.field_pos_order__payment_description
msgid "Payments Description"
msgstr "Description des paiements"

#. module: pos_payment_description
#: model_terms:ir.ui.view,arch_db:pos_payment_description.view_pos_order_search
#: model_terms:ir.ui.view,arch_db:pos_payment_description.view_pos_order_tree
msgid "Payments"
msgstr "Paiements"

#. module: pos_payment_description
#: model:ir.model,name:pos_payment_description.model_pos_order
msgid "Point of Sale Orders"
msgstr "Commandes du point de vente"
1 change: 1 addition & 0 deletions pos_payment_description/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import pos_order
46 changes: 46 additions & 0 deletions pos_payment_description/models/pos_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright (C) 2024 - 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.tools import formatLang


class PosOrder(models.Model):
_inherit = "pos.order"

payment_description = fields.Char(
string="Payments Description",
compute="_compute_payment_description",
store=True,
)

@api.depends("payment_ids.amount")
def _compute_payment_description(self):
for order in self:
details = []
for payment in order.payment_ids.filtered(
lambda x: x.payment_method_id.journal_id
):
details.append(
"%s: %s"
% (
payment.payment_method_id.journal_id.code,
formatLang(
self.env, payment.amount, currency_obj=payment.currency_id
),
)
)
for payment in order.payment_ids.filtered(
lambda x: not x.payment_method_id.journal_id
):
details.append(

Check warning on line 37 in pos_payment_description/models/pos_order.py

View check run for this annotation

Codecov / codecov/patch

pos_payment_description/models/pos_order.py#L37

Added line #L37 was not covered by tests
"%s: %s"
% (
payment.payment_method_id.name,
formatLang(
self.env, payment.amount, currency_obj=payment.currency_id
),
)
)
order.payment_description = " - ".join(sorted(details))
1 change: 1 addition & 0 deletions pos_payment_description/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Sylvain LE GAL (https://twitter.com/legalsylvain)
3 changes: 3 additions & 0 deletions pos_payment_description/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This module shows payment details on Pos order tree view.

.. figure:: ../static/description/pos_order_tree.png
Loading

0 comments on commit 27e2860

Please sign in to comment.