Skip to content

Commit 889fc1e

Browse files
committed
8.0 account_financial_report_webkit fix for multilingual Chart of Accounts
1 parent a367b2b commit 889fc1e

File tree

5 files changed

+26
-10
lines changed

5 files changed

+26
-10
lines changed

account_financial_report_webkit/report/common_balance_reports.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def _get_account_details(self, account_ids, target_move, fiscalyear,
117117
return accounts_by_id
118118

119119
def _get_comparison_details(self, data, account_ids, target_move,
120-
comparison_filter, index):
120+
comparison_filter, index, context=None):
121121
"""
122122
123123
@param data: data of the wizard form
@@ -154,7 +154,7 @@ def _get_comparison_details(self, data, account_ids, target_move,
154154
and self._get_initial_balance_mode(start) or False
155155
accounts_by_ids = self._get_account_details(
156156
account_ids, target_move, fiscalyear, details_filter,
157-
start, stop, initial_balance_mode)
157+
start, stop, initial_balance_mode, context=context)
158158
comp_params = {
159159
'comparison_filter': comparison_filter,
160160
'fiscalyear': fiscalyear,
@@ -230,6 +230,8 @@ def _get_start_stop_for_filter(self, main_filter, fiscalyear, start_date,
230230
return start_period, stop_period, start, stop
231231

232232
def compute_balance_data(self, data, filter_report_type=None):
233+
lang = self.localcontext.get('lang')
234+
lang_ctx = lang and {'lang': lang} or {}
233235
new_ids = data['form']['account_ids'] or data[
234236
'form']['chart_account_id']
235237
max_comparison = self._get_form_param(
@@ -265,20 +267,22 @@ def compute_balance_data(self, data, filter_report_type=None):
265267
# get details for each accounts, total of debit / credit / balance
266268
accounts_by_ids = self._get_account_details(
267269
account_ids, target_move, fiscalyear, main_filter, start, stop,
268-
initial_balance_mode)
270+
initial_balance_mode, context=lang_ctx)
269271

270272
comparison_params = []
271273
comp_accounts_by_ids = []
272274
for index in range(max_comparison):
273275
if comp_filters[index] != 'filter_no':
274276
comparison_result, comp_params = self._get_comparison_details(
275-
data, account_ids, target_move, comp_filters[index], index)
277+
data, account_ids, target_move, comp_filters[index], index,
278+
context=lang_ctx)
276279
comparison_params.append(comp_params)
277280
comp_accounts_by_ids.append(comparison_result)
278281

279282
objects = self.pool.get('account.account').browse(self.cursor,
280283
self.uid,
281-
account_ids)
284+
account_ids,
285+
context=lang_ctx)
282286

283287
to_display_accounts = dict.fromkeys(account_ids, True)
284288
init_balance_accounts = dict.fromkeys(account_ids, False)

account_financial_report_webkit/report/common_partner_balance_reports.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ def _get_partners_comparison_details(self, data, account_ids, target_move,
220220
return accounts_details_by_ids, comp_params
221221

222222
def compute_partner_balance_data(self, data, filter_report_type=None):
223+
lang = self.localcontext.get('lang')
224+
lang_ctx = lang and {'lang': lang} or {}
223225
new_ids = data['form']['account_ids'] or data[
224226
'form']['chart_account_id']
225227
max_comparison = self._get_form_param(
@@ -259,7 +261,7 @@ def compute_partner_balance_data(self, data, filter_report_type=None):
259261
# get details for each accounts, total of debit / credit / balance
260262
accounts_by_ids = self._get_account_details(
261263
account_ids, target_move, fiscalyear, main_filter, start, stop,
262-
initial_balance_mode)
264+
initial_balance_mode, context=lang_ctx)
263265

264266
partner_details_by_ids = self._get_account_partners_details(
265267
accounts_by_ids, main_filter, target_move, start, stop,
@@ -280,7 +282,8 @@ def compute_partner_balance_data(self, data, filter_report_type=None):
280282
comp_accounts_by_ids.append(comparison_result)
281283
objects = self.pool.get('account.account').browse(self.cursor,
282284
self.uid,
283-
account_ids)
285+
account_ids,
286+
context=lang_ctx)
284287

285288
init_balance_accounts = {}
286289
comparisons_accounts = {}

account_financial_report_webkit/report/general_ledger.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ def __init__(self, cursor, uid, name, context):
7575
def set_context(self, objects, data, ids, report_type=None):
7676
"""Populate a ledger_lines attribute on each browse record that will be
7777
used by mako template"""
78+
lang = self.localcontext.get('lang')
79+
lang_ctx = lang and {'lang': lang} or {}
7880
new_ids = data['form']['account_ids'] or data[
7981
'form']['chart_account_id']
8082

@@ -121,7 +123,8 @@ def set_context(self, objects, data, ids, report_type=None):
121123
stop)
122124
objects = self.pool.get('account.account').browse(self.cursor,
123125
self.uid,
124-
accounts)
126+
accounts,
127+
context=lang_ctx)
125128

126129
init_balance = {}
127130
ledger_lines = {}

account_financial_report_webkit/report/open_invoices.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ def _group_lines_by_currency(self, account_br):
101101
def set_context(self, objects, data, ids, report_type=None):
102102
"""Populate a ledger_lines attribute on each browse record that will
103103
be used by mako template"""
104+
lang = self.localcontext.get('lang')
105+
lang_ctx = lang and {'lang': lang} or {}
104106
new_ids = data['form']['chart_account_id']
105107
# Account initial balance memoizer
106108
init_balance_memoizer = {}
@@ -147,7 +149,8 @@ def set_context(self, objects, data, ids, report_type=None):
147149
partner_filter=partner_ids)
148150
objects = self.pool.get('account.account').browse(self.cursor,
149151
self.uid,
150-
account_ids)
152+
account_ids,
153+
context=lang_ctx)
151154

152155
ledger_lines = {}
153156
init_balance = {}

account_financial_report_webkit/report/partners_ledger.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ def _get_initial_balance_mode(self, start_period):
8686
def set_context(self, objects, data, ids, report_type=None):
8787
"""Populate a ledger_lines attribute on each browse record that will
8888
be used by mako template"""
89+
lang = self.localcontext.get('lang')
90+
lang_ctx = lang and {'lang': lang} or {}
8991
new_ids = data['form']['chart_account_id']
9092

9193
# account partner memoizer
@@ -148,7 +150,8 @@ def set_context(self, objects, data, ids, report_type=None):
148150
partner_filter=partner_ids)
149151
objects = self.pool.get('account.account').browse(self.cursor,
150152
self.uid,
151-
accounts)
153+
accounts,
154+
context=lang_ctx)
152155

153156
init_balance = {}
154157
ledger_lines_dict = {}

0 commit comments

Comments
 (0)