Browse Source

Merge pull request #424 from Eficent/10.0-account_financial_report_qweb-open_items-foreign_currency

[10.0] [IMP] account_financial_report_qweb - foreign currencies + dynamic reporting
pull/425/head
Pedro M. Baeza 7 years ago
committed by GitHub
parent
commit
adc30345d0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      account_financial_report_qweb/__manifest__.py
  2. 84
      account_financial_report_qweb/report/abstract_report_xlsx.py
  3. 23
      account_financial_report_qweb/report/aged_partner_balance.py
  4. 123
      account_financial_report_qweb/report/general_ledger.py
  5. 71
      account_financial_report_qweb/report/general_ledger_xlsx.py
  6. 73
      account_financial_report_qweb/report/journal_report.py
  7. 2
      account_financial_report_qweb/report/journal_report_xlsx.py
  8. 255
      account_financial_report_qweb/report/open_items.py
  9. 39
      account_financial_report_qweb/report/open_items_xlsx.py
  10. 463
      account_financial_report_qweb/report/templates/aged_partner_balance.xml
  11. 449
      account_financial_report_qweb/report/templates/general_ledger.xml
  12. 14
      account_financial_report_qweb/report/templates/journal.xml
  13. 165
      account_financial_report_qweb/report/templates/open_items.xml
  14. 418
      account_financial_report_qweb/report/templates/trial_balance.xml
  15. 88
      account_financial_report_qweb/report/trial_balance.py
  16. 67
      account_financial_report_qweb/report/trial_balance_xlsx.py
  17. 47
      account_financial_report_qweb/reports.xml
  18. 14
      account_financial_report_qweb/static/src/css/report.css
  19. 95
      account_financial_report_qweb/static/src/js/account_financial_report_qweb_backend.js
  20. 69
      account_financial_report_qweb/static/src/js/account_financial_report_qweb_widgets.js
  21. 1
      account_financial_report_qweb/tests/__init__.py
  22. 281
      account_financial_report_qweb/tests/abstract_test.py
  23. 79
      account_financial_report_qweb/tests/abstract_test_foreign_currency.py
  24. 2
      account_financial_report_qweb/tests/test_aged_partner_balance.py
  25. 14
      account_financial_report_qweb/tests/test_general_ledger.py
  26. 45
      account_financial_report_qweb/tests/test_journal.py
  27. 7
      account_financial_report_qweb/tests/test_open_items.py
  28. 7
      account_financial_report_qweb/tests/test_trial_balance.py
  29. 9
      account_financial_report_qweb/view/report_aged_partner_balance.xml
  30. 9
      account_financial_report_qweb/view/report_general_ledger.xml
  31. 9
      account_financial_report_qweb/view/report_journal_ledger.xml
  32. 9
      account_financial_report_qweb/view/report_open_items.xml
  33. 57
      account_financial_report_qweb/view/report_template.xml
  34. 11
      account_financial_report_qweb/view/report_trial_balance.xml
  35. 29
      account_financial_report_qweb/wizard/aged_partner_balance_wizard.py
  36. 3
      account_financial_report_qweb/wizard/aged_partner_balance_wizard_view.xml
  37. 36
      account_financial_report_qweb/wizard/general_ledger_wizard.py
  38. 4
      account_financial_report_qweb/wizard/general_ledger_wizard_view.xml
  39. 38
      account_financial_report_qweb/wizard/journal_report_wizard.py
  40. 19
      account_financial_report_qweb/wizard/journal_report_wizard.xml
  41. 36
      account_financial_report_qweb/wizard/open_items_wizard.py
  42. 4
      account_financial_report_qweb/wizard/open_items_wizard_view.xml
  43. 39
      account_financial_report_qweb/wizard/trial_balance_wizard.py
  44. 4
      account_financial_report_qweb/wizard/trial_balance_wizard_view.xml

8
account_financial_report_qweb/__manifest__.py

@ -34,7 +34,13 @@
'report/templates/layouts.xml', 'report/templates/layouts.xml',
'report/templates/open_items.xml', 'report/templates/open_items.xml',
'report/templates/trial_balance.xml', 'report/templates/trial_balance.xml',
'view/account_view.xml'
'view/account_view.xml',
'view/report_template.xml',
'view/report_general_ledger.xml',
'view/report_journal_ledger.xml',
'view/report_trial_balance.xml',
'view/report_open_items.xml',
'view/report_aged_partner_balance.xml',
], ],
'installable': True, 'installable': True,
'application': True, 'application': True,

84
account_financial_report_qweb/report/abstract_report_xlsx.py

@ -46,6 +46,7 @@ class AbstractReportXslx(ReportXlsx):
filters = self._get_report_filters(report) filters = self._get_report_filters(report)
self.columns = self._get_report_columns(report) self.columns = self._get_report_columns(report)
self.workbook = workbook
self.set_sheet(self.add_sheet(workbook, report_name[:31])) self.set_sheet(self.add_sheet(workbook, report_name[:31]))
self._set_column_width() self._set_column_width()
@ -100,9 +101,12 @@ class AbstractReportXslx(ReportXlsx):
{'bold': True, {'bold': True,
'border': True, 'border': True,
'bg_color': '#FFFFCC'}) 'bg_color': '#FFFFCC'})
self.format_header_amount.set_num_format('#,##0.00')
currency_id = self.env['res.company']._get_user_currency()
self.format_header_amount.set_num_format(
'#,##0.'+'0'*currency_id.decimal_places)
self.format_amount = workbook.add_format() self.format_amount = workbook.add_format()
self.format_amount.set_num_format('#,##0.00')
self.format_amount.set_num_format(
'#,##0.'+'0'*currency_id.decimal_places)
self.format_percent_bold_italic = workbook.add_format( self.format_percent_bold_italic = workbook.add_format(
{'bold': True, 'italic': True} {'bold': True, 'italic': True}
) )
@ -189,6 +193,14 @@ class AbstractReportXslx(ReportXlsx):
self.sheet.write_number( self.sheet.write_number(
self.row_pos, col_pos, float(value), self.format_amount self.row_pos, col_pos, float(value), self.format_amount
) )
elif cell_type == 'amount_currency':
if line_object.currency_id:
format_amt = self._get_currency_amt_format(line_object)
self.sheet.write_number(
self.row_pos, col_pos, float(value), format_amt)
elif cell_type == 'many2one':
self.sheet.write_string(
self.row_pos, col_pos, value.name or '', self.format_right)
self.row_pos += 1 self.row_pos += 1
def write_initial_balance(self, my_object, label): def write_initial_balance(self, my_object, label):
@ -209,6 +221,23 @@ class AbstractReportXslx(ReportXlsx):
self.sheet.write_number( self.sheet.write_number(
self.row_pos, col_pos, float(value), self.format_amount self.row_pos, col_pos, float(value), self.format_amount
) )
elif cell_type == 'amount_currency':
if my_object.currency_id:
format_amt = self._get_currency_amt_format(
my_object)
self.sheet.write_number(
self.row_pos, col_pos,
float(value), format_amt
)
elif column.get('field_currency_balance'):
value = getattr(my_object, column['field_currency_balance'])
cell_type = column.get('type', 'string')
if cell_type == 'many2one':
if my_object.currency_id:
self.sheet.write_string(
self.row_pos, col_pos, value.name or '',
self.format_right
)
self.row_pos += 1 self.row_pos += 1
def write_ending_balance(self, my_object, name, label): def write_ending_balance(self, my_object, name, label):
@ -239,8 +268,59 @@ class AbstractReportXslx(ReportXlsx):
self.row_pos, col_pos, float(value), self.row_pos, col_pos, float(value),
self.format_header_amount self.format_header_amount
) )
elif cell_type == 'amount_currency':
if my_object.currency_id:
format_amt = self._get_currency_amt_header_format(
my_object)
self.sheet.write_number(
self.row_pos, col_pos,
float(value), format_amt
)
elif column.get('field_currency_balance'):
value = getattr(my_object, column['field_currency_balance'])
cell_type = column.get('type', 'string')
if cell_type == 'many2one':
if my_object.currency_id:
self.sheet.write_string(
self.row_pos, col_pos, value.name or '',
self.format_header_right)
self.row_pos += 1 self.row_pos += 1
def _get_currency_amt_format(self, line_object):
""" Return amount format specific for each currency. """
format_amt = getattr(self, 'format_amount')
if line_object.currency_id:
field_name = \
'format_amount_%s' % line_object.currency_id.name
if hasattr(self, field_name):
format_amt = getattr(self, field_name)
else:
format_amt = self.workbook.add_format()
setattr(self, 'field_name', format_amt)
format_amount = \
'#,##0.' + ('0' * line_object.currency_id.decimal_places)
format_amt.set_num_format(format_amount)
return format_amt
def _get_currency_amt_header_format(self, line_object):
""" Return amount header format for each currency. """
format_amt = getattr(self, 'format_header_amount')
if line_object.currency_id:
field_name = \
'format_header_amount_%s' % line_object.currency_id.name
if hasattr(self, field_name):
format_amt = getattr(self, field_name)
else:
format_amt = self.workbook.add_format(
{'bold': True,
'border': True,
'bg_color': '#FFFFCC'})
setattr(self, 'field_name', format_amt)
format_amount = \
'#,##0.' + ('0' * line_object.currency_id.decimal_places)
format_amt.set_num_format(format_amount)
return format_amt
def _generate_report_content(self, workbook, report): def _generate_report_content(self, workbook, report):
pass pass

23
account_financial_report_qweb/report/aged_partner_balance.py

@ -185,10 +185,9 @@ class AgedPartnerBalanceReportCompute(models.TransientModel):
_inherit = 'report_aged_partner_balance_qweb' _inherit = 'report_aged_partner_balance_qweb'
@api.multi @api.multi
def print_report(self, xlsx_report=False):
def print_report(self, report_type):
self.ensure_one() self.ensure_one()
self.compute_data_for_report()
if xlsx_report:
if report_type == 'xlsx':
report_name = 'account_financial_report_qweb.' \ report_name = 'account_financial_report_qweb.' \
'report_aged_partner_balance_xlsx' 'report_aged_partner_balance_xlsx'
else: else:
@ -197,6 +196,22 @@ class AgedPartnerBalanceReportCompute(models.TransientModel):
return self.env['report'].get_action(docids=self.ids, return self.env['report'].get_action(docids=self.ids,
report_name=report_name) report_name=report_name)
def _get_html(self):
result = {}
rcontext = {}
context = dict(self.env.context)
report = self.browse(context.get('active_id'))
if report:
rcontext['o'] = report
result['html'] = self.env.ref(
'account_financial_report_qweb.'
'report_aged_partner_balance_html').render(rcontext)
return result
@api.model
def get_html(self, given_context=None):
return self._get_html()
def _prepare_report_open_items(self): def _prepare_report_open_items(self):
self.ensure_one() self.ensure_one()
return { return {
@ -439,6 +454,7 @@ INSERT INTO
report_partner_id, report_partner_id,
create_uid, create_uid,
create_date, create_date,
move_line_id,
date, date,
date_due, date_due,
entry, entry,
@ -458,6 +474,7 @@ SELECT
rp.id AS report_partner_id, rp.id AS report_partner_id,
%s AS create_uid, %s AS create_uid,
NOW() AS create_date, NOW() AS create_date,
rlo.move_line_id,
rlo.date, rlo.date,
rlo.date_due, rlo.date_due,
rlo.entry, rlo.entry,

123
account_financial_report_qweb/report/general_ledger.py

@ -29,6 +29,7 @@ class GeneralLedgerReport(models.TransientModel):
fy_start_date = fields.Date() fy_start_date = fields.Date()
only_posted_moves = fields.Boolean() only_posted_moves = fields.Boolean()
hide_account_balance_at_0 = fields.Boolean() hide_account_balance_at_0 = fields.Boolean()
foreign_currency = fields.Boolean()
company_id = fields.Many2one(comodel_name='res.company') company_id = fields.Many2one(comodel_name='res.company')
filter_account_ids = fields.Many2many(comodel_name='account.account') filter_account_ids = fields.Many2many(comodel_name='account.account')
filter_partner_ids = fields.Many2many(comodel_name='res.partner') filter_partner_ids = fields.Many2many(comodel_name='res.partner')
@ -38,7 +39,6 @@ class GeneralLedgerReport(models.TransientModel):
centralize = fields.Boolean() centralize = fields.Boolean()
# Flag fields, used for report display # Flag fields, used for report display
has_second_currency = fields.Boolean()
show_cost_center = fields.Boolean( show_cost_center = fields.Boolean(
default=lambda self: self.env.user.has_group( default=lambda self: self.env.user.has_group(
'analytic.group_analytic_accounting' 'analytic.group_analytic_accounting'
@ -91,7 +91,7 @@ class GeneralLedgerReportAccount(models.TransientModel):
initial_debit = fields.Float(digits=(16, 2)) initial_debit = fields.Float(digits=(16, 2))
initial_credit = fields.Float(digits=(16, 2)) initial_credit = fields.Float(digits=(16, 2))
initial_balance = fields.Float(digits=(16, 2)) initial_balance = fields.Float(digits=(16, 2))
currency_name = fields.Char()
currency_id = fields.Many2one(comodel_name='res.currency')
initial_balance_foreign_currency = fields.Float(digits=(16, 2)) initial_balance_foreign_currency = fields.Float(digits=(16, 2))
final_debit = fields.Float(digits=(16, 2)) final_debit = fields.Float(digits=(16, 2))
final_credit = fields.Float(digits=(16, 2)) final_credit = fields.Float(digits=(16, 2))
@ -133,7 +133,7 @@ class GeneralLedgerReportPartner(models.TransientModel):
initial_debit = fields.Float(digits=(16, 2)) initial_debit = fields.Float(digits=(16, 2))
initial_credit = fields.Float(digits=(16, 2)) initial_credit = fields.Float(digits=(16, 2))
initial_balance = fields.Float(digits=(16, 2)) initial_balance = fields.Float(digits=(16, 2))
currency_name = fields.Char()
currency_id = fields.Many2one(comodel_name='res.currency')
initial_balance_foreign_currency = fields.Float(digits=(16, 2)) initial_balance_foreign_currency = fields.Float(digits=(16, 2))
final_debit = fields.Float(digits=(16, 2)) final_debit = fields.Float(digits=(16, 2))
final_credit = fields.Float(digits=(16, 2)) final_credit = fields.Float(digits=(16, 2))
@ -191,7 +191,7 @@ class GeneralLedgerReportMoveLine(models.TransientModel):
debit = fields.Float(digits=(16, 2)) debit = fields.Float(digits=(16, 2))
credit = fields.Float(digits=(16, 2)) credit = fields.Float(digits=(16, 2))
cumul_balance = fields.Float(digits=(16, 2)) cumul_balance = fields.Float(digits=(16, 2))
currency_name = fields.Char()
currency_id = fields.Many2one(comodel_name='res.currency')
amount_currency = fields.Float(digits=(16, 2)) amount_currency = fields.Float(digits=(16, 2))
@ -203,10 +203,9 @@ class GeneralLedgerReportCompute(models.TransientModel):
_inherit = 'report_general_ledger_qweb' _inherit = 'report_general_ledger_qweb'
@api.multi @api.multi
def print_report(self, xlsx_report=False):
def print_report(self, report_type):
self.ensure_one() self.ensure_one()
self.compute_data_for_report()
if xlsx_report:
if report_type == 'xlsx':
report_name = 'account_financial_report_qweb.' \ report_name = 'account_financial_report_qweb.' \
'report_general_ledger_xlsx' 'report_general_ledger_xlsx'
else: else:
@ -215,6 +214,22 @@ class GeneralLedgerReportCompute(models.TransientModel):
return self.env['report'].get_action(docids=self.ids, return self.env['report'].get_action(docids=self.ids,
report_name=report_name) report_name=report_name)
def _get_html(self):
result = {}
rcontext = {}
context = dict(self.env.context)
report = self.browse(context.get('active_id'))
if report:
rcontext['o'] = report
result['html'] = self.env.ref(
'account_financial_report_qweb.'
'report_general_ledger_html').render(rcontext)
return result
@api.model
def get_html(self, given_context=None):
return self._get_html()
@api.multi @api.multi
def compute_data_for_report( def compute_data_for_report(
self, with_line_details=True, with_partners=True): self, with_line_details=True, with_partners=True):
@ -255,10 +270,6 @@ class GeneralLedgerReportCompute(models.TransientModel):
if self.centralize: if self.centralize:
self._inject_line_centralized_values() self._inject_line_centralized_values()
if with_line_details:
# Compute display flag
self._compute_has_second_currency()
# Refresh cache because all data are computed with SQL requests # Refresh cache because all data are computed with SQL requests
self.invalidate_cache() self.invalidate_cache()
@ -271,8 +282,12 @@ class GeneralLedgerReportCompute(models.TransientModel):
SUM(ml.debit) AS debit, SUM(ml.debit) AS debit,
SUM(ml.credit) AS credit, SUM(ml.credit) AS credit,
SUM(ml.balance) AS balance, SUM(ml.balance) AS balance,
c.name AS currency_name,
SUM(ml.amount_currency) AS balance_currency
c.id AS currency_id,
CASE
WHEN c.id IS NOT NULL
THEN SUM(ml.amount_currency)
ELSE NULL
END AS balance_currency
FROM FROM
accounts a accounts a
INNER JOIN INNER JOIN
@ -319,7 +334,7 @@ class GeneralLedgerReportCompute(models.TransientModel):
""" """
sub_subquery_sum_amounts += """ sub_subquery_sum_amounts += """
GROUP BY GROUP BY
a.id, c.name
a.id, c.id
""" """
return sub_subquery_sum_amounts return sub_subquery_sum_amounts
@ -331,7 +346,7 @@ class GeneralLedgerReportCompute(models.TransientModel):
SUM(COALESCE(sub.debit, 0.0)) AS debit, SUM(COALESCE(sub.debit, 0.0)) AS debit,
SUM(COALESCE(sub.credit, 0.0)) AS credit, SUM(COALESCE(sub.credit, 0.0)) AS credit,
SUM(COALESCE(sub.balance, 0.0)) AS balance, SUM(COALESCE(sub.balance, 0.0)) AS balance,
MAX(sub.currency_name) AS currency_name,
MAX(sub.currency_id) AS currency_id,
SUM(COALESCE(sub.balance_currency, 0.0)) AS balance_currency SUM(COALESCE(sub.balance_currency, 0.0)) AS balance_currency
FROM FROM
( (
@ -431,7 +446,7 @@ INSERT INTO
initial_debit, initial_debit,
initial_credit, initial_credit,
initial_balance, initial_balance,
currency_name,
currency_id,
initial_balance_foreign_currency, initial_balance_foreign_currency,
final_debit, final_debit,
final_credit, final_credit,
@ -449,7 +464,7 @@ SELECT
COALESCE(i.debit, 0.0) AS initial_debit, COALESCE(i.debit, 0.0) AS initial_debit,
COALESCE(i.credit, 0.0) AS initial_credit, COALESCE(i.credit, 0.0) AS initial_credit,
COALESCE(i.balance, 0.0) AS initial_balance, COALESCE(i.balance, 0.0) AS initial_balance,
c.name AS currency_name,
c.id AS currency_id,
COALESCE(i.balance_currency, 0.0) AS initial_balance_foreign_currency, COALESCE(i.balance_currency, 0.0) AS initial_balance_foreign_currency,
COALESCE(f.debit, 0.0) AS final_debit, COALESCE(f.debit, 0.0) AS final_debit,
COALESCE(f.credit, 0.0) AS final_credit, COALESCE(f.credit, 0.0) AS final_credit,
@ -527,7 +542,7 @@ AND
tuple(self.filter_cost_center_ids.ids), tuple(self.filter_cost_center_ids.ids),
) )
query_inject_account_params += ( query_inject_account_params += (
self.id,
self.id or 'NULL',
self.env.uid, self.env.uid,
) )
self.env.cr.execute(query_inject_account, query_inject_account_params) self.env.cr.execute(query_inject_account, query_inject_account_params)
@ -543,14 +558,18 @@ AND
SUM(ml.debit) AS debit, SUM(ml.debit) AS debit,
SUM(ml.credit) AS credit, SUM(ml.credit) AS credit,
SUM(ml.balance) AS balance, SUM(ml.balance) AS balance,
c.name as currency_name,
SUM(ml.amount_currency) AS balance_currency
c.id as currency_id,
CASE
WHEN c.id IS NOT NULL
THEN SUM(ml.amount_currency)
ELSE NULL
END AS balance_currency
FROM FROM
accounts_partners ap accounts_partners ap
INNER JOIN account_account ac INNER JOIN account_account ac
ON ac.id = ap.account_id ON ac.id = ap.account_id
LEFT JOIN LEFT JOIN
res_currency c ON ap.account_id = c.id
res_currency c ON ac.currency_id = c.id
INNER JOIN INNER JOIN
account_move_line ml account_move_line ml
ON ap.account_id = ml.account_id ON ap.account_id = ml.account_id
@ -594,7 +613,7 @@ AND
""" """
sub_subquery_sum_amounts += """ sub_subquery_sum_amounts += """
GROUP BY GROUP BY
ap.account_id, ap.partner_id, c.name
ap.account_id, ap.partner_id, c.id
""" """
return sub_subquery_sum_amounts return sub_subquery_sum_amounts
@ -610,7 +629,7 @@ AND
SUM(COALESCE(sub.debit, 0.0)) AS debit, SUM(COALESCE(sub.debit, 0.0)) AS debit,
SUM(COALESCE(sub.credit, 0.0)) AS credit, SUM(COALESCE(sub.credit, 0.0)) AS credit,
SUM(COALESCE(sub.balance, 0.0)) AS balance, SUM(COALESCE(sub.balance, 0.0)) AS balance,
MAX(sub.currency_name) AS currency_name,
MAX(sub.currency_id) AS currency_id,
SUM(COALESCE(sub.balance_currency, 0.0)) AS balance_currency SUM(COALESCE(sub.balance_currency, 0.0)) AS balance_currency
FROM FROM
( (
@ -736,7 +755,7 @@ INSERT INTO
initial_debit, initial_debit,
initial_credit, initial_credit,
initial_balance, initial_balance,
currency_name,
currency_id,
initial_balance_foreign_currency, initial_balance_foreign_currency,
final_debit, final_debit,
final_credit, final_credit,
@ -752,7 +771,7 @@ SELECT
COALESCE(i.debit, 0.0) AS initial_debit, COALESCE(i.debit, 0.0) AS initial_debit,
COALESCE(i.credit, 0.0) AS initial_credit, COALESCE(i.credit, 0.0) AS initial_credit,
COALESCE(i.balance, 0.0) AS initial_balance, COALESCE(i.balance, 0.0) AS initial_balance,
i.currency_name AS currency_name,
i.currency_id AS currency_id,
COALESCE(i.balance_currency, 0.0) AS initial_balance_foreign_currency, COALESCE(i.balance_currency, 0.0) AS initial_balance_foreign_currency,
COALESCE(f.debit, 0.0) AS final_debit, COALESCE(f.debit, 0.0) AS final_debit,
COALESCE(f.credit, 0.0) AS final_credit, COALESCE(f.credit, 0.0) AS final_credit,
@ -900,7 +919,7 @@ INSERT INTO
debit, debit,
credit, credit,
cumul_balance, cumul_balance,
currency_name,
currency_id,
amount_currency amount_currency
) )
SELECT SELECT
@ -989,7 +1008,7 @@ SELECT
) AS cumul_balance, ) AS cumul_balance,
""" """
query_inject_move_line += """ query_inject_move_line += """
c.name AS currency_name,
c.id AS currency_id,
ml.amount_currency ml.amount_currency
FROM FROM
""" """
@ -1235,48 +1254,6 @@ ORDER BY
query_inject_move_line_centralized_params query_inject_move_line_centralized_params
) )
def _compute_has_second_currency(self):
""" Compute "has_second_currency" flag which will used for display."""
query_update_has_second_currency = """
UPDATE
report_general_ledger_qweb
SET
has_second_currency =
(
SELECT
TRUE
FROM
report_general_ledger_qweb_move_line l
INNER JOIN
report_general_ledger_qweb_account a
ON l.report_account_id = a.id
WHERE
a.report_id = %s
AND l.currency_name IS NOT NULL
LIMIT 1
)
OR
(
SELECT
TRUE
FROM
report_general_ledger_qweb_move_line l
INNER JOIN
report_general_ledger_qweb_partner p
ON l.report_partner_id = p.id
INNER JOIN
report_general_ledger_qweb_account a
ON p.report_account_id = a.id
WHERE
a.report_id = %s
AND l.currency_name IS NOT NULL
LIMIT 1
)
WHERE id = %s
"""
params = (self.id,) * 3
self.env.cr.execute(query_update_has_second_currency, params)
def _get_unaffected_earnings_account_sub_subquery_sum_initial( def _get_unaffected_earnings_account_sub_subquery_sum_initial(
self self
): ):
@ -1391,7 +1368,7 @@ WHERE id = %s
is_partner_account, is_partner_account,
initial_balance, initial_balance,
final_balance, final_balance,
currency_name
currency_id
) )
SELECT SELECT
%(report_id)s AS report_id, %(report_id)s AS report_id,
@ -1403,9 +1380,11 @@ WHERE id = %s
False AS is_partner_account, False AS is_partner_account,
COALESCE(i.initial_balance, 0.0) AS initial_balance, COALESCE(i.initial_balance, 0.0) AS initial_balance,
COALESCE(i.final_balance, 0.0) AS final_balance, COALESCE(i.final_balance, 0.0) AS final_balance,
''
c.id as currency_id
FROM FROM
account_account a,
account_account a
LEFT JOIN
res_currency c ON c.id = a.currency_id,
sum_amounts i sum_amounts i
WHERE WHERE
a.company_id = %(company_id)s a.company_id = %(company_id)s

71
account_financial_report_qweb/report/general_ledger_xlsx.py

