[FIX] account: invoiced amount

- Create 2 companies: A is parent of B.
- Demo is in Company A
- Create 2 invoices for a partner: one in A, one in B (100 each)
- Validate the invoices

Connected as Demo, the 'Invoiced' amount on the partner form view (stat
button) is 100, while clicking on it shows both invoices (total of 200).

There is no need to manually add the company in the `where` clause since
the `_apply_ir_rules` will take care of adding the appropriate
multi-company rules.

opw-772479
This commit is contained in:
Nicolas Martinelli
2017-10-10 17:20:41 +02:00
parent 2d8e6ff05e
commit 99703583d4
+1 -1
View File
@@ -306,7 +306,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')