Permalink
Browse files

[FIX] account: multi-company match payments interface

In a multicompany environment, the match payment interface was filtering move lines on the user's company, ignoring the lines of child companies.
  • Loading branch information...
ivantodorovich committed Sep 7, 2018
1 parent 0b58667 commit dc4b00e91ad41fd5221496c2451b11f30d4c3f3c
Showing with 4 additions and 2 deletions.
  1. +4 −2 addons/account/models/account_move.py
@@ -498,6 +498,8 @@ def get_data_for_manual_reconciliation(self, res_type, res_ids=None, account_typ
is_partner = res_type == 'partner'
res_alias = is_partner and 'p' or 'a'
company_ids = self.env['res.company'].search([('id', 'child_of', self.env.user.company_id.id)])
query = ("""
SELECT {0} account_id, account_name, account_code, max_date,
to_char(last_time_entries_checked, 'YYYY-MM-DD') AS last_time_entries_checked
@@ -519,7 +521,7 @@ def get_data_for_manual_reconciliation(self, res_type, res_ids=None, account_typ
{3}
{4}
{5}
AND l.company_id = {6}
AND l.company_id IN {6}
AND EXISTS (
SELECT NULL
FROM account_move_line l
@@ -545,7 +547,7 @@ def get_data_for_manual_reconciliation(self, res_type, res_ids=None, account_typ
is_partner and ' ' or "AND at.type <> 'payable' AND at.type <> 'receivable'",
account_type and "AND at.type = %(account_type)s" or '',
res_ids and 'AND ' + res_alias + '.id in %(res_ids)s' or '',
self.env.user.company_id.id,
tuple(company_ids.ids),
is_partner and 'AND l.partner_id = p.id' or ' ',
is_partner and 'l.partner_id, p.id,' or ' ',
res_alias=res_alias

0 comments on commit dc4b00e

Please sign in to comment.