@ -20,7 +20,7 @@ class GeneralLedgerXslx(abstract_report_xlsx.AbstractReportXslx):
return _('General Ledger') return _('General Ledger')
def _get_report_columns(self, report): def _get_report_columns(self, report):
return {
res = {
0: {'header': _('Date'), 'field': 'date', 'width': 11}, 0: {'header': _('Date'), 'field': 'date', 'width': 11},
1: {'header': _('Entry'), 'field': 'entry', 'width': 18}, 1: {'header': _('Entry'), 'field': 'entry', 'width': 18},
2: {'header': _('Journal'), 'field': 'journal', 'width': 8}, 2: {'header': _('Journal'), 'field': 'journal', 'width': 8},
@ -54,32 +54,38 @@ class GeneralLedgerXslx(abstract_report_xlsx.AbstractReportXslx):
'field_final_balance': 'final_balance', 'field_final_balance': 'final_balance',
'type': 'amount', 'type': 'amount',
'width': 14}, 'width': 14},
12: {'header': _('Cur.'), 'field': 'currency_name', 'width': 7},
}
if report.foreign_currency:
foreign_currency = {
12: {'header': _('Cur.'),
'field': 'currency_id',
'field_currency_balance': 'currency_id',
'type': 'many2one',
'width': 7},
13: {'header': _('Amount cur.'), 13: {'header': _('Amount cur.'),
'field': 'amount_currency', 'field': 'amount_currency',
'type': 'amount',
'field_initial_balance':
'initial_balance_foreign_currency',
'field_final_balance': 'final_balance_foreign_currency',
'type': 'amount_currency',
'width': 14}, 'width': 14},
} }
res = dict(res.items() + foreign_currency.items())
return res
def _get_report_filters(self, report): def _get_report_filters(self, report):
return [ return [
[
_('Date range filter'),
_('From: %s To: %s') % (report.date_from, report.date_to),
],
[
_('Target moves filter'),
_('All posted entries') if report.only_posted_moves
else _('All entries'),
],
[
_('Account balance at 0 filter'),
_('Hide') if report.hide_account_balance_at_0 else _('Show'),
],
[
_('Centralize filter'),
_('Yes') if report.centralize else _('No'),
],
[_('Date range filter'),
_('From: %s To: %s') % (report.date_from, report.date_to)],
[_('Target moves filter'),
_('All posted entries') if report.only_posted_moves else _(
'All entries')],
[_('Account balance at 0 filter'),
_('Hide') if report.hide_account_balance_at_0 else _('Show')],
[_('Centralize filter'),
_('Yes') if report.centralize else _('No')],
[_('Show foreign currency'),
_('Yes') if report.foreign_currency else _('No')],
] ]
def _get_col_count_filter_name(self): def _get_col_count_filter_name(self):
@ -108,7 +114,7 @@ class GeneralLedgerXslx(abstract_report_xlsx.AbstractReportXslx):
self.write_array_header() self.write_array_header()
# Display initial balance line for account # Display initial balance line for account
self.write_initial_balance(account, _('Initial balance'))
self.write_initial_balance(account)
# Display account move lines # Display account move lines
for line in account.move_line_ids: for line in account.move_line_ids:
@ -124,30 +130,41 @@ class GeneralLedgerXslx(abstract_report_xlsx.AbstractReportXslx):
self.write_array_header() self.write_array_header()
# Display initial balance line for partner # Display initial balance line for partner
self.write_initial_balance(partner, _('Initial balance'))
self.write_initial_balance(partner)
# Display account move lines # Display account move lines
for line in partner.move_line_ids: for line in partner.move_line_ids:
self.write_line(line) self.write_line(line)
# Display ending balance line for partner # Display ending balance line for partner
self.write_ending_balance(partner, 'partner')
self.write_ending_balance(partner)
# Line break # Line break
self.row_pos += 1 self.row_pos += 1
# Display ending balance line for account # Display ending balance line for account
self.write_ending_balance(account, 'account')
self.write_ending_balance(account)
# 2 lines break # 2 lines break
self.row_pos += 2 self.row_pos += 2
def write_ending_balance(self, my_object, type_object):
def write_initial_balance(self, my_object):
"""Specific function to write initial balance for General Ledger"""
if 'partner' in my_object._name:
label = _('Partner Initial balance')
my_object.currency_id = my_object.report_account_id.currency_id
elif 'account' in my_object._name:
label = _('Initial balance')
super(GeneralLedgerXslx, self).write_initial_balance(
my_object, label
)
def write_ending_balance(self, my_object):
"""Specific function to write ending balance for General Ledger""" """Specific function to write ending balance for General Ledger"""
if type_object == 'partner':
if 'partner' in my_object._name:
name = my_object.name name = my_object.name
label = _('Partner ending balance') label = _('Partner ending balance')
elif type_object == 'account':
elif 'account' in my_object._name:
name = my_object.code + ' - ' + my_object.name name = my_object.code + ' - ' + my_object.name
label = _('Ending balance') label = _('Ending balance')
super(GeneralLedgerXslx, self).write_ending_balance( super(GeneralLedgerXslx, self).write_ending_balance(

73
account_financial_report_qweb/report/journal_report.py

@ -61,7 +61,7 @@ class ReportJournalQweb(models.TransientModel):
comodel_name='report_journal_qweb_report_tax_line', comodel_name='report_journal_qweb_report_tax_line',
inverse_name='report_id', inverse_name='report_id',
) )
with_currency = fields.Boolean()
foreign_currency = fields.Boolean()
with_account_name = fields.Boolean() with_account_name = fields.Boolean()
@api.model @api.model
@ -76,6 +76,12 @@ class ReportJournalQweb(models.TransientModel):
def _get_group_options(self): def _get_group_options(self):
return self.env['journal.report.wizard']._get_group_options() return self.env['journal.report.wizard']._get_group_options()
@api.multi
def refresh(self):
self.ensure_one()
self.report_journal_ids.unlink()
self.compute_data_for_report()
@api.multi @api.multi
def compute_data_for_report(self): def compute_data_for_report(self):
self.ensure_one() self.ensure_one()
@ -88,15 +94,21 @@ class ReportJournalQweb(models.TransientModel):
if self.group_option == 'none': if self.group_option == 'none':
self._inject_report_tax_values() self._inject_report_tax_values()
@api.multi
def refresh(self):
self.ensure_one()
self.report_journal_ids.unlink()
self.compute_data_for_report()
# Refresh cache because all data are computed with SQL requests
self.invalidate_cache()
@api.multi @api.multi
def _inject_journal_values(self): def _inject_journal_values(self):
self.ensure_one() self.ensure_one()
sql = """
DELETE
FROM report_journal_qweb_journal
WHERE report_id = %s
"""
params = (
self.id,
)
self.env.cr.execute(sql, params)
sql = """ sql = """
INSERT INTO report_journal_qweb_journal ( INSERT INTO report_journal_qweb_journal (
create_uid, create_uid,
@ -139,6 +151,15 @@ class ReportJournalQweb(models.TransientModel):
@api.multi @api.multi
def _inject_move_values(self): def _inject_move_values(self):
self.ensure_one() self.ensure_one()
sql = """
DELETE
FROM report_journal_qweb_move
WHERE report_id = %s
"""
params = (
self.id,
)
self.env.cr.execute(sql, params)
sql = self._get_inject_move_insert() sql = self._get_inject_move_insert()
sql += self._get_inject_move_select() sql += self._get_inject_move_select()
sql += self._get_inject_move_where_clause() sql += self._get_inject_move_where_clause()
@ -225,6 +246,15 @@ class ReportJournalQweb(models.TransientModel):
@api.multi @api.multi
def _inject_move_line_values(self): def _inject_move_line_values(self):
self.ensure_one() self.ensure_one()
sql = """
DELETE
FROM report_journal_qweb_move_line
WHERE report_id = %s
"""
params = (
self.id,
)
self.env.cr.execute(sql, params)
sql = """ sql = """
INSERT INTO report_journal_qweb_move_line ( INSERT INTO report_journal_qweb_move_line (
create_uid, create_uid,
@ -414,7 +444,15 @@ class ReportJournalQweb(models.TransientModel):
@api.multi @api.multi
def _inject_journal_tax_values(self): def _inject_journal_tax_values(self):
self.ensure_one() self.ensure_one()
sql = """
DELETE
FROM report_journal_qweb_journal_tax_line
WHERE report_id = %s
"""
params = (
self.id,
)
self.env.cr.execute(sql, params)
sql_distinct_tax_id = """ sql_distinct_tax_id = """
SELECT SELECT
distinct(jrqml.tax_id) distinct(jrqml.tax_id)
@ -553,10 +591,9 @@ class ReportJournalQweb(models.TransientModel):
self.env.cr.execute(sql, (self.id,)) self.env.cr.execute(sql, (self.id,))
@api.multi @api.multi
def print_report(self, xlsx_report=False):
def print_report(self, report_type):
self.ensure_one() self.ensure_one()
self.compute_data_for_report()
if xlsx_report:
if report_type == 'xlsx':
report_name = 'account_financial_report_qweb.' \ report_name = 'account_financial_report_qweb.' \
'report_journal_xlsx' 'report_journal_xlsx'
else: else:
@ -565,6 +602,22 @@ class ReportJournalQweb(models.TransientModel):
return self.env['report'].get_action( return self.env['report'].get_action(
docids=self.ids, report_name=report_name) docids=self.ids, report_name=report_name)
def _get_html(self):
result = {}
rcontext = {}
context = dict(self.env.context)
report = self.browse(context.get('active_id'))
if report:
rcontext['o'] = report
result['html'] = self.env.ref(
'account_financial_report_qweb.'
'report_journal_html').render(rcontext)
return result
@api.model
def get_html(self, given_context=None):
return self._get_html()
class ReportJournalQwebJournal(models.TransientModel): class ReportJournalQwebJournal(models.TransientModel):

2
account_financial_report_qweb/report/journal_report_xlsx.py

@ -76,7 +76,7 @@ class JournalXslx(abstract_report_xlsx.AbstractReportXslx):
} }
] ]
if report.with_currency:
if report.foreign_currency:
columns += [ columns += [
{ {
'header': _('Amount Currency'), 'header': _('Amount Currency'),

255
account_financial_report_qweb/report/open_items.py

@ -22,13 +22,11 @@ class OpenItemsReport(models.TransientModel):
date_at = fields.Date() date_at = fields.Date()
only_posted_moves = fields.Boolean() only_posted_moves = fields.Boolean()
hide_account_balance_at_0 = fields.Boolean() hide_account_balance_at_0 = fields.Boolean()
foreign_currency = fields.Boolean()
company_id = fields.Many2one(comodel_name='res.company') company_id = fields.Many2one(comodel_name='res.company')
filter_account_ids = fields.Many2many(comodel_name='account.account') filter_account_ids = fields.Many2many(comodel_name='account.account')
filter_partner_ids = fields.Many2many(comodel_name='res.partner') filter_partner_ids = fields.Many2many(comodel_name='res.partner')
# Flag fields, used for report display
has_second_currency = fields.Boolean()
# Data fields, used to browse report data # Data fields, used to browse report data
account_ids = fields.One2many( account_ids = fields.One2many(
comodel_name='report_open_items_qweb_account', comodel_name='report_open_items_qweb_account',
@ -56,7 +54,11 @@ class OpenItemsReportAccount(models.TransientModel):
# Data fields, used for report display # Data fields, used for report display
code = fields.Char() code = fields.Char()
name = fields.Char() name = fields.Char()
currency_id = fields.Many2one(comodel_name='res.currency')
final_amount_residual = fields.Float(digits=(16, 2)) final_amount_residual = fields.Float(digits=(16, 2))
final_amount_total_due = fields.Float(digits=(16, 2))
final_amount_residual_currency = fields.Float(digits=(16, 2))
final_amount_total_due_currency = fields.Float(digits=(16, 2))
# Data fields, used to browse report data # Data fields, used to browse report data
partner_ids = fields.One2many( partner_ids = fields.One2many(
@ -83,7 +85,11 @@ class OpenItemsReportPartner(models.TransientModel):
# Data fields, used for report display # Data fields, used for report display
name = fields.Char() name = fields.Char()
currency_id = fields.Many2one(comodel_name='res.currency')
final_amount_residual = fields.Float(digits=(16, 2)) final_amount_residual = fields.Float(digits=(16, 2))
final_amount_total_due = fields.Float(digits=(16, 2))
final_amount_residual_currency = fields.Float(digits=(16, 2))
final_amount_total_due_currency = fields.Float(digits=(16, 2))
# Data fields, used to browse report data # Data fields, used to browse report data
move_line_ids = fields.One2many( move_line_ids = fields.One2many(
@ -128,7 +134,7 @@ class OpenItemsReportMoveLine(models.TransientModel):
label = fields.Char() label = fields.Char()
amount_total_due = fields.Float(digits=(16, 2)) amount_total_due = fields.Float(digits=(16, 2))
amount_residual = fields.Float(digits=(16, 2)) amount_residual = fields.Float(digits=(16, 2))
currency_name = fields.Char()
currency_id = fields.Many2one(comodel_name='res.currency')
amount_total_due_currency = fields.Float(digits=(16, 2)) amount_total_due_currency = fields.Float(digits=(16, 2))
amount_residual_currency = fields.Float(digits=(16, 2)) amount_residual_currency = fields.Float(digits=(16, 2))
@ -141,10 +147,9 @@ class OpenItemsReportCompute(models.TransientModel):
_inherit = 'report_open_items_qweb' _inherit = 'report_open_items_qweb'
@api.multi @api.multi
def print_report(self, xlsx_report=False):
def print_report(self, report_type):
self.ensure_one() self.ensure_one()
self.compute_data_for_report()
if xlsx_report:
if report_type == 'xlsx':
report_name = 'account_financial_report_qweb.' \ report_name = 'account_financial_report_qweb.' \
'report_open_items_xlsx' 'report_open_items_xlsx'
else: else:
@ -153,6 +158,22 @@ class OpenItemsReportCompute(models.TransientModel):
return self.env['report'].get_action(docids=self.ids, return self.env['report'].get_action(docids=self.ids,
report_name=report_name) report_name=report_name)
def _get_html(self):
result = {}
rcontext = {}
context = dict(self.env.context)
report = self.browse(context.get('active_id'))
if report:
rcontext['o'] = report
result['html'] = self.env.ref(
'account_financial_report_qweb.'
'report_open_items_html').render(rcontext)
return result
@api.model
def get_html(self, given_context=None):
return self._get_html()
@api.multi @api.multi
def compute_data_for_report(self): def compute_data_for_report(self):
self.ensure_one() self.ensure_one()
@ -167,8 +188,6 @@ class OpenItemsReportCompute(models.TransientModel):
self._clean_partners_and_accounts( self._clean_partners_and_accounts(
only_delete_account_balance_at_0=True only_delete_account_balance_at_0=True
) )
# Compute display flag
self._compute_has_second_currency()
# Refresh cache because all data are computed with SQL requests # Refresh cache because all data are computed with SQL requests
self.invalidate_cache() self.invalidate_cache()
@ -182,11 +201,14 @@ WITH
a.id, a.id,
a.code, a.code,
a.name, a.name,
a.user_type_id
a.user_type_id,
c.id as currency_id
FROM FROM
account_account a account_account a
INNER JOIN INNER JOIN
account_move_line ml ON a.id = ml.account_id AND ml.date <= %s account_move_line ml ON a.id = ml.account_id AND ml.date <= %s
LEFT JOIN
res_currency c ON a.currency_id = c.id
""" """
if self.filter_partner_ids: if self.filter_partner_ids:
query_inject_account += """ query_inject_account += """
@ -215,7 +237,7 @@ WITH
""" """
query_inject_account += """ query_inject_account += """
GROUP BY GROUP BY
a.id
a.id, c.id
) )
INSERT INTO INSERT INTO
report_open_items_qweb_account report_open_items_qweb_account
@ -224,6 +246,7 @@ INSERT INTO
create_uid, create_uid,
create_date, create_date,
account_id, account_id,
currency_id,
code, code,
name name
) )
@ -232,6 +255,7 @@ SELECT
%s AS create_uid, %s AS create_uid,
NOW() AS create_date, NOW() AS create_date,
a.id AS account_id, a.id AS account_id,
a.currency_id,
a.code, a.code,
a.name a.name
FROM FROM
@ -497,7 +521,7 @@ INSERT INTO
label, label,
amount_total_due, amount_total_due,
amount_residual, amount_residual,
currency_name,
currency_id,
amount_total_due_currency, amount_total_due_currency,
amount_residual_currency amount_residual_currency
) )
@ -530,7 +554,7 @@ SELECT
CONCAT_WS(' - ', NULLIF(ml.ref, ''), NULLIF(ml.name, '')) AS label, CONCAT_WS(' - ', NULLIF(ml.ref, ''), NULLIF(ml.name, '')) AS label,
ml.balance, ml.balance,
ml2.amount_residual, ml2.amount_residual,
c.name AS currency_name,
c.id AS currency_id,
ml.amount_currency, ml.amount_currency,
ml2.amount_residual_currency ml2.amount_residual_currency
FROM FROM
@ -606,7 +630,25 @@ ORDER BY
""" Compute cumulative amount for """ Compute cumulative amount for
report_open_items_qweb_partner and report_open_items_qweb_account. report_open_items_qweb_partner and report_open_items_qweb_account.
""" """
query_compute_partners_cumul = """
self._compute_partner_cumul()
self._compute_account_cumul()
def _compute_partner_cumul(self):
where_condition_partner_by_account = """
WHERE
id IN
(
SELECT
rp.id
FROM
report_open_items_qweb_account ra
INNER JOIN
report_open_items_qweb_partner rp
ON ra.id = rp.report_account_id
WHERE
ra.report_id = %s
)"""
query_computer_partner_residual_cumul = """
UPDATE UPDATE
report_open_items_qweb_partner report_open_items_qweb_partner
SET SET
@ -619,6 +661,31 @@ SET
WHERE WHERE
rml.report_partner_id = report_open_items_qweb_partner.id rml.report_partner_id = report_open_items_qweb_partner.id
) )
""" + where_condition_partner_by_account
params_compute_partners_residual_cumul = (self.id,)
self.env.cr.execute(query_computer_partner_residual_cumul,
params_compute_partners_residual_cumul)
query_compute_partners_due_cumul = """
UPDATE
report_open_items_qweb_partner
SET
final_amount_total_due =
(
SELECT
SUM(rml.amount_total_due) AS final_amount_total_due
FROM
report_open_items_qweb_move_line rml
WHERE
rml.report_partner_id = report_open_items_qweb_partner.id
)
""" + where_condition_partner_by_account
params_compute_partner_due_cumul = (self.id,)
self.env.cr.execute(query_compute_partners_due_cumul,
params_compute_partner_due_cumul)
# Manage currency in partner
where_condition_partner_by_account_cur = """
WHERE WHERE
id IN id IN
( (
@ -630,13 +697,67 @@ WHERE
report_open_items_qweb_partner rp report_open_items_qweb_partner rp
ON ra.id = rp.report_account_id ON ra.id = rp.report_account_id
WHERE WHERE
ra.report_id = %s
ra.report_id = %s AND ra.currency_id IS NOT NULL
) )
""" """
params_compute_partners_cumul = (self.id,)
self.env.cr.execute(query_compute_partners_cumul,
params_compute_partners_cumul)
query_compute_accounts_cumul = """
query_compute_partners_cur_id_cumul = """
UPDATE
report_open_items_qweb_partner
SET
currency_id =
(
SELECT
MAX(currency_id) as currency_id
FROM
report_open_items_qweb_move_line rml
WHERE
rml.report_partner_id = report_open_items_qweb_partner.id
)
""" + where_condition_partner_by_account_cur
params_compute_partners_cur_id_cumul = (self.id,)
self.env.cr.execute(query_compute_partners_cur_id_cumul,
params_compute_partners_cur_id_cumul)
query_compute_partners_cur_residual_cumul = """
UPDATE
report_open_items_qweb_partner
SET
final_amount_residual_currency =
(
SELECT
SUM(rml.amount_residual_currency)
AS final_amount_residual_currency
FROM
report_open_items_qweb_move_line rml
WHERE
rml.report_partner_id = report_open_items_qweb_partner.id
)
""" + where_condition_partner_by_account_cur
params_compute_partners_cur_residual_cumul = (self.id,)
self.env.cr.execute(query_compute_partners_cur_residual_cumul,
params_compute_partners_cur_residual_cumul)
query_compute_partners_cur_due_cumul = """
UPDATE
report_open_items_qweb_partner
SET
final_amount_total_due_currency =
(
SELECT
SUM(rml.amount_total_due_currency)
AS final_amount_total_due_currency
FROM
report_open_items_qweb_move_line rml
WHERE
rml.report_partner_id = report_open_items_qweb_partner.id
)
""" + where_condition_partner_by_account_cur
params_compute_partners_cur_due_cumul = (self.id,)
self.env.cr.execute(query_compute_partners_cur_due_cumul,
params_compute_partners_cur_due_cumul)
def _compute_account_cumul(self):
query_compute_accounts_residual_cumul = """
UPDATE UPDATE
report_open_items_qweb_account report_open_items_qweb_account
SET SET
@ -652,9 +773,71 @@ SET
WHERE WHERE
report_id = %s report_id = %s
""" """
params_compute_accounts_cumul = (self.id,)
self.env.cr.execute(query_compute_accounts_cumul,
params_compute_accounts_cumul)
params_compute_accounts_residual_cumul = (self.id,)
self.env.cr.execute(query_compute_accounts_residual_cumul,
params_compute_accounts_residual_cumul)
query_compute_accounts_cur_residual_cumul = """
UPDATE
report_open_items_qweb_account
SET
final_amount_residual_currency =
(
SELECT
SUM(rp.final_amount_residual_currency)
AS final_amount_residual_currency
FROM
report_open_items_qweb_partner rp
WHERE
rp.report_account_id = report_open_items_qweb_account.id
)
WHERE
report_id = %s
"""
params_compute_accounts_cur_residual_cumul = (self.id,)
self.env.cr.execute(query_compute_accounts_cur_residual_cumul,
params_compute_accounts_cur_residual_cumul)
query_compute_accounts_due_cumul = """
UPDATE
report_open_items_qweb_account
SET
final_amount_total_due =
(
SELECT
SUM(rp.final_amount_total_due) AS final_amount_total_due
FROM
report_open_items_qweb_partner rp
WHERE
rp.report_account_id = report_open_items_qweb_account.id
)
WHERE
report_id = %s
"""
params_compute_accounts_due_cumul = (self.id,)
self.env.cr.execute(query_compute_accounts_due_cumul,
params_compute_accounts_due_cumul)
query_compute_accounts_cur_due_cumul = """
UPDATE
report_open_items_qweb_account
SET
final_amount_total_due_currency =
(
SELECT
SUM(rp.final_amount_total_due_currency)
AS final_amount_total_due_currency
FROM
report_open_items_qweb_partner rp
WHERE
rp.report_account_id = report_open_items_qweb_account.id
)
WHERE
report_id = %s
"""
params_compute_accounts_cur_due_cumul = (self.id,)
self.env.cr.execute(query_compute_accounts_cur_due_cumul,
params_compute_accounts_cur_due_cumul)
def _clean_partners_and_accounts(self, def _clean_partners_and_accounts(self,
only_delete_account_balance_at_0=False): only_delete_account_balance_at_0=False):
@ -731,31 +914,3 @@ WHERE
""" """
params_clean_accounts = (self.id,) params_clean_accounts = (self.id,)
self.env.cr.execute(query_clean_accounts, params_clean_accounts) self.env.cr.execute(query_clean_accounts, params_clean_accounts)
def _compute_has_second_currency(self):
""" Compute "has_second_currency" flag which will used for display."""
query_update_has_second_currency = """
UPDATE
report_open_items_qweb
SET
has_second_currency =
(
SELECT
TRUE
FROM
report_open_items_qweb_move_line l
INNER JOIN
report_open_items_qweb_partner p
ON l.report_partner_id = p.id
INNER JOIN
report_open_items_qweb_account a
ON p.report_account_id = a.id
WHERE
a.report_id = %s
AND l.currency_name IS NOT NULL
LIMIT 1
)
WHERE id = %s
"""
params = (self.id,) * 2
self.env.cr.execute(query_update_has_second_currency, params)

39
account_financial_report_qweb/report/open_items_xlsx.py

@ -19,7 +19,7 @@ class OpenItemsXslx(abstract_report_xlsx.AbstractReportXslx):
return _('Open Items') return _('Open Items')
def _get_report_columns(self, report): def _get_report_columns(self, report):
return {
res = {
0: {'header': _('Date'), 'field': 'date', 'width': 11}, 0: {'header': _('Date'), 'field': 'date', 'width': 11},
1: {'header': _('Entry'), 'field': 'entry', 'width': 18}, 1: {'header': _('Entry'), 'field': 'entry', 'width': 18},
2: {'header': _('Journal'), 'field': 'journal', 'width': 8}, 2: {'header': _('Journal'), 'field': 'journal', 'width': 8},
@ -36,32 +36,36 @@ class OpenItemsXslx(abstract_report_xlsx.AbstractReportXslx):
'field_final_balance': 'final_amount_residual', 'field_final_balance': 'final_amount_residual',
'type': 'amount', 'type': 'amount',
'width': 14}, 'width': 14},
9: {'header': _('Cur.'), 'field': 'currency_name', 'width': 7},
}
if report.foreign_currency:
foreign_currency = {
9: {'header': _('Cur.'), 'field': 'currency_id',
'field_currency_balance': 'currency_id',
'type': 'many2one', 'width': 7},
10: {'header': _('Cur. Original'), 10: {'header': _('Cur. Original'),
'field': 'amount_total_due_currency', 'field': 'amount_total_due_currency',
'type': 'amount',
'field_final_balance': 'final_amount_total_due_currency',
'type': 'amount_currency',
'width': 14}, 'width': 14},
11: {'header': _('Cur. Residual'), 11: {'header': _('Cur. Residual'),
'field': 'amount_residual_currency', 'field': 'amount_residual_currency',
'type': 'amount',
'field_final_balance': 'final_amount_residual_currency',
'type': 'amount_currency',
'width': 14}, 'width': 14},
} }
res = dict(res.items() + foreign_currency.items())
return res
def _get_report_filters(self, report): def _get_report_filters(self, report):
return [ return [
[
_('Date at filter'),
report.date_at
],
[
_('Target moves filter'),
_('All posted entries') if report.only_posted_moves
else _('All entries'),
],
[
_('Account balance at 0 filter'),
_('Hide') if report.hide_account_balance_at_0 else _('Show'),
],
[_('Date at filter'), report.date_at],
[_('Target moves filter'),
_('All posted entries') if report.only_posted_moves else _(
'All entries')],
[_('Account balance at 0 filter'),
_('Hide') if report.hide_account_balance_at_0 else _('Show')],
[_('Show foreign currency'),
_('Yes') if report.foreign_currency else _('No')],
] ]
def _get_col_count_filter_name(self): def _get_col_count_filter_name(self):
@ -111,6 +115,7 @@ class OpenItemsXslx(abstract_report_xlsx.AbstractReportXslx):
if type_object == 'partner': if type_object == 'partner':
name = my_object.name name = my_object.name
label = _('Partner ending balance') label = _('Partner ending balance')
my_object.currency_id = my_object.report_account_id.currency_id
elif type_object == 'account': elif type_object == 'account':
name = my_object.code + ' - ' + my_object.name name = my_object.code + ' - ' + my_object.name
label = _('Ending balance') label = _('Ending balance')

