diff --git a/addons/account/models/partner.py b/addons/account/models/partner.py index 0bef6eb52ec35c145fbbe00af0d5c0b6ea4d1549..25832af081c34ef6c2edb9530d6ff38c523f44f9 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 0ef495e12a8cd79de0329d080955cc5990f13a76..f577b47921aee16e0ba78255cfa1db58c764afb6 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