Browse Source

Merge fd6c77cf5e into 1ac8744ae8

pull/714/merge
Alexandre Fayolle 3 years ago
committed by GitHub
parent
commit
e01caef7b5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 40
      account_financial_report_qweb/report/abstract_report_xlsx.py
  2. 28
      account_financial_report_qweb/report/aged_partner_balance.py
  3. 2
      account_financial_report_qweb/report/aged_partner_balance_xlsx.py
  4. 55
      account_financial_report_qweb/report/general_ledger.py
  5. 20
      account_financial_report_qweb/report/journal_report.py
  6. 41
      account_financial_report_qweb/report/open_items.py
  7. 62
      account_financial_report_qweb/report/trial_balance.py
  8. 6
      account_financial_report_qweb/report/trial_balance_xlsx.py
  9. 2
      account_financial_report_qweb/static/src/js/account_financial_report_qweb_backend.js
  10. 4
      account_financial_report_qweb/tests/test_general_ledger.py

40
account_financial_report_qweb/report/abstract_report_xlsx.py

@ -2,6 +2,7 @@
# Author: Julien Coux
# Copyright 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from decimal import Decimal
from odoo.addons.report_xlsx.report.report_xlsx import ReportXlsx
@ -32,6 +33,22 @@ class AbstractReportXslx(ReportXlsx):
self.format_header_amount = None
self.format_amount = None
self.format_percent_bold_italic = None
self.nb_decimals = None
def _number_as_decimal(self, value, decimal_places=None):
"""convert a number to a Decimal, rounded at the specified decimal place.
If decimal place is omitted, use the precision of the currency of the
company.
"""
if decimal_places is None:
if self.nb_decimals is None:
self.nb_decimals = (
self.env.user.company_id.currency_id.decimal_places
)
decimal_places = self.nb_decimals
return Decimal('%.*f' % (decimal_places, float(value)))
def get_workbook_options(self):
return {'constant_memory': True}
@ -221,13 +238,19 @@ class AbstractReportXslx(ReportXlsx):
else:
cell_format = self.format_amount
self.sheet.write_number(
self.row_pos, col_pos, float(value), cell_format
self.row_pos, col_pos,
self._number_as_decimal(value),
cell_format
)
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)
self.row_pos, col_pos,
self._number_as_decimal(
value,
line_object.currency_id.decimal_places),
format_amt)
elif cell_type == 'many2one':
self.sheet.write_string(
self.row_pos, col_pos, value.name or '', self.format_right)
@ -249,7 +272,9 @@ class AbstractReportXslx(ReportXlsx):
self.sheet.write_string(self.row_pos, col_pos, value or '')
elif cell_type == 'amount':
self.sheet.write_number(
self.row_pos, col_pos, float(value), self.format_amount
self.row_pos, col_pos,
self._number_as_decimal(value),
self.format_amount
)
elif cell_type == 'amount_currency':
if my_object.currency_id:
@ -257,7 +282,7 @@ class AbstractReportXslx(ReportXlsx):
my_object)
self.sheet.write_number(
self.row_pos, col_pos,
float(value), format_amt
self._number_as_decimal(value), format_amt
)
elif column.get('field_currency_balance'):
value = getattr(my_object, column['field_currency_balance'])
@ -295,7 +320,7 @@ class AbstractReportXslx(ReportXlsx):
self.format_header_right)
elif cell_type == 'amount':
self.sheet.write_number(
self.row_pos, col_pos, float(value),
self.row_pos, col_pos, self._number_as_decimal(value),
self.format_header_amount
)
elif cell_type == 'amount_currency':
@ -304,7 +329,10 @@ class AbstractReportXslx(ReportXlsx):
my_object)
self.sheet.write_number(
self.row_pos, col_pos,
float(value), format_amt
self._number_as_decimal(
value,
my_object.currency_id.decimal_places),
format_amt
)
elif column.get('field_currency_balance'):
value = getattr(my_object, column['field_currency_balance'])