463
account_financial_report_qweb/report/templates/aged_partner_balance.xml

@ -1,44 +1,55 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<template id="account_financial_report_qweb.report_aged_partner_balance_qweb">
<template id="report_aged_partner_balance_qweb">
<t t-call="report.html_container"> <t t-call="report.html_container">
<t t-foreach="docs" t-as="o"> <t t-foreach="docs" t-as="o">
<t t-call="account_financial_report_qweb.internal_layout">
<t t-call="account_financial_report_qweb.report_aged_partner_balance_base"/>
</t>
</t>
</t>
</template>
<template id="report_aged_partner_balance_base">
<!-- Saved flag fields into variables, used to define columns display --> <!-- Saved flag fields into variables, used to define columns display -->
<t t-set="show_move_line_details" t-value="o.show_move_line_details"/> <t t-set="show_move_line_details" t-value="o.show_move_line_details"/>
<t t-call="account_financial_report_qweb.internal_layout">
<!-- Defines global variables used by internal layout --> <!-- Defines global variables used by internal layout -->
<t t-set="title">Aged Partner Balance</t> <t t-set="title">Aged Partner Balance</t>
<t t-set="company_name" t-value="o.company_id.name"/>
<t t-set="res_company" t-value="o.company_id"/>
<div class="page"> <div class="page">
<!-- Display filters --> <!-- Display filters -->
<t t-call="account_financial_report_qweb.report_aged_partner_balance_qweb_filters"/>
<t t-call="account_financial_report_qweb.report_aged_partner_balance_filters"/>
<t t-foreach="o.account_ids" t-as="account"> <t t-foreach="o.account_ids" t-as="account">
<div class="page_break"> <div class="page_break">
<!-- Display account header --> <!-- Display account header -->
<div class="act_as_table list_table" style="margin-top: 10px;"/> <div class="act_as_table list_table" style="margin-top: 10px;"/>
<div class="act_as_caption account_title" style="width: 1141px !important;">
<span t-field="account.code"/> - <span t-field="account.name"/>
<div class="act_as_caption account_title"
style="width: 100%;">
<span t-field="account.code"/>
-
<span t-field="account.name"/>
</div> </div>
<!-- Display account lines --> <!-- Display account lines -->
<t t-if="not show_move_line_details"> <t t-if="not show_move_line_details">
<div class="act_as_table data_table" style="width: 1140px !important;">
<div class="act_as_table data_table"
style="width: 100%;">
<!-- Display account header --> <!-- Display account header -->
<t t-call="account_financial_report_qweb.report_aged_partner_balance_qweb_lines_header"/>
<t t-call="account_financial_report_qweb.report_aged_partner_balance_lines_header"/>
<t t-foreach="account.partner_ids" t-as="partner"> <t t-foreach="account.partner_ids" t-as="partner">
<!-- Display one line per partner --> <!-- Display one line per partner -->
<t t-call="account_financial_report_qweb.report_aged_partner_balance_qweb_lines"/>
<t t-call="account_financial_report_qweb.report_aged_partner_balance_lines"/>
</t> </t>
</div> </div>
<!-- Display account footer --> <!-- Display account footer -->
<t t-call="account_financial_report_qweb.report_aged_partner_balance_qweb_account_ending_cumul"/>
<t t-call="account_financial_report_qweb.report_aged_partner_balance_account_ending_cumul"/>
</t> </t>
<!-- Display account move lines --> <!-- Display account move lines -->
@ -53,28 +64,25 @@
</div> </div>
<!-- Display partner move lines --> <!-- Display partner move lines -->
<t t-call="account_financial_report_qweb.report_aged_partner_balance_qweb_move_lines"/>
<t t-call="account_financial_report_qweb.report_aged_partner_balance_move_lines"/>
<!-- Display partner footer --> <!-- Display partner footer -->
<t t-call="account_financial_report_qweb.report_aged_partner_balance_qweb_partner_ending_cumul">
<t t-call="account_financial_report_qweb.report_aged_partner_balance_partner_ending_cumul">
<t t-set="partner_cumul_line" t-value="partner.line_ids"/> <t t-set="partner_cumul_line" t-value="partner.line_ids"/>
</t> </t>
</div> </div>
</t> </t>
<!-- Display account footer --> <!-- Display account footer -->
<t t-call="account_financial_report_qweb.report_aged_partner_balance_qweb_account_ending_cumul"/>
<t t-call="account_financial_report_qweb.report_aged_partner_balance_account_ending_cumul"/>
</t> </t>
</div> </div>
</t> </t>
</div> </div>
</t>
</t>
</t>
</template> </template>
<template id="account_financial_report_qweb.report_aged_partner_balance_qweb_filters">
<div class="act_as_table data_table" style="width: 1140px !important;">
<template id="report_aged_partner_balance_filters">
<div class="act_as_table data_table" style="width: 100%;">
<div class="act_as_row labels"> <div class="act_as_row labels">
<div class="act_as_cell">Date at filter</div> <div class="act_as_cell">Date at filter</div>
<div class="act_as_cell">Target moves filter</div> <div class="act_as_cell">Target moves filter</div>
@ -91,88 +99,113 @@
</div> </div>
</template> </template>
<template id="account_financial_report_qweb.report_aged_partner_balance_qweb_lines_header">
<template id="report_aged_partner_balance_lines_header">
<!-- Display table headers for lines --> <!-- Display table headers for lines -->
<div class="act_as_thead"> <div class="act_as_thead">
<div class="act_as_row labels"> <div class="act_as_row labels">
<!--## partner--> <!--## partner-->
<div class="act_as_cell" style="width: 370px;">Partner</div>
<div class="act_as_cell" style="width: 32.52%;">Partner</div>
<!--## amount_residual--> <!--## amount_residual-->
<div class="act_as_cell" style="width: 110px;">Residual</div>
<div class="act_as_cell" style="width: 9.64%;">Residual</div>
<!--## current--> <!--## current-->
<div class="act_as_cell" style="width: 110px;">Not due</div>
<div class="act_as_cell" style="width: 9.64%;">Not due</div>
<!--## age_30_days--> <!--## age_30_days-->
<div class="act_as_cell" style="width: 110px;">1 - 30 d.</div>
<div class="act_as_cell" style="width: 9.64%;">1 - 30 d.</div>
<!--## age_60_days--> <!--## age_60_days-->
<div class="act_as_cell" style="width: 110px;">31 - 60 d.</div>
<div class="act_as_cell" style="width: 9.64%;">31 - 60 d.</div>
<!--## age_90_days--> <!--## age_90_days-->
<div class="act_as_cell" style="width: 110px;">61 - 90 d.</div>
<div class="act_as_cell" style="width: 9.64%;">61 - 90 d.</div>
<!--## age_120_days--> <!--## age_120_days-->
<div class="act_as_cell" style="width: 110px;">91 - 120 d.</div>
<div class="act_as_cell" style="width: 9.64%;">91 - 120 d.</div>
<!--## older--> <!--## older-->
<div class="act_as_cell" style="width: 110px;"> > 120 d.</div>
<div class="act_as_cell" style="width: 9.64%;"> > 120 d.</div>
</div> </div>
</div> </div>
</template> </template>
<template id="account_financial_report_qweb.report_aged_partner_balance_qweb_lines">
<template id="report_aged_partner_balance_lines">
<!-- Display each lines --> <!-- Display each lines -->
<t t-foreach="partner.line_ids" t-as="line"> <t t-foreach="partner.line_ids" t-as="line">
<!-- # lines --> <!-- # lines -->
<div class="act_as_row lines"> <div class="act_as_row lines">
<!--## partner--> <!--## partner-->
<div class="act_as_cell left"><span t-field="line.partner"/></div>
<div class="act_as_cell left">
<span t-field="line.partner"/>
</div>
<!--## amount_residual--> <!--## amount_residual-->
<div class="act_as_cell amount"><span t-field="line.amount_residual"/></div>
<div class="act_as_cell amount">
<span t-field="line.amount_residual" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## current--> <!--## current-->
<div class="act_as_cell amount"><span t-field="line.current"/></div>
<div class="act_as_cell amount">
<span t-field="line.current" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_30_days--> <!--## age_30_days-->
<div class="act_as_cell amount"><span t-field="line.age_30_days"/></div>
<div class="act_as_cell amount">
<span t-field="line.age_30_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_60_days--> <!--## age_60_days-->
<div class="act_as_cell amount"><span t-field="line.age_60_days"/></div>
<div class="act_as_cell amount">
<span t-field="line.age_60_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_90_days--> <!--## age_90_days-->
<div class="act_as_cell amount"><span t-field="line.age_90_days"/></div>
<div class="act_as_cell amount">
<span t-field="line.age_90_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_120_days--> <!--## age_120_days-->
<div class="act_as_cell amount"><span t-field="line.age_120_days"/></div>
<div class="act_as_cell amount">
<span t-field="line.age_120_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## older--> <!--## older-->
<div class="act_as_cell amount"><span t-field="line.older"/></div>
<div class="act_as_cell amount">
<span t-field="line.older" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
</div> </div>
</t> </t>
</template> </template>
<template id="account_financial_report_qweb.report_aged_partner_balance_qweb_move_lines">
<div class="act_as_table data_table" style="width: 1140px !important;">
<template id="report_aged_partner_balance_move_lines">
<div class="act_as_table data_table" style="width: 100%;">
<!-- Display table headers for move lines --> <!-- Display table headers for move lines -->
<div class="act_as_thead"> <div class="act_as_thead">
<div class="act_as_row labels"> <div class="act_as_row labels">
<!--## date--> <!--## date-->
<div class="act_as_cell first_column" style="width: 60px;">Date</div>
<div class="act_as_cell first_column" style="width: 6.00%;">
Date</div>
<!--## move--> <!--## move-->
<div class="act_as_cell" style="width: 100px;">Entry</div>
<div class="act_as_cell" style="width: 7.00%;">Entry</div>
<!--## journal--> <!--## journal-->
<div class="act_as_cell" style="width: 40px;">Journal</div>
<div class="act_as_cell" style="width: 5.00%;">Journal</div>
<!--## account code--> <!--## account code-->
<div class="act_as_cell" style="width: 50px;">Account</div>
<div class="act_as_cell" style="width: 6.00%;">Account</div>
<!--## partner--> <!--## partner-->
<div class="act_as_cell" style="width: 120px;">Partner</div>
<div class="act_as_cell" style="width: 10.50%;">Partner
</div>
<!--## ref - label--> <!--## ref - label-->
<div class="act_as_cell" style="width: 220px;">Ref - Label</div>
<div class="act_as_cell" style="width: 18.00%;">Ref -
Label</div>
<!--## date_due--> <!--## date_due-->
<div class="act_as_cell" style="width: 60px;">Due date</div>
<div class="act_as_cell" style="width: 6.00%;">Due
date</div>
<!--## amount_residual--> <!--## amount_residual-->
<div class="act_as_cell" style="width: 70px;">Residual</div>
<div class="act_as_cell" style="width: 6.00%;">Residual
</div>
<!--## current--> <!--## current-->
<div class="act_as_cell" style="width: 70px;">Current</div>
<div class="act_as_cell" style="width: 6.00%;">Current</div>
<!--## age_30_days--> <!--## age_30_days-->
<div class="act_as_cell" style="width: 70px;">Age ≤ 30 d.</div>
<div class="act_as_cell" style="width: 6.00%;">Age ≤ 30
d.</div>
<!--## age_60_days--> <!--## age_60_days-->
<div class="act_as_cell" style="width: 70px;">Age ≤ 60 d.</div>
<div class="act_as_cell" style="width: 6.00%;">Age ≤ 60
d.</div>
<!--## age_90_days--> <!--## age_90_days-->
<div class="act_as_cell" style="width: 70px;">Age ≤ 90 d.</div>
<div class="act_as_cell" style="width: 6.00%;">Age ≤ 90
d.</div>
<!--## age_120_days--> <!--## age_120_days-->
<div class="act_as_cell" style="width: 70px;">Age ≤ 120 d.</div>
<div class="act_as_cell" style="width: 6.00%;">Age ≤ 120
d.</div>
<!--## older--> <!--## older-->
<div class="act_as_cell" style="width: 70px;">Older</div>
<div class="act_as_cell" style="width: 6.00%;">Older</div>
</div> </div>
</div> </div>
<!-- Display each move lines --> <!-- Display each move lines -->
@ -180,145 +213,345 @@
<!-- # lines or centralized lines --> <!-- # lines or centralized lines -->
<div class="act_as_row lines"> <div class="act_as_row lines">
<!--## date--> <!--## date-->
<div class="act_as_cell left"><span t-field="line.date"/></div>
<div class="act_as_cell left">
<span>
<a t-att-data-active-id="line.move_line_id.id"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action"
style="color: black;">
<t t-raw="line.date"/></a>
</span>
</div>
<!--## move--> <!--## move-->
<div class="act_as_cell left"><span t-field="line.entry"/></div>
<div class="act_as_cell left">
<span>
<a t-att-data-active-id="line.move_line_id.move_id.id"
t-att-data-res-model="'account.move'"
class="o_account_financial_reports_web_action"
style="color: black;">
<t t-raw="line.entry"/></a>
</span>
</div>
<!--## journal--> <!--## journal-->
<div class="act_as_cell left"><span t-field="line.journal"/></div>
<div class="act_as_cell left">
<span>
<a t-att-data-active-id="line.move_line_id.move_id.journal_id.id"
t-att-data-res-model="'account.journal'"
class="o_account_financial_reports_web_action"
style="color: black;">
<t t-raw="line.journal"/></a>
</span>
</div>
<!--## account code--> <!--## account code-->
<div class="act_as_cell left"><span t-field="line.account"/></div>
<div class="act_as_cell left">
<span>
<a t-att-data-active-id="line.move_line_id.account_id.id"
t-att-data-res-model="'account.account'"
class="o_account_financial_reports_web_action"
style="color: black;">
<t t-raw="line.account"/></a>
</span>
</div>
<!--## partner--> <!--## partner-->
<div class="act_as_cell left"><span t-field="line.partner"/></div>
<div class="act_as_cell left">
<span>
<a t-att-data-active-id="line.move_line_id.partner_id.id"
t-att-data-res-model="'res.partner'"
class="o_account_financial_reports_web_action"
style="color: black;">
<t t-raw="line.partner"/></a>
</span>
</div>
<!--## ref - label--> <!--## ref - label-->
<div class="act_as_cell left"><span t-field="line.label"/></div>
<div class="act_as_cell left">
<span>
<a t-att-data-active-id="line.move_line_id.id"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action"
style="color: black;">
<t t-raw="line.label"/></a>
</span>
</div>
<!--## date_due--> <!--## date_due-->
<div class="act_as_cell left"><span t-field="line.date_due"/></div>
<div class="act_as_cell left">
<span>
<a t-att-data-active-id="line.move_line_id.id"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action"
style="color: black;">
<t t-raw="line.date_due"/></a>
</span>
</div>
<!--## amount_residual--> <!--## amount_residual-->
<div class="act_as_cell amount"><span t-field="line.amount_residual"/></div>
<div class="act_as_cell amount">
<span>
<a t-att-data-domain="[('id', 'in', list(filter(lambda x: x != 'False', [str(line.move_line_id.id), str(line.move_line_id.matched_debit_ids.debit_move_id.id), str(line.move_line_id.matched_credit_ids.credit_move_id.id)])))]"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
style="color: black;">
<t t-raw="line.amount_residual" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</div>
<!--## current--> <!--## current-->
<div class="act_as_cell amount"><span t-field="line.current"/></div>
<div class="act_as_cell amount">
<t t-if="line.current != 0">
<span>
<a t-att-data-domain="[('id', 'in', list(filter(lambda x: x != 'False', [str(line.move_line_id.id), str(line.move_line_id.matched_debit_ids.debit_move_id.id), str(line.move_line_id.matched_credit_ids.credit_move_id.id)])))]"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
style="color: black;">
<t t-raw="line.current" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
<t t-if="line.current == 0">
<span t-field="line.current" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</t>
</div>
<!--## age_30_days--> <!--## age_30_days-->
<div class="act_as_cell amount"><span t-field="line.age_30_days"/></div>
<div class="act_as_cell amount">
<t t-if="line.age_30_days != 0">
<span>
<a t-att-data-domain="[('id', 'in', list(filter(lambda x: x != 'False', [str(line.move_line_id.id), str(line.move_line_id.matched_debit_ids.debit_move_id.id), str(line.move_line_id.matched_credit_ids.credit_move_id.id)])))]"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
style="color: black;">
<t t-raw="line.age_30_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
<t t-if="line.age_30_days == 0">
<span t-field="line.age_30_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</t>
</div>
<!--## age_60_days--> <!--## age_60_days-->
<div class="act_as_cell amount"><span t-field="line.age_60_days"/></div>
<div class="act_as_cell amount">
<t t-if="line.age_60_days != 0">
<span>
<a t-att-data-domain="[('id', 'in', list(filter(lambda x: x != 'False', [str(line.move_line_id.id), str(line.move_line_id.matched_debit_ids.debit_move_id.id), str(line.move_line_id.matched_credit_ids.credit_move_id.id)])))]"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
style="color: black;">
<t t-raw="line.age_60_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
<t t-if="line.age_60_days == 0">
<span t-field="line.age_60_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</t>
</div>
<!--## age_90_days--> <!--## age_90_days-->
<div class="act_as_cell amount"><span t-field="line.age_90_days"/></div>
<div class="act_as_cell amount">
<t t-if="line.age_90_days != 0">
<span>
<a t-att-data-domain="[('id', 'in', list(filter(lambda x: x != 'False', [str(line.move_line_id.id), str(line.move_line_id.matched_debit_ids.debit_move_id.id), str(line.move_line_id.matched_credit_ids.credit_move_id.id)])))]"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
style="color: black;">
<t t-raw="line.age_90_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
<t t-if="line.age_90_days == 0">
<span t-field="line.age_90_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</t>
</div>
<!--## age_120_days--> <!--## age_120_days-->
<div class="act_as_cell amount"><span t-field="line.age_120_days"/></div>
<div class="act_as_cell amount">
<t t-if="line.age_120_days != 0">
<span>
<a t-att-data-domain="[('id', 'in', list(filter(lambda x: x != 'False', [str(line.move_line_id.id), str(line.move_line_id.matched_debit_ids.debit_move_id.id), str(line.move_line_id.matched_credit_ids.credit_move_id.id)])))]"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
style="color: black;">
<t t-raw="line.age_120_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
<t t-if="line.age_120_days == 0">
<span t-field="line.age_120_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</t>
</div>
<!--## older--> <!--## older-->
<div class="act_as_cell amount"><span t-field="line.older"/></div>
<div class="act_as_cell amount">
<t t-if="line.older != 0">
<span>
<a t-att-data-domain="[('id', 'in', list(filter(lambda x: x != 'False', [str(line.move_line_id.id), str(line.move_line_id.matched_debit_ids.debit_move_id.id), str(line.move_line_id.matched_credit_ids.credit_move_id.id)])))]"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
style="color: black;">
<t t-raw="line.older" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
<t t-if="line.older == 0">
<span t-field="line.older" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</t>
</div>
</div> </div>
</t> </t>
</div> </div>
</template> </template>
<template id="account_financial_report_qweb.report_aged_partner_balance_qweb_partner_ending_cumul">
<template id="report_aged_partner_balance_partner_ending_cumul">
<!-- Display ending balance line for partner --> <!-- Display ending balance line for partner -->
<div class="act_as_table list_table" style="width: 1141px !important;">
<div class="act_as_row labels" style="font-weight: bold;">
<div class="act_as_table list_table" style="width: 100%;">
<div class="act_as_row lines" style="font-weight: bold;">
<!--## date--> <!--## date-->
<div class="act_as_cell right" style="width: 590px;">Partner cumul aged balance</div>
<div class="act_as_cell right" style="width: 52.00%;">Partner
cumul aged balance</div>
<!--## date_due--> <!--## date_due-->
<div class="act_as_cell" style="width: 60px;"/>
<div class="act_as_cell" style="width: 6.00%;"/>
<!--## amount_residual--> <!--## amount_residual-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="partner_cumul_line.amount_residual"/></div>
<div class="act_as_cell amount" style="width: 6.00%;">
<span t-field="partner_cumul_line.amount_residual" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## current--> <!--## current-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="partner_cumul_line.current"/></div>
<div class="act_as_cell amount" style="width: 6.00%;">
<span t-field="partner_cumul_line.current" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_30_days--> <!--## age_30_days-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="partner_cumul_line.age_30_days"/></div>
<div class="act_as_cell amount" style="width: 6.00%;">
<span t-field="partner_cumul_line.age_30_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_60_days--> <!--## age_60_days-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="partner_cumul_line.age_60_days"/></div>
<div class="act_as_cell amount" style="width: 6.00%;">
<span t-field="partner_cumul_line.age_60_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_90_days--> <!--## age_90_days-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="partner_cumul_line.age_90_days"/></div>
<div class="act_as_cell amount" style="width: 6.00%;">
<span t-field="partner_cumul_line.age_90_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_120_days--> <!--## age_120_days-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="partner_cumul_line.age_120_days"/></div>
<div class="act_as_cell amount" style="width: 6.00%;">
<span t-field="partner_cumul_line.age_120_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## older--> <!--## older-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="partner_cumul_line.older"/></div>
<div class="act_as_cell amount" style="width: 6.00%;">
<span t-field="partner_cumul_line.older" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
</div> </div>
</div> </div>
</template> </template>
<template id="account_financial_report_qweb.report_aged_partner_balance_qweb_account_ending_cumul">
<template id="report_aged_partner_balance_account_ending_cumul">
<!-- Display ending balance line for account --> <!-- Display ending balance line for account -->
<div class="act_as_table list_table" style="width: 1141px !important;">
<div class="act_as_row labels" style="font-weight: bold;">
<div class="act_as_table list_table" style="width: 100%;">
<div class="act_as_row lines" style="font-weight: bold;">
<t t-if="not show_move_line_details"> <t t-if="not show_move_line_details">
<!--## total--> <!--## total-->
<div class="act_as_cell right" style="width: 370px;">Total</div>
<div class="act_as_cell right" style="width: 32.52%;">Total</div>
<!--## amount_residual--> <!--## amount_residual-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.cumul_amount_residual"/></div>
<div class="act_as_cell amount" style="width: 9.64%;">
<span t-field="account.cumul_amount_residual" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## current--> <!--## current-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.cumul_current"/></div>
<div class="act_as_cell amount" style="width: 9.64%;">
<span t-field="account.cumul_current" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_30_days--> <!--## age_30_days-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.cumul_age_30_days"/></div>
<div class="act_as_cell amount" style="width: 9.64%;">
<span t-field="account.cumul_age_30_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_60_days--> <!--## age_60_days-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.cumul_age_60_days"/></div>
<div class="act_as_cell amount" style="width: 9.64%;">
<span t-field="account.cumul_age_60_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_90_days--> <!--## age_90_days-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.cumul_age_90_days"/></div>
<div class="act_as_cell amount" style="width: 9.64%;">
<span t-field="account.cumul_age_90_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_120_days--> <!--## age_120_days-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.cumul_age_120_days"/></div>
<div class="act_as_cell amount" style="width: 9.64%;">
<span t-field="account.cumul_age_120_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## older--> <!--## older-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.cumul_older"/></div>
<div class="act_as_cell amount" style="width: 9.64%;">
<span t-field="account.cumul_older" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
</t> </t>
<t t-if="show_move_line_details"> <t t-if="show_move_line_details">
<!--## total--> <!--## total-->
<div class="act_as_cell right" style="width: 590px;">Total</div>
<div class="act_as_cell right" style="width: 52.00%;">Total</div>
<!--## date_due--> <!--## date_due-->
<div class="act_as_cell" style="width: 60px;"/>
<div class="act_as_cell" style="width: 6.00%;"/>
<!--## amount_residual--> <!--## amount_residual-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.cumul_amount_residual"/></div>
<div class="act_as_cell amount" style="width: 6.00%">
<span t-field="account.cumul_amount_residual" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## current--> <!--## current-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.cumul_current"/></div>
<div class="act_as_cell amount" style="width: 6.00%">
<span t-field="account.cumul_current" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_30_days--> <!--## age_30_days-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.cumul_age_30_days"/></div>
<div class="act_as_cell amount" style="width: 6.00%">
<span t-field="account.cumul_age_30_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_60_days--> <!--## age_60_days-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.cumul_age_60_days"/></div>
<div class="act_as_cell amount" style="width: 6.00%">
<span t-field="account.cumul_age_60_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_90_days--> <!--## age_90_days-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.cumul_age_90_days"/></div>
<div class="act_as_cell amount" style="width: 6.00%">
<span t-field="account.cumul_age_90_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## age_120_days--> <!--## age_120_days-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.cumul_age_120_days"/></div>
<div class="act_as_cell amount" style="width: 6.00%">
<span t-field="account.cumul_age_120_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## older--> <!--## older-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.cumul_older"/></div>
<div class="act_as_cell amount" style="width: 6.00%">
<span t-field="account.cumul_older" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
</t> </t>
</div> </div>
<div class="act_as_row" style="font-weight: bold; font-style: italic;"> <div class="act_as_row" style="font-weight: bold; font-style: italic;">
<t t-if="not show_move_line_details"> <t t-if="not show_move_line_details">
<!--## total--> <!--## total-->
<div class="act_as_cell right" style="width: 370px;">Percents</div>
<div class="act_as_cell right" style="width: 32.52%;">
Percents</div>
<!--## amount_residual--> <!--## amount_residual-->
<div class="act_as_cell amount" style="width: 110px;"></div>
<div class="act_as_cell amount" style="width: 9.64%;"/>
<!--## current--> <!--## current-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.percent_current"/>%</div>
<div class="act_as_cell amount" style="width: 9.64%;"><span t-field="account.percent_current"/>%
</div>
<!--## age_30_days--> <!--## age_30_days-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.percent_age_30_days"/>%</div>
<div class="act_as_cell amount" style="width: 9.64%;"><span t-field="account.percent_age_30_days"/>%
</div>
<!--## age_60_days--> <!--## age_60_days-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.percent_age_60_days"/>%</div>
<div class="act_as_cell amount" style="width: 9.64%;"><span t-field="account.percent_age_60_days"/>%
</div>
<!--## age_90_days--> <!--## age_90_days-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.percent_age_90_days"/>%</div>
<div class="act_as_cell amount" style="width: 9.64%;"><span t-field="account.percent_age_90_days"/>%
</div>
<!--## age_120_days--> <!--## age_120_days-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.percent_age_120_days"/>%</div>
<div class="act_as_cell amount" style="width: 9.64%;"><span t-field="account.percent_age_120_days"/>
%
</div>
<!--## older--> <!--## older-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.percent_older"/>%</div>
<div class="act_as_cell amount" style="width: 9.64%;"><span t-field="account.percent_older"/>%
</div>
</t> </t>
<t t-if="show_move_line_details"> <t t-if="show_move_line_details">
<!--## total--> <!--## total-->
<div class="act_as_cell right" style="width: 590px;">Percents</div>
<div class="act_as_cell right" style="width: 52.00%;">
Percents</div>
<!--## date_due--> <!--## date_due-->
<div class="act_as_cell" style="width: 60px;"/>
<div class="act_as_cell" style="width: 6.00%;"/>
<!--## amount_residual--> <!--## amount_residual-->
<div class="act_as_cell amount" style="width: 70px;"></div>
<div class="act_as_cell amount" style="width: 6.00%"/>
<!--## current--> <!--## current-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.percent_current"/>%</div>
<div class="act_as_cell amount" style="width: 6.00%"><span t-field="account.percent_current"/>%
</div>
<!--## age_30_days--> <!--## age_30_days-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.percent_age_30_days"/>%</div>
<div class="act_as_cell amount" style="width: 6.00%"><span t-field="account.percent_age_30_days"/>%
</div>
<!--## age_60_days--> <!--## age_60_days-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.percent_age_60_days"/>%</div>
<div class="act_as_cell amount" style="width: 6.00%"><span t-field="account.percent_age_60_days"/>%
</div>
<!--## age_90_days--> <!--## age_90_days-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.percent_age_90_days"/>%</div>
<div class="act_as_cell amount" style="width: 6.00%"><span t-field="account.percent_age_90_days"/>%
</div>
<!--## age_120_days--> <!--## age_120_days-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.percent_age_120_days"/>%</div>
<div class="act_as_cell amount" style="width: 6.00%"><span t-field="account.percent_age_120_days"/>%
</div>
<!--## older--> <!--## older-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.percent_older"/>%</div>
<div class="act_as_cell amount" style="width: 6.00%"><span t-field="account.percent_older"/>%
</div>
</t> </t>
</div> </div>
</div> </div>

