[MOV] acc_pay_patch->acc_pay: merge bugfix module
The module ´account_payment_invoice_online_payment_patch´ was added in stable to allow account_payment users to disable online invoice payment (without removing the module, critical for other flows). It can be safely merged into the account_payment module for future versions. Original bugfix PR: #110177 Related to opw-3114860 Part-of: odoo/odoo#111046
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
'depends': ['account', 'payment'],
|
||||
'auto_install': ['account'],
|
||||
'data': [
|
||||
'data/ir_config_parameter.xml',
|
||||
|
||||
'security/ir.model.access.csv',
|
||||
'security/ir_rules.xml',
|
||||
|
||||
@@ -23,6 +25,7 @@
|
||||
'wizards/account_payment_register_views.xml',
|
||||
'wizards/payment_link_wizard_views.xml',
|
||||
'wizards/payment_refund_wizard_views.xml',
|
||||
'wizards/res_config_settings_views.xml',
|
||||
],
|
||||
'assets': {
|
||||
'web.assets_frontend': [
|
||||
|
||||
@@ -41,7 +41,12 @@ class AccountMove(models.Model):
|
||||
def _has_to_be_paid(self):
|
||||
self.ensure_one()
|
||||
transactions = self.transaction_ids.filtered(lambda tx: tx.state in ('authorized', 'done'))
|
||||
return bool(
|
||||
enabled_feature = str2bool(
|
||||
self.env['ir.config_parameter'].sudo().get_param(
|
||||
'account_payment.enable_portal_payment'
|
||||
)
|
||||
)
|
||||
return enabled_feature and bool(
|
||||
(
|
||||
self.amount_residual
|
||||
# FIXME someplace we check amount_residual and some other amount_paid < amount_total
|
||||
|
||||
@@ -5,9 +5,7 @@
|
||||
</xpath>
|
||||
<xpath expr="//t[@t-foreach='invoices']/tr/td[last()]" position="before">
|
||||
<td class="text-center">
|
||||
<t t-set="tx_ids" t-value="invoice.transaction_ids.filtered(lambda tx: tx.state in ('pending', 'authorized', 'done'))"/>
|
||||
<t t-set="pending_manual_txs" t-value="tx_ids.filtered(lambda tx: tx.state == 'pending' and tx.provider_code in ('none', 'custom'))"/>
|
||||
<a t-if="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)"
|
||||
<a t-if="invoice._has_to_be_paid()"
|
||||
t-att-href="invoice.get_portal_url(anchor='portal_pay')" title="Pay Now" aria-label="Pay now" class="btn btn-sm btn-primary" role="button">
|
||||
<i class="fa fa-arrow-circle-right"/><span class='d-none d-md-inline'> Pay Now</span>
|
||||
</a>
|
||||
@@ -16,23 +14,40 @@
|
||||
<xpath expr="//t[@t-foreach='invoices']/tr/td[hasclass('tx_status')]" position="replace">
|
||||
<t t-set="last_tx" t-value="invoice.get_portal_last_transaction()"/>
|
||||
<td class="tx_status text-center">
|
||||
<t t-if="invoice.state == 'posted' and invoice.payment_state in ('not_paid', 'partial') and (last_tx.state not in ['pending', 'authorized', 'done', 'cancel'] or (last_tx.state == 'pending' and last_tx.provider_code in ('none', 'custom')))">
|
||||
<span class="badge rounded-pill text-bg-info"><i class="fa fa-fw fa-clock-o"></i><span class="d-none d-md-inline"> Waiting for Payment</span></span>
|
||||
<t t-if="last_tx">
|
||||
<t t-if="invoice.state == 'posted' and invoice.payment_state in ('not_paid', 'partial') and (last_tx.state not in ['pending', 'authorized', 'done', 'cancel'] or (last_tx.state == 'pending' and last_tx.provider_code in ('none', 'custom')))">
|
||||
<span class="badge rounded-pill text-bg-info"><i class="fa fa-fw fa-clock-o"></i><span class="d-none d-md-inline"> Waiting for Payment</span></span>
|
||||
</t>
|
||||
<t t-if="invoice.state == 'posted' and last_tx.state == 'authorized'">
|
||||
<span class="badge rounded-pill text-bg-primary"><i class="fa fa-fw fa-check"/><span class="d-none d-md-inline"> Authorized</span></span>
|
||||
</t>
|
||||
<t t-if="invoice.state == 'posted' and last_tx.state == 'pending' and last_tx.provider_code not in ('none', 'custom')">
|
||||
<span class="badge rounded-pill text-bg-warning"><span class="d-none d-md-inline"> Pending</span></span>
|
||||
</t>
|
||||
<t t-if="invoice.state == 'posted' and invoice.payment_state in ('paid', 'in_payment') or last_tx.state == 'done'">
|
||||
<span class="badge rounded-pill text-bg-success"><i class="fa fa-fw fa-check"></i><span class="d-none d-md-inline"> Paid</span></span>
|
||||
</t>
|
||||
<t t-if="invoice.state == 'posted' and invoice.payment_state == 'reversed'">
|
||||
<span class="badge rounded-pill text-bg-success"><i class="fa fa-fw fa-check"></i><span class="d-none d-md-inline"> Reversed</span></span>
|
||||
</t>
|
||||
<t t-if="invoice.state == 'cancel'">
|
||||
<span class="badge rounded-pill text-bg-danger"><i class="fa fa-fw fa-remove"></i><span class="d-none d-md-inline"> Cancelled</span></span>
|
||||
</t>
|
||||
</t>
|
||||
<t t-if="invoice.state == 'posted' and last_tx.state == 'authorized'">
|
||||
<span class="badge rounded-pill text-bg-primary"><i class="fa fa-fw fa-check"/><span class="d-none d-md-inline"> Authorized</span></span>
|
||||
</t>
|
||||
<t t-if="invoice.state == 'posted' and last_tx.state == 'pending' and last_tx.provider_code not in ('none', 'custom')">
|
||||
<span class="badge rounded-pill text-bg-warning"><span class="d-none d-md-inline"> Pending</span></span>
|
||||
</t>
|
||||
<t t-if="invoice.state == 'posted' and invoice.payment_state in ('paid', 'in_payment') or last_tx.state == 'done'">
|
||||
<span class="badge rounded-pill text-bg-success"><i class="fa fa-fw fa-check"></i><span class="d-none d-md-inline"> Paid</span></span>
|
||||
</t>
|
||||
<t t-if="invoice.state == 'posted' and invoice.payment_state == 'reversed'">
|
||||
<span class="badge rounded-pill text-bg-success"><i class="fa fa-fw fa-check"></i><span class="d-none d-md-inline"> Reversed</span></span>
|
||||
</t>
|
||||
<t t-if="invoice.state == 'cancel'">
|
||||
<span class="badge rounded-pill text-bg-danger"><i class="fa fa-fw fa-remove"></i><span class="d-none d-md-inline"> Cancelled</span></span>
|
||||
<t t-else="">
|
||||
<!-- c/p of account -->
|
||||
<t t-if="invoice.state == 'posted' and invoice.payment_state not in ('in_payment', 'paid', 'reversed')">
|
||||
<span class="badge rounded-pill text-bg-info"><i class="fa fa-fw fa-clock-o" aria-label="Opened" title="Opened" role="img"></i><span class="d-none d-md-inline"> Waiting for Payment</span></span>
|
||||
</t>
|
||||
<t t-if="invoice.state == 'posted' and invoice.payment_state in ('paid', 'in_payment')">
|
||||
<span class="badge rounded-pill text-bg-success"><i class="fa fa-fw fa-check" aria-label="Paid" title="Paid" role="img"></i><span class="d-none d-md-inline"> Paid</span></span>
|
||||
</t>
|
||||
<t t-if="invoice.state == 'posted' and invoice.payment_state == 'reversed'">
|
||||
<span class="badge rounded-pill text-bg-success"><i class="fa fa-fw fa-check" aria-label="Reversed" title="Reversed" role="img"></i><span class="d-none d-md-inline"> Reversed</span></span>
|
||||
</t>
|
||||
<t t-if="invoice.state == 'cancel'">
|
||||
<span class="badge rounded-pill text-bg-warning"><i class="fa fa-fw fa-remove" aria-label="Cancelled" title="Cancelled" role="img"></i><span class="d-none d-md-inline"> Cancelled</span></span>
|
||||
</t>
|
||||
</t>
|
||||
</td>
|
||||
</xpath>
|
||||
@@ -70,8 +85,7 @@
|
||||
<t t-set="tx_ids" t-value="invoice.transaction_ids.filtered(lambda tx: tx.state in ('pending', 'authorized', 'done'))"/>
|
||||
<t t-set="pending_manual_txs" t-value="tx_ids.filtered(lambda tx: tx.state == 'pending' and tx.provider_code in ('none', 'custom'))"/>
|
||||
<div class="d-grid">
|
||||
<a href="#" t-if="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)"
|
||||
|
||||
<a href="#" t-if="invoice._has_to_be_paid()"
|
||||
class="btn btn-primary mb-2" data-bs-toggle="modal" data-bs-target="#pay_with">
|
||||
<i class="fa fa-fw fa-arrow-circle-right"/> Pay Now
|
||||
</a>
|
||||
@@ -90,7 +104,7 @@
|
||||
</t>
|
||||
</div>
|
||||
<t t-set="tx_ids" t-value="invoice.transaction_ids.filtered(lambda tx: tx.state in ('authorized', 'done'))"/>
|
||||
<div t-if="(invoice.amount_residual or not tx_ids) and invoice.state == 'posted' and invoice.payment_state in ('not_paid', 'partial') and invoice.amount_total" id="portal_pay">
|
||||
<div t-if="invoice._has_to_be_paid()" id="portal_pay">
|
||||
<t t-call="account_payment.portal_invoice_payment"/>
|
||||
</div>
|
||||
</xpath>
|
||||
|
||||
@@ -3,3 +3,4 @@
|
||||
from . import account_payment_register
|
||||
from . import payment_link_wizard
|
||||
from . import payment_refund_wizard
|
||||
from . import res_config_settings
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import models
|
||||
from . import wizards
|
||||
@@ -1,16 +0,0 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
{
|
||||
'name': "Payment - Account / Invoice Online Payment Patch",
|
||||
'category': 'Accounting/Accounting',
|
||||
'depends': ['account_payment'],
|
||||
'auto_install': True,
|
||||
'data': [
|
||||
'data/ir_config_parameter.xml',
|
||||
|
||||
'views/account_portal_templates.xml',
|
||||
|
||||
'wizards/res_config_settings_views.xml',
|
||||
],
|
||||
'license': 'LGPL-3',
|
||||
}
|
||||
-111
@@ -1,111 +0,0 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_payment_invoice_online_payment_patch
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 16.0+e\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2023-01-26 13:32+0000\n"
|
||||
"PO-Revision-Date: 2023-01-26 13:32+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: account_payment_invoice_online_payment_patch
|
||||
#: model_terms:ir.ui.view,arch_db:account_payment_invoice_online_payment_patch.portal_my_invoices_payment
|
||||
msgid ""
|
||||
"<span class=\"badge rounded-pill text-bg-danger\"><i class=\"fa fa-fw fa-"
|
||||
"remove\"/><span class=\"d-none d-md-inline\"> Cancelled</span></span>"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_payment_invoice_online_payment_patch
|
||||
#: model_terms:ir.ui.view,arch_db:account_payment_invoice_online_payment_patch.portal_my_invoices_payment
|
||||
msgid ""
|
||||
"<span class=\"badge rounded-pill text-bg-info\"><i class=\"fa fa-fw fa-"
|
||||
"clock-o\" aria-label=\"Opened\" title=\"Opened\" role=\"img\"/><span "
|
||||
"class=\"d-none d-md-inline\"> Waiting for Payment</span></span>"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_payment_invoice_online_payment_patch
|
||||
#: model_terms:ir.ui.view,arch_db:account_payment_invoice_online_payment_patch.portal_my_invoices_payment
|
||||
msgid ""
|
||||
"<span class=\"badge rounded-pill text-bg-info\"><i class=\"fa fa-fw fa-"
|
||||
"clock-o\"/><span class=\"d-none d-md-inline\"> Waiting for "
|
||||
"Payment</span></span>"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_payment_invoice_online_payment_patch
|
||||
#: model_terms:ir.ui.view,arch_db:account_payment_invoice_online_payment_patch.portal_my_invoices_payment
|
||||
msgid ""
|
||||
"<span class=\"badge rounded-pill text-bg-primary\"><i class=\"fa fa-fw fa-"
|
||||
"check\"/><span class=\"d-none d-md-inline\"> Authorized</span></span>"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_payment_invoice_online_payment_patch
|
||||
#: model_terms:ir.ui.view,arch_db:account_payment_invoice_online_payment_patch.portal_my_invoices_payment
|
||||
msgid ""
|
||||
"<span class=\"badge rounded-pill text-bg-success\"><i class=\"fa fa-fw fa-"
|
||||
"check\" aria-label=\"Paid\" title=\"Paid\" role=\"img\"/><span "
|
||||
"class=\"d-none d-md-inline\"> Paid</span></span>"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_payment_invoice_online_payment_patch
|
||||
#: model_terms:ir.ui.view,arch_db:account_payment_invoice_online_payment_patch.portal_my_invoices_payment
|
||||
msgid ""
|
||||
"<span class=\"badge rounded-pill text-bg-success\"><i class=\"fa fa-fw fa-"
|
||||
"check\" aria-label=\"Reversed\" title=\"Reversed\" role=\"img\"/><span "
|
||||
"class=\"d-none d-md-inline\"> Reversed</span></span>"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_payment_invoice_online_payment_patch
|
||||
#: model_terms:ir.ui.view,arch_db:account_payment_invoice_online_payment_patch.portal_my_invoices_payment
|
||||
msgid ""
|
||||
"<span class=\"badge rounded-pill text-bg-success\"><i class=\"fa fa-fw fa-"
|
||||
"check\"/><span class=\"d-none d-md-inline\"> Paid</span></span>"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_payment_invoice_online_payment_patch
|
||||
#: model_terms:ir.ui.view,arch_db:account_payment_invoice_online_payment_patch.portal_my_invoices_payment
|
||||
msgid ""
|
||||
"<span class=\"badge rounded-pill text-bg-success\"><i class=\"fa fa-fw fa-"
|
||||
"check\"/><span class=\"d-none d-md-inline\"> Reversed</span></span>"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_payment_invoice_online_payment_patch
|
||||
#: model_terms:ir.ui.view,arch_db:account_payment_invoice_online_payment_patch.portal_my_invoices_payment
|
||||
msgid ""
|
||||
"<span class=\"badge rounded-pill text-bg-warning\"><i class=\"fa fa-fw fa-"
|
||||
"remove\" aria-label=\"Cancelled\" title=\"Cancelled\" role=\"img\"/><span "
|
||||
"class=\"d-none d-md-inline\"> Cancelled</span></span>"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_payment_invoice_online_payment_patch
|
||||
#: model_terms:ir.ui.view,arch_db:account_payment_invoice_online_payment_patch.portal_my_invoices_payment
|
||||
msgid ""
|
||||
"<span class=\"badge rounded-pill text-bg-warning\"><span class=\"d-none "
|
||||
"d-md-inline\"> Pending</span></span>"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_payment_invoice_online_payment_patch
|
||||
#: model:ir.model,name:account_payment_invoice_online_payment_patch.model_res_config_settings
|
||||
msgid "Config Settings"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_payment_invoice_online_payment_patch
|
||||
#: model_terms:ir.ui.view,arch_db:account_payment_invoice_online_payment_patch.res_config_settings_view_form
|
||||
msgid "Invoice Online Payment"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_payment_invoice_online_payment_patch
|
||||
#: model:ir.model,name:account_payment_invoice_online_payment_patch.model_account_move
|
||||
msgid "Journal Entry"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_payment_invoice_online_payment_patch
|
||||
#: model:ir.model.fields,field_description:account_payment_invoice_online_payment_patch.field_res_config_settings__pay_invoices_online
|
||||
msgid "Pay Invoices Online"
|
||||
msgstr ""
|
||||
@@ -1,3 +0,0 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import account_move
|
||||
@@ -1,16 +0,0 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import models
|
||||
from odoo.tools import str2bool
|
||||
|
||||
|
||||
class AccountMove(models.Model):
|
||||
_inherit = 'account.move'
|
||||
|
||||
def _has_to_be_paid(self):
|
||||
enabled_feature = str2bool(
|
||||
self.env['ir.config_parameter'].sudo().get_param(
|
||||
'account_payment.enable_portal_payment'
|
||||
)
|
||||
)
|
||||
return enabled_feature and super()._has_to_be_paid()
|
||||
-65
@@ -1,65 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
|
||||
<template id="portal_my_invoices_payment" inherit_id="account_payment.portal_my_invoices_payment">
|
||||
<xpath expr="//t[@t-foreach='invoices']/tr/td[count(t)=2]/t[@t-set='pending_manual_txs']/following-sibling::a[i]" position="attributes">
|
||||
<attribute name="t-if">
|
||||
invoice._has_to_be_paid()
|
||||
</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//t[@t-foreach='invoices']/tr/td[hasclass('tx_status')]" position="replace">
|
||||
<td class="tx_status text-center">
|
||||
<t t-if="last_tx">
|
||||
<!-- c/p of account_payment -->
|
||||
<t t-if="invoice.state == 'posted' and invoice.payment_state in ('not_paid', 'partial') and (last_tx.state not in ['pending', 'authorized', 'done', 'cancel'] or (last_tx.state == 'pending' and last_tx.provider_code in ('none', 'custom')))">
|
||||
<span class="badge rounded-pill text-bg-info"><i class="fa fa-fw fa-clock-o"></i><span class="d-none d-md-inline"> Waiting for Payment</span></span>
|
||||
</t>
|
||||
<t t-if="invoice.state == 'posted' and last_tx.state == 'authorized'">
|
||||
<span class="badge rounded-pill text-bg-primary"><i class="fa fa-fw fa-check"/><span class="d-none d-md-inline"> Authorized</span></span>
|
||||
</t>
|
||||
<t t-if="invoice.state == 'posted' and last_tx.state == 'pending' and last_tx.provider_code not in ('none', 'custom')">
|
||||
<span class="badge rounded-pill text-bg-warning"><span class="d-none d-md-inline"> Pending</span></span>
|
||||
</t>
|
||||
<t t-if="invoice.state == 'posted' and invoice.payment_state in ('paid', 'in_payment') or last_tx.state == 'done'">
|
||||
<span class="badge rounded-pill text-bg-success"><i class="fa fa-fw fa-check"></i><span class="d-none d-md-inline"> Paid</span></span>
|
||||
</t>
|
||||
<t t-if="invoice.state == 'posted' and invoice.payment_state == 'reversed'">
|
||||
<span class="badge rounded-pill text-bg-success"><i class="fa fa-fw fa-check"></i><span class="d-none d-md-inline"> Reversed</span></span>
|
||||
</t>
|
||||
<t t-if="invoice.state == 'cancel'">
|
||||
<span class="badge rounded-pill text-bg-danger"><i class="fa fa-fw fa-remove"></i><span class="d-none d-md-inline"> Cancelled</span></span>
|
||||
</t>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<!-- c/p of account -->
|
||||
<t t-if="invoice.state == 'posted' and invoice.payment_state not in ('in_payment', 'paid', 'reversed')">
|
||||
<span class="badge rounded-pill text-bg-info"><i class="fa fa-fw fa-clock-o" aria-label="Opened" title="Opened" role="img"></i><span class="d-none d-md-inline"> Waiting for Payment</span></span>
|
||||
</t>
|
||||
<t t-if="invoice.state == 'posted' and invoice.payment_state in ('paid', 'in_payment')">
|
||||
<span class="badge rounded-pill text-bg-success"><i class="fa fa-fw fa-check" aria-label="Paid" title="Paid" role="img"></i><span class="d-none d-md-inline"> Paid</span></span>
|
||||
</t>
|
||||
<t t-if="invoice.state == 'posted' and invoice.payment_state == 'reversed'">
|
||||
<span class="badge rounded-pill text-bg-success"><i class="fa fa-fw fa-check" aria-label="Reversed" title="Reversed" role="img"></i><span class="d-none d-md-inline"> Reversed</span></span>
|
||||
</t>
|
||||
<t t-if="invoice.state == 'cancel'">
|
||||
<span class="badge rounded-pill text-bg-warning"><i class="fa fa-fw fa-remove" aria-label="Cancelled" title="Cancelled" role="img"></i><span class="d-none d-md-inline"> Cancelled</span></span>
|
||||
</t>
|
||||
</t>
|
||||
</td>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<template id="portal_invoice_page_inherit_payment" inherit_id="account_payment.portal_invoice_page_inherit_payment">
|
||||
<xpath expr="//div[@id='portal_pay']" position="attributes">
|
||||
<attribute name="t-if">
|
||||
invoice._has_to_be_paid()
|
||||
</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//t[@t-call='portal.portal_record_sidebar']//div[hasclass('d-grid')]//a[starts-with(@href, '#')][i]" position="attributes">
|
||||
<attribute name="t-if">
|
||||
invoice._has_to_be_paid()
|
||||
</attribute>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
</odoo>
|
||||
@@ -1,3 +0,0 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import res_config_settings
|
||||
Reference in New Issue
Block a user