[IMP] partner_statement: ref in activity statement lines

This commit is contained in:
mariadforgeflow
2023-02-15 17:01:48 +01:00
committed by Miquel Raïch
parent b9b4f1e67f
commit 1eb23d561b

View File

@@ -3,7 +3,7 @@
from collections import defaultdict from collections import defaultdict
from odoo import api, models from odoo import _, api, models
from .outstanding_statement import OutstandingStatement from .outstanding_statement import OutstandingStatement
@@ -118,6 +118,7 @@ class ActivityStatement(models.AbstractModel):
def _display_activity_lines_sql_q1( def _display_activity_lines_sql_q1(
self, partners, date_start, date_end, account_type self, partners, date_start, date_end, account_type
): ):
payment_ref = _("Payment")
return str( return str(
self._cr.mogrify( self._cr.mogrify(
""" """
@@ -130,11 +131,9 @@ class ActivityStatement(models.AbstractModel):
CASE CASE
WHEN (aj.type IN ('sale', 'purchase')) AND l.name IS NOT NULL WHEN (aj.type IN ('sale', 'purchase')) AND l.name IS NOT NULL
THEN l.ref THEN l.ref
WHEN aj.type IN ('sale', 'purchase') AND l.name IS NULL
THEN m.ref
WHEN (aj.type in ('bank', 'cash')) WHEN (aj.type in ('bank', 'cash'))
THEN 'Payment' THEN %(payment_ref)s
ELSE '' ELSE m.ref
END as case_ref, END as case_ref,
l.blocked, l.currency_id, l.company_id, l.blocked, l.currency_id, l.company_id,
sum(CASE WHEN (l.currency_id is not null AND l.amount_currency > 0.0) sum(CASE WHEN (l.currency_id is not null AND l.amount_currency > 0.0)