449
account_financial_report_qweb/report/templates/general_ledger.xml

@ -1,33 +1,40 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<template id="account_financial_report_qweb.report_general_ledger_qweb">
<template id="report_general_ledger_qweb">
<t t-call="report.html_container"> <t t-call="report.html_container">
<t t-foreach="docs" t-as="o"> <t t-foreach="docs" t-as="o">
<t t-call="account_financial_report_qweb.internal_layout">
<t t-call="account_financial_report_qweb.report_general_ledger_base"/>
</t>
</t>
</t>
</template>
<template id="report_general_ledger_base">
<!-- Saved flag fields into variables, used to define columns display --> <!-- Saved flag fields into variables, used to define columns display -->
<t t-set="show_cost_center" t-value="o.show_cost_center"/> <t t-set="show_cost_center" t-value="o.show_cost_center"/>
<t t-set="has_second_currency" t-value="o.has_second_currency"/>
<t t-call="account_financial_report_qweb.internal_layout">
<t t-set="foreign_currency" t-value="o.foreign_currency"/>
<!-- Defines global variables used by internal layout --> <!-- Defines global variables used by internal layout -->
<t t-set="title">General Ledger</t> <t t-set="title">General Ledger</t>
<t t-set="company_name" t-value="o.company_id.name"/>
<t t-set="res_company" t-value="o.company_id"/>
<div class="page"> <div class="page">
<!-- Display filters --> <!-- Display filters -->
<t t-call="account_financial_report_qweb.report_general_ledger_qweb_filters"/>
<t t-call="account_financial_report_qweb.report_general_ledger_filters"/>
<t t-foreach="o.account_ids" t-as="account"> <t t-foreach="o.account_ids" t-as="account">
<div class="page_break"> <div class="page_break">
<!-- Display account header --> <!-- Display account header -->
<div class="act_as_table list_table" style="margin-top: 10px;"/> <div class="act_as_table list_table" style="margin-top: 10px;"/>
<div class="act_as_caption account_title" style="width: 1141px !important;">
<div class="act_as_caption account_title"
style="width: 100%">
<span t-field="account.code"/> - <span t-field="account.name"/> <span t-field="account.code"/> - <span t-field="account.name"/>
</div> </div>
<t t-if="not account.partner_ids"> <t t-if="not account.partner_ids">
<!-- Display account move lines without partner regroup --> <!-- Display account move lines without partner regroup -->
<t t-call="account_financial_report_qweb.report_general_ledger_qweb_lines">
<t t-set="type" t-value='"account_type"'/>
<t t-call="account_financial_report_qweb.report_general_ledger_lines">
<t t-set="account_or_partner_object" t-value="account"/> <t t-set="account_or_partner_object" t-value="account"/>
</t> </t>
</t> </t>
@ -35,6 +42,7 @@
<t t-if="account.partner_ids"> <t t-if="account.partner_ids">
<!-- Display account partners --> <!-- Display account partners -->
<t t-foreach="account.partner_ids" t-as="partner"> <t t-foreach="account.partner_ids" t-as="partner">
<t t-set="type" t-value='"partner_type"'/>
<div class="page_break"> <div class="page_break">
<!-- Display partner header --> <!-- Display partner header -->
<div class="act_as_caption account_title"> <div class="act_as_caption account_title">
@ -42,12 +50,12 @@
</div> </div>
<!-- Display partner move lines --> <!-- Display partner move lines -->
<t t-call="account_financial_report_qweb.report_general_ledger_qweb_lines">
<t t-call="account_financial_report_qweb.report_general_ledger_lines">
<t t-set="account_or_partner_object" t-value="partner"/> <t t-set="account_or_partner_object" t-value="partner"/>
</t> </t>
<!-- Display partner footer --> <!-- Display partner footer -->
<t t-call="account_financial_report_qweb.report_general_ledger_qweb_ending_cumul">
<t t-call="account_financial_report_qweb.report_general_ledger_ending_cumul">
<t t-set="account_or_partner_object" t-value="partner"/> <t t-set="account_or_partner_object" t-value="partner"/>
<t t-set="type" t-value='"partner_type"'/> <t t-set="type" t-value='"partner_type"'/>
</t> </t>
@ -56,20 +64,17 @@
</t> </t>
<!-- Display account footer --> <!-- Display account footer -->
<t t-call="account_financial_report_qweb.report_general_ledger_qweb_ending_cumul">
<t t-call="account_financial_report_qweb.report_general_ledger_ending_cumul">
<t t-set="account_or_partner_object" t-value="account"/> <t t-set="account_or_partner_object" t-value="account"/>
<t t-set="type" t-value='"account_type"'/> <t t-set="type" t-value='"account_type"'/>
</t> </t>
</div> </div>
</t> </t>
</div> </div>
</t>
</t>
</t>
</template> </template>
<template id="account_financial_report_qweb.report_general_ledger_qweb_filters">
<div class="act_as_table data_table" style="width: 1140px !important;">
<template id="account_financial_report_qweb.report_general_ledger_filters">
<div class="act_as_table data_table" style="width: 100%;">
<div class="act_as_row labels"> <div class="act_as_row labels">
<div class="act_as_cell">Date range filter</div> <div class="act_as_cell">Date range filter</div>
<div class="act_as_cell">Target moves filter</div> <div class="act_as_cell">Target moves filter</div>
@ -96,82 +101,198 @@
</div> </div>
</template> </template>
<template id="account_financial_report_qweb.report_general_ledger_qweb_lines">
<div class="act_as_table data_table" style="width: 1140px !important;">
<template id="account_financial_report_qweb.report_general_ledger_lines">
<div class="act_as_table data_table" style="width: 100%;">
<!-- Display table headers for lines --> <!-- Display table headers for lines -->
<div class="act_as_thead"> <div class="act_as_thead">
<div class="act_as_row labels"> <div class="act_as_row labels">
<!--## date--> <!--## date-->
<div class="act_as_cell first_column" style="width: 60px;">Date</div>
<div class="act_as_cell first_column" style="width: 5.74%;">
Date</div>
<!--## move--> <!--## move-->
<div class="act_as_cell" style="width: 100px;">Entry</div>
<div class="act_as_cell" style="width: 8.77%">Entry</div>
<!--## journal--> <!--## journal-->
<div class="act_as_cell" style="width: 40px;">Journal</div>
<div class="act_as_cell" style="width: 4.13%;">Journal</div>
<!--## account code--> <!--## account code-->
<div class="act_as_cell" style="width: 50px;">Account</div>
<div class="act_as_cell" style="width: 4.75%;">Account</div>
<!--## account code--> <!--## account code-->
<div class="act_as_cell" style="width: 90px;">Taxes</div>
<div class="act_as_cell" style="width: 8.89%;">Taxes</div>
<!--## partner--> <!--## partner-->
<div class="act_as_cell" style="width: 140px;">Partner</div>
<div class="act_as_cell" style="width: 12.01%;">Partner
</div>
<!--## ref - label--> <!--## ref - label-->
<div class="act_as_cell" style="width: 250px;">Ref - Label</div>
<div class="act_as_cell" style="width: 22.9%;">Ref -
Label</div>
<t t-if="show_cost_center"> <t t-if="show_cost_center">
<!--## cost_center--> <!--## cost_center-->
<div class="act_as_cell" style="width: 100px;">Cost center</div>
<div class="act_as_cell" style="width: 8.03%;">Cost
center</div>
</t> </t>
<!--## matching_number--> <!--## matching_number-->
<div class="act_as_cell" style="width: 25px;">Rec.</div>
<div class="act_as_cell" style="width: 2.41%;">Rec.</div>
<!--## debit--> <!--## debit-->
<div class="act_as_cell amount" style="width: 75px;">Debit</div>
<div class="act_as_cell amount" style="width: 6.02%;">Debit</div>
<!--## credit--> <!--## credit-->
<div class="act_as_cell amount" style="width: 75px;">Credit</div>
<div class="act_as_cell amount" style="width: 6.02%;">Credit</div>
<!--## balance cumulated--> <!--## balance cumulated-->
<div class="act_as_cell amount" style="width: 75px;">Cumul. Bal.</div>
<div class="act_as_cell amount" style="width: 6.02%;">Cumul. Bal.</div>
<t t-if="foreign_currency">
<!--## currency_name--> <!--## currency_name-->
<div class="act_as_cell" style="width: 35px;">Cur.</div>
<div class="act_as_cell" style="width: 2.08%;">Cur.</div>
<!--## amount_currency--> <!--## amount_currency-->
<div class="act_as_cell amount" style="width: 75px;">Amount cur.</div>
<div class="act_as_cell amount" style="width: 5.19%;">Amount cur.</div>
</t>
</div> </div>
</div> </div>
<!-- Display first line with initial balance --> <!-- Display first line with initial balance -->
<div class="act_as_row lines"> <div class="act_as_row lines">
<!--## date--> <!--## date-->
<div class="act_as_cell"></div>
<div class="act_as_cell"/>
<!--## move--> <!--## move-->
<div class="act_as_cell"></div>
<div class="act_as_cell"/>
<!--## journal--> <!--## journal-->
<div class="act_as_cell"></div>
<div class="act_as_cell"/>
<!--## account code--> <!--## account code-->
<div class="act_as_cell"></div>
<div class="act_as_cell"/>
<!--## taxes--> <!--## taxes-->
<div class="act_as_cell"></div>
<div class="act_as_cell"/>
<!--## partner--> <!--## partner-->
<div class="act_as_cell"></div>
<div class="act_as_cell"/>
<!--## ref - label--> <!--## ref - label-->
<div class="act_as_cell amount">Initial balance</div> <div class="act_as_cell amount">Initial balance</div>
<t t-if="show_cost_center"> <t t-if="show_cost_center">
<!--## cost_center--> <!--## cost_center-->
<div class="act_as_cell"></div>
<div class="act_as_cell"/>
</t> </t>
<!--## matching_number--> <!--## matching_number-->
<div class="act_as_cell"></div>
<div class="act_as_cell"/>
<!--## debit--> <!--## debit-->
<div class="act_as_cell amount"><span t-field="account_or_partner_object.initial_debit"/></div>
<div class="act_as_cell amount">
<t t-if="type == 'account_type'">
<t t-set="domain"
t-value="[('account_id', '=', account_or_partner_object.account_id.id),
('date', '&lt;', o.date_from),
('debit', '&lt;&gt;', 0)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi underline-on-hover"
style="color: black; cursor: pointer;">
<t t-raw="account_or_partner_object.initial_debit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
<t t-if="type == 'partner_type'">
<t t-set="domain"
t-value="[('account_id', '=', account_or_partner_object.report_account_id.account_id.id),
('partner_id', '=', account_or_partner_object.partner_id.id),
('date', '&lt;', o.date_from),
('debit', '&lt;&gt;', 0)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi underline-on-hover"
style="color: black; cursor: pointer;">
<t t-raw="account_or_partner_object.initial_debit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
</div>
<!--## credit--> <!--## credit-->
<div class="act_as_cell amount"><span t-field="account_or_partner_object.initial_credit"/></div>
<div class="act_as_cell amount">
<t t-if="type == 'account_type'">
<t t-set="domain"
t-value="[('account_id', '=', account_or_partner_object.account_id.id),
('date', '&lt;', o.date_from),
('credit', '&lt;&gt;', 0)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi underline-on-hover"
style="color: black; cursor: pointer;">
<t t-raw="account_or_partner_object.initial_credit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
<t t-if="type == 'partner_type'">
<t t-set="domain"
t-value="[('account_id', '=', account_or_partner_object.report_account_id.account_id.id),
('partner_id', '=', account_or_partner_object.partner_id.id),
('date', '&lt;', o.date_from),
('credit', '&lt;&gt;', 0)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi underline-on-hover"
style="color: black; cursor: pointer;">
<t t-raw="account_or_partner_object.initial_credit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
</div>
<!--## balance cumulated--> <!--## balance cumulated-->
<div class="act_as_cell amount"><span t-field="account_or_partner_object.initial_balance"/></div>
<!--## currency_name-->
<div class="act_as_cell"><span t-field="account_or_partner_object.currency_name"/></div>
<t t-if="account_or_partner_object.currency_name">
<!--## balance_currency-->
<div class="act_as_cell amount"><span t-field="account_or_partner_object.initial_balance_foreign_currency"/></div>
<div class="act_as_cell amount">
<t t-if="type == 'account_type'">
<t t-set="domain"
t-value="[('account_id', '=', account_or_partner_object.account_id.id),
('date', '&lt;', o.date_from)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi underline-on-hover"
style="color: black; cursor: pointer;">
<t t-raw="account_or_partner_object.initial_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
<t t-if="type == 'partner_type'">
<t t-set="domain"
t-value="[('account_id', '=', account_or_partner_object.report_account_id.account_id.id),
('partner_id', '=', account_or_partner_object.partner_id.id),
('date', '&lt;', o.date_from)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi underline-on-hover"
style="color: black; cursor: pointer;">
<t t-raw="account_or_partner_object.initial_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
</div>
<t t-if="foreign_currency">
<t t-if="account.account_id.currency_id.id">
<div class="act_as_cell amount" style="width: 2.08%;">
<span t-field="account.account_id.currency_id.display_name"/>
</div>
<div class="act_as_cell amount" style="width: 5.19%;">
<t t-if="type == 'account_type'">
<t t-set="domain"
t-value="[('account_id', '=', account_or_partner_object.account_id.id),
('date', '&lt;', o.date_from)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
style="color: black;">
<t t-raw="account_or_partner_object.initial_balance_foreign_currency" t-options="{'widget': 'monetary', 'display_currency': account.account_id.currency_id}"/></a>
</span>
</t>
<t t-if="type == 'partner_type'">
<t t-set="domain"
t-value="[('account_id', '=', account_or_partner_object.report_account_id.account_id.id),
('partner_id', '=', account_or_partner_object.partner_id.id),
('date', '&lt;', o.date_from)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
style="color: black;">
<t t-raw="account_or_partner_object.initial_balance_foreign_currency" t-options="{'widget': 'monetary', 'display_currency': account.account_id.currency_id}"/></a>
</span>
</t>
</div>
</t>
<t t-if="not account.account_id.currency_id.id">
<div class="act_as_cell" style="width: 2.08%;"/>
<div class="act_as_cell" style="width: 5.19%;"/>
</t> </t>
<t t-if="not account_or_partner_object.currency_name">
<!--## balance_currency-->
<div class="act_as_cell"></div>
</t> </t>
</div> </div>
@ -180,80 +301,230 @@
<!-- # lines or centralized lines --> <!-- # lines or centralized lines -->
<div class="act_as_row lines"> <div class="act_as_row lines">
<!--## date--> <!--## date-->
<div class="act_as_cell left"><span t-field="line.date"/></div>
<div class="act_as_cell left">
<t t-set="res_model" t-value="'account.move.line'"/>
<span>
<a t-att-data-active-id="line.move_line_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action underline-on-hover"
style="color: black; cursor: pointer;">
<t t-raw="line.date"/></a>
</span>
</div>
<!--## move--> <!--## move-->
<div class="act_as_cell left"><span t-field="line.entry"/></div>
<div class="act_as_cell left">
<t t-set="res_model" t-value="'account.move'"/>
<span>
<a t-att-data-active-id="line.move_line_id.move_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action underline-on-hover"
style="color: black; cursor: pointer;">
<t t-raw="line.entry"/></a>
</span>
</div>
<!--## journal--> <!--## journal-->
<div class="act_as_cell left"><span t-field="line.journal"/></div>
<div class="act_as_cell left">
<t t-set="res_model" t-value="'account.journal'"/>
<span>
<a t-att-data-active-id="line.move_line_id.move_id.journal_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action underline-on-hover"
style="color: black; cursor: pointer;">
<t t-raw="line.journal"/></a>
</span>
</div>
<!--## account code--> <!--## account code-->
<div class="act_as_cell left"><span t-field="line.account"/></div>
<div class="act_as_cell left">
<t t-set="res_model" t-value="'account.account'"/>
<span>
<a t-att-data-active-id="line.move_line_id.account_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action underline-on-hover"
style="color: black; cursor: pointer;">
<t t-raw="line.account"/></a>
</span>
</div>
<!--## taxes--> <!--## taxes-->
<div class="act_as_cell left"><span t-field="line.taxes_description"/></div> <div class="act_as_cell left"><span t-field="line.taxes_description"/></div>
<!--## partner--> <!--## partner-->
<div class="act_as_cell left"><span t-field="line.partner"/></div>
<div class="act_as_cell left">
<t t-set="res_model" t-value="'res.partner'"/>
<span t-if="line.partner">
<a t-att-data-active-id="line.move_line_id.partner_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action underline-on-hover"
style="color: black; cursor: pointer;"><t t-raw="line.partner"/></a>
</span>
</div>
<!--## ref - label--> <!--## ref - label-->
<div class="act_as_cell left"><span t-field="line.label"/></div>
<t t-if="show_cost_center">
<div class="act_as_cell left">
<t t-set="res_model" t-value="'account.move.line'"/>
<span>
<a t-att-data-active-id="line.move_line_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action underline-on-hover"
style="color: black; cursor: pointer;">
<t t-raw="line.label"/></a>
</span>
</div>
<!--## cost_center--> <!--## cost_center-->
<div class="act_as_cell left"><span t-field="line.cost_center"/></div>
<t t-if="show_cost_center">
<div class="act_as_cell left">
<t t-set="res_model" t-value="'account_analytic_account'"/>
<span t-if="line.cost_center">
<a t-att-data-active-id="line.move_line_id.analytic_account_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action underline-on-hover"
style="color: black; cursor: pointer;"><t t-raw="line.cost_center"/></a>
</span>
</div>
</t> </t>
<!--## matching_number--> <!--## matching_number-->
<div class="act_as_cell"><span t-field="line.matching_number"/></div>
<div class="act_as_cell">
<t t-set="res_model" t-value="'account_full_reconcile'"/>
<span t-if="line.matching_number">
<a t-att-data-active-id="line.move_line_id.full_reconcile_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action underline-on-hover"
style="color: black; cursor: pointer;"><t t-raw="line.matching_number"/></a>
</span>
</div>
<!--## debit--> <!--## debit-->
<div class="act_as_cell amount"><span t-field="line.debit"/></div>
<div class="act_as_cell amount">
<t t-set="res_model" t-value="'account.move.line'"/>
<span>
<a t-att-data-active-id="line.move_line_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action_monetary underline-on-hover"
style="color: black; cursor: pointer;">
<t t-raw="line.debit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</div>
<!--## credit--> <!--## credit-->
<div class="act_as_cell amount"><span t-field="line.credit"/></div>
<div class="act_as_cell amount">
<t t-set="res_model" t-value="'account.move.line'"/>
<span>
<a t-att-data-active-id="line.move_line_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action_monetary underline-on-hover"
style="color: black; cursor: pointer;">
<t t-raw="line.credit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</div>
<!--## balance cumulated--> <!--## balance cumulated-->
<div class="act_as_cell amount"><span t-field="line.cumul_balance"/></div>
<div class="act_as_cell amount">
<t t-set="res_model" t-value="'account.move.line'"/>
<span>
<a t-att-data-active-id="line.move_line_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action_monetary underline-on-hover"
style="color: black; cursor: pointer;">
<t t-raw="line.cumul_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</div>
<t t-if="foreign_currency">
<t t-if="line.currency_id.id">
<!--## currency_name--> <!--## currency_name-->
<div class="act_as_cell"><span t-field="line.currency_name"/></div>
<t t-if="line.currency_name">
<div class="act_as_cell amount" style="width: 2.08%;">
<span t-field="line.currency_id.display_name"/>
</div>
<!--## amount_currency--> <!--## amount_currency-->
<div class="act_as_cell amount"><span t-field="line.amount_currency"/></div>
<div class="act_as_cell amount" style="width: 5.19%;">
<t t-set="res_model" t-value="'account.move.line'"/>
<span>
<a t-att-data-active-id="line.move_line_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action underline-on-hover"
style="color: black; cursor: pointer;">
<t t-raw="line.amount_currency" t-options="{'widget': 'monetary', 'display_currency': line.currency_id}"/></a>
</span>
</div>
</t> </t>
<t t-if="not line.currency_name">
<t t-if="not line.currency_id.id">
<!--## currency_name-->
<div class="act_as_cell amount" style="width: 2.08%;"/>
<!--## amount_currency--> <!--## amount_currency-->
<div class="act_as_cell"></div>
<div class="act_as_cell amount" style="width: 5.19%;"/>
</t>
</t> </t>
</div> </div>
</t> </t>
</div> </div>
</template> </template>
<template id="account_financial_report_qweb.report_general_ledger_qweb_ending_cumul">
<template id="account_financial_report_qweb.report_general_ledger_ending_cumul">
<!-- Display ending balance line for account or partner --> <!-- Display ending balance line for account or partner -->
<div class="act_as_table list_table" style="width: 1141px !important;">
<div class="act_as_table list_table" style="width: 100%;">
<div class="act_as_row labels" style="font-weight: bold;"> <div class="act_as_row labels" style="font-weight: bold;">
<!--## date--> <!--## date-->
<t t-if='type == "account_type"'> <t t-if='type == "account_type"'>
<div class="act_as_cell first_column" style="width: 380px;"><span t-field="account_or_partner_object.code"/> - <span t-field="account_or_partner_object.name"/></div>
<div class="act_as_cell right" style="width: 290px;">Ending balance</div>
<div class="act_as_cell first_column"
style="width: 43.88%;"><span
t-field="account_or_partner_object.code"/> - <span t-field="account_or_partner_object.name"/></div>
<div class="act_as_cell right"
style="width: 22.9%;">Ending balance</div>
</t> </t>
<t t-if='type == "partner_type"'> <t t-if='type == "partner_type"'>
<div class="act_as_cell first_column" style="width: 380px;"></div>
<div class="act_as_cell right" style="width: 290px;">Partner ending balance</div>
<div class="act_as_cell first_column" style="width: 43.88%;"/>
<div class="act_as_cell right" style="width: 22.9%;">Partner ending balance</div>
</t> </t>
<t t-if="show_cost_center"> <t t-if="show_cost_center">
<!--## cost_center--> <!--## cost_center-->
<div class="act_as_cell" style="width: 100px;"></div>
<div class="act_as_cell" style="width: 8.03%"/>
</t> </t>
<!--## matching_number--> <!--## matching_number-->
<div class="act_as_cell" style="width: 25px;"></div>
<div class="act_as_cell" style="width: 2.41%;"/>
<!--## debit--> <!--## debit-->
<div class="act_as_cell amount" style="width: 75px;"><span t-field="account_or_partner_object.final_debit"/></div>
<div class="act_as_cell amount" style="width: 6.02%;">
<span t-field="account_or_partner_object.final_debit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## credit--> <!--## credit-->
<div class="act_as_cell amount" style="width: 75px;"><span t-field="account_or_partner_object.final_credit"/></div>
<div class="act_as_cell amount" style="width: 6.02%;">
<span t-field="account_or_partner_object.final_credit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## balance cumulated--> <!--## balance cumulated-->
<div class="act_as_cell amount" style="width: 75px; padding-right: 1px;"><span t-field="account_or_partner_object.final_balance"/></div>
<!--## currency_name-->
<div class="act_as_cell" style="width: 35px;"><span t-field="account_or_partner_object.currency_name"/></div>
<t t-if="account_or_partner_object.currency_name">
<!--## balance_currency-->
<div class="act_as_cell amount" style="width: 75px;"><span t-field="account_or_partner_object.final_balance_foreign_currency"/></div>
</t>
<t t-if="not account_or_partner_object.currency_name">
<!--## balance_currency-->
<div class="act_as_cell" style="width: 75px;"/>
<div class="act_as_cell amount" style="width: 6.02%;">
<span t-field="account_or_partner_object.final_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## currency_name + amount_currency-->
<t t-if="foreign_currency">
<t t-if="account.account_id.currency_id.id">
<div class="act_as_cell amount" style="width: 2.08%;">
<span t-field="account.account_id.currency_id.display_name"/>
</div>
<div class="act_as_cell amount" style="width: 5.19%;">
<t t-if="type == 'account_type'">
<t t-set="domain"
t-value="[('account_id', '=', account_or_partner_object.account_id.id),
('date', '&lt;', o.date_from)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
style="color: black;">
<t t-raw="account_or_partner_object.final_balance_foreign_currency" t-options="{'widget': 'monetary', 'display_currency': account_or_partner_object.account_id.currency_id}"/></a>
</span>
</t>
<t t-if="type == 'partner_type'">
<t t-set="domain"
t-value="[('account_id', '=', account_or_partner_object.report_account_id.account_id.id),
('partner_id', '=', account_or_partner_object.partner_id.id),
('date', '&lt;', o.date_from)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
style="color: black;">
<t t-raw="account_or_partner_object.final_balance_foreign_currency" t-options="{'widget': 'monetary', 'display_currency': account_or_partner_object.report_account_id.currency_id}"/></a>
</span>
</t>
</div>
</t>
<t t-if="not account.account_id.currency_id ">
<div class="act_as_cell amount" style="width: 2.08%;"/>
<div class="act_as_cell amount" style="width: 5.19%;"/>
</t>
</t> </t>
</div> </div>
</div> </div>

