summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjbw <jbw@odoo.com>2020-10-15 09:02:16 +0000
committerjbw <jbw@odoo.com>2020-10-15 13:44:48 +0000
commit2e1003a969f6fc907544e6506e1c6147e5e11d3e (patch)
treeddd27de599633bfbe6d8fdfa10f71f164f820a63
parenta1d5981912631c871a3efb692e3c1a4e64bb5957 (diff)
[FIX] account, account_payment, sale : add support of new 'reversed' payment_state
Add handling of reversed payment state (added in odoo/enterprise#7202) in move view, portal templates and sales_team. closes odoo/odoo#60100 Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
-rw-r--r--addons/account/views/account_move_views.xml2
-rw-r--r--addons/account/views/account_portal_templates.xml5
-rw-r--r--addons/account_payment/views/account_portal_templates.xml3
-rw-r--r--addons/sale/models/sales_team.py2
4 files changed, 9 insertions, 3 deletions
diff --git a/addons/account/views/account_move_views.xml b/addons/account/views/account_move_views.xml
index faca6990fa6..3a6c7a6ba17 100644
--- a/addons/account/views/account_move_views.xml
+++ b/addons/account/views/account_move_views.xml
@@ -414,7 +414,7 @@
<field name="invoice_partner_display_name" invisible="context.get('default_move_type') not in ('out_invoice', 'out_refund','out_receipt')" groups="base.group_user" string="Customer" />
<field name="invoice_date" optional="show" invisible="context.get('default_move_type') not in ('in_invoice', 'in_refund','in_receipt')" string="Bill Date"/>
<field name="invoice_date" optional="show" invisible="context.get('default_move_type') not in ('out_invoice', 'out_refund','out_receipt')" string="Invoice Date"/>
- <field name="invoice_date_due" widget="remaining_days" optional="show" attrs="{'invisible': [['payment_state', '=', 'paid']]}"/>
+ <field name="invoice_date_due" widget="remaining_days" optional="show" attrs="{'invisible': [['payment_state', 'in', ('paid', 'reversed')]]}"/>
<field name="invoice_origin" optional="hide" string="Source Document"/>
<field name="payment_reference" optional="hide" invisible="context.get('default_move_type') in ('out_invoice', 'out_refund','out_receipt')"/>
<field name="ref" optional="hide"/>
diff --git a/addons/account/views/account_portal_templates.xml b/addons/account/views/account_portal_templates.xml
index 90c4604a4d6..6e14c5d601f 100644
--- a/addons/account/views/account_portal_templates.xml
+++ b/addons/account/views/account_portal_templates.xml
@@ -54,12 +54,15 @@
<td><span t-field="invoice.invoice_date"/></td>
<td class='d-none d-md-table-cell'><span t-field="invoice.invoice_date_due"/></td>
<td class="tx_status">
- <t t-if="invoice.state == 'posted' and invoice.payment_state != 'paid'">
+ <t t-if="invoice.state == 'posted' and invoice.payment_state not in ('paid', 'reversed')">
<span class="badge badge-pill badge-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 == 'paid'">
<span class="badge badge-pill badge-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 badge-pill badge-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 badge-pill badge-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>
diff --git a/addons/account_payment/views/account_portal_templates.xml b/addons/account_payment/views/account_portal_templates.xml
index cb16452f5c5..be21d379b22 100644
--- a/addons/account_payment/views/account_portal_templates.xml
+++ b/addons/account_payment/views/account_portal_templates.xml
@@ -28,6 +28,9 @@
<t t-if="invoice.state == 'posted' and invoice.payment_state == 'paid' or last_tx.state == 'done'">
<span class="badge badge-pill badge-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' or last_tx.state == 'done'">
+ <span class="badge badge-pill badge-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 badge-pill badge-danger"><i class="fa fa-fw fa-remove"></i><span class="d-none d-md-inline"> Cancelled</span></span>
</t>
diff --git a/addons/sale/models/sales_team.py b/addons/sale/models/sales_team.py
index 9e592561f89..b73828684cc 100644
--- a/addons/sale/models/sales_team.py
+++ b/addons/sale/models/sales_team.py
@@ -81,7 +81,7 @@ class CrmTeam(models.Model):
JOIN account_move_line line ON line.move_id = move.id
JOIN account_account account ON account.id = line.account_id
WHERE move.move_type IN ('out_invoice', 'out_refund', 'in_invoice', 'in_refund')
- AND move.payment_state IN ('in_payment', 'paid')
+ AND move.payment_state IN ('in_payment', 'paid', 'reversed')
AND move.state = 'posted'
AND move.team_id IN %s
AND move.date BETWEEN %s AND %s