[16.0] [MIG] partner_statement: Migration to 16.0

This commit is contained in:
Danny W. Adair
2023-10-24 15:14:08 +13:00
committed by Miquel Raïch
parent 5b7e7d4842
commit bf2d7c6dd1
13 changed files with 32 additions and 28 deletions

View File

@@ -69,7 +69,6 @@ class ReportStatementCommon(models.AbstractModel):
FROM account_move_line l
JOIN account_move m ON (l.move_id = m.id)
JOIN account_account aa ON (aa.id = l.account_id)
JOIN account_account_type at ON (at.id = aa.user_type_id)
LEFT JOIN (SELECT pr.*
FROM account_partial_reconcile pr
INNER JOIN account_move_line l2
@@ -82,7 +81,7 @@ class ReportStatementCommon(models.AbstractModel):
ON pr.debit_move_id = l2.id
WHERE l2.date <= %(date_end)s
) as pc ON pc.credit_move_id = l.id
WHERE l.partner_id IN %(partners)s AND at.type = %(account_type)s
WHERE l.partner_id IN %(partners)s
AND (
(pd.id IS NOT NULL AND
pd.max_date <= %(date_end)s) OR
@@ -91,6 +90,7 @@ class ReportStatementCommon(models.AbstractModel):
(pd.id IS NULL AND pc.id IS NULL)
) AND l.date <= %(date_end)s AND not l.blocked
AND m.state IN ('posted')
AND aa.account_type = %(account_type)s
GROUP BY l.partner_id, l.currency_id, l.date, l.date_maturity,
l.amount_currency, l.balance, l.move_id,
l.company_id, l.id