14
account_financial_report_qweb/report/templates/journal.xml

@ -1,13 +1,20 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<template id="account_financial_report_qweb.report_journal_qweb">
<template id="report_journal_qweb">
<t t-call="report.html_container"> <t t-call="report.html_container">
<t t-foreach="docs" t-as="o"> <t t-foreach="docs" t-as="o">
<t t-call="account_financial_report_qweb.internal_layout"> <t t-call="account_financial_report_qweb.internal_layout">
<t t-call="account_financial_report_qweb.report_journal_qweb_base"/>
</t>
</t>
</t>
</template>
<template id="report_journal_qweb_base">
<t t-set="title">Journal Ledger</t> <t t-set="title">Journal Ledger</t>
<t t-set="company_name" t-value="o.company_id.name"/> <t t-set="company_name" t-value="o.company_id.name"/>
<t t-set="display_currency" t-value="o.with_currency"/>
<t t-set="display_currency" t-value="o.foreign_currency"/>
<t t-set="display_account_name" t-value="o.with_account_name"/> <t t-set="display_account_name" t-value="o.with_account_name"/>
<div class="page"> <div class="page">
@ -29,9 +36,6 @@
</t> </t>
</t> </t>
</div> </div>
</t>
</t>
</t>
</template> </template>
<template id="account_financial_report_qweb.report_journal_qweb_all"> <template id="account_financial_report_qweb.report_journal_qweb_all">

165
account_financial_report_qweb/report/templates/open_items.xml

@ -1,17 +1,22 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<template id="account_financial_report_qweb.report_open_items_qweb">
<template id="report_open_items_qweb">
<t t-call="report.html_container"> <t t-call="report.html_container">
<t t-foreach="docs" t-as="o"> <t t-foreach="docs" t-as="o">
<!-- Saved flag fields into variables, used to define columns display -->
<t t-set="has_second_currency" t-value="o.has_second_currency"/>
<t t-call="account_financial_report_qweb.internal_layout"> <t t-call="account_financial_report_qweb.internal_layout">
<t t-call="account_financial_report_qweb.report_open_items_base"/>
</t>
</t>
</t>
</template>
<template id="report_open_items_base">
<!-- Defines global variables used by internal layout --> <!-- Defines global variables used by internal layout -->
<t t-set="title">Open Items</t> <t t-set="title">Open Items</t>
<t t-set="company_name" t-value="o.company_id.name"/> <t t-set="company_name" t-value="o.company_id.name"/>
<t t-set="res_company" t-value="o.company_id"/>
<t t-set="foreign_currency" t-value="o.foreign_currency"/>
<div class="page"> <div class="page">
<!-- Display filters --> <!-- Display filters -->
<t t-call="account_financial_report_qweb.report_open_items_qweb_filters"/> <t t-call="account_financial_report_qweb.report_open_items_qweb_filters"/>
@ -20,7 +25,8 @@
<div class="page_break"> <div class="page_break">
<!-- Display account header --> <!-- Display account header -->
<div class="act_as_table list_table" style="margin-top: 10px;"/> <div class="act_as_table list_table" style="margin-top: 10px;"/>
<div class="act_as_caption account_title" style="width: 1141px !important;">
<div class="act_as_caption account_title"
style="width: 100%;">
<span t-field="account.code"/> - <span t-field="account.name"/> <span t-field="account.code"/> - <span t-field="account.name"/>
</div> </div>
@ -51,14 +57,10 @@
</div> </div>
</t> </t>
</div> </div>
</t>
</t>
</t>
</template> </template>
<template id="account_financial_report_qweb.report_open_items_qweb_filters"> <template id="account_financial_report_qweb.report_open_items_qweb_filters">
<div class="act_as_table data_table" style="width: 1140px !important;">
<div class="act_as_table data_table" style="width: 100%;">
<div class="act_as_row labels"> <div class="act_as_row labels">
<div class="act_as_cell">Date at filter</div> <div class="act_as_cell">Date at filter</div>
<div class="act_as_cell">Target moves filter</div> <div class="act_as_cell">Target moves filter</div>
@ -81,34 +83,41 @@
</template> </template>
<template id="account_financial_report_qweb.report_open_items_qweb_lines"> <template id="account_financial_report_qweb.report_open_items_qweb_lines">
<div class="act_as_table data_table" style="width: 1140px !important;">
<div class="act_as_table data_table" style="width: 100%;">
<!-- Display table headers for lines --> <!-- Display table headers for lines -->
<div class="act_as_thead"> <div class="act_as_thead">
<div class="act_as_row labels"> <div class="act_as_row labels">
<!--## date--> <!--## date-->
<div class="act_as_cell first_column" style="width: 60px;">Date</div>
<div class="act_as_cell first_column" style="width: 4.51%;">
Date</div>
<!--## move--> <!--## move-->
<div class="act_as_cell" style="width: 100px;">Entry</div>
<div class="act_as_cell" style="width: 9.76%;">Entry</div>
<!--## journal--> <!--## journal-->
<div class="act_as_cell" style="width: 40px;">Journal</div>
<div class="act_as_cell" style="width: 4.78%;">Journal</div>
<!--## account code--> <!--## account code-->
<div class="act_as_cell" style="width: 50px;">Account</div>
<div class="act_as_cell" style="width: 5.38%;">Account</div>
<!--## partner--> <!--## partner-->
<div class="act_as_cell" style="width: 140px;">Partner</div>
<div class="act_as_cell" style="width: 15.07%;">Partner
</div>
<!--## ref - label--> <!--## ref - label-->
<div class="act_as_cell" style="width: 290px;">Ref - Label</div>
<div class="act_as_cell" style="width: 25.5%;">Ref -
Label</div>
<!--## date_due--> <!--## date_due-->
<div class="act_as_cell" style="width: 60px;">Due date</div>
<div class="act_as_cell" style="width: 6.47%;">Due
date</div>
<!--## amount_total_due--> <!--## amount_total_due-->
<div class="act_as_cell" style="width: 75px;">Original</div>
<div class="act_as_cell" style="width: 6.57%;">Original
</div>
<!--## amount_residual--> <!--## amount_residual-->
<div class="act_as_cell" style="width: 75px;">Residual</div>
<div class="act_as_cell" style="width: 6.57%;">Residual</div>
<t t-if="foreign_currency">
<!--## currency_name--> <!--## currency_name-->
<div class="act_as_cell" style="width: 35px;">Cur.</div>
<div class="act_as_cell" style="width: 2.25%;">Cur.</div>
<!--## amount_total_due_currency--> <!--## amount_total_due_currency-->
<div class="act_as_cell amount" style="width: 75px;">Cur. Original</div>
<div class="act_as_cell amount" style="width: 6.57%;">Cur. Original</div>
<!--## amount_residual_currency--> <!--## amount_residual_currency-->
<div class="act_as_cell amount" style="width: 75px;">Cur. Residual</div>
<div class="act_as_cell amount" style="width: 6.57%;">Cur. Residual</div>
</t>
</div> </div>
</div> </div>
@ -119,34 +128,68 @@
<!--## date--> <!--## date-->
<div class="act_as_cell left"><span t-field="line.date"/></div> <div class="act_as_cell left"><span t-field="line.date"/></div>
<!--## move--> <!--## move-->
<div class="act_as_cell left"><span t-field="line.entry"/></div>
<div class="act_as_cell left">
<t t-set="res_model" t-value="'account.move'"/>
<span>
<a t-att-data-active-id="line.move_line_id.move_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
style="color: black;">
<t t-raw="line.entry"/>
</a>
</span>
</div>
<!--## journal--> <!--## journal-->
<div class="act_as_cell left"><span t-field="line.journal"/></div> <div class="act_as_cell left"><span t-field="line.journal"/></div>
<!--## account code--> <!--## account code-->
<div class="act_as_cell left"><span t-field="line.account"/></div> <div class="act_as_cell left"><span t-field="line.account"/></div>
<!--## partner--> <!--## partner-->
<div class="act_as_cell left"><span t-field="line.partner"/></div>
<div class="act_as_cell left">
<t t-set="res_model" t-value="'res.partner'"/>
<span t-if="line.partner">
<a t-att-data-active-id="line.move_line_id.partner_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
style="color: black;">
<t t-raw="line.partner"/>
</a>
</span>
</div>
<!--## ref - label--> <!--## ref - label-->
<div class="act_as_cell left"><span t-field="line.label"/></div> <div class="act_as_cell left"><span t-field="line.label"/></div>
<!--## date_due--> <!--## date_due-->
<div class="act_as_cell left"><span t-field="line.date_due"/></div> <div class="act_as_cell left"><span t-field="line.date_due"/></div>
<!--## amount_total_due--> <!--## amount_total_due-->
<div class="act_as_cell amount"><span t-field="line.amount_total_due"/></div>
<div class="act_as_cell amount">
<span t-field="line.amount_total_due" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## amount_residual--> <!--## amount_residual-->
<div class="act_as_cell amount"><span t-field="line.amount_residual"/></div>
<div class="act_as_cell amount">
<span t-field="line.amount_residual" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<t t-if="foreign_currency">
<t t-if="line.currency_id.id">
<!--## currency_name--> <!--## currency_name-->
<div class="act_as_cell"><span t-field="line.currency_name"/></div>
<t t-if="line.currency_name">
<div class="act_as_cell amount">
<span t-field="line.currency_id.display_name"/>
</div>
<!--## amount_total_due_currency--> <!--## amount_total_due_currency-->
<div class="act_as_cell amount"><span t-field="line.amount_total_due_currency"/></div>
<div class="act_as_cell amount">
<span t-field="line.amount_total_due_currency" t-options="{'widget': 'monetary', 'display_currency': line.currency_id}"/>
</div>
<!--## amount_residual_currency--> <!--## amount_residual_currency-->
<div class="act_as_cell amount"><span t-field="line.amount_residual_currency"/></div>
<div class="act_as_cell amount">
<span t-field="line.amount_residual_currency" t-options="{'widget': 'monetary', 'display_currency': line.currency_id}"/>
</div>
</t> </t>
<t t-if="not line.currency_name">
<t t-if="not line.currency_id.id">
<!--## currency_name-->
<div class="act_as_cell"/>
<!--## amount_total_due_currency--> <!--## amount_total_due_currency-->
<div class="act_as_cell"></div>
<div class="act_as_cell"/>
<!--## amount_residual_currency--> <!--## amount_residual_currency-->
<div class="act_as_cell"></div>
<div class="act_as_cell"/>
</t>
</t> </t>
</div> </div>
</t> </t>
@ -155,25 +198,57 @@
<template id="account_financial_report_qweb.report_open_items_qweb_ending_cumul"> <template id="account_financial_report_qweb.report_open_items_qweb_ending_cumul">
<!-- Display ending balance line for account or partner --> <!-- Display ending balance line for account or partner -->
<div class="act_as_table list_table" style="width: 1141px !important;">
<div class="act_as_table list_table" style="width: 100%;">
<div class="act_as_row labels" style="font-weight: bold;"> <div class="act_as_row labels" style="font-weight: bold;">
<!--## date--> <!--## date-->
<t t-if='type == "account_type"'> <t t-if='type == "account_type"'>
<div class="act_as_cell first_column" style="width: 380px;"><span t-field="account_or_partner_object.code"/> - <span t-field="account_or_partner_object.name"/></div>
<div class="act_as_cell right" style="width: 290px;">Ending balance</div>
<div class="act_as_cell first_column" style="width: 36.34%;">
<span t-field="account_or_partner_object.code"/>
-
<span t-field="account_or_partner_object.name"/>
</div>
<div class="act_as_cell right" style="width: 28.66%;">Ending
balance</div>
</t> </t>
<t t-if='type == "partner_type"'> <t t-if='type == "partner_type"'>
<div class="act_as_cell first_column" style="width: 380px;"></div>
<div class="act_as_cell right" style="width: 290px;">Partner ending balance</div>
<div class="act_as_cell first_column"
style="width: 36.34%;"/>
<div class="act_as_cell right"
style="width: 28.66%;">Partner ending balance</div>
</t> </t>
<!--## date_due--> <!--## date_due-->
<div class="act_as_cell" style="width: 60px;"></div>
<div class="act_as_cell" style="width: 6.47%;"/>
<!--## amount_total_due--> <!--## amount_total_due-->
<div class="act_as_cell amount" style="width: 75px;"></div>
<div class="act_as_cell amount" style="width: 6.57%;"/>
<!--## amount_currency--> <!--## amount_currency-->
<div class="act_as_cell amount" style="width: 75px;"><span t-field="account_or_partner_object.final_amount_residual"/></div>
<!--## currency_name + amount_total_due_currency + amount_residual_currency -->
<div class="act_as_cell" style="width: 185px;"></div>
<div class="act_as_cell amount" style="width: 6.57%;">
<span t-field="account_or_partner_object.final_amount_residual" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</div>
<!--## amount_total_due_currency + amount_residual_currency -->
<t t-if="foreign_currency">
<t t-if="account_or_partner_object.currency_id.id">
<!--## currency_name-->
<div class="act_as_cell amount" style="width: 2.25%;">
<span t-field="account_or_partner_object.currency_id.display_name"/>
</div>
<!--## amount_total_due_currency-->
<div class="act_as_cell amount" style="width: 6.57%;">
<span t-field="account_or_partner_object.final_amount_total_due_currency" t-options="{'widget': 'monetary', 'display_currency': account_or_partner_object.currency_id}"/>
</div>
<!--## amount_residual_currency-->
<div class="act_as_cell amount" style="width: 6.57%;">
<span t-field="account_or_partner_object.final_amount_residual_currency" t-options="{'widget': 'monetary', 'display_currency': account_or_partner_object.currency_id}"/>
</div>
</t>
<t t-if="not account_or_partner_object.currency_id.id">
<!--## currency_name-->
<div class="act_as_cell"/>
<!--## amount_total_due_currency-->
<div class="act_as_cell"/>
<!--## amount_residual_currency-->
<div class="act_as_cell"/>
</t>
</t>
</div> </div>
</div> </div>
</template> </template>

418
account_financial_report_qweb/report/templates/trial_balance.xml

