diff --git a/addons/account/models/partner.py b/addons/account/models/partner.py index 0bef6eb52ec..25832af081c 100644 --- a/addons/account/models/partner.py +++ b/addons/account/models/partner.py @@ -279,7 +279,7 @@ class ResPartner(models.Model): # generate where clause to include multicompany rules where_query = account_invoice_report._where_calc([ - ('partner_id', 'in', all_partner_ids), ('state', 'not in', ['draft', 'cancel']), ('company_id', '=', self.env.user.company_id.id), + ('partner_id', 'in', all_partner_ids), ('state', 'not in', ['draft', 'cancel']), ('type', 'in', ('out_invoice', 'out_refund')) ]) account_invoice_report._apply_ir_rules(where_query, 'read') diff --git a/addons/account/report/account_invoice_report.py b/addons/account/report/account_invoice_report.py index 0ef495e12a8..f577b47921a 100644 --- a/addons/account/report/account_invoice_report.py +++ b/addons/account/report/account_invoice_report.py @@ -136,7 +136,7 @@ class AccountInvoiceReport(models.Model): JOIN ( -- Temporary table to decide if the qty should be added or retrieved (Invoice vs Refund) SELECT id,(CASE - WHEN ai.type::text = ANY (ARRAY['out_refund'::character varying::text, 'in_invoice'::character varying::text]) + WHEN ai.type::text = ANY (ARRAY['in_refund'::character varying::text, 'in_invoice'::character varying::text]) THEN -1 ELSE 1 END) AS sign