28
account_financial_report_qweb/report/aged_partner_balance.py

@ -353,11 +353,11 @@ SELECT
%s AS create_uid,
NOW() AS create_date,
rp.name,
SUM(rlo.amount_residual) AS amount_residual,
SUM(ROUND(rlo.amount_residual, 2)) AS amount_residual,
SUM(
CASE
WHEN rlo.date_due >= date_range.date_current
THEN rlo.amount_residual
THEN ROUND(rlo.amount_residual, 2)
END
) AS current,
SUM(
@ -365,7 +365,7 @@ SELECT
WHEN
rlo.date_due >= date_range.date_less_30_days
AND rlo.date_due < date_range.date_current
THEN rlo.amount_residual
THEN ROUND(rlo.amount_residual, 2)
END
) AS age_30_days,
SUM(
@ -373,7 +373,7 @@ SELECT
WHEN
rlo.date_due >= date_range.date_less_60_days
AND rlo.date_due < date_range.date_less_30_days
THEN rlo.amount_residual
THEN ROUND(rlo.amount_residual, 2)
END
) AS age_60_days,
SUM(
@ -381,7 +381,7 @@ SELECT
WHEN
rlo.date_due >= date_range.date_less_90_days
AND rlo.date_due < date_range.date_less_60_days
THEN rlo.amount_residual
THEN ROUND(rlo.amount_residual, 2)
END
) AS age_90_days,
SUM(
@ -389,13 +389,13 @@ SELECT
WHEN
rlo.date_due >= date_range.date_less_120_days
AND rlo.date_due < date_range.date_less_90_days
THEN rlo.amount_residual
THEN ROUND(rlo.amount_residual, 2)
END
) AS age_120_days,
SUM(
CASE
WHEN rlo.date_due < date_range.date_less_120_days
THEN rlo.amount_residual
THEN ROUND(rlo.amount_residual, 2)
END
) AS older
FROM
@ -567,13 +567,13 @@ WITH
(
SELECT
ra.id AS report_account_id,
SUM(rl.amount_residual) AS cumul_amount_residual,
SUM(rl.current) AS cumul_current,
SUM(rl.age_30_days) AS cumul_age_30_days,
SUM(rl.age_60_days) AS cumul_age_60_days,
SUM(rl.age_90_days) AS cumul_age_90_days,
SUM(rl.age_120_days) AS cumul_age_120_days,
SUM(rl.older) AS cumul_older
SUM(ROUND(rl.amount_residual, 2)) AS cumul_amount_residual,
SUM(ROUND(rl.current, 2)) AS cumul_current,
SUM(ROUND(rl.age_30_days, 2)) AS cumul_age_30_days,
SUM(ROUND(rl.age_60_days, 2)) AS cumul_age_60_days,
SUM(ROUND(rl.age_90_days, 2)) AS cumul_age_90_days,
SUM(ROUND(rl.age_120_days, 2)) AS cumul_age_120_days,
SUM(ROUND(rl.older, 2)) AS cumul_older
FROM
report_aged_partner_balance_qweb_line rl
INNER JOIN

2
account_financial_report_qweb/report/aged_partner_balance_xlsx.py

@ -254,7 +254,7 @@ class AgedPartnerBalanceXslx(abstract_report_xlsx.AbstractReportXslx):
if amount_is_percent:
number /= 100
self.sheet.write_number(self.row_pos, col_pos,
number,
self._number_as_decimal(number),
amount_format)
else:
self.sheet.write_string(self.row_pos, col_pos, '',

55
account_financial_report_qweb/report/general_ledger.py

@ -293,13 +293,13 @@ class GeneralLedgerReportCompute(models.TransientModel):
sub_subquery_sum_amounts = """
SELECT
a.id AS account_id,
SUM(ml.debit) AS debit,
SUM(ml.credit) AS credit,
SUM(ml.balance) AS balance,
SUM(ROUND(ml.debit, 2)) AS debit,
SUM(ROUND(ml.credit,2)) AS credit,
SUM(ROUND(ml.balance,2)) AS balance,
c.id AS currency_id,
CASE
WHEN c.id IS NOT NULL
THEN SUM(ml.amount_currency)
THEN SUM(ROUND(ml.amount_currency, 2))
ELSE NULL
END AS balance_currency
FROM
@ -367,11 +367,11 @@ class GeneralLedgerReportCompute(models.TransientModel):
subquery_sum_amounts = """
SELECT
sub.account_id AS account_id,
SUM(COALESCE(sub.debit, 0.0)) AS debit,
SUM(COALESCE(sub.credit, 0.0)) AS credit,
SUM(COALESCE(sub.balance, 0.0)) AS balance,
SUM(ROUND(COALESCE(sub.debit, 0.0), 2)) AS debit,
SUM(ROUND(COALESCE(sub.credit, 0.0), 2)) AS credit,
SUM(ROUND(COALESCE(sub.balance, 0.0), 2)) AS balance,
MAX(sub.currency_id) AS currency_id,
SUM(COALESCE(sub.balance_currency, 0.0)) AS balance_currency
SUM(ROUND(COALESCE(sub.balance_currency, 0.0), 2)) AS balance_currency
FROM
(
"""
@ -631,13 +631,13 @@ AND
SELECT
ap.account_id AS account_id,
ap.partner_id AS partner_id,
SUM(ml.debit) AS debit,
SUM(ml.credit) AS credit,
SUM(ml.balance) AS balance,
SUM(ROUND(ml.debit,2)) AS debit,
SUM(ROUND(ml.credit,2)) AS credit,
SUM(ROUND(ml.balance,2)) AS balance,
c.id as currency_id,
CASE
WHEN c.id IS NOT NULL
THEN SUM(ml.amount_currency)
THEN SUM(ROUND(ml.amount_currency,2))
ELSE NULL
END AS balance_currency
FROM
@ -707,11 +707,12 @@ AND
SELECT
sub.account_id AS account_id,
sub.partner_id AS partner_id,
SUM(COALESCE(sub.debit, 0.0)) AS debit,
SUM(COALESCE(sub.credit, 0.0)) AS credit,
SUM(COALESCE(sub.balance, 0.0)) AS balance,
SUM(ROUND(COALESCE(sub.debit, 0.0), 2)) AS debit,
SUM(ROUND(COALESCE(sub.credit, 0.0), 2)) AS credit,
SUM(ROUND(COALESCE(sub.balance, 0.0), 2)) AS balance,
MAX(sub.currency_id) AS currency_id,
SUM(COALESCE(sub.balance_currency, 0.0)) AS balance_currency
SUM(ROUND(COALESCE(sub.balance_currency, 0.0), 2))
AS balance_currency
FROM
(
"""
@ -1151,7 +1152,7 @@ SELECT
if is_account_line:
query_inject_move_line += """
ra.initial_balance + (
SUM(ml.balance)
SUM(ROUND(ml.balance, 2))
OVER (PARTITION BY a.code
ORDER BY a.code, ml.date, ml.id)
) AS cumul_balance,
@ -1159,7 +1160,7 @@ SELECT
elif is_partner_line and not only_empty_partner_line:
query_inject_move_line += """
rp.initial_balance + (
SUM(ml.balance)
SUM(ROUND(ml.balance, 2))
OVER (PARTITION BY a.code, p.name
ORDER BY a.code, p.name, ml.date, ml.id)
) AS cumul_balance,
@ -1167,7 +1168,7 @@ SELECT
elif is_partner_line and only_empty_partner_line:
query_inject_move_line += """
rp.initial_balance + (
SUM(ml.balance)
SUM(ROUND(ml.balance, 2))
OVER (PARTITION BY a.code
ORDER BY a.code, ml.date, ml.id)
) AS cumul_balance,
@ -1371,9 +1372,9 @@ WITH
DATE_TRUNC('month', ml.date) + interval '1 month'
- interval '1 day'
)::date AS date,
SUM(ml.debit) AS debit,
SUM(ml.credit) AS credit,
SUM(ml.balance) AS balance,
SUM(ROUND(ml.debit, 2)) AS debit,
SUM(ROUND(ml.credit, 2)) AS credit,
SUM(ROUND(ml.balance, 2)) AS balance,
ml.currency_id AS currency_id,
ml.journal_id as journal_id
FROM
@ -1440,7 +1441,7 @@ SELECT
ml.debit AS debit,
ml.credit AS credit,
ra.initial_balance + (
SUM(ml.balance)
SUM(ROUND(ml.balance, 2))
OVER (PARTITION BY a.code ORDER BY ml.date)
) AS cumul_balance
FROM
@ -1616,7 +1617,7 @@ WITH move_lines_on_tags AS
query_select_previous_fy_unaffected_earnings += q_analytic_tags
query_select_previous_fy_unaffected_earnings += """
SELECT sum(ml.balance) as balance
SELECT sum(ROUND(ml.balance, 2)) as balance
FROM account_move_line as ml
INNER JOIN account_move as am
ON am.id = ml.move_id
@ -1670,9 +1671,9 @@ WITH move_lines_on_tags AS
query_select_period_unaffected_earnings += q_analytic_tags
query_select_period_unaffected_earnings += """
SELECT
sum(ml.debit) as sum_debit,
sum(ml.credit) as sum_credit,
sum(ml.balance) as balance
sum(ROUND(ml.debit, 2)) as sum_debit,
sum(ROUND(ml.credit, 2)) as sum_credit,
sum(ROUND(ml.balance, 2)) as balance
FROM account_move_line as ml
INNER JOIN account_move as am
ON am.id = ml.move_id

20
account_financial_report_qweb/report/journal_report.py

@ -390,25 +390,25 @@ class ReportJournalQweb(models.TransientModel):
at.name as tax_name,
at.description as tax_code,
(
SELECT sum(base_debit)
SELECT sum(round(base_debit, 2))
FROM report_journal_qweb_journal_tax_line jrqjtl2
WHERE jrqjtl2.report_id = %s
AND jrqjtl2.tax_id = %s
) as base_debit,
(
SELECT sum(base_credit)
SELECT sum(round(base_credit, 2))
FROM report_journal_qweb_journal_tax_line jrqjtl2
WHERE jrqjtl2.report_id = %s
AND jrqjtl2.tax_id = %s
) as base_credit,
(
SELECT sum(tax_debit)
SELECT sum(round(tax_debit, 2))
FROM report_journal_qweb_journal_tax_line jrqjtl2
WHERE jrqjtl2.report_id = %s
AND jrqjtl2.tax_id = %s
) as tax_debit,
(
SELECT sum(tax_credit)
SELECT sum(round(tax_credit, 2))
FROM report_journal_qweb_journal_tax_line jrqjtl2
WHERE jrqjtl2.report_id = %s
AND jrqjtl2.tax_id = %s
@ -496,7 +496,7 @@ class ReportJournalQweb(models.TransientModel):
at.name as tax_name,
at.description as tax_code,
(
SELECT sum(debit)
SELECT sum(round(debit, 2))
FROM report_journal_qweb_move_line jrqml2
WHERE jrqml2.report_journal_id = %s
AND (
@ -512,7 +512,7 @@ class ReportJournalQweb(models.TransientModel):
) > 0
) as base_debit,
(
SELECT sum(credit)
SELECT sum(round(credit, 2))
FROM report_journal_qweb_move_line jrqml2
WHERE jrqml2.report_journal_id = %s
AND (
@ -528,13 +528,13 @@ class ReportJournalQweb(models.TransientModel):
) > 0
) as base_credit,
(
SELECT sum(debit)
SELECT sum(round(debit, 2))
FROM report_journal_qweb_move_line jrqml2
WHERE jrqml2.report_journal_id = %s
AND jrqml2.tax_id = %s
) as tax_debit,
(
SELECT sum(credit)
SELECT sum(round(credit, 2))
FROM report_journal_qweb_move_line jrqml2
WHERE jrqml2.report_journal_id = %s
AND jrqml2.tax_id = %s
@ -577,12 +577,12 @@ class ReportJournalQweb(models.TransientModel):
report_journal_qweb_journal rjqj
SET
debit = (
SELECT sum(rjqml.debit)
SELECT sum(round(rjqml.debit, 2))
FROM report_journal_qweb_move_line rjqml
WHERE rjqml.report_journal_id = rjqj.id
),
credit = (
SELECT sum(rjqml.credit)
SELECT sum(round(rjqml.credit, 2))
FROM report_journal_qweb_move_line rjqml
WHERE rjqml.report_journal_id = rjqj.id
)

41
account_financial_report_qweb/report/open_items.py

@ -380,7 +380,7 @@ FROM
SUM(
CASE
WHEN ml_past.id IS NOT NULL
THEN pr.amount
THEN ROUND(pr.amount, 2)
ELSE NULL
END
) AS partial_amount,
@ -388,7 +388,7 @@ FROM
SUM(
CASE
WHEN ml_past.id IS NOT NULL
THEN pr.amount_currency
THEN ROUND(pr.amount_currency, 2)
ELSE NULL
END
) AS partial_amount_currency,
@ -431,7 +431,8 @@ FROM
AND ml_past.date <= %s
"""
sub_query += """
LEFT JOIN account_full_reconcile afr ON afr.id = ml.full_reconcile_id
LEFT JOIN account_full_reconcile afr
ON afr.id = ml.full_reconcile_id
WHERE
ra.report_id = %s
AND ml.full_reconcile_id IS NULL OR afr.create_date >= %s
@ -471,22 +472,26 @@ WITH
SELECT
id,
CASE
WHEN SUM(partial_amount) > 0
WHEN SUM(ROUND(partial_amount, 2)) > 0
THEN
CASE
WHEN balance > 0
THEN balance - SUM(partial_amount)
ELSE balance + SUM(partial_amount)
THEN balance - SUM(ROUND(partial_amount, 2))
ELSE balance + SUM(ROUND(partial_amount, 2))
END
ELSE balance
END AS amount_residual,
CASE
WHEN SUM(partial_amount_currency) > 0
WHEN SUM(ROUND(partial_amount_currency, 2)) > 0
THEN
CASE
WHEN amount_currency > 0
THEN amount_currency - SUM(partial_amount_currency)
ELSE amount_currency + SUM(partial_amount_currency)
THEN amount_currency - SUM(
ROUND(partial_amount_currency, 2)
)
ELSE amount_currency + SUM(
ROUND(partial_amount_currency, 2)
)
END
ELSE amount_currency
END AS amount_residual_currency,
@ -653,7 +658,7 @@ SET
final_amount_residual =
(
SELECT
SUM(rml.amount_residual) AS final_amount_residual
SUM(ROUND(rml.amount_residual, 2)) AS final_amount_residual
FROM
report_open_items_qweb_move_line rml
WHERE
@ -671,7 +676,7 @@ SET
final_amount_total_due =
(
SELECT
SUM(rml.amount_total_due) AS final_amount_total_due
SUM(ROUND(rml.amount_total_due, 2)) AS final_amount_total_due
FROM
report_open_items_qweb_move_line rml
WHERE
@ -723,7 +728,7 @@ SET
final_amount_residual_currency =
(
SELECT
SUM(rml.amount_residual_currency)
SUM(ROUND(rml.amount_residual_currency, 2))
AS final_amount_residual_currency
FROM
report_open_items_qweb_move_line rml
@ -742,7 +747,7 @@ SET
final_amount_total_due_currency =
(
SELECT
SUM(rml.amount_total_due_currency)
SUM(ROUND(rml.amount_total_due_currency, 2))
AS final_amount_total_due_currency
FROM
report_open_items_qweb_move_line rml
@ -762,7 +767,8 @@ SET
final_amount_residual =
(
SELECT
SUM(rp.final_amount_residual) AS final_amount_residual
SUM(ROUND(rp.final_amount_residual, 2))
AS final_amount_residual
FROM
report_open_items_qweb_partner rp
WHERE
@ -782,7 +788,7 @@ SET
final_amount_residual_currency =
(
SELECT
SUM(rp.final_amount_residual_currency)
SUM(ROUND(rp.final_amount_residual_currency, 2))
AS final_amount_residual_currency
FROM
report_open_items_qweb_partner rp
@ -803,7 +809,8 @@ SET
final_amount_total_due =
(
SELECT
SUM(rp.final_amount_total_due) AS final_amount_total_due
SUM(ROUND(rp.final_amount_total_due, 2))
AS final_amount_total_due
FROM
report_open_items_qweb_partner rp
WHERE
@ -823,7 +830,7 @@ SET
final_amount_total_due_currency =
(
SELECT
SUM(rp.final_amount_total_due_currency)
SUM(ROUND(rp.final_amount_total_due_currency, 2))
AS final_amount_total_due_currency
FROM
report_open_items_qweb_partner rp

62
account_financial_report_qweb/report/trial_balance.py

@ -301,15 +301,15 @@ SELECT
acc.group_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 - rag.initial_balance, 0) AS period_balance,
coalesce(rag.final_balance, 0) AS final_balance,
round(coalesce(rag.initial_balance, 0), 2) AS initial_balance,
round(coalesce(rag.final_debit - rag.initial_debit, 0), 2) AS debit,
round(coalesce(rag.final_credit - rag.initial_credit, 0), 2) AS credit,
round(coalesce(rag.final_balance - rag.initial_balance, 0), 2) AS period_balance,
round(coalesce(rag.final_balance, 0), 2) AS final_balance,
rag.currency_id AS currency_id,
coalesce(rag.initial_balance_foreign_currency, 0)
round(coalesce(rag.initial_balance_foreign_currency, 0), 2)
AS initial_balance_foreign_currency,
coalesce(rag.final_balance_foreign_currency, 0)
round(coalesce(rag.final_balance_foreign_currency, 0), 2)
AS final_balance_foreign_currency
FROM
account_account acc
@ -351,13 +351,15 @@ SELECT
NOW() AS create_date,
rpg.partner_id,
rpg.name,
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_credit - rpg.initial_credit AS credit,
rpg.final_balance - rpg.initial_balance AS period_balance,
rpg.final_balance AS final_balance,
rpg.final_balance_foreign_currency AS final_balance_foreign_currency
round(rpg.initial_balance, 2) AS initial_balance,
round(rpg.initial_balance_foreign_currency, 2)
AS initial_balance_foreign_currency,
round(rpg.final_debit - rpg.initial_debit, 2) AS debit,
round(rpg.final_credit - rpg.initial_credit, 2) AS credit,
round(rpg.final_balance - rpg.initial_balance, 2) AS period_balance,
round(rpg.final_balance, 2) AS final_balance,
round(rpg.final_balance_foreign_currency, 2)
AS final_balance_foreign_currency
FROM
report_general_ledger_qweb_partner rpg
INNER JOIN
@ -431,13 +433,15 @@ WITH computed AS (WITH RECURSIVE cte AS (
WHERE p.report_id = %s
)
SELECT account_group_id, code,
sum(initial_balance) AS initial_balance,
sum(initial_balance_foreign_currency) AS initial_balance_foreign_currency,
sum(debit) AS debit,
sum(credit) AS credit,
sum(debit) - sum(credit) AS period_balance,
sum(final_balance) AS final_balance,
sum(final_balance_foreign_currency) AS final_balance_foreign_currency
sum(round(initial_balance, 2)) AS initial_balance,
sum(round(initial_balance_foreign_currency, 2))
AS initial_balance_foreign_currency,
sum(round(debit, 2)) AS debit,
sum(round(credit, 2)) AS credit,
sum(round(debit, 2)) - sum(round(credit, 2)) AS period_balance,
sum(round(final_balance, 2)) AS final_balance,
sum(round(final_balance_foreign_currency, 2))
AS final_balance_foreign_currency
FROM cte
GROUP BY cte.account_group_id, cte.code
ORDER BY account_group_id
@ -511,14 +515,16 @@ WHERE report_trial_balance_qweb_account.account_group_id =
WITH RECURSIVE accgroup AS
(SELECT
accgroup.id,
sum(coalesce(ra.initial_balance, 0)) as initial_balance,
sum(coalesce(ra.initial_balance_foreign_currency, 0))
sum(round(coalesce(ra.initial_balance, 0), 2)) as initial_balance,
sum(round(coalesce(ra.initial_balance_foreign_currency, 0), 2))
as initial_balance_foreign_currency,
sum(coalesce(ra.debit, 0)) as debit,
sum(coalesce(ra.credit, 0)) as credit,
sum(coalesce(ra.debit, 0)) - sum(coalesce(ra.credit, 0)) as period_balance,
sum(coalesce(ra.final_balance, 0)) as final_balance,
sum(coalesce(ra.final_balance_foreign_currency, 0))
sum(round(coalesce(ra.debit, 0), 2)) as debit,
sum(round(coalesce(ra.credit, 0), 2)) as credit,
sum(round(coalesce(ra.debit, 0), 2)) -
sum(round(coalesce(ra.credit, 0), 2))
as period_balance,
sum(round(coalesce(ra.final_balance, 0), 2)) as final_balance,
sum(round(coalesce(ra.final_balance_foreign_currency, 0), 2))
as final_balance_foreign_currency
FROM
account_group accgroup

6
account_financial_report_qweb/report/trial_balance_xlsx.py

@ -180,7 +180,8 @@ class TrialBalanceXslx(abstract_report_xlsx.AbstractReportXslx):
self.sheet.write_string(self.row_pos, col_pos, value or '',
self.format_header_left)
elif cell_type == 'amount':
self.sheet.write_number(self.row_pos, col_pos, float(value),
self.sheet.write_number(self.row_pos, col_pos,
self._number_as_decimal(value),
self.format_header_amount)
elif cell_type == 'many2one':
self.sheet.write_string(
@ -188,7 +189,8 @@ class TrialBalanceXslx(abstract_report_xlsx.AbstractReportXslx):
self.format_header_right)
elif cell_type == 'amount_currency' and account.currency_id:
self.sheet.write_number(
self.row_pos, col_pos, float(value),
self.row_pos, col_pos, self._number_as_decimal(
value, account.currency_id.decimal_places),
format_amt)
else:
self.sheet.write_string(

2
account_financial_report_qweb/static/src/js/account_financial_report_qweb_backend.js

@ -5,7 +5,7 @@ odoo.define('account_financial_report_qweb.account_financial_report_backend', fu
var Widget = require('web.Widget');
var ControlPanelMixin = require('web.ControlPanelMixin');
var ReportWidget = require(
'account_financial_report_qweb.account_financial_report_widget');
'account_financial_report_qweb.account_financial_report_widget');
var Model = require('web.Model');

4
account_financial_report_qweb/tests/test_general_ledger.py

@ -534,7 +534,7 @@ class TestGeneralLedgerReport(common.TransactionCase):
time.strftime('%Y') + '-01-01')
def test_validate_date_range(self):
type = self.env['date.range.type'].create({
rangetype = self.env['date.range.type'].create({
'name': 'Fiscal year',
'company_id': False,
'allow_overlap': False
@ -544,7 +544,7 @@ class TestGeneralLedgerReport(common.TransactionCase):
'name': 'FS2015',
'date_start': '2018-01-01',
'date_end': '2018-12-31',
'type_id': type.id,
'type_id': rangetype.id,
})
wizard = self.env["general.ledger.report.wizard"].create({

Loading…
Cancel
Save