Skip to content
Closed
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
84 changes: 84 additions & 0 deletions pos_multi_order_payment/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
=======================
Pos Multi Order Payment
=======================

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

.. |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/17.0/pos_multi_order_payment
:alt: OCA/pos
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/pos-17-0/pos-17-0-pos_multi_order_payment
: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=17.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module will allow you to pay several open point of sale orders at
the same time.

The principal order will return the other orders amount and the other
orders will be payed with this amount.

**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_multi_order_payment%0Aversion:%2017.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
-------

* Dixmit
* INVITU

Contributors
------------

- Enric Tobella
- ``SerpentCS <https://www.serpentcs.com>``:

- Kamla Dodiya kamla.d.serpentcs@gmail.com

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/17.0/pos_multi_order_payment>`_ 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_multi_order_payment/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
24 changes: 24 additions & 0 deletions pos_multi_order_payment/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2023 Dixmit
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Pos Multi Order Payment",
"summary": """
Allow to pay multiple orders with the same payment""",
"version": "17.0.1.0.0",
"license": "AGPL-3",
"author": "Dixmit,INVITU,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/pos",
"depends": ["point_of_sale"],
"assets": {
"point_of_sale._assets_pos": [
"pos_multi_order_payment/static/src/app/screens/payment_screen/payment_screen.esm.js",
"pos_multi_order_payment/static/src/app/screens/payment_screen/payment_screen.xml",
"pos_multi_order_payment/static/src/app/screens/receipt_screen/receipt_screen.esm.js",
"pos_multi_order_payment/static/src/app/screens/receipt_screen/receipt_screen.xml",
"pos_multi_order_payment/static/src/app/models.esm.js",
],
},
"data": [],
"demo": [],
}
1 change: 1 addition & 0 deletions pos_multi_order_payment/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_multi_order_payment/models/pos_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright 2023 Dixmit
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import _, fields, models
from odoo.exceptions import UserError
from odoo.tools import float_is_zero


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

payment_order_id = fields.Many2one("pos.order", readonly=True)

def _export_for_ui(self, order):
result = super()._export_for_ui(order)
result["payment_order_id"] = order.payment_order_id.id
return result

def _process_payment_lines(self, pos_order, order, pos_session, draft):
rec = super()._process_payment_lines(pos_order, order, pos_session, draft)
prec_acc = order.currency_id.decimal_places
if (
not draft
and float_is_zero(order.amount_paid, prec_acc)
and pos_order.get("payment_order_id")
):
order.write({"payment_order_id": pos_order["payment_order_id"]})
cash_payment_method = pos_session.payment_method_ids.filtered(
"is_cash_count"
)[:1]
if not cash_payment_method:
raise UserError(
_(
"""No cash statement found for this session.
Unable to record a multiple order payment."""
)
)
return_payment_vals = {
"name": _("Multi order payment"),
"pos_order_id": order.id,
"amount": order.amount_total,
"payment_date": fields.Datetime.now(),
"payment_method_id": cash_payment_method.id,
}
order.add_payment(return_payment_vals)
return rec
3 changes: 3 additions & 0 deletions pos_multi_order_payment/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
3 changes: 3 additions & 0 deletions pos_multi_order_payment/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Enric Tobella
- `SerpentCS <https://www.serpentcs.com>`:
- Kamla Dodiya <kamla.d.serpentcs@gmail.com>
3 changes: 3 additions & 0 deletions pos_multi_order_payment/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This module will allow you to pay several open point of sale orders at the same time.

The principal order will return the other orders amount and the other orders will be payed with this amount.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading