Anh Thao Pham (pta) a8dfb18dfa [FIX] account_payment: fix portal pay button
Steps to reproduce:
- Install Accounting
- Activate a payment provider (e.g. Stripe)
- Configure payment provider with "Capture Amount Manually" option activated
- Invoice Online Payment in Accounting settings
- Create an invoice
- Go to invoice portal preview
- Pay it via "Pay Now" button
- Go back to invoice portal preview
=> The "Pay Now" button is still there (not expected)

- Uninstall "account_payment_invoice_online_payment_patch" module
- Go back to invoice portal preview
=> The "Pay Now" button does not appear anymore (expected)

Cause:
"account_payment_invoice_online_payment_patch" module has been created to
allow to disable invoice online payment without uninstalling "account_payment"
module.

However, it overrides 2 different "t-if" conditions:

1) (invoice.amount_residual or not tx_ids) and
   invoice.state == 'posted' and
   invoice.payment_state in ('not_paid', 'partial') and
   invoice.amount_total

2) invoice.state == 'posted' and
   invoice.payment_state in ('not_paid', 'partial') and
   invoice.amount_total and
   invoice.move_type == 'out_invoice' and
   (pending_manual_txs or not tx_ids or invoice.amount_paid < invoice.amount_total)

with the same condition "invoice._has_to_be_paid()" that corresponds to:
   (self.amount_residual or not transactions) and
   self.state == 'posted' and
   self.payment_state in ('not_paid', 'partial') and
   self.amount_total and
   self.move_type == 'out_invoice'

One part of the second "t-if" condition is removed by the override:
(pending_manual_txs or not tx_ids or invoice.amount_paid < invoice.amount_total)

The second condition is used and is overridden 2 times.

Solution:
Add (pending_manual_txs or not tx_ids or invoice.amount_paid < invoice.amount_total)
in the "_has_to_be_paid" method.

opw-3378400

closes odoo/odoo#147316

X-original-commit: df110bb524f780433cdaf64e482329989e9d513b
Signed-off-by: Anh Thao Pham (pta) <pta@odoo.com>
2023-12-22 16:14:54 +00:00
2023-11-02 21:02:44 +00:00
2023-12-21 10:42:50 +00:00
…
…
…
…

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%