@ -4,13 +4,21 @@
<template id="account_financial_report_qweb.report_trial_balance_qweb"> <template id="account_financial_report_qweb.report_trial_balance_qweb">
<t t-call="report.html_container"> <t t-call="report.html_container">
<t t-foreach="docs" t-as="o"> <t t-foreach="docs" t-as="o">
<t t-call="account_financial_report_qweb.internal_layout">
<t t-call="account_financial_report_qweb.report_trial_balance_base"/>
</t>
</t>
</t>
</template>
<template id="report_trial_balance_base">
<!-- Saved flag fields into variables, used to define columns display --> <!-- Saved flag fields into variables, used to define columns display -->
<t t-set="show_partner_details" t-value="o.show_partner_details"/> <t t-set="show_partner_details" t-value="o.show_partner_details"/>
<t t-call="account_financial_report_qweb.internal_layout">
<t t-set="foreign_currency" t-value="o.foreign_currency"/>
<!-- Defines global variables used by internal layout --> <!-- Defines global variables used by internal layout -->
<t t-set="title">Trial Balance</t> <t t-set="title">Trial Balance</t>
<t t-set="company_name" t-value="o.company_id.name"/> <t t-set="company_name" t-value="o.company_id.name"/>
<t t-set="res_company" t-value="o.company_id"/>
<div class="page"> <div class="page">
<!-- Display filters --> <!-- Display filters -->
@ -25,6 +33,12 @@
<!-- Display each lines --> <!-- Display each lines -->
<t t-foreach="o.account_ids" t-as="line"> <t t-foreach="o.account_ids" t-as="line">
<t t-set="type" t-value='"account_type"'/>
<!-- Adapt -->
<t t-set="style" t-value="'font-size:8px;'"/>
<t t-set="padding" t-value="line.level * 4"/>
<t t-set="style" t-value="'font-size: ' + str(14 - line.level) + 'px; margin-left: ' + str(line.level * 4) + 'px;'"/>
<!-- Display account lines --> <!-- Display account lines -->
<t t-call="account_financial_report_qweb.report_trial_balance_qweb_line"/> <t t-call="account_financial_report_qweb.report_trial_balance_qweb_line"/>
</t> </t>
@ -33,39 +47,56 @@
<!-- Display partner lines --> <!-- Display partner lines -->
<t t-if="show_partner_details"> <t t-if="show_partner_details">
<t t-set="padding" t-value="0"/>
<t t-foreach="o.account_ids" t-as="account"> <t t-foreach="o.account_ids" t-as="account">
<div class="page_break"> <div class="page_break">
<t t-set="style" t-value="'font-size:8px;'"/>
<t t-set="padding" t-value="account.level * 4"/>
<t t-set="style" t-value="'font-size: ' + str(14 - account.level) + 'px; margin-left: ' + str(account.level * 4) + 'px;'"/>
<!-- Display account header --> <!-- Display account header -->
<div class="act_as_table list_table" style="margin-top: 10px;"/> <div class="act_as_table list_table" style="margin-top: 10px;"/>
<div class="act_as_caption account_title" style="width: 1141px !important;">
<span t-field="account.code"/> - <span t-field="account.name"/>
<div class="act_as_caption account_title"
style="width: 100%;">
<t t-set="res_model" t-value="'account.account'"/>
<span>
<a t-att-data-active-id="account.account_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
t-att-style="style">
<t t-raw="account.code"/> - <t t-raw="account.name"/></a>
</span>
</div> </div>
<div class="act_as_table data_table" style="width: 1325px !important;">
<div class="act_as_table data_table"
style="width: 100%;">
<!-- Display account/partner header --> <!-- Display account/partner header -->
<t t-call="account_financial_report_qweb.report_trial_balance_qweb_lines_header"/> <t t-call="account_financial_report_qweb.report_trial_balance_qweb_lines_header"/>
<!-- Adapt style -->
<t t-set="padding" t-value="padding+4"/>
<!-- Display each partners --> <!-- Display each partners -->
<t t-foreach="account.partner_ids" t-as="line"> <t t-foreach="account.partner_ids" t-as="line">
<t t-set="type" t-value='"partner_type"'/>
<!-- Display partner line --> <!-- Display partner line -->
<t t-call="account_financial_report_qweb.report_trial_balance_qweb_line"/> <t t-call="account_financial_report_qweb.report_trial_balance_qweb_line"/>
</t> </t>
<t t-set="padding" t-value="padding-4"/>
</div> </div>
<!-- Display account footer --> <!-- Display account footer -->
<t t-set="type" t-value='"account_type"'/>
<t t-call="account_financial_report_qweb.report_trial_balance_qweb_account_footer"/> <t t-call="account_financial_report_qweb.report_trial_balance_qweb_account_footer"/>
</div> </div>
</t> </t>
</t> </t>
</div> </div>
</t>
</t>
</t>
</template> </template>
<template id="account_financial_report_qweb.report_trial_balance_qweb_filters"> <template id="account_financial_report_qweb.report_trial_balance_qweb_filters">
<div class="act_as_table data_table" style="width: 1325px !important;">
<div class="act_as_table data_table" style="width: 100%;">
<div class="act_as_row labels"> <div class="act_as_row labels">
<div class="act_as_cell">Date range filter</div> <div class="act_as_cell">Date range filter</div>
<div class="act_as_cell">Target moves filter</div> <div class="act_as_cell">Target moves filter</div>
@ -93,27 +124,32 @@
<div class="act_as_row labels"> <div class="act_as_row labels">
<t t-if="not show_partner_details"> <t t-if="not show_partner_details">
<!--## Code--> <!--## Code-->
<div class="act_as_cell" style="width: 100px;">Code</div>
<div class="act_as_cell" style="width: 8.86%;">Code</div>
<!--## Account--> <!--## Account-->
<div class="act_as_cell" style="width: 600px;">Account</div>
<div class="act_as_cell" style="width: 52.58%;">Account
</div>
</t> </t>
<t t-if="show_partner_details"> <t t-if="show_partner_details">
<!--## Partner--> <!--## Partner-->
/<div class="act_as_cell" style="width: 700px;">Partner</div>
<div class="act_as_cell" style="width: 61.44%;">Partner
</div>
</t> </t>
<!--## Initial balance--> <!--## Initial balance-->
<div class="act_as_cell" style="width: 110px;">Initial balance</div>
<div class="act_as_cell" style="width: 9.64%;">Initial
balance</div>
<!--## Debit--> <!--## Debit-->
<div class="act_as_cell" style="width: 110px;">Debit</div>
<div class="act_as_cell" style="width: 9.64%;">Debit</div>
<!--## Credit--> <!--## Credit-->
<div class="act_as_cell" style="width: 110px;">Credit</div>
<div class="act_as_cell" style="width: 9.64%;">Credit</div>
<!--## Ending balance--> <!--## Ending balance-->
<div class="act_as_cell" style="width: 110px;">Ending balance</div>
<div class="act_as_cell" style="width: 9.64%;">Ending balance</div>
<t t-if="foreign_currency">
<!--## currency_name--> <!--## currency_name-->
<div class="act_as_cell" style="width: 35px;">Cur.</div>
<div class="act_as_cell" style="width: 4.43%;">Cur.</div>
<!--## amount_currency--> <!--## amount_currency-->
<div class="act_as_cell" style="width: 75px;">Initial blance cur.</div>
<div class="act_as_cell" style="width: 75px;">Ending blance cur.</div>
<div class="act_as_cell" style="width: 8.86%;">Initial blance cur.</div>
<div class="act_as_cell" style="width: 8.86%;">Ending blance cur.</div>
</t>
</div> </div>
</div> </div>
</template> </template>
@ -123,48 +159,354 @@
<div class="act_as_row lines"> <div class="act_as_row lines">
<t t-if="not show_partner_details"> <t t-if="not show_partner_details">
<!--## Code--> <!--## Code-->
<div class="act_as_cell left"><span t-field="line.code"/></div>
<div class="act_as_cell left">
<t t-if="line.account_id">
<t t-set="res_model" t-value="'account.account'"/>
<span>
<a t-att-data-active-id="line.account_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
t-att-style="style">
<t t-att-style="style" t-raw="line.code"/></a>
</span>
</t>
</div>
</t> </t>
<!--## Account/Partner--> <!--## Account/Partner-->
<div class="act_as_cell left"><span t-field="line.name"/></div>
<div class="act_as_cell left">
<t t-if="type == 'account_type'">
<t t-set="account_or_partner_line" t-value="line"/>
<t t-if="line.account_id">
<t t-set="res_model" t-value="'account.account'"/>
<span>
<a t-att-data-active-id="line.account_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
t-att-style="style">
<t t-att-style="style" t-raw="line.name"/></a>
</span>
</t>
</t>
<t t-if="type == 'partner_type'">
<t t-set="account_or_partner_line" t-value="line.report_account_id"/>
<t t-set="res_model" t-value="'res.partner'"/>
<span>
<a t-att-data-active-id="line.partner_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
t-att-style="style">
<t t-att-style="style" t-raw="line.name"/></a>
</span>
</t>
</div>
<!--## Initial balance--> <!--## Initial balance-->
<div class="act_as_cell amount"><span t-field="line.initial_balance"/></div>
<div class="act_as_cell amount">
<t t-if="type == 'account_type'">
<t t-if="line.account_id">
<t t-set="domain"
t-value="[('account_id', '=', line.account_id.id),
('date', '&lt;', o.date_from)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
t-att-style="style">
<t t-att-style="style" t-raw="line.initial_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
</t>
<t t-if="type == 'partner_type'">
<t t-set="domain"
t-value="[('account_id', '=', line.report_account_id.account_id.id),
('partner_id', '=', line.partner_id.id),
('date', '&lt;', o.date_from)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
t-att-style="style">
<t t-att-style="style" t-raw="line.initial_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
</div>
<!--## Debit--> <!--## Debit-->
<div class="act_as_cell amount"><span t-field="line.debit"/></div>
<div class="act_as_cell amount">
<t t-if="type == 'account_type'">
<t t-if="line.account_id">
<t t-set="domain"
t-value="[('account_id', '=', line.account_id.id),
('date', '&gt;=', line.report_id.date_from),
('date', '&lt;=', line.report_id.date_to),
('debit', '&lt;&gt;', 0)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
t-att-style="style">
<t t-att-style="style" t-raw="line.debit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
</t>
<t t-if="type == 'partner_type'">
<t t-set="domain"
t-value="[('account_id', '=', line.report_account_id.account_id.id),
('partner_id', '=', line.partner_id.id),
('date', '&gt;=', line.report_account_id.report_id.date_from),
('date', '&lt;=', line.report_account_id.report_id.date_to),
('debit', '&lt;&gt;', 0)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
t-att-style="style">
<t t-att-style="style" t-raw="line.debit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
</div>
<!--## Credit--> <!--## Credit-->
<div class="act_as_cell amount"><span t-field="line.credit"/></div>
<div class="act_as_cell amount">
<t t-if="type == 'account_type'">
<t t-if="line.account_id">
<t t-set="domain"
t-value="[('account_id', '=', line.account_id.id),
('date', '&gt;=', line.report_id.date_from),
('date', '&lt;=', line.report_id.date_to),
('credit', '&lt;&gt;', 0)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
t-att-style="style">
<t t-att-style="style" t-raw="line.credit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
</t>
<t t-if="type == 'partner_type'">
<t t-set="domain"
t-value="[('account_id', '=', line.report_account_id.account_id.id),
('partner_id', '=', line.partner_id.id),
('date', '&gt;=', line.report_account_id.report_id.date_from),
('date', '&lt;=', line.report_account_id.report_id.date_to),
('credit', '&lt;&gt;', 0)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
t-att-style="style">
<t t-att-style="style" t-raw="line.credit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
</div>
<!--## Ending balance--> <!--## Ending balance-->
<div class="act_as_cell amount"><span t-field="line.final_balance"/></div>
<div class="act_as_cell amount">
<t t-if="type == 'account_type'">
<t t-if="line.account_id">
<t t-set="domain"
t-value="[('account_id', '=', line.account_id.id)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
t-att-style="style">
<t t-att-style="style" t-raw="line.final_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
</t>
<t t-if="type == 'partner_type'">
<t t-set="domain"
t-value="[('account_id', '=', line.report_account_id.account_id.id),
('partner_id', '=', line.partner_id.id)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
t-att-style="style">
<t t-att-style="style" t-raw="line.final_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</t>
</div>
<t t-if="foreign_currency">
<t t-if="account_or_partner_line.currency_id">
<!--## currency_name--> <!--## currency_name-->
<div class="act_as_cell"><span t-field="line.currency_name"/></div>
<t t-if="line.currency_name">
<!--## balance_currency-->
<div class="act_as_cell amount"><span t-field="line.initial_balance_foreign_currency"/></div>
<div class="act_as_cell amount"><span
t-field="line.final_balance_foreign_currency"/></div>
<div class="act_as_cell" style="width: 4.43%;">
<span t-field="account_or_partner_line.currency_id.display_name"/>
</div>
<!--## Initial balance cur.-->
<div class="act_as_cell amount">
<t t-if="type == 'account_type'">
<t t-if="line.account_id">
<t t-set="domain"
t-value="[('account_id', '=', line.account_id.id)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
t-att-style="style">
<t t-att-style="style" t-raw="line.initial_balance_foreign_currency" t-options="{'widget': 'monetary', 'display_currency': line.currency_id}"/></a>
</span>
</t>
</t>
<t t-if="type == 'partner_type'">
<t t-set="domain"
t-value="[('account_id', '=', line.report_account_id.account_id.id),
('partner_id', '=', line.partner_id.id)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
t-att-style="style">
<t t-att-style="style" t-raw="line.initial_balance_foreign_currency" t-options="{'widget': 'monetary', 'display_currency': line.report_account_id.currency_id}"/></a>
</span>
</t>
</div>
<!--## Ending balance cur.-->
<div class="act_as_cell amount">
<t t-if="type == 'account_type'">
<t t-if="line.account_id">
<t t-set="domain"
t-value="[('account_id', '=', line.account_id.id)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
t-att-style="style">
<t t-att-style="style" t-raw="line.final_balance_foreign_currency" t-options="{'widget': 'monetary', 'display_currency': line.currency_id}"/></a>
</span>
</t>
</t> </t>
<t t-if="not line.currency_name">
<t t-if="type == 'partner_type'">
<t t-set="domain"
t-value="[('account_id', '=', line.report_account_id.account_id.id),
('partner_id', '=', line.partner_id.id)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
t-att-style="style">
<t t-att-style="style" t-raw="line.final_balance_foreign_currency" t-options="{'widget': 'monetary', 'display_currency': line.report_account_id.currency_id}"/></a>
</span>
</t>
</div>
</t>
<t t-if="not account_or_partner_line.currency_id.id">
<!--## balance_currency--> <!--## balance_currency-->
<div class="act_as_cell"/> <div class="act_as_cell"/>
<div class="act_as_cell"/> <div class="act_as_cell"/>
<div class="act_as_cell"/>
</t>
</t> </t>
</div> </div>
</template> </template>
<template id="account_financial_report_qweb.report_trial_balance_qweb_account_footer"> <template id="account_financial_report_qweb.report_trial_balance_qweb_account_footer">
<!-- Display account footer --> <!-- Display account footer -->
<div class="act_as_table list_table" style="width: 1141px !important;">
<div class="act_as_table list_table" style="width: 100%;">
<div class="act_as_row labels" style="font-weight: bold;"> <div class="act_as_row labels" style="font-weight: bold;">
<!--## Account--> <!--## Account-->
<div class="act_as_cell left" style="width: 700px;"><span t-field="account.code"/> - <span t-field="account.name"/></div>
<div class="act_as_cell left" style="width: 61.44%;">
<t t-set="res_model" t-value="'account.account'"/>
<span>
<a t-att-data-active-id="account.account_id.id"
t-att-data-res-model="res_model"
class="o_account_financial_reports_web_action"
t-att-style="style">
<t t-att-style="style" t-raw="account.code"/> - <t t-att-style="style" t-raw="account.name"/></a>
</span>
</div>
<!--## Initial balance--> <!--## Initial balance-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.initial_balance"/></div>
<div class="act_as_cell amount" style="width: 9.64%;">
<t t-set="domain"
t-value="[('account_id', '=', account.account_id.id),
('date', '&lt;', o.date_from)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
t-att-style="style">
<t t-att-style="style" t-raw="account.initial_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</div>
<!--## Debit--> <!--## Debit-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.debit"/></div>
<div class="act_as_cell amount" style="width: 9.64%;">
<t t-set="domain"
t-value="[('account_id', '=', account.account_id.id),
('date', '&gt;=', account.report_id.date_from),
('date', '&lt;=', account.report_id.date_to),
('debit', '&lt;&gt;', 0)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
t-att-style="style">
<t t-att-style="style" t-raw="account.debit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</div>
<!--## Credit--> <!--## Credit-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.credit"/></div>
<div class="act_as_cell amount" style="width: 9.64%;">
<t t-set="domain"
t-value="[('account_id', '=', account.account_id.id),
('date', '&gt;=', account.report_id.date_from),
('date', '&lt;=', account.report_id.date_to),
('credit', '&lt;&gt;', 0)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
t-att-style="style">
<t t-att-style="style" t-raw="account.credit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</div>
<!--## Ending balance--> <!--## Ending balance-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.final_balance"/></div>
<div class="act_as_cell amount" style="width: 9.64%;">
<t t-set="domain"
t-value="[('account_id', '=', account.account_id.id)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
t-att-style="style" >
<t t-att-style="style" t-raw="account.final_balance" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
</span>
</div>
<t t-if="foreign_currency">
<t t-if="account.currency_id.id">
<!--## currency_name-->
<div class="act_as_cell" style="width: 4.43%;">
<t t-set="domain"
t-value="[('account_id', '=', account.account_id.id)]"/>
<span t-field="account.currency_id.display_name"/>
</div>
<!--## balance_currency-->
<div class="act_as_cell amount" style="width: 8.86%;">
<t t-set="domain"
t-value="[('account_id', '=', account.account_id.id),
('date', '&lt;', o.date_from)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
t-att-style="style">
<t t-att-style="style" t-raw="account.initial_balance_foreign_currency" t-options="{'widget': 'monetary', 'display_currency': account.account_id.currency_id}"/></a>
</span>
</div>
<div class="act_as_cell amount" style="width: 8.86%;">
<t t-set="domain"
t-value="[('account_id', '=', account.account_id.id)]"/>
<span>
<a t-att-data-domain="domain"
t-att-data-res-model="'account.move.line'"
class="o_account_financial_reports_web_action_monetary_multi"
t-att-style="style" >
<t t-att-style="style" t-raw="account.final_balance_foreign_currency" t-options="{'widget': 'monetary', 'display_currency': account.account_id.currency_id}"/></a>
</span>
</div>
</t>
<t t-if="not account.currency_id.id">
<div class="act_as_cell" style="width: 4.43%;"/>
<div class="act_as_cell" style="width: 8.86%;"/>
<div class="act_as_cell" style="width: 8.86%;"/>
</t>
</t>
</div> </div>
</div> </div>
</template> </template>

88
account_financial_report_qweb/report/trial_balance.py

@ -24,6 +24,7 @@ class TrialBalanceReport(models.TransientModel):
fy_start_date = fields.Date() fy_start_date = fields.Date()
only_posted_moves = fields.Boolean() only_posted_moves = fields.Boolean()
hide_account_balance_at_0 = fields.Boolean() hide_account_balance_at_0 = fields.Boolean()
foreign_currency = fields.Boolean()
company_id = fields.Many2one(comodel_name='res.company') company_id = fields.Many2one(comodel_name='res.company')
filter_account_ids = fields.Many2many(comodel_name='account.account') filter_account_ids = fields.Many2many(comodel_name='account.account')
filter_partner_ids = fields.Many2many(comodel_name='res.partner') filter_partner_ids = fields.Many2many(comodel_name='res.partner')
@ -53,6 +54,10 @@ class TrialBalanceReportAccount(models.TransientModel):
index=True index=True
) )
# Data fields, used to keep link with real object
sequence = fields.Integer(index=True, default=0)
level = fields.Integer(index=True, default=0)
# Data fields, used to keep link with real object # Data fields, used to keep link with real object
account_id = fields.Many2one( account_id = fields.Many2one(
'account.account', 'account.account',
@ -67,7 +72,7 @@ class TrialBalanceReportAccount(models.TransientModel):
initial_balance_foreign_currency = fields.Float(digits=(16, 2)) initial_balance_foreign_currency = fields.Float(digits=(16, 2))
debit = fields.Float(digits=(16, 2)) debit = fields.Float(digits=(16, 2))
credit = fields.Float(digits=(16, 2)) credit = fields.Float(digits=(16, 2))
currency_name = fields.Char()
currency_id = fields.Many2one(comodel_name='res.currency')
final_balance = fields.Float(digits=(16, 2)) final_balance = fields.Float(digits=(16, 2))
final_balance_foreign_currency = fields.Float(digits=(16, 2)) final_balance_foreign_currency = fields.Float(digits=(16, 2))
@ -98,10 +103,12 @@ class TrialBalanceReportPartner(models.TransientModel):
name = fields.Char() name = fields.Char()
initial_balance = fields.Float(digits=(16, 2)) initial_balance = fields.Float(digits=(16, 2))
initial_balance_foreign_currency = fields.Float(digits=(16, 2))
debit = fields.Float(digits=(16, 2)) debit = fields.Float(digits=(16, 2))
credit = fields.Float(digits=(16, 2)) credit = fields.Float(digits=(16, 2))
currency_name = fields.Char()
currency_id = fields.Many2one(comodel_name='res.currency')
final_balance = fields.Float(digits=(16, 2)) final_balance = fields.Float(digits=(16, 2))
final_balance_foreign_currency = fields.Float(digits=(16, 2))
@api.model @api.model
def _generate_order_by(self, order_spec, query): def _generate_order_by(self, order_spec, query):
@ -125,10 +132,9 @@ class TrialBalanceReportCompute(models.TransientModel):
_inherit = 'report_trial_balance_qweb' _inherit = 'report_trial_balance_qweb'
@api.multi @api.multi
def print_report(self, xlsx_report=False):
def print_report(self, report_type):
self.ensure_one() self.ensure_one()
self.compute_data_for_report()
if xlsx_report:
if report_type == 'xlsx':
report_name = 'account_financial_report_qweb.' \ report_name = 'account_financial_report_qweb.' \
'report_trial_balance_xlsx' 'report_trial_balance_xlsx'
else: else:
@ -137,15 +143,32 @@ class TrialBalanceReportCompute(models.TransientModel):
return self.env['report'].get_action(docids=self.ids, return self.env['report'].get_action(docids=self.ids,
report_name=report_name) report_name=report_name)
def _prepare_report_general_ledger(self):
def _get_html(self):
result = {}
rcontext = {}
context = dict(self.env.context)
report = self.browse(context.get('active_id'))
if report:
rcontext['o'] = report
result['html'] = self.env.ref(
'account_financial_report_qweb.'
'report_trial_balance_html').render(rcontext)
return result
@api.model
def get_html(self, given_context=None):
return self._get_html()
def _prepare_report_general_ledger(self, account_ids):
self.ensure_one() self.ensure_one()
return { return {
'date_from': self.date_from, 'date_from': self.date_from,
'date_to': self.date_to, 'date_to': self.date_to,
'only_posted_moves': self.only_posted_moves, 'only_posted_moves': self.only_posted_moves,
'hide_account_balance_at_0': self.hide_account_balance_at_0, 'hide_account_balance_at_0': self.hide_account_balance_at_0,
'foreign_currency': self.foreign_currency,
'company_id': self.company_id.id, 'company_id': self.company_id.id,
'filter_account_ids': [(6, 0, self.filter_account_ids.ids)],
'filter_account_ids': [(6, 0, account_ids.ids)],
'filter_partner_ids': [(6, 0, self.filter_partner_ids.ids)], 'filter_partner_ids': [(6, 0, self.filter_partner_ids.ids)],
'fy_start_date': self.fy_start_date, 'fy_start_date': self.fy_start_date,
} }
@ -157,21 +180,26 @@ class TrialBalanceReportCompute(models.TransientModel):
# The data of Trial Balance Report # The data of Trial Balance Report
# are based on General Ledger Report data. # are based on General Ledger Report data.
model = self.env['report_general_ledger_qweb'] model = self.env['report_general_ledger_qweb']
if self.filter_account_ids:
account_ids = self.filter_account_ids
else:
account_ids = self.env['account.account'].search(
[('company_id', '=', self.company_id.id)])
self.general_ledger_id = model.create( self.general_ledger_id = model.create(
self._prepare_report_general_ledger()
self._prepare_report_general_ledger(account_ids)
) )
self.general_ledger_id.compute_data_for_report( self.general_ledger_id.compute_data_for_report(
with_line_details=False, with_partners=self.show_partner_details with_line_details=False, with_partners=self.show_partner_details
) )
# Compute report data # Compute report data
self._inject_account_values()
self._inject_account_values(account_ids)
if self.show_partner_details: if self.show_partner_details:
self._inject_partner_values() self._inject_partner_values()
# Refresh cache because all data are computed with SQL requests # Refresh cache because all data are computed with SQL requests
self.invalidate_cache() self.invalidate_cache()
def _inject_account_values(self):
def _inject_account_values(self, account_ids):
"""Inject report values for report_trial_balance_qweb_account""" """Inject report values for report_trial_balance_qweb_account"""
query_inject_account = """ query_inject_account = """
INSERT INTO INSERT INTO
@ -187,7 +215,7 @@ INSERT INTO
debit, debit,
credit, credit,
final_balance, final_balance,
currency_name,
currency_id,
initial_balance_foreign_currency, initial_balance_foreign_currency,
final_balance_foreign_currency final_balance_foreign_currency
) )
@ -195,25 +223,33 @@ SELECT
%s AS report_id, %s AS report_id,
%s AS create_uid, %s AS create_uid,
NOW() AS create_date, NOW() AS create_date,
rag.account_id,
rag.code,
rag.name,
rag.initial_balance AS initial_balance,
rag.final_debit - rag.initial_debit AS debit,
rag.final_credit - rag.initial_credit AS credit,
rag.final_balance AS final_balance,
rag.currency_name AS currency_name,
rag.initial_balance_foreign_currency AS initial_balance_foreign_currency,
rag.final_balance_foreign_currency AS final_balance_foreign_currency
acc.id,
acc.code,
acc.name,
coalesce(rag.initial_balance, 0) AS initial_balance,
coalesce(rag.final_debit - rag.initial_debit, 0) AS debit,
coalesce(rag.final_credit - rag.initial_credit, 0) AS credit,
coalesce(rag.final_balance, 0) AS final_balance,
rag.currency_id AS currency_id,
coalesce(rag.initial_balance_foreign_currency, 0)
AS initial_balance_foreign_currency,
coalesce(rag.final_balance_foreign_currency, 0)
AS final_balance_foreign_currency
FROM FROM
report_general_ledger_qweb_account rag
account_account acc
LEFT OUTER JOIN report_general_ledger_qweb_account AS rag
ON rag.account_id = acc.id AND rag.report_id = %s
WHERE WHERE
rag.report_id = %s
acc.id in %s
""" """
if self.hide_account_balance_at_0:
query_inject_account += """ AND
final_balance IS NOT NULL AND final_balance != 0"""
query_inject_account_params = ( query_inject_account_params = (
self.id, self.id,
self.env.uid, self.env.uid,
self.general_ledger_id.id, self.general_ledger_id.id,
account_ids._ids,
) )
self.env.cr.execute(query_inject_account, query_inject_account_params) self.env.cr.execute(query_inject_account, query_inject_account_params)
@ -229,10 +265,11 @@ INSERT INTO
partner_id, partner_id,
name, name,
initial_balance, initial_balance,
initial_balance_foreign_currency,
debit, debit,
credit, credit,
final_balance, final_balance,
currency_name
final_balance_foreign_currency
) )
SELECT SELECT
ra.id AS report_account_id, ra.id AS report_account_id,
@ -241,10 +278,11 @@ SELECT
rpg.partner_id, rpg.partner_id,
rpg.name, rpg.name,
rpg.initial_balance AS initial_balance, rpg.initial_balance AS initial_balance,
rpg.initial_balance_foreign_currency AS initial_balance_foreign_currency,
rpg.final_debit - rpg.initial_debit AS debit, rpg.final_debit - rpg.initial_debit AS debit,
rpg.final_credit - rpg.initial_credit AS credit, rpg.final_credit - rpg.initial_credit AS credit,
rpg.final_balance AS final_balance, rpg.final_balance AS final_balance,
rpg.currency_name AS currency_name
rpg.final_balance_foreign_currency AS final_balance_foreign_currency
FROM FROM
report_general_ledger_qweb_partner rpg report_general_ledger_qweb_partner rpg
INNER JOIN INNER JOIN

67
account_financial_report_qweb/report/trial_balance_xlsx.py

