Skip to content
Snippets Groups Projects
Commit 7ee253b1 authored by Pedram (PEBR)'s avatar Pedram (PEBR)
Browse files

[FIX] point_of_sale: ensure customer presence for `split_transactions`


This commit addresses an issue where `split_transactions` payments were
allowed to be added without adding a customer during the creation of
return orders. The problem led to errors during session closure.

The solution is that in the backend when creating return orders and
adding payments, enforce the presence of a customer for
`split_transactions` by showing an error.

opw-3468160

closes odoo/odoo#132096

X-original-commit: 6f20626b
Signed-off-by: default avatarDavid Monnom (moda) <moda@odoo.com>
Signed-off-by: default avatarPedram Bi Ria (pebr) <pebr@odoo.com>
parent ba6f90fa
Branches
Tags
No related merge requests found
......@@ -1733,6 +1733,7 @@ msgstr ""
#. module: point_of_sale
#. odoo-javascript
#: code:addons/point_of_sale/static/src/js/Screens/PaymentScreen/PaymentScreen.js:0
#: code:addons/point_of_sale/wizard/pos_payment.py:0
#, python-format
msgid "Customer is required for %s payment method."
msgstr ""
......
......@@ -3,6 +3,7 @@
from odoo import api, fields, models, _
from odoo.tools import float_is_zero
from odoo.exceptions import UserError
class PosMakePayment(models.TransientModel):
......@@ -43,6 +44,12 @@ class PosMakePayment(models.TransientModel):
self.ensure_one()
order = self.env['pos.order'].browse(self.env.context.get('active_id', False))
if self.payment_method_id.split_transactions and not order.partner_id:
raise UserError(_(
"Customer is required for %s payment method.",
self.payment_method_id.name
))
currency = order.currency_id
init_data = self.read()[0]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment