Merge pull request #23 from acsone/8.0-account_financial_report_webkit_xls
account_financial_report_webkit_xls: Port to 8.0pull/25/head
commit
d48a435e02
|
@ -11,7 +11,7 @@ virtualenv:
|
||||||
system_site_packages: true
|
system_site_packages: true
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- git clone https://github.com/OCA/reporting-engine ${HOME}/reporting-engine -b ${VERSION}
|
- git clone https://github.com/OCA/reporting-engine.git ${HOME}/reporting-engine -b ${VERSION}
|
||||||
- git clone https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools
|
- git clone https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools
|
||||||
- sudo wget http://downloads.sourceforge.net/project/wkhtmltopdf/0.12.1/wkhtmltox-0.12.1_linux-precise-amd64.deb -P /tmp/
|
- sudo wget http://downloads.sourceforge.net/project/wkhtmltopdf/0.12.1/wkhtmltox-0.12.1_linux-precise-amd64.deb -P /tmp/
|
||||||
- sudo dpkg -i /tmp/wkhtmltox-0.12.1_linux-precise-amd64.deb
|
- sudo dpkg -i /tmp/wkhtmltox-0.12.1_linux-precise-amd64.deb
|
||||||
|
|
|
@ -45,5 +45,5 @@
|
||||||
'wizard/open_invoices_wizard_view.xml',
|
'wizard/open_invoices_wizard_view.xml',
|
||||||
],
|
],
|
||||||
'active': False,
|
'active': False,
|
||||||
'installable': False,
|
'installable': True,
|
||||||
}
|
}
|
|
@ -98,8 +98,8 @@ class general_ledger_xls(report_xls):
|
||||||
('df', 3, 0, 'text', _p.filter_form(data) ==
|
('df', 3, 0, 'text', _p.filter_form(data) ==
|
||||||
'filter_date' and _('Dates Filter') or _('Periods Filter')),
|
'filter_date' and _('Dates Filter') or _('Periods Filter')),
|
||||||
('af', 1, 0, 'text', _('Accounts Filter')),
|
('af', 1, 0, 'text', _('Accounts Filter')),
|
||||||
('tm', 2, 0, 'text', _('Target Moves')),
|
('tm', 2, 0, 'text', _('Target Moves')),
|
||||||
('ib', 2, 0, 'text', _('Initial Balance')),
|
('ib', 2, 0, 'text', _('Initial Balance')),
|
||||||
|
|
||||||
]
|
]
|
||||||
row_data = self.xls_row_template(c_specs, [x[0] for x in c_specs])
|
row_data = self.xls_row_template(c_specs, [x[0] for x in c_specs])
|
||||||
|
@ -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 \
|
display_initial_balance = _p['init_balance'][account.id] and \
|
||||||
(account.init_balance.get(
|
(_p['init_balance'][account.id].get(
|
||||||
'debit', 0.0) != 0.0 or account.
|
'debit', 0.0) != 0.0 or
|
||||||
init_balance.get('credit', 0.0) != 0.0)
|
_p['init_balance'][account.id].get('credit', 0.0)
|
||||||
display_ledger_lines = account.ledger_lines
|
!= 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
|
init_balance = _p['init_balance'][account.id]
|
||||||
cumul_credit = account.init_balance.get('credit') or 0.0
|
cumul_debit = init_balance.get('debit') or 0.0
|
||||||
cumul_balance = account.init_balance.get(
|
cumul_credit = init_balance.get('credit') or 0.0
|
||||||
'init_balance') or 0.0
|
cumul_balance = init_balance.get('init_balance') or 0.0
|
||||||
cumul_balance_curr = account.init_balance.get(
|
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)]
|
|
@ -639,7 +639,7 @@ class open_invoices_xls(report_xls):
|
||||||
None, self.style_account_title_right),
|
None, self.style_account_title_right),
|
||||||
]
|
]
|
||||||
else:
|
else:
|
||||||
c_specs += [('cumul_bal_curr', 1, 0, 'text', "-", None,
|
c_specs += [('cumul_bal_curr', 1, 0, 'text', "-", None,
|
||||||
self.style_account_title_right),
|
self.style_account_title_right),
|
||||||
('curr_name', 1, 0, 'text', "",
|
('curr_name', 1, 0, 'text', "",
|
||||||
None, self.style_account_title_right)
|
None, self.style_account_title_right)
|
||||||
|
@ -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(
|
|
@ -100,8 +100,8 @@ class partner_ledger_xls(report_xls):
|
||||||
('df', 2, 0, 'text', _p.filter_form(data) ==
|
('df', 2, 0, 'text', _p.filter_form(data) ==
|
||||||
'filter_date' and _('Dates Filter') or _('Periods Filter')),
|
'filter_date' and _('Dates Filter') or _('Periods Filter')),
|
||||||
('af', 1, 0, 'text', _('Accounts Filter')),
|
('af', 1, 0, 'text', _('Accounts Filter')),
|
||||||
('tm', 2, 0, 'text', _('Target Moves')),
|
('tm', 2, 0, 'text', _('Target Moves')),
|
||||||
('ib', nbr_columns - 8, 0, 'text', _('Initial Balance')),
|
('ib', nbr_columns - 8, 0, 'text', _('Initial Balance')),
|
||||||
|
|
||||||
]
|
]
|
||||||
row_data = self.xls_row_template(c_specs, [x[0] for x in c_specs])
|
row_data = self.xls_row_template(c_specs, [x[0] for x in c_specs])
|
||||||
|
@ -214,7 +214,8 @@ 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 +255,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,12 +265,15 @@ 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_id, {}).get('init_balance') or 0.0
|
_p['init_balance'][account.id].get(
|
||||||
part_cumul_balance_curr = account.init_balance.get(
|
p_id, {}).get('init_balance') or 0.0
|
||||||
p_id, {}).get('init_balance_currency') or 0.0
|
part_cumul_balance_curr = \
|
||||||
balance_forward_currency = account.init_balance.get(
|
_p['init_balance'][account.id].get(
|
||||||
p_id, {}).get('currency_name') or ''
|
p_id, {}).get('init_balance_currency') or 0.0
|
||||||
|
balance_forward_currency = \
|
||||||
|
_p['init_balance'][account.id].get(
|
||||||
|
p_id, {}).get('currency_name') or ''
|
||||||
|
|
||||||
cumul_balance += part_cumul_balance
|
cumul_balance += part_cumul_balance
|
||||||
cumul_balance_curr += part_cumul_balance_curr
|
cumul_balance_curr += part_cumul_balance_curr
|
||||||
|
@ -304,7 +308,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
|
|
@ -71,10 +71,10 @@ class partners_balance_xls(report_xls):
|
||||||
('df', 1, 0, 'text', _p.filter_form(data) == 'filter_date' and _(
|
('df', 1, 0, 'text', _p.filter_form(data) == 'filter_date' and _(
|
||||||
'Dates Filter') or _('Periods Filter'), None,
|
'Dates Filter') or _('Periods Filter'), None,
|
||||||
cell_style_center),
|
cell_style_center),
|
||||||
('pf', 1, 0, 'text', _('Partners Filter'),
|
('pf', 1, 0, 'text', _('Partners Filter'),
|
||||||
None, cell_style_center),
|
None, cell_style_center),
|
||||||
('tm', 1, 0, 'text', _('Target Moves'), None, cell_style_center),
|
('tm', 1, 0, 'text', _('Target Moves'), None, cell_style_center),
|
||||||
('ib', 1, 0, 'text', _('Initial Balance'),
|
('ib', 1, 0, 'text', _('Initial Balance'),
|
||||||
None, cell_style_center),
|
None, cell_style_center),
|
||||||
('coa', 1, 0, 'text', _('Chart of Account'),
|
('coa', 1, 0, 'text', _('Chart of Account'),
|
||||||
None, cell_style_center),
|
None, cell_style_center),
|
|
@ -80,8 +80,8 @@ class trial_balance_xls(report_xls):
|
||||||
('af', 2, 0, 'text', _('Accounts Filter')),
|
('af', 2, 0, 'text', _('Accounts Filter')),
|
||||||
('df', 1, 0, 'text', _p.filter_form(data) ==
|
('df', 1, 0, 'text', _p.filter_form(data) ==
|
||||||
'filter_date' and _('Dates Filter') or _('Periods Filter')),
|
'filter_date' and _('Dates Filter') or _('Periods Filter')),
|
||||||
('tm', 2, 0, 'text', _('Target Moves'), None, cell_style_center),
|
('tm', 2, 0, 'text', _('Target Moves'), None, cell_style_center),
|
||||||
('ib', 1, 0, 'text', _('Initial Balance'),
|
('ib', 1, 0, 'text', _('Initial Balance'),
|
||||||
None, cell_style_center),
|
None, cell_style_center),
|
||||||
('coa', 1, 0, 'text', _('Chart of Account'),
|
('coa', 1, 0, 'text', _('Chart of Account'),
|
||||||
None, cell_style_center),
|
None, cell_style_center),
|
||||||
|
@ -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…
Reference in New Issue