@ -20,7 +20,7 @@ class TrialBalanceXslx(abstract_report_xlsx.AbstractReportXslx):
def _get_report_columns(self, report): def _get_report_columns(self, report):
if not report.show_partner_details: if not report.show_partner_details:
return {
res = {
0: {'header': _('Code'), 'field': 'code', 'width': 10}, 0: {'header': _('Code'), 'field': 'code', 'width': 10},
1: {'header': _('Account'), 'field': 'name', 'width': 60}, 1: {'header': _('Account'), 'field': 'name', 'width': 60},
2: {'header': _('Initial balance'), 2: {'header': _('Initial balance'),
@ -40,8 +40,25 @@ class TrialBalanceXslx(abstract_report_xlsx.AbstractReportXslx):
'type': 'amount', 'type': 'amount',
'width': 14}, 'width': 14},
} }
if report.foreign_currency:
foreign_currency = {
6: {'header': _('Cur.'),
'field': 'currency_id',
'field_currency_balance': 'currency_id',
'type': 'many2one', 'width': 7},
7: {'header': _('Initial balance'),
'field': 'initial_balance_foreign_currency',
'type': 'amount_currency',
'width': 14},
8: {'header': _('Ending balance'),
'field': 'final_balance_foreign_currency',
'type': 'amount_currency',
'width': 14},
}
res = dict(res.items() + foreign_currency.items())
return res
else: else:
return {
res = {
0: {'header': _('Partner'), 'field': 'name', 'width': 70}, 0: {'header': _('Partner'), 'field': 'name', 'width': 70},
1: {'header': _('Initial balance'), 1: {'header': _('Initial balance'),
'field': 'initial_balance', 'field': 'initial_balance',
@ -60,6 +77,23 @@ class TrialBalanceXslx(abstract_report_xlsx.AbstractReportXslx):
'type': 'amount', 'type': 'amount',
'width': 14}, 'width': 14},
} }
if report.foreign_currency:
foreign_currency = {
5: {'header': _('Cur.'),
'field': 'currency_id',
'field_currency_balance': 'currency_id',
'type': 'many2one', 'width': 7},
6: {'header': _('Initial balance'),
'field': 'initial_balance_foreign_currency',
'type': 'amount_currency',
'width': 14},
7: {'header': _('Ending balance'),
'field': 'final_balance_foreign_currency',
'type': 'amount_currency',
'width': 14},
}
res = dict(res.items() + foreign_currency.items())
return res
def _get_report_filters(self, report): def _get_report_filters(self, report):
return [ return [
@ -70,6 +104,8 @@ class TrialBalanceXslx(abstract_report_xlsx.AbstractReportXslx):
else _('All entries')], else _('All entries')],
[_('Account balance at 0 filter'), [_('Account balance at 0 filter'),
_('Hide') if report.hide_account_balance_at_0 else _('Show')], _('Hide') if report.hide_account_balance_at_0 else _('Show')],
[_('Show foreign currency'),
_('Yes') if report.foreign_currency else _('No')],
] ]
def _get_col_count_filter_name(self): def _get_col_count_filter_name(self):
@ -88,7 +124,7 @@ class TrialBalanceXslx(abstract_report_xlsx.AbstractReportXslx):
for account in report.account_ids: for account in report.account_ids:
if not report.show_partner_details: if not report.show_partner_details:
# Display account lines # Display account lines
self.write_line(account)
self.write_line(account, 'account')
else: else:
# Write account title # Write account title
@ -100,7 +136,7 @@ class TrialBalanceXslx(abstract_report_xlsx.AbstractReportXslx):
# For each partner # For each partner
for partner in account.partner_ids: for partner in account.partner_ids:
# Display partner lines # Display partner lines
self.write_line(partner)
self.write_line(partner, 'partner')
# Display account footer line # Display account footer line
self.write_account_footer(account, self.write_account_footer(account,
@ -109,8 +145,19 @@ class TrialBalanceXslx(abstract_report_xlsx.AbstractReportXslx):
# Line break # Line break
self.row_pos += 2 self.row_pos += 2
def write_line(self, line_object, type_object):
"""Write a line on current line using all defined columns field name.
Columns are defined with `_get_report_columns` method.
"""
if type_object == 'partner':
line_object.currency_id = line_object.report_account_id.currency_id
elif type_object == 'account':
line_object.currency_id = line_object.currency_id
super(TrialBalanceXslx, self).write_line(line_object)
def write_account_footer(self, account, name_value): def write_account_footer(self, account, name_value):
"""Specific function to write account footer for Trial Balance""" """Specific function to write account footer for Trial Balance"""
format_amt = self._get_currency_amt_header_format(account)
for col_pos, column in self.columns.iteritems(): for col_pos, column in self.columns.iteritems():
if column['field'] == 'name': if column['field'] == 'name':
value = name_value value = name_value
@ -123,6 +170,18 @@ class TrialBalanceXslx(abstract_report_xlsx.AbstractReportXslx):
elif cell_type == 'amount': elif cell_type == 'amount':
self.sheet.write_number(self.row_pos, col_pos, float(value), self.sheet.write_number(self.row_pos, col_pos, float(value),
self.format_header_amount) self.format_header_amount)
elif cell_type == 'many2one':
self.sheet.write_string(
self.row_pos, col_pos, value.name or '',
self.format_header_right)
elif cell_type == 'amount_currency' and account.currency_id:
self.sheet.write_number(
self.row_pos, col_pos, float(value),
format_amt)
else:
self.sheet.write_string(
self.row_pos, col_pos, '',
self.format_header_right)
self.row_pos += 1 self.row_pos += 1

47
account_financial_report_qweb/reports.xml

@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<!-- PDF REPORTS -->
<!-- PDF/HMTL REPORTS -->
<!-- General Ledger -->
<report <report
id="action_report_general_ledger_qweb" id="action_report_general_ledger_qweb"
model="report_general_ledger_qweb" model="report_general_ledger_qweb"
@ -12,6 +13,15 @@
file="account_financial_report_qweb.report_general_ledger_qweb" file="account_financial_report_qweb.report_general_ledger_qweb"
/> />
<report
id="action_report_general_ledger_html"
model="report_general_ledger_qweb"
string="General Ledger"
report_type="qweb-html"
name="account_financial_report_qweb.report_general_ledger_html"
file="account_financial_report_qweb.report_general_ledger_html"
/>
<report <report
id="action_report_journal_qweb" id="action_report_journal_qweb"
model="report_journal_qweb" model="report_journal_qweb"
@ -21,6 +31,15 @@
file="account_financial_report_qweb.report_journal_qweb" file="account_financial_report_qweb.report_journal_qweb"
/> />
<report
id="action_report_journal_html"
model="report_journal_qweb"
string="Journal"
report_type="qweb-html"
name="account_financial_report_qweb.report_journal_html"
file="account_financial_report_qweb.report_journal_html"
/>
<report <report
id="action_report_trial_balance_qweb" id="action_report_trial_balance_qweb"
model="report_trial_balance_qweb" model="report_trial_balance_qweb"
@ -30,6 +49,15 @@
file="account_financial_report_qweb.report_trial_balance_qweb" file="account_financial_report_qweb.report_trial_balance_qweb"
/> />
<report
id="action_report_trial_balance_html"
model="report_trial_balance_qweb"
string="Trial Balance"
report_type="qweb-html"
name="account_financial_report_qweb.report_trial_balance_html"
file="account_financial_report_qweb.report_trial_balance_html"
/>
<report <report
id="action_report_open_items_qweb" id="action_report_open_items_qweb"
model="report_open_items_qweb" model="report_open_items_qweb"
@ -39,6 +67,15 @@
file="account_financial_report_qweb.report_open_items_qweb" file="account_financial_report_qweb.report_open_items_qweb"
/> />
<report
id="action_report_open_items_html"
model="report_open_items_qweb"
string="Open Items"
report_type="qweb-html"
name="account_financial_report_qweb.report_open_items_html"
file="account_financial_report_qweb.report_open_items_html"
/>
<report <report
id="action_report_aged_partner_balance_qweb" id="action_report_aged_partner_balance_qweb"
model="report_aged_partner_balance_qweb" model="report_aged_partner_balance_qweb"
@ -48,6 +85,14 @@
file="account_financial_report_qweb.report_aged_partner_balance_qweb" file="account_financial_report_qweb.report_aged_partner_balance_qweb"
/> />
<report
id="action_report_aged_partner_balance_html"
model="report_aged_partner_balance_qweb"
string="Aged Partner Balance"
report_type="qweb-html"
name="account_financial_report_qweb.report_aged_partner_balance_html"
file="account_financial_report_qweb.report_aged_partner_balance_html"
/>
<!-- PDF REPORTS : paperformat --> <!-- PDF REPORTS : paperformat -->
<record id="report_qweb_paperformat" model="report.paperformat"> <record id="report_qweb_paperformat" model="report.paperformat">

14
account_financial_report_qweb/static/src/css/report.css

@ -75,7 +75,6 @@ body, table, td, span, div {
text-align:right; text-align:right;
} }
.list_table .act_as_cell{ .list_table .act_as_cell{
padding-left: 5px;
/* border-right:1px solid lightGrey; uncomment to active column lines */ /* border-right:1px solid lightGrey; uncomment to active column lines */
} }
.list_table .act_as_cell.first_column { .list_table .act_as_cell.first_column {
@ -93,3 +92,16 @@ body, table, td, span, div {
.page_break { .page_break {
page-break-inside: avoid; page-break-inside: avoid;
} }
.button_row {
padding-bottom: 10px;
}
.o_account_financial_reports_page {
background-color: @odoo-view-background-color;
color: @odoo-main-text-color;
padding-top: 10px;
width: 90%;
margin-right: auto;
margin-left: auto;
}

95
account_financial_report_qweb/static/src/js/account_financial_report_qweb_backend.js

@ -0,0 +1,95 @@
odoo.define('account_financial_report_qweb.account_financial_report_backend', function (require) {
'use strict';
var core = require('web.core');
var Widget = require('web.Widget');
var ControlPanelMixin = require('web.ControlPanelMixin');
var ReportWidget = require('account_financial_report_qweb.account_financial_report_widget');
var Model = require('web.Model');
var report_backend = Widget.extend(ControlPanelMixin, {
// Stores all the parameters of the action.
events: {
'click .o_account_financial_reports_print': 'print',
'click .o_account_financial_reports_export': 'export',
},
init: function(parent, action) {
this.actionManager = parent;
this.given_context = {};
this.odoo_context = action.context;
this.controller_url = action.context.url;
if (action.context.context) {
this.given_context = action.context.context;
}
this.given_context.active_id = action.context.active_id || action.params.active_id;
this.given_context.model = action.context.active_model || false;
this.given_context.ttype = action.context.ttype || false;
return this._super.apply(this, arguments);
},
willStart: function() {
return $.when(this.get_html());
},
set_html: function() {
var self = this;
var def = $.when();
if (!this.report_widget) {
this.report_widget = new ReportWidget(this, this.given_context);
def = this.report_widget.appendTo(this.$el);
}
def.then(function () {
self.report_widget.$el.html(self.html);
});
},
start: function() {
this.set_html();
return this._super();
},
// Fetches the html and is previous report.context if any, else create it
get_html: function() {
var self = this;
var defs = [];
self.model = new Model(this.given_context.model);
return self.model.call('get_html', [this.given_context], {context: self.odoo_context}).then(function
(result) {
self.html = result.html;
defs.push(self.update_cp());
return $.when.apply($, defs);
});
},
// Updates the control panel and render the elements that have yet to be rendered
update_cp: function() {
if (!this.$buttons) {
}
var status = {
breadcrumbs: this.actionManager.get_breadcrumbs(),
cp_content: {$buttons: this.$buttons},
};
return this.update_control_panel(status);
},
do_show: function() {
this._super();
this.update_cp();
},
print: function() {
var self = this;
self.model = new Model(this.given_context.model);
self.model.call('print_report', [this.given_context.active_id, 'qweb-pdf'], {context: self.odoo_context})
.then(function(result){
self.do_action(result);
});
},
export: function() {
var self = this;
self.model = new Model(this.given_context.model);
self.model.call('print_report', [this.given_context.active_id, 'xlsx'], {context: self.odoo_context})
.then(function(result){
self.do_action(result);
});
},
});
core.action_registry.add("account_financial_report_backend", report_backend);
return report_backend;
});

69
account_financial_report_qweb/static/src/js/account_financial_report_qweb_widgets.js

@ -0,0 +1,69 @@
odoo.define('account_financial_report_qweb.account_financial_report_widget', function
(require) {
'use strict';
var Widget = require('web.Widget');
var accountFinancialReportWidget = Widget.extend({
events: {
'click .o_account_financial_reports_web_action': 'boundLink',
'click .o_account_financial_reports_web_action_multi': 'boundLinkmulti',
'click .o_account_financial_reports_web_action_monetary': 'boundLinkMonetary',
'click .o_account_financial_reports_web_action_monetary_multi': 'boundLinkMonetarymulti',
},
init: function() {
this._super.apply(this, arguments);
},
start: function() {
return this._super.apply(this, arguments);
},
boundLink: function(e) {
var res_model = $(e.target).data('res-model');
var res_id = $(e.target).data('active-id');
return this.do_action({
type: 'ir.actions.act_window',
res_model: res_model,
res_id: res_id,
views: [[false, 'form']],
target: 'current'
});
},
boundLinkmulti: function(e) {
var res_model = $(e.target).data('res-model');
var domain = $(e.target).data('domain');
return this.do_action({
type: 'ir.actions.act_window',
res_model: res_model,
domain: domain,
views: [[false, "list"], [false, "form"]],
target: 'current'
});
},
boundLinkMonetary: function(e) {
var res_model = $(e.target.parentElement).data('res-model');
var res_id = $(e.target.parentElement).data('active-id');
return this.do_action({
type: 'ir.actions.act_window',
res_model: res_model,
res_id: res_id,
views: [[false, 'form']],
target: 'current'
});
},
boundLinkMonetarymulti: function(e) {
var res_model = $(e.target.parentElement).data('res-model');
var domain = $(e.target.parentElement).data('domain');
return this.do_action({
type: 'ir.actions.act_window',
res_model: res_model,
domain: domain,
views: [[false, "list"], [false, "form"]],
target: 'current'
});
},
});
return accountFinancialReportWidget;
});

1
account_financial_report_qweb/tests/__init__.py

@ -3,6 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).- # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).-
from . import abstract_test from . import abstract_test
from . import abstract_test_foreign_currency
from . import test_aged_partner_balance from . import test_aged_partner_balance
from . import test_general_ledger from . import test_general_ledger
from . import test_journal from . import test_journal

281
account_financial_report_qweb/tests/abstract_test.py

@ -3,75 +3,250 @@
# Copyright 2016 Camptocamp SA # Copyright 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests.common import TransactionCase
import logging
from odoo.tests import common
from odoo.tools import test_reports
class AbstractTest(TransactionCase):
_logger = logging.getLogger(__name__)
class AbstractTest(common.TransactionCase):
"""Common technical tests for all reports.""" """Common technical tests for all reports."""
at_install = True
post_install = True
accounts = {}
def with_context(self, *args, **kwargs):
context = dict(args[0] if args else self.env.context, **kwargs)
self.env = self.env(context=context)
return self
def _chart_template_create(self):
transfer_account_id = self.env['account.account.template'].create({
'code': '000',
'name': 'Liquidity Transfers',
'reconcile': True,
'user_type_id': self.ref(
"account.data_account_type_current_assets"),
})
self.chart = self.env['account.chart.template'].create({
'name': 'Test COA',
'code_digits': 4,
'bank_account_code_prefix': 1014,
'cash_account_code_prefix': 1014,
'currency_id': self.ref('base.USD'),
'transfer_account_id': transfer_account_id.id,
})
transfer_account_id.update({
'chart_template_id': self.chart.id,
})
self.env['ir.model.data'].create({
'res_id': transfer_account_id.id,
'model': transfer_account_id._name,
'name': 'Liquidity Transfers',
})
act = self.env['account.account.template'].create({
'code': '001',
'name': 'Expenses',
'user_type_id': self.ref("account.data_account_type_expenses"),
'chart_template_id': self.chart.id,
'reconcile': True,
})
self.env['ir.model.data'].create({
'res_id': act.id,
'model': act._name,
'name': 'expenses',
})
act = self.env['account.account.template'].create({
'code': '002',
'name': 'Product Sales',
'user_type_id': self.ref("account.data_account_type_revenue"),
'chart_template_id': self.chart.id,
'reconcile': True,
})
self.env['ir.model.data'].create({
'res_id': act.id,
'model': act._name,
'name': 'sales',
})
act = self.env['account.account.template'].create({
'code': '003',
'name': 'Account Receivable',
'user_type_id': self.ref("account.data_account_type_receivable"),
'chart_template_id': self.chart.id,
'reconcile': True,
})
self.env['ir.model.data'].create({
'res_id': act.id,
'model': act._name,
'name': 'receivable',
})
act = self.env['account.account.template'].create({
'code': '004',
'name': 'Account Payable',
'user_type_id': self.ref("account.data_account_type_payable"),
'chart_template_id': self.chart.id,
'reconcile': True,
})
self.env['ir.model.data'].create({
'res_id': act.id,
'model': act._name,
'name': 'payable',
})
def _add_chart_of_accounts(self):
self.company = self.env['res.company'].create({
'name': 'Spanish test company',
})
self.env.ref('base.group_multi_company').write({
'users': [(4, self.env.uid)],
})
self.env.user.write({
'company_ids': [(4, self.company.id)],
'company_id': self.company.id,
})
self.with_context(
company_id=self.company.id, force_company=self.company.id)
wizard = self.env['wizard.multi.charts.accounts'].create({
'company_id': self.company.id,
'chart_template_id': self.chart.id,
'code_digits': 4,
'currency_id': self.ref('base.USD'),
'transfer_account_id': self.chart.transfer_account_id.id,
})
wizard.onchange_chart_template_id()
wizard.execute()
self.revenue = self.env['account.account'].search(
[('user_type_id', '=', self.ref(
"account.data_account_type_revenue"))], limit=1)
self.expense = self.env['account.account'].search(
[('user_type_id', '=', self.ref(
"account.data_account_type_expenses"))], limit=1)
self.receivable = self.env['account.account'].search(
[('user_type_id', '=', self.ref(
"account.data_account_type_receivable"))], limit=1)
self.payable = self.env['account.account'].search(
[('user_type_id', '=', self.ref(
"account.data_account_type_payable"))], limit=1)
return True
def setUp(cls):
super(AbstractTest, cls).setUp()
def _journals_create(self):
self.journal_sale = self.env['account.journal'].create({
'company_id': self.company.id,
'name': 'Test journal for sale',
'type': 'sale',
'code': 'TSALE',
'default_debit_account_id': self.revenue.id,
'default_credit_account_id': self.revenue.id,
})
self.journal_purchase = self.env['account.journal'].create({
'company_id': self.company.id,
'name': 'Test journal for purchase',
'type': 'purchase',
'code': 'TPUR',
'default_debit_account_id': self.expense.id,
'default_credit_account_id': self.expense.id,
})
return True
cls.model = cls._getReportModel()
def _invoice_create(self):
self.partner = self.env['res.partner'].create({
'name': 'Test partner',
'company_id': self.company.id,
'property_account_receivable_id': self.receivable.id,
'property_account_payable_id': self.payable.id,
})
cls.qweb_report_name = cls._getQwebReportName()
cls.xlsx_report_name = cls._getXlsxReportName()
cls.xlsx_action_name = cls._getXlsxReportActionName()
# customer invoice
customer_invoice_lines = [(0, False, {
'name': 'Test description #1',
'account_id': self.revenue.id,
'quantity': 1.0,
'price_unit': 100.0,
}), (0, False, {
'name': 'Test description #2',
'account_id': self.revenue.id,
'quantity': 2.0,
'price_unit': 25.0,
})]
self.invoice_out = self.env['account.invoice'].create({
'partner_id': self.partner.id,
'type': 'out_invoice',
'invoice_line_ids': customer_invoice_lines,
'account_id': self.partner.property_account_receivable_id.id,
'journal_id': self.journal_sale.id,
})
self.invoice_out.action_invoice_open()
# vendor bill
vendor_invoice_lines = [(0, False, {
'name': 'Test description #1',
'account_id': self.revenue.id,
'quantity': 1.0,
'price_unit': 100.0,
}), (0, False, {
'name': 'Test description #2',
'account_id': self.revenue.id,
'quantity': 2.0,
'price_unit': 25.0,
})]
self.invoice_in = self.env['account.invoice'].create({
'partner_id': self.partner.id,
'type': 'in_invoice',
'invoice_line_ids': vendor_invoice_lines,
'account_id': self.partner.property_account_payable_id.id,
'journal_id': self.journal_purchase.id,
})
self.invoice_in.action_invoice_open()
cls.report_title = cls._getReportTitle()
def setUp(self):
super(AbstractTest, self).setUp()
cls.base_filters = cls._getBaseFilters()
cls.additional_filters = cls._getAdditionalFiltersToBeTested()
self.with_context()
self._chart_template_create()
self._add_chart_of_accounts()
self._journals_create()
self._invoice_create()
cls.report = cls.model.create(cls.base_filters)
self.model = self._getReportModel()
def test_01_generation_report_qweb(self):
"""Check if report PDF/HTML is correctly generated"""
self.qweb_report_name = self._getQwebReportName()
self.xlsx_report_name = self._getXlsxReportName()
self.xlsx_action_name = self._getXlsxReportActionName()
# Check if returned report action is correct
report_action = self.report.print_report()
self.assertDictContainsSubset(
{
'type': 'ir.actions.report.xml',
'report_name': self.qweb_report_name,
'report_type': 'qweb-pdf',
},
report_action
)
self.report_title = self._getReportTitle()
# Check if report template is correct
report_html = self.env['report'].get_html(
self.report.id, self.qweb_report_name
)
self.assertTrue(self.report_title.encode('utf8') in report_html)
self.assertTrue(
self.report.account_ids[0].name.encode('utf8') in report_html
)
self.base_filters = self._getBaseFilters()
self.additional_filters = self._getAdditionalFiltersToBeTested()
def test_02_generation_report_xlsx(self):
"""Check if report XLSX is correctly generated"""
# Check if returned report action is correct
report_action = self.report.print_report(xlsx_report=True)
self.assertDictContainsSubset(
{
'type': 'ir.actions.report.xml',
'report_name': self.xlsx_report_name,
'report_type': 'xlsx',
},
report_action
)
self.report = self.model.create(self.base_filters)
self.report.compute_data_for_report()
# Check if report template is correct
report_xlsx = self.env.ref(self.xlsx_action_name).render_report(
self.report.ids,
def test_html(self):
test_reports.try_report(self.env.cr, self.env.uid,
self.qweb_report_name,
[self.report.id],
report_type='qweb-html')
def test_qweb(self):
test_reports.try_report(self.env.cr, self.env.uid,
self.qweb_report_name,
[self.report.id],
report_type='qweb-pdf')
def test_xlsx(self):
test_reports.try_report(self.env.cr, self.env.uid,
self.xlsx_report_name, self.xlsx_report_name,
{'report_type': 'xlsx'}
)
self.assertGreaterEqual(len(report_xlsx[0]), 1)
self.assertEqual(report_xlsx[1], 'xlsx')
[self.report.id],
report_type='xlsx')
def test_print(self):
self.report.print_report('qweb')
self.report.print_report('xlsx')
def test_03_compute_data(self):
def test_04_compute_data(self):
"""Check that the SQL queries work with all filters options""" """Check that the SQL queries work with all filters options"""
for filters in [{}] + self.additional_filters: for filters in [{}] + self.additional_filters:

79
account_financial_report_qweb/tests/abstract_test_foreign_currency.py

@ -0,0 +1,79 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import logging
from . import abstract_test
_logger = logging.getLogger(__name__)
class AbstractTestForeignCurrency(abstract_test.AbstractTest):
"""Common technical tests for all reports."""
def _chart_template_create(self):
super(AbstractTestForeignCurrency, self)._chart_template_create()
# Account for foreign payments
self.account_type_other = self.env['account.account.type'].create(
{'name': 'foreign expenses',
'type': 'other',
})
act = self.env['account.account.template'].create({
'code': '0012',
'name': 'Foreign Expenses',
'user_type_id': self.account_type_other.id,
'chart_template_id': self.chart.id,
'currency_id': self.env.ref('base.EUR').id,
})
self.env['ir.model.data'].create({
'res_id': act.id,
'model': act._name,
'name': 'foreign expenses',
})
return True
def _add_chart_of_accounts(self):
super(AbstractTestForeignCurrency, self)._add_chart_of_accounts()
self.foreign_expense = self.env['account.account'].search(
[('currency_id', '=', self.env.ref('base.EUR').id)], limit=1)
self.foreign_currency_id = self.foreign_expense.currency_id
return True
def _journals_create(self):
super(AbstractTestForeignCurrency, self)._journals_create()
self.journal_foreign_purchases = self.env['account.journal'].create({
'company_id': self.company.id,
'name': 'Test journal for purchase',
'type': 'purchase',
'code': 'TFORPUR',
'default_debit_account_id': self.foreign_expense.id,
'default_credit_account_id': self.foreign_expense.id,
'currency_id': self.foreign_currency_id.id,
})
return True
def _invoice_create(self):
super(AbstractTestForeignCurrency, self)._invoice_create()
# vendor bill foreign currency
foreign_vendor_invoice_lines = [(0, False, {
'name': 'Test description #1',
'account_id': self.revenue.id,
'quantity': 1.0,
'price_unit': 100.0,
'currency_id': self.foreign_currency_id.id,
}), (0, False, {
'name': 'Test description #2',
'account_id': self.revenue.id,
'quantity': 2.0,
'price_unit': 25.0,
'currency_id': self.foreign_currency_id.id,
})]
self.foreign_invoice_in = self.env['account.invoice'].create({
'partner_id': self.partner.id,
'type': 'in_invoice',
'invoice_line_ids': foreign_vendor_invoice_lines,
'account_id': self.partner.property_account_payable_id.id,
'journal_id': self.journal_foreign_purchases.id,
})
self.foreign_invoice_in.action_invoice_open()
return True

2
account_financial_report_qweb/tests/test_aged_partner_balance.py

@ -31,7 +31,7 @@ class TestAgedPartnerBalance(abstract_test.AbstractTest):
def _getBaseFilters(self): def _getBaseFilters(self):
return { return {
'date_at': time.strftime('%Y-12-31'), 'date_at': time.strftime('%Y-12-31'),
'company_id': self.env.ref('base.main_company').id,
'company_id': self.company.id,
} }
def _getAdditionalFiltersToBeTested(self): def _getAdditionalFiltersToBeTested(self):

14
account_financial_report_qweb/tests/test_general_ledger.py

@ -4,11 +4,12 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import time import time
from . import abstract_test
from odoo.tests.common import TransactionCase
from odoo.tests import common
from . import abstract_test_foreign_currency as a_t_f_c
class TestGeneralLedger(abstract_test.AbstractTest):
class TestGeneralLedger(a_t_f_c.AbstractTestForeignCurrency):
""" """
Technical tests for General Ledger Report. Technical tests for General Ledger Report.
""" """
@ -33,8 +34,9 @@ class TestGeneralLedger(abstract_test.AbstractTest):
return { return {
'date_from': time.strftime('%Y-01-01'), 'date_from': time.strftime('%Y-01-01'),
'date_to': time.strftime('%Y-12-31'), 'date_to': time.strftime('%Y-12-31'),
'company_id': self.env.ref('base.main_company').id,
'company_id': self.company.id,
'fy_start_date': time.strftime('%Y-01-01'), 'fy_start_date': time.strftime('%Y-01-01'),
'foreign_currency': True,
} }
def _getAdditionalFiltersToBeTested(self): def _getAdditionalFiltersToBeTested(self):
@ -53,7 +55,9 @@ class TestGeneralLedger(abstract_test.AbstractTest):
] ]
class TestGeneralLedgerReport(TransactionCase):
@common.at_install(False)
@common.post_install(True)
class TestGeneralLedgerReport(common.TransactionCase):
def setUp(self): def setUp(self):
super(TestGeneralLedgerReport, self).setUp() super(TestGeneralLedgerReport, self).setUp()

45
account_financial_report_qweb/tests/test_journal.py

@ -2,12 +2,57 @@
# Copyright 2017 ACSONE SA/NV # Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import time
from datetime import datetime from datetime import datetime
from dateutil.relativedelta import relativedelta from dateutil.relativedelta import relativedelta
from odoo.fields import Date from odoo.fields import Date
from odoo.tests.common import TransactionCase from odoo.tests.common import TransactionCase
from . import abstract_test_foreign_currency as a_t_f_c
class TestJournalLedger(a_t_f_c.AbstractTestForeignCurrency):
"""
Technical tests for General Ledger Report.
"""
def _getReportModel(self):
return self.env['report_journal_qweb']
def _getQwebReportName(self):
return 'account_financial_report_qweb.report_journal_qweb'
def _getXlsxReportName(self):
return 'account_financial_report_qweb.report_journal_xlsx'
def _getXlsxReportActionName(self):
return 'account_financial_report_qweb.' \
'action_report_journal_ledger'
def _getReportTitle(self):
return 'Journal Ledger'
def _getBaseFilters(self):
return {
'date_from': time.strftime('%Y-01-01'),
'date_to': time.strftime('%Y-12-31'),
'company_id': self.company.id,
'journal_ids': [(6, 0, self.journal_sale.ids)]
}
def _getAdditionalFiltersToBeTested(self):
return [
{'move_target': "All",
'sort_option': "Date",
'group_option': "Journal",
'with_account_name': True,
'foreign_currency': True},
]
def test_04_compute_data(self):
return True
class TestJournalReport(TransactionCase): class TestJournalReport(TransactionCase):

7
account_financial_report_qweb/tests/test_open_items.py

@ -4,10 +4,10 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import time import time
from . import abstract_test
from . import abstract_test_foreign_currency as a_t_f_c
class TestOpenItems(abstract_test.AbstractTest):
class TestOpenItems(a_t_f_c.AbstractTestForeignCurrency):
""" """
Technical tests for Open Items Report. Technical tests for Open Items Report.
""" """
@ -30,7 +30,8 @@ class TestOpenItems(abstract_test.AbstractTest):
def _getBaseFilters(self): def _getBaseFilters(self):
return { return {
'date_at': time.strftime('%Y-12-31'), 'date_at': time.strftime('%Y-12-31'),
'company_id': self.env.ref('base.main_company').id,
'company_id': self.company.id,
'foreign_currency': True,
} }
def _getAdditionalFiltersToBeTested(self): def _getAdditionalFiltersToBeTested(self):

7
account_financial_report_qweb/tests/test_trial_balance.py

@ -4,10 +4,11 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import time import time
from . import abstract_test
from . import abstract_test_foreign_currency as a_t_f_c
class TestTrialBalance(abstract_test.AbstractTest):
class TestTrialBalance(a_t_f_c.AbstractTestForeignCurrency):
""" """
Technical tests for Trial Balance Report. Technical tests for Trial Balance Report.
""" """
@ -33,6 +34,8 @@ class TestTrialBalance(abstract_test.AbstractTest):
'date_to': time.strftime('%Y-12-31'), 'date_to': time.strftime('%Y-12-31'),
'company_id': self.env.ref('base.main_company').id, 'company_id': self.env.ref('base.main_company').id,
'fy_start_date': time.strftime('%Y-01-01'), 'fy_start_date': time.strftime('%Y-01-01'),
'foreign_currency': True,
'show_partner_details': True,
} }
def _getAdditionalFiltersToBeTested(self): def _getAdditionalFiltersToBeTested(self):

