diff --git a/account_partner_open_items_xlsx/__manifest__.py b/account_partner_open_items_xlsx/__manifest__.py index e023694..7764c3f 100644 --- a/account_partner_open_items_xlsx/__manifest__.py +++ b/account_partner_open_items_xlsx/__manifest__.py @@ -1,9 +1,9 @@ -# Copyright 2009-2019 Noviat. +# Copyright 2009-2021 Noviat. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { 'name': 'Open Journal Items per partner', - 'version': '11.0.1.0.0', + 'version': '11.0.1.0.1', 'license': 'AGPL-3', 'author': 'Noviat', 'website': 'http://www.noviat.com', diff --git a/account_partner_open_items_xlsx/report/account_partner_open_items_xlsx.py b/account_partner_open_items_xlsx/report/account_partner_open_items_xlsx.py index 037b654..3120dfe 100644 --- a/account_partner_open_items_xlsx/report/account_partner_open_items_xlsx.py +++ b/account_partner_open_items_xlsx/report/account_partner_open_items_xlsx.py @@ -1,4 +1,4 @@ -# Copyright 2009-2019 Noviat +# Copyright 2009-2021 Noviat # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from functools import reduce @@ -170,9 +170,18 @@ def _get_ws_params(self, workbook, data, partners): query_end = ( "WHERE m.company_id = %s " % wiz.company_id.id + move_selection + account_selection + partner_selection + - "AND " - "((l.full_reconcile_id IS NULL " - " AND COALESCE(pr.amount, 0) < abs(l.balance)) " + """ + AND ( + (l.full_reconcile_id IS NULL AND + (pr.id IS NULL + OR CASE WHEN l.id = pr.debit_move_id + THEN (SELECT date FROM account_move_line WHERE id = pr.credit_move_id) + ELSE (SELECT date FROM account_move_line WHERE id = pr.debit_move_id) + END > '{0}' + OR COALESCE(pr.amount, 0) < abs(l.balance) + ) + ) + """.format(wiz.date_at) + reconciled_after + ") " "AND l.balance != 0 " + where_extra + "ORDER BY a_code")