Browse Source

[REF] account_financial_report_webkit: more reformatting

pull/7/merge
Alexandre Fayolle @ camptocamp 12 years ago
parent
commit
3dba319995
  1. 4
      account_financial_report_webkit/__openerp__.py
  2. 2
      account_financial_report_webkit/account.py
  3. 2
      account_financial_report_webkit/report/partners_ledger.py
  4. 38
      account_financial_report_webkit/report/webkit_parser_header_fix.py
  5. 6
      account_financial_report_webkit/wizard/balance_common.py
  6. 12
      account_financial_report_webkit/wizard/partners_ledger_wizard.py

4
account_financial_report_webkit/__openerp__.py

@ -44,7 +44,7 @@ The General ledger: details of all entries posted in your books sorted by accoun
* The report only prints accounts with moves OR with a non
null balance. No more endless report with empty accounts (field:
display account is hidden)
* initial balance calculation on the fly if no open entry posted
* initial balance computation on the fly if no open entry posted
* Thanks to a new checkbox in the account form, you will have the
possibility to centralize any account you like. This means you do
not want to see all entries posted under the account VAT on sales;
@ -108,7 +108,7 @@ library `wkhtmltopdf` for the pdf rendering (the library path must be
set in a System Parameter `webkit_path`).
Initial balances in these reports are based either on opening entry
posted in the opening period or calculated on the fly. So make sure
posted in the opening period or computed on the fly. So make sure
that your past accounting opening entries are in an opening period.
Initials balances are not computed when using the Date filter (since a
date can be outside its logical period and the initial balance could

2
account_financial_report_webkit/account.py

@ -3,7 +3,7 @@
#
# Copyright (c) 2011 Camptocamp SA (http://www.camptocamp.com)
#
# Author : Guewen Baconnier (Camptocamp)
# Author: Guewen Baconnier (Camptocamp)
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential

2
account_financial_report_webkit/report/partners_ledger.py

@ -121,7 +121,7 @@ class PartnersLedgerWebkit(report_sxw.rml_parse, CommonPartnersReportHeaderWebki
# when the opening period is included in the selected range of periods and
# the opening period contains move lines, we must not compute the initial balance from previous periods
# but only display the move lines of the opening period
# we identify them as :
# we identify them as:
# - 'initial_balance' means compute the sums of move lines from previous periods
# - 'opening_balance' means display the move lines of the opening period
init_balance = main_filter in ('filter_no', 'filter_period')

38
account_financial_report_webkit/report/webkit_parser_header_fix.py

@ -3,7 +3,7 @@
#
# Copyright (c) 2011 Camptocamp SA (http://www.camptocamp.com)
#
# Author : Guewen Baconnier (Camptocamp)
# Author: Guewen Baconnier (Camptocamp)
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
@ -46,7 +46,7 @@ from openerp.addons.report_webkit.report_helper import WebKitHelper
_logger = logging.getLogger('financial.reports.webkit')
# Class used only as a workaround to bug :
# Class used only as a workaround to bug:
# http://code.google.com/p/wkhtmltopdf/issues/detail?id=656
# html headers and footers do not work on big files (hundreds of pages) so we replace them by
@ -54,7 +54,7 @@ _logger = logging.getLogger('financial.reports.webkit')
# this class has to be removed once the bug is fixed
# in your report class, to print headers and footers as text, you have to add them in the localcontext with a key 'additional_args'
# for instance :
# for instance:
# header_report_name = _('PARTNER LEDGER')
# footer_date_time = self.formatLang(str(datetime.today()), date_time=True)
# self.localcontext.update({
@ -89,17 +89,17 @@ class HeaderFooterTextWebKitParser(webkit_report.WebKitParser):
# default to UTF-8 encoding. Use <meta charset="latin-1"> to override.
command.extend(['--encoding', 'utf-8'])
if webkit_header.margin_top :
if webkit_header.margin_top:
command.extend(['--margin-top', str(webkit_header.margin_top).replace(',', '.')])
if webkit_header.margin_bottom :
if webkit_header.margin_bottom:
command.extend(['--margin-bottom', str(webkit_header.margin_bottom).replace(',', '.')])
if webkit_header.margin_left :
if webkit_header.margin_left:
command.extend(['--margin-left', str(webkit_header.margin_left).replace(',', '.')])
if webkit_header.margin_right :
if webkit_header.margin_right:
command.extend(['--margin-right', str(webkit_header.margin_right).replace(',', '.')])
if webkit_header.orientation :
if webkit_header.orientation:
command.extend(['--orientation', str(webkit_header.orientation).replace(',', '.')])
if webkit_header.format :
if webkit_header.format:
command.extend(['--page-size', str(webkit_header.format).replace(',', '.')])
if self.parser_instance.localcontext.get('additional_args', False):
@ -107,7 +107,7 @@ class HeaderFooterTextWebKitParser(webkit_report.WebKitParser):
command.extend(arg)
count = 0
for html in html_list :
for html in html_list:
html_file = file(os.path.join(tmp_dir, str(time.time()) + str(count) +'.body.html'), 'w')
count += 1
html_file.write(html)
@ -165,13 +165,13 @@ class HeaderFooterTextWebKitParser(webkit_report.WebKitParser):
template = False
if report_xml.report_file :
if report_xml.report_file:
path = addons.get_module_resource(*report_xml.report_file.split(os.path.sep))
if os.path.exists(path) :
if os.path.exists(path):
template = file(path).read()
if not template and report_xml.report_webkit_data :
if not template and report_xml.report_webkit_data:
template = report_xml.report_webkit_data
if not template :
if not template:
raise except_osv(_('Error!'), _('Webkit Report template not found !'))
header = report_xml.webkit_header.html
footer = report_xml.webkit_header.footer_html
@ -182,7 +182,7 @@ class HeaderFooterTextWebKitParser(webkit_report.WebKitParser):
)
css = report_xml.webkit_header.css
if not css :
if not css:
css = ''
user = self.pool.get('res.users').browse(cursor, uid, uid)
@ -192,7 +192,7 @@ class HeaderFooterTextWebKitParser(webkit_report.WebKitParser):
if report_xml.precise_mode:
for obj in objs:
self.parser_instance.localcontext['objects'] = [obj]
try :
try:
html = body_mako_tpl.render(helper=helper,
css=css,
_=self.translate_call,
@ -203,7 +203,7 @@ class HeaderFooterTextWebKitParser(webkit_report.WebKitParser):
_logger.error(msg)
raise except_osv(_('Webkit render'), msg)
else:
try :
try:
html = body_mako_tpl.render(helper=helper,
css=css,
_=self.translate_call,
@ -217,8 +217,8 @@ class HeaderFooterTextWebKitParser(webkit_report.WebKitParser):
# NO html footer and header because we write them as text with wkhtmltopdf
head = foot = False
if report_xml.webkit_debug :
try :
if report_xml.webkit_debug:
try:
deb = body_mako_tpl.render(helper=helper,
css=css,
_debug=tools.ustr("\n".join(htmls)),

6
account_financial_report_webkit/wizard/balance_common.py

@ -3,7 +3,7 @@
#
# Copyright (c) 2011 Camptocamp SA (http://www.camptocamp.com)
#
# Author : Guewen Baconnier (Camptocamp)
# Author: Guewen Baconnier (Camptocamp)
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
@ -88,8 +88,8 @@ class AccountBalanceCommonWizard(orm.TransientModel):
('filter_opening', 'Opening Only')],
"Filter by",
required=True,
help='Filter by date : no opening balance will be displayed. '
'(opening balance can only be calculated based on period to be correct).'),
help='Filter by date: no opening balance will be displayed. '
'(opening balance can only be computed based on period to be correct).'),
}
for index in range(COMPARISON_LEVEL):

12
account_financial_report_webkit/wizard/partners_ledger_wizard.py

@ -34,10 +34,13 @@ class AccountReportPartnersLedgerWizard(orm.TransientModel):
'amount_currency': fields.boolean("With Currency",
help="It adds the currency column"),
'partner_ids': fields.many2many('res.partner', string='Filter on partner',
help="Only selected partners will be printed. Leave empty to print all partners."),
help="Only selected partners will be printed. "
"Leave empty to print all partners."),
'filter': fields.selection([('filter_no', 'No Filters'),
('filter_date', 'Date'),
('filter_period', 'Periods')], "Filter by", required=True, help='Filter by date : no opening balance will be displayed. (opening balance can only be calculated based on period to be correct).'),
('filter_period', 'Periods')], "Filter by", required=True,
help='Filter by date: no opening balance will be displayed. '
'(opening balance can only be computed based on period to be correct).'),
}
_defaults = {
'amount_currency': False,
@ -51,7 +54,10 @@ class AccountReportPartnersLedgerWizard(orm.TransientModel):
return True
_constraints = [
(_check_fiscalyear, 'When no Fiscal year is selected, you must choose to filter by periods or by date.', ['filter']),
(_check_fiscalyear,
'When no Fiscal year is selected, you must choose to '
'filter by periods or by date.',
['filter']),
]
def onchange_filter(self, cr, uid, ids, filter='filter_no', fiscalyear_id=False, context=None):

Loading…
Cancel
Save