[FIX] account: group by payment status in the invoice analysis

An error is thrown when displaying the invoice analysis with a group by
on payment status when there is at least one invoice partially paid

Steps to reproduce:
1. Install Invoicing
2. Open Invoicing and partially pay any invoice
3. Go to Invoicing > Reporting > Invoice Analysis
4. Group by custom field: payment status

Solution:
Use all the possible payment_state values of account_move for
account_invoice_report

opw-3213576

closes odoo/odoo#123777

X-original-commit: 0e063bc142f13456935263caa07e6d840c1852f9
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
This commit is contained in:
MerlinGuillaume
2023-06-06 10:30:11 +02:00
parent fc82e4feda
commit abdae38656
2 changed files with 12 additions and 13 deletions
+10 -8
View File
@@ -38,6 +38,15 @@ _logger = logging.getLogger(__name__)
MAX_HASH_VERSION = 3
PAYMENT_STATE_SELECTION = [
('not_paid', 'Not Paid'),
('in_payment', 'In Payment'),
('paid', 'Paid'),
('partial', 'Partially Paid'),
('reversed', 'Reversed'),
('invoicing_legacy', 'Invoicing App Legacy'),
]
TYPE_REVERSE_MAP = {
'entry': 'entry',
'out_invoice': 'out_refund',
@@ -444,14 +453,7 @@ class AccountMove(models.Model):
exportable=False,
)
payment_state = fields.Selection(
selection=[
('not_paid', 'Not Paid'),
('in_payment', 'In Payment'),
('paid', 'Paid'),
('partial', 'Partially Paid'),
('reversed', 'Reversed'),
('invoicing_legacy', 'Invoicing App Legacy'),
],
selection=PAYMENT_STATE_SELECTION,
string="Payment Status",
compute='_compute_payment_state', store=True, readonly=True,
copy=False,
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from odoo import models, fields, api
from odoo.addons.account.models.account_move import PAYMENT_STATE_SELECTION
from functools import lru_cache
@@ -32,11 +33,7 @@ class AccountInvoiceReport(models.Model):
('posted', 'Open'),
('cancel', 'Cancelled')
], string='Invoice Status', readonly=True)
payment_state = fields.Selection(selection=[
('not_paid', 'Not Paid'),
('in_payment', 'In Payment'),
('paid', 'paid')
], string='Payment Status', readonly=True)
payment_state = fields.Selection(selection=PAYMENT_STATE_SELECTION, string='Payment Status', readonly=True)
fiscal_position_id = fields.Many2one('account.fiscal.position', string='Fiscal Position', readonly=True)
invoice_date = fields.Date(readonly=True, string="Invoice Date")