Skip to content
Snippets Groups Projects
Commit bd76e9d6 authored by Valentin Chevalier's avatar Valentin Chevalier
Browse files

[FIX] sale: check the right partner in the access token


When using a different invoicing address for a partner on a sale order,
an error is thrown up. This is caused by checking the wrong partner in
the access token.

opw-3298228

closes odoo/odoo#120759

Signed-off-by: default avatarAntoine Vandevenne (anv) <anv@odoo.com>
parent 8b919ae5
No related branches found
No related tags found
No related merge requests found
......@@ -343,7 +343,7 @@ class PaymentPortal(payment_portal.PaymentPortal):
# Check the access token against the order values. Done after fetching the order as we
# need the order fields to check the access token.
if not payment_utils.check_access_token(
access_token, order_sudo.partner_id.id, amount, order_sudo.currency_id.id
access_token, order_sudo.partner_invoice_id.id, amount, order_sudo.currency_id.id
):
raise ValidationError(_("The provided parameters are invalid."))
......
......@@ -19,7 +19,7 @@ class TestSalePayment(AccountPaymentCommon, SaleCommon, PaymentHttpCommon):
# Replace PaymentCommon defaults by SaleCommon ones
cls.currency = cls.sale_order.currency_id
cls.partner = cls.sale_order.partner_id
cls.partner = cls.sale_order.partner_invoice_id
def test_11_so_payment_link(self):
# test customized /payment/pay route with sale_order_id param
......@@ -70,6 +70,17 @@ class TestSalePayment(AccountPaymentCommon, SaleCommon, PaymentHttpCommon):
self.assertTrue(tx_sudo.payment_id)
self.assertEqual(tx_sudo.payment_id.state, 'posted')
def test_so_payment_link_with_different_partner_invoice(self):
# test customized /payment/pay route with sale_order_id param
# partner_id and partner_invoice_id different on the so
self.sale_order.partner_invoice_id = self.portal_partner
self.partner = self.sale_order.partner_invoice_id
route_values = self._prepare_pay_values()
route_values['sale_order_id'] = self.sale_order.id
tx_context = self._get_tx_checkout_context(**route_values)
self.assertEqual(tx_context['partner_id'], self.sale_order.partner_invoice_id.id)
def test_12_so_partial_payment_link(self):
# test customized /payment/pay route with sale_order_id param
# partial amount specified
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment