Browse Source

[CHG]account_financial_report_webkit_xls: Migration to v8

pull/23/head
Anthony Muschang 10 years ago
parent
commit
7b5e2b0beb
  1. 2
      account_financial_report_webkit_xls/__openerp__.py
  2. 21
      account_financial_report_webkit_xls/report/general_ledger_xls.py
  3. 15
      account_financial_report_webkit_xls/report/open_invoices_xls.py
  4. 17
      account_financial_report_webkit_xls/report/partner_ledger_xls.py
  5. 6
      account_financial_report_webkit_xls/report/trial_balance_xls.py

2
account_financial_report_webkit_xls/__openerp__.py

@ -45,5 +45,5 @@
'wizard/open_invoices_wizard_view.xml', 'wizard/open_invoices_wizard_view.xml',
], ],
'active': False, 'active': False,
'installable': False,
'installable': True,
} }

21
account_financial_report_webkit_xls/report/general_ledger_xls.py

@ -197,11 +197,12 @@ class general_ledger_xls(report_xls):
cnt = 0 cnt = 0
for account in objects: for account in objects:
display_initial_balance = account.init_balance and \
(account.init_balance.get(
'debit', 0.0) != 0.0 or account.
init_balance.get('credit', 0.0) != 0.0)
display_ledger_lines = account.ledger_lines
display_initial_balance = _p['init_balance'][account.id] and \
(_p['init_balance'][account.id].get(
'debit', 0.0) != 0.0 or
_p['init_balance'][account.id].get('credit', 0.0)
!= 0.0)
display_ledger_lines = _p['ledger_lines'][account.id]
if _p.display_account_raw(data) == 'all' or \ if _p.display_account_raw(data) == 'all' or \
(display_ledger_lines or display_initial_balance): (display_ledger_lines or display_initial_balance):
@ -223,11 +224,11 @@ class general_ledger_xls(report_xls):
row_start = row_pos row_start = row_pos
if display_initial_balance: if display_initial_balance:
cumul_debit = account.init_balance.get('debit') or 0.0
cumul_credit = account.init_balance.get('credit') or 0.0
cumul_balance = account.init_balance.get(
'init_balance') or 0.0
cumul_balance_curr = account.init_balance.get(
init_balance = _p['init_balance'][account.id]
cumul_debit = init_balance.get('debit') or 0.0
cumul_credit = init_balance.get('credit') or 0.0
cumul_balance = init_balance.get('init_balance') or 0.0
cumul_balance_curr = init_balance.get(
'init_balance_currency') or 0.0 'init_balance_currency') or 0.0
c_specs = [('empty%s' % x, 1, 0, 'text', None) c_specs = [('empty%s' % x, 1, 0, 'text', None)
for x in range(6)] for x in range(6)]

15
account_financial_report_webkit_xls/report/open_invoices_xls.py

@ -725,10 +725,12 @@ class open_invoices_xls(report_xls):
# selected # selected
def print_grouped_line_report(self, row_pos, account, _xs, xlwt, _p, data): def print_grouped_line_report(self, row_pos, account, _xs, xlwt, _p, data):
if account.grouped_ledger_lines and account.partners_order:
if account.grouped_ledger_lines and \
_p['partners_order'][account.id]:
row_start_account = row_pos row_start_account = row_pos
for partner_name, p_id, p_ref, p_name in account.partners_order:
for partner_name, p_id, p_ref, p_name \
in _p['partners_order'][account.id]:
row_pos = self.print_row_code_account( row_pos = self.print_row_code_account(
"regroup", account, row_pos, partner_name) "regroup", account, row_pos, partner_name)
@ -757,13 +759,16 @@ class open_invoices_xls(report_xls):
# export the invoice AR/AP lines # export the invoice AR/AP lines
def print_ledger_lines(self, row_pos, account, _xs, xlwt, _p, data): def print_ledger_lines(self, row_pos, account, _xs, xlwt, _p, data):
if account.ledger_lines and account.partners_order:
if _p['ledger_lines'][account.id] \
and _p['partners_order'][account.id]:
row_start_account = row_pos row_start_account = row_pos
# Print account line: code - account # Print account line: code - account
row_pos = self.print_row_code_account( row_pos = self.print_row_code_account(
"noregroup", account, row_pos, "") "noregroup", account, row_pos, "")
for partner_name, p_id, p_ref, p_name in account.partners_order:
for partner_name, p_id, p_ref, p_name \
in _p['partners_order'][account.id]:
# Print partner row # Print partner row
row_pos = self.print_row_partner(row_pos, partner_name) row_pos = self.print_row_partner(row_pos, partner_name)
@ -773,7 +778,7 @@ class open_invoices_xls(report_xls):
row_pos_start = row_pos row_pos_start = row_pos
line_number = 0 line_number = 0
for line in account.ledger_lines.get(p_id, []):
for line in _p['ledger_lines'][account.id].get(p_id, []):
line_number += 1 line_number += 1
# print ledger lines # print ledger lines
row_pos = self.print_lines( row_pos = self.print_lines(

17
account_financial_report_webkit_xls/report/partner_ledger_xls.py

@ -214,7 +214,7 @@ class partner_ledger_xls(report_xls):
cnt = 0 cnt = 0
for account in objects: for account in objects:
if account.ledger_lines or account.init_balance:
if _p['ledger_lines'].get(account.id, False) or _p['init_balance'].get(account.id, False):
if not account.partners_order: if not account.partners_order:
continue continue
cnt += 1 cnt += 1
@ -254,9 +254,9 @@ class partner_ledger_xls(report_xls):
row_pos = self.xls_write_row(ws, row_pos, c_hdr_data) row_pos = self.xls_write_row(ws, row_pos, c_hdr_data)
row_start_partner = row_pos row_start_partner = row_pos
total_debit = account.init_balance.get(
total_debit = _p['init_balance'][account.id].get(
p_id, {}).get('debit') or 0.0 p_id, {}).get('debit') or 0.0
total_credit = account.init_balance.get(
total_credit = _p['init_balance'][account.id].get(
p_id, {}).get('credit') or 0.0 p_id, {}).get('credit') or 0.0
init_line = False init_line = False
@ -264,11 +264,14 @@ class partner_ledger_xls(report_xls):
(total_debit or total_credit): (total_debit or total_credit):
init_line = True init_line = True
part_cumul_balance = account.init_balance.get(
part_cumul_balance = \
_p['init_balance'][account.id].get(
p_id, {}).get('init_balance') or 0.0 p_id, {}).get('init_balance') or 0.0
part_cumul_balance_curr = account.init_balance.get(
part_cumul_balance_curr = \
_p['init_balance'][account.id].get(
p_id, {}).get('init_balance_currency') or 0.0 p_id, {}).get('init_balance_currency') or 0.0
balance_forward_currency = account.init_balance.get(
balance_forward_currency = \
_p['init_balance'][account.id].get(
p_id, {}).get('currency_name') or '' p_id, {}).get('currency_name') or ''
cumul_balance += part_cumul_balance cumul_balance += part_cumul_balance
@ -304,7 +307,7 @@ class partner_ledger_xls(report_xls):
row_pos = self.xls_write_row( row_pos = self.xls_write_row(
ws, row_pos, row_data, c_init_cell_style) ws, row_pos, row_data, c_init_cell_style)
for line in account.ledger_lines.get(p_id, []):
for line in _p['ledger_lines'][account.id].get(p_id, []):
total_debit += line.get('debit') or 0.0 total_debit += line.get('debit') or 0.0
total_credit += line.get('credit') or 0.0 total_credit += line.get('credit') or 0.0

6
account_financial_report_webkit_xls/report/trial_balance_xls.py

@ -237,7 +237,7 @@ class trial_balance_xls(report_xls):
for current_account in objects: for current_account in objects:
if not current_account.to_display:
if not _p['to_display_accounts'][current_account.id]:
continue continue
if current_account.type == 'view': if current_account.type == 'view':
@ -277,7 +277,9 @@ class trial_balance_xls(report_xls):
bal_formula = init_cell + '+' + \ bal_formula = init_cell + '+' + \
debit_cell + '-' + credit_cell debit_cell + '-' + credit_cell
c_specs += [('init_bal', 1, 0, 'number', c_specs += [('init_bal', 1, 0, 'number',
current_account.init_balance, None,
_p['init_balance_'
'accounts'][current_account.id],
None,
cell_style_decimal)] cell_style_decimal)]
c_specs += [ c_specs += [
('debit', 1, 0, 'number', current_account.debit, ('debit', 1, 0, 'number', current_account.debit,

Loading…
Cancel
Save