9
account_financial_report_qweb/view/report_aged_partner_balance.xml

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_aged_partner_balance_html">
<div class="o_account_financial_reports_page">
<t t-call="account_financial_report_qweb.report_buttons"/>
<t t-call="account_financial_report_qweb.report_aged_partner_balance_base"/>
</div>
</template>
</odoo>

9
account_financial_report_qweb/view/report_general_ledger.xml

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_general_ledger_html">
<div class="o_account_financial_reports_page">
<t t-call="account_financial_report_qweb.report_buttons"/>
<t t-call="account_financial_report_qweb.report_general_ledger_base"/>
</div>
</template>
</odoo>

9
account_financial_report_qweb/view/report_journal_ledger.xml

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_journal_html">
<div class="o_account_financial_reports_page">
<t t-call="account_financial_report_qweb.report_buttons"/>
<t t-call="account_financial_report_qweb.report_journal_qweb_base"/>
</div>
</template>
</odoo>

9
account_financial_report_qweb/view/report_open_items.xml

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_open_items_html">
<div class="o_account_financial_reports_page">
<t t-call="account_financial_report_qweb.report_buttons"/>
<t t-call="account_financial_report_qweb.report_open_items_base"/>
</div>
</template>
</odoo>

57
account_financial_report_qweb/view/report_template.xml

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="account_financial_report_assets_backend"
name="account_financial_report assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link href="/account_financial_report_qweb/static/src/css/report.css" rel="stylesheet"/>
<script type="text/javascript"
src="/account_financial_report_qweb/static/src/js/account_financial_report_qweb_backend.js"/>
<script type="text/javascript"
src="/account_financial_report_qweb/static/src/js/account_financial_report_qweb_widgets.js"/>
</xpath>
</template>
<template id="report_buttons">
<div class="button_row">
<button class="o_account_financial_reports_print btn btn-sm oe_button"><span class="fa fa-print"/> Print</button>
<button class="o_account_financial_reports_export btn btn-sm oe_button"><span class="fa fa-download"/> Export</button>
</div>
</template>
<record id="action_report_general_ledger" model="ir.actions.client">
<field name="name">General Ledger</field>
<field name="tag">account_financial_report_backend</field>
<field name="context" eval="{'active_model': 'report_general_ledger_qweb'}" />
</record>
<record id="action_report_journal_ledger" model="ir.actions.client">
<field name="name">Journal</field>
<field name="tag">account_financial_report_backend</field>
<field name="context" eval="{'active_model': 'report_journal_qweb'}" />
</record>
<record id="action_report_open_items" model="ir.actions.client">
<field name="name">Open Items</field>
<field name="tag">account_financial_report_backend</field>
<field name="context" eval="{'active_model': 'report_open_items_qweb'}" />
</record>
<record id="action_report_trial_balance" model="ir.actions.client">
<field name="name">Trial Balance</field>
<field name="tag">account_financial_report_backend</field>
<field name="context" eval="{'active_model': 'report_trial_balance_qweb'}" />
</record>
<record id="action_report_aged_partner_balance" model="ir.actions.client">
<field name="name">Aged Partner Balance</field>
<field name="tag">account_financial_report_backend</field>
<field name="context" eval="{'active_model': 'report_aged_partner_balance_qweb'}" />
</record>
<record id="action_report_vat_report" model="ir.actions.client">
<field name="name">VAT Report</field>
<field name="tag">account_financial_report_backend</field>
<field name="context" eval="{'active_model': 'report_vat_report'}" />
</record>
</odoo>

11
account_financial_report_qweb/view/report_trial_balance.xml

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_trial_balance_html">
<div class="o_account_financial_reports_page">
<t t-call="account_financial_report_qweb.report_buttons"/>
<t t-call="account_financial_report_qweb.report_trial_balance_base"/>
</div>
</template>
</odoo>

29
account_financial_report_qweb/wizard/aged_partner_balance_wizard.py

@ -6,6 +6,7 @@
from datetime import datetime from datetime import datetime
from odoo import api, fields, models from odoo import api, fields, models
from odoo.tools.safe_eval import safe_eval
class AgedPartnerBalance(models.TransientModel): class AgedPartnerBalance(models.TransientModel):
@ -53,15 +54,34 @@ class AgedPartnerBalance(models.TransientModel):
else: else:
self.account_ids = None self.account_ids = None
@api.multi
def button_export_html(self):
self.ensure_one()
action = self.env.ref(
'account_financial_report_qweb.action_report_aged_partner_balance')
vals = action.read()[0]
context1 = vals.get('context', {})
if isinstance(context1, basestring):
context1 = safe_eval(context1)
model = self.env['report_aged_partner_balance_qweb']
report = model.create(self._prepare_report_aged_partner_balance())
report.compute_data_for_report()
context1['active_id'] = report.id
context1['active_ids'] = report.ids
vals['context'] = context1
return vals
@api.multi @api.multi
def button_export_pdf(self): def button_export_pdf(self):
self.ensure_one() self.ensure_one()
return self._export()
report_type = 'qweb-pdf'
return self._export(report_type)
@api.multi @api.multi
def button_export_xlsx(self): def button_export_xlsx(self):
self.ensure_one() self.ensure_one()
return self._export(xlsx_report=True)
report_type = 'xlsx'
return self._export(report_type)
def _prepare_report_aged_partner_balance(self): def _prepare_report_aged_partner_balance(self):
self.ensure_one() self.ensure_one()
@ -74,8 +94,9 @@ class AgedPartnerBalance(models.TransientModel):
'show_move_line_details': self.show_move_line_details, 'show_move_line_details': self.show_move_line_details,
} }
def _export(self, xlsx_report=False):
def _export(self, report_type):
"""Default export is PDF.""" """Default export is PDF."""
model = self.env['report_aged_partner_balance_qweb'] model = self.env['report_aged_partner_balance_qweb']
report = model.create(self._prepare_report_aged_partner_balance()) report = model.create(self._prepare_report_aged_partner_balance())
return report.print_report(xlsx_report)
report.compute_data_for_report()
return report.print_report(report_type)

3
account_financial_report_qweb/wizard/aged_partner_balance_wizard_view.xml

@ -29,6 +29,9 @@
</group> </group>
<field name="account_ids" widget="many2many_tags" nolabel="1" options="{'no_create': True}"/> <field name="account_ids" widget="many2many_tags" nolabel="1" options="{'no_create': True}"/>
<footer> <footer>
<button name="button_export_html" string="View"
type="object" default_focus="1" class="oe_highlight"/>
or
<button name="button_export_pdf" string="Export PDF" type="object" default_focus="1" class="oe_highlight"/> <button name="button_export_pdf" string="Export PDF" type="object" default_focus="1" class="oe_highlight"/>
or or
<button name="button_export_xlsx" string="Export XLSX" type="object"/> <button name="button_export_xlsx" string="Export XLSX" type="object"/>

36
account_financial_report_qweb/wizard/general_ledger_wizard.py

@ -6,6 +6,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models, fields, api from odoo import models, fields, api
from odoo.tools.safe_eval import safe_eval
class GeneralLedgerReportWizard(models.TransientModel): class GeneralLedgerReportWizard(models.TransientModel):
@ -59,6 +60,12 @@ class GeneralLedgerReportWizard(models.TransientModel):
readonly=True, readonly=True,
string='Not only one unaffected earnings account' string='Not only one unaffected earnings account'
) )
foreign_currency = fields.Boolean(
string='Show foreign currency',
help='Display foreign currency for move lines, unless '
'account currency is not setup through chart of accounts '
'will display initial and final balance in that currency.'
)
@api.depends('date_from') @api.depends('date_from')
def _compute_fy_start_date(self): def _compute_fy_start_date(self):
@ -107,15 +114,34 @@ class GeneralLedgerReportWizard(models.TransientModel):
else: else:
self.receivable_accounts_only = self.payable_accounts_only = False self.receivable_accounts_only = self.payable_accounts_only = False
@api.multi
def button_export_html(self):
self.ensure_one()
action = self.env.ref(
'account_financial_report_qweb.action_report_general_ledger')
vals = action.read()[0]
context1 = vals.get('context', {})
if isinstance(context1, basestring):
context1 = safe_eval(context1)
model = self.env['report_general_ledger_qweb']
report = model.create(self._prepare_report_general_ledger())
report.compute_data_for_report()
context1['active_id'] = report.id
context1['active_ids'] = report.ids
vals['context'] = context1
return vals
@api.multi @api.multi
def button_export_pdf(self): def button_export_pdf(self):
self.ensure_one() self.ensure_one()
return self._export()
report_type = 'qweb-pdf'
return self._export(report_type)
@api.multi @api.multi
def button_export_xlsx(self): def button_export_xlsx(self):
self.ensure_one() self.ensure_one()
return self._export(xlsx_report=True)
report_type = 'xlsx'
return self._export(report_type)
def _prepare_report_general_ledger(self): def _prepare_report_general_ledger(self):
self.ensure_one() self.ensure_one()
@ -124,6 +150,7 @@ class GeneralLedgerReportWizard(models.TransientModel):
'date_to': self.date_to, 'date_to': self.date_to,
'only_posted_moves': self.target_move == 'posted', 'only_posted_moves': self.target_move == 'posted',
'hide_account_balance_at_0': self.hide_account_balance_at_0, 'hide_account_balance_at_0': self.hide_account_balance_at_0,
'foreign_currency': self.foreign_currency,
'company_id': self.company_id.id, 'company_id': self.company_id.id,
'filter_account_ids': [(6, 0, self.account_ids.ids)], 'filter_account_ids': [(6, 0, self.account_ids.ids)],
'filter_partner_ids': [(6, 0, self.partner_ids.ids)], 'filter_partner_ids': [(6, 0, self.partner_ids.ids)],
@ -132,8 +159,9 @@ class GeneralLedgerReportWizard(models.TransientModel):
'fy_start_date': self.fy_start_date, 'fy_start_date': self.fy_start_date,
} }
def _export(self, xlsx_report=False):
def _export(self, report_type):
"""Default export is PDF.""" """Default export is PDF."""
model = self.env['report_general_ledger_qweb'] model = self.env['report_general_ledger_qweb']
report = model.create(self._prepare_report_general_ledger()) report = model.create(self._prepare_report_general_ledger())
return report.print_report(xlsx_report)
report.compute_data_for_report()
return report.print_report(report_type)

4
account_financial_report_qweb/wizard/general_ledger_wizard_view.xml

@ -22,6 +22,7 @@
<field name="target_move" widget="radio"/> <field name="target_move" widget="radio"/>
<field name="centralize"/> <field name="centralize"/>
<field name="hide_account_balance_at_0"/> <field name="hide_account_balance_at_0"/>
<field name="foreign_currency"/>
</group> </group>
</group> </group>
<label for="cost_center_ids" groups="analytic.group_analytic_accounting"/> <label for="cost_center_ids" groups="analytic.group_analytic_accounting"/>
@ -45,6 +46,9 @@
</div> </div>
<footer> <footer>
<div attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', True)]}"> <div attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', True)]}">
<button name="button_export_html" string="View"
type="object" default_focus="1" class="oe_highlight"/>
or
<button name="button_export_pdf" string="Export PDF" type="object" default_focus="1" class="oe_highlight"/> <button name="button_export_pdf" string="Export PDF" type="object" default_focus="1" class="oe_highlight"/>
or or
<button name="button_export_xlsx" string="Export XLSX" type="object"/> <button name="button_export_xlsx" string="Export XLSX" type="object"/>

38
account_financial_report_qweb/wizard/journal_report_wizard.py

@ -3,6 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models, _ from odoo import api, fields, models, _
from odoo.tools.safe_eval import safe_eval
class JournalReportWizard(models.TransientModel): class JournalReportWizard(models.TransientModel):
@ -42,7 +43,7 @@ class JournalReportWizard(models.TransientModel):
default='all', default='all',
required=True, required=True,
) )
with_currency = fields.Boolean()
foreign_currency = fields.Boolean()
sort_option = fields.Selection( sort_option = fields.Selection(
selection='_get_sort_options', selection='_get_sort_options',
string="Sort entries by", string="Sort entries by",
@ -87,14 +88,33 @@ class JournalReportWizard(models.TransientModel):
self.date_to = self.date_range_id.date_end self.date_to = self.date_range_id.date_end
@api.multi @api.multi
def export_as_pdf(self):
def button_export_html(self):
self.ensure_one() self.ensure_one()
return self._export()
action = self.env.ref(
'account_financial_report_qweb.action_report_journal_ledger')
vals = action.read()[0]
context1 = vals.get('context', {})
if isinstance(context1, basestring):
context1 = safe_eval(context1)
model = self.env['report_journal_qweb']
report = model.create(self._prepare_report_journal())
report.compute_data_for_report()
context1['active_id'] = report.id
context1['active_ids'] = report.ids
vals['context'] = context1
return vals
@api.multi
def button_export_pdf(self):
self.ensure_one()
report_type = 'qweb-pdf'
return self._export(report_type)
@api.multi @api.multi
def export_as_xlsx(self):
def button_export_xlsx(self):
self.ensure_one() self.ensure_one()
return self._export(xlsx_report=True)
report_type = 'xlsx'
return self._export(report_type)
@api.multi @api.multi
def _prepare_report_journal(self): def _prepare_report_journal(self):
@ -103,7 +123,7 @@ class JournalReportWizard(models.TransientModel):
'date_from': self.date_from, 'date_from': self.date_from,
'date_to': self.date_to, 'date_to': self.date_to,
'move_target': self.move_target, 'move_target': self.move_target,
'with_currency': self.with_currency,
'foreign_currency': self.foreign_currency,
'company_id': self.company_id.id, 'company_id': self.company_id.id,
'journal_ids': [(6, 0, self.journal_ids.ids)], 'journal_ids': [(6, 0, self.journal_ids.ids)],
'sort_option': self.sort_option, 'sort_option': self.sort_option,
@ -112,8 +132,10 @@ class JournalReportWizard(models.TransientModel):
} }
@api.multi @api.multi
def _export(self, xlsx_report=False):
def _export(self, report_type):
"""Default export is PDF."""
self.ensure_one() self.ensure_one()
model = self.env['report_journal_qweb'] model = self.env['report_journal_qweb']
report = model.create(self._prepare_report_journal()) report = model.create(self._prepare_report_journal())
return report.print_report(xlsx_report=xlsx_report)
report.compute_data_for_report()
return report.print_report(report_type)

19
account_financial_report_qweb/wizard/journal_report_wizard.xml

@ -29,7 +29,7 @@
<field name="move_target" widget="radio" options="{'horizontal': true}"/> <field name="move_target" widget="radio" options="{'horizontal': true}"/>
<field name="sort_option"/> <field name="sort_option"/>
<field name="group_option"/> <field name="group_option"/>
<field name="with_currency"/>
<field name="foreign_currency"/>
<field name="with_account_name"/> <field name="with_account_name"/>
</group> </group>
<group/> <group/>
@ -41,15 +41,14 @@
</group> </group>
<footer> <footer>
<button name="export_as_pdf"
string="Print" class="btn-primary"
type="object"/>
<button name="export_as_xlsx"
string="Export" class="btn-primary"
type="object"/>
<button string="Cancel"
class="btn-default"
special="cancel"/>
<button name="button_export_html" string="View"
type="object" default_focus="1" class="oe_highlight"/>
or
<button name="button_export_pdf" string="Export PDF" type="object" default_focus="1" class="oe_highlight"/>
or
<button name="button_export_xlsx" string="Export XLSX" type="object"/>
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer> </footer>
</form> </form>
</field> </field>

36
account_financial_report_qweb/wizard/open_items_wizard.py

@ -6,6 +6,7 @@
from datetime import datetime from datetime import datetime
from odoo import models, fields, api from odoo import models, fields, api
from odoo.tools.safe_eval import safe_eval
class OpenItemsReportWizard(models.TransientModel): class OpenItemsReportWizard(models.TransientModel):
@ -44,6 +45,12 @@ class OpenItemsReportWizard(models.TransientModel):
comodel_name='res.partner', comodel_name='res.partner',
string='Filter partners', string='Filter partners',
) )
foreign_currency = fields.Boolean(
string='Show foreign currency',
help='Display foreign currency for move lines, unless '
'account currency is not setup through chart of accounts '
'will display initial and final balance in that currency.'
)
@api.onchange('receivable_accounts_only', 'payable_accounts_only') @api.onchange('receivable_accounts_only', 'payable_accounts_only')
def onchange_type_accounts_only(self): def onchange_type_accounts_only(self):
@ -60,15 +67,34 @@ class OpenItemsReportWizard(models.TransientModel):
else: else:
self.account_ids = None self.account_ids = None
@api.multi
def button_export_html(self):
self.ensure_one()
action = self.env.ref(
'account_financial_report_qweb.action_report_open_items')
vals = action.read()[0]
context1 = vals.get('context', {})
if isinstance(context1, basestring):
context1 = safe_eval(context1)
model = self.env['report_open_items_qweb']
report = model.create(self._prepare_report_open_items())
report.compute_data_for_report()
context1['active_id'] = report.id
context1['active_ids'] = report.ids
vals['context'] = context1
return vals
@api.multi @api.multi
def button_export_pdf(self): def button_export_pdf(self):
self.ensure_one() self.ensure_one()
return self._export()
report_type = 'qweb-pdf'
return self._export(report_type)
@api.multi @api.multi
def button_export_xlsx(self): def button_export_xlsx(self):
self.ensure_one() self.ensure_one()
return self._export(xlsx_report=True)
report_type = 'xlsx'
return self._export(report_type)
def _prepare_report_open_items(self): def _prepare_report_open_items(self):
self.ensure_one() self.ensure_one()
@ -76,13 +102,15 @@ class OpenItemsReportWizard(models.TransientModel):
'date_at': self.date_at, 'date_at': self.date_at,
'only_posted_moves': self.target_move == 'posted', 'only_posted_moves': self.target_move == 'posted',
'hide_account_balance_at_0': self.hide_account_balance_at_0, 'hide_account_balance_at_0': self.hide_account_balance_at_0,
'foreign_currency': self.foreign_currency,
'company_id': self.company_id.id, 'company_id': self.company_id.id,
'filter_account_ids': [(6, 0, self.account_ids.ids)], 'filter_account_ids': [(6, 0, self.account_ids.ids)],
'filter_partner_ids': [(6, 0, self.partner_ids.ids)], 'filter_partner_ids': [(6, 0, self.partner_ids.ids)],
} }
def _export(self, xlsx_report=False):
def _export(self, report_type):
"""Default export is PDF.""" """Default export is PDF."""
model = self.env['report_open_items_qweb'] model = self.env['report_open_items_qweb']
report = model.create(self._prepare_report_open_items()) report = model.create(self._prepare_report_open_items())
return report.print_report(xlsx_report)
report.compute_data_for_report()
return report.print_report(report_type)

4
account_financial_report_qweb/wizard/open_items_wizard_view.xml

@ -17,6 +17,7 @@
<group name="other_filters"> <group name="other_filters">
<field name="target_move" widget="radio"/> <field name="target_move" widget="radio"/>
<field name="hide_account_balance_at_0"/> <field name="hide_account_balance_at_0"/>
<field name="foreign_currency"/>
</group> </group>
</group> </group>
<label for="partner_ids"/> <label for="partner_ids"/>
@ -29,6 +30,9 @@
</group> </group>
<field name="account_ids" widget="many2many_tags" nolabel="1" options="{'no_create': True}"/> <field name="account_ids" widget="many2many_tags" nolabel="1" options="{'no_create': True}"/>
<footer> <footer>
<button name="button_export_html" string="View"
type="object" default_focus="1" class="oe_highlight"/>
or
<button name="button_export_pdf" string="Export PDF" type="object" default_focus="1" class="oe_highlight"/> <button name="button_export_pdf" string="Export PDF" type="object" default_focus="1" class="oe_highlight"/>
or or
<button name="button_export_xlsx" string="Export XLSX" type="object"/> <button name="button_export_xlsx" string="Export XLSX" type="object"/>

39
account_financial_report_qweb/wizard/trial_balance_wizard.py

@ -5,6 +5,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models, fields, api from odoo import models, fields, api
from odoo.tools.safe_eval import safe_eval
class TrialBalanceReportWizard(models.TransientModel): class TrialBalanceReportWizard(models.TransientModel):
@ -54,6 +55,13 @@ class TrialBalanceReportWizard(models.TransientModel):
string='Not only one unaffected earnings account' string='Not only one unaffected earnings account'
) )
foreign_currency = fields.Boolean(
string='Show foreign currency',
help='Display foreign currency for move lines, unless '
'account currency is not setup through chart of accounts '
'will display initial and final balance in that currency.'
)
@api.depends('date_from') @api.depends('date_from')
def _compute_fy_start_date(self): def _compute_fy_start_date(self):
for wiz in self.filtered('date_from'): for wiz in self.filtered('date_from'):
@ -98,18 +106,39 @@ class TrialBalanceReportWizard(models.TransientModel):
"""Handle partners change.""" """Handle partners change."""
if self.show_partner_details: if self.show_partner_details:
self.receivable_accounts_only = self.payable_accounts_only = True self.receivable_accounts_only = self.payable_accounts_only = True
self.hide_account_balance_at_0 = True
else: else:
self.receivable_accounts_only = self.payable_accounts_only = False self.receivable_accounts_only = self.payable_accounts_only = False
self.hide_account_balance_at_0 = False
@api.multi
def button_export_html(self):
self.ensure_one()
action = self.env.ref(
'account_financial_report_qweb.action_report_trial_balance')
vals = action.read()[0]
context1 = vals.get('context', {})
if isinstance(context1, basestring):
context1 = safe_eval(context1)
model = self.env['report_trial_balance_qweb']
report = model.create(self._prepare_report_trial_balance())
report.compute_data_for_report()
context1['active_id'] = report.id
context1['active_ids'] = report.ids
vals['context'] = context1
return vals
@api.multi @api.multi
def button_export_pdf(self): def button_export_pdf(self):
self.ensure_one() self.ensure_one()
return self._export()
report_type = 'qweb-pdf'
return self._export(report_type)
@api.multi @api.multi
def button_export_xlsx(self): def button_export_xlsx(self):
self.ensure_one() self.ensure_one()
return self._export(xlsx_report=True)
report_type = 'xlsx'
return self._export(report_type)
def _prepare_report_trial_balance(self): def _prepare_report_trial_balance(self):
self.ensure_one() self.ensure_one()
@ -118,6 +147,7 @@ class TrialBalanceReportWizard(models.TransientModel):
'date_to': self.date_to, 'date_to': self.date_to,
'only_posted_moves': self.target_move == 'posted', 'only_posted_moves': self.target_move == 'posted',
'hide_account_balance_at_0': self.hide_account_balance_at_0, 'hide_account_balance_at_0': self.hide_account_balance_at_0,
'foreign_currency': self.foreign_currency,
'company_id': self.company_id.id, 'company_id': self.company_id.id,
'filter_account_ids': [(6, 0, self.account_ids.ids)], 'filter_account_ids': [(6, 0, self.account_ids.ids)],
'filter_partner_ids': [(6, 0, self.partner_ids.ids)], 'filter_partner_ids': [(6, 0, self.partner_ids.ids)],
@ -125,8 +155,9 @@ class TrialBalanceReportWizard(models.TransientModel):
'show_partner_details': self.show_partner_details, 'show_partner_details': self.show_partner_details,
} }
def _export(self, xlsx_report=False):
def _export(self, report_type):
"""Default export is PDF.""" """Default export is PDF."""
model = self.env['report_trial_balance_qweb'] model = self.env['report_trial_balance_qweb']
report = model.create(self._prepare_report_trial_balance()) report = model.create(self._prepare_report_trial_balance())
return report.print_report(xlsx_report)
report.compute_data_for_report()
return report.print_report(report_type)

4
account_financial_report_qweb/wizard/trial_balance_wizard_view.xml

@ -22,6 +22,7 @@
<field name="target_move" widget="radio"/> <field name="target_move" widget="radio"/>
<field name="hide_account_balance_at_0"/> <field name="hide_account_balance_at_0"/>
<field name="show_partner_details"/> <field name="show_partner_details"/>
<field name="foreign_currency"/>
</group> </group>
</group> </group>
<label for="partner_ids" attrs="{'invisible':[('show_partner_details','!=',True)]}"/> <label for="partner_ids" attrs="{'invisible':[('show_partner_details','!=',True)]}"/>
@ -42,6 +43,9 @@
</div> </div>
<footer> <footer>
<div attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', True)]}"> <div attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', True)]}">
<button name="button_export_html" string="View"
type="object" default_focus="1" class="oe_highlight"/>
or
<button name="button_export_pdf" string="Export PDF" type="object" default_focus="1" class="oe_highlight"/> <button name="button_export_pdf" string="Export PDF" type="object" default_focus="1" class="oe_highlight"/>
or or
<button name="button_export_xlsx" string="Export XLSX" type="object"/> <button name="button_export_xlsx" string="Export XLSX" type="object"/>

Loading…
Cancel
Save