Browse Source

Merge pull request #364 from acsone/10.0-general_ledger_qweb_add_tax-bwi

[10.0][ADD] Add taxes description in general ledger report
pull/408/head
Pedro M. Baeza 6 years ago
committed by GitHub
parent
commit
11ff5b0950
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 34
      account_financial_report_qweb/report/general_ledger.py
  2. 49
      account_financial_report_qweb/report/general_ledger_xlsx.py
  3. 1
      account_financial_report_qweb/report/open_items.py
  4. 17
      account_financial_report_qweb/report/open_items_xlsx.py
  5. 8
      account_financial_report_qweb/report/templates/general_ledger.xml

34
account_financial_report_qweb/report/general_ledger.py

@ -183,6 +183,7 @@ class GeneralLedgerReportMoveLine(models.TransientModel):
entry = fields.Char()
journal = fields.Char()
account = fields.Char()
taxes_description = fields.Char()
partner = fields.Char()
label = fields.Char()
cost_center = fields.Char()
@ -215,10 +216,8 @@ class GeneralLedgerReportCompute(models.TransientModel):
report_name=report_name)
@api.multi
def compute_data_for_report(self,
with_line_details=True,
with_partners=True
):
def compute_data_for_report(
self, with_line_details=True, with_partners=True):
self.ensure_one()
# Compute report data
self._inject_account_values()
@ -647,7 +646,7 @@ AND
Only for "partner" accounts (payable and receivable).
"""
# pylint: disable=sql-injection
query_inject_partner = """
WITH
accounts_partners AS
@ -899,6 +898,7 @@ INSERT INTO
entry,
journal,
account,
taxes_description,
partner,
label,
cost_center,
@ -927,6 +927,27 @@ SELECT
m.name AS entry,
j.code AS journal,
a.code AS account,
CASE
WHEN
ml.tax_line_id is not null
THEN
COALESCE(at.description, at.name)
WHEN
ml.tax_line_id is null
THEN
(SELECT
array_to_string(
array_agg(COALESCE(at.description, at.name)
), ', ')
FROM
account_move_line_account_tax_rel aml_at_rel
LEFT JOIN
account_tax at on (at.id = aml_at_rel.account_tax_id)
WHERE
aml_at_rel.account_move_line_id = ml.id)
ELSE
''
END as taxes_description,
"""
if not only_empty_partner_line:
query_inject_move_line += """
@ -997,6 +1018,8 @@ INNER JOIN
account_journal j ON ml.journal_id = j.id
INNER JOIN
account_account a ON ml.account_id = a.id
LEFT JOIN
account_tax at ON ml.tax_line_id = at.id
"""
if is_account_line:
query_inject_move_line += """
@ -1337,6 +1360,7 @@ WHERE id = %s
subquery_sum_amounts += """
) sub
"""
# pylint: disable=sql-injection
query_inject_account = """
WITH
initial_sum_amounts AS ( """ + subquery_sum_amounts + """ )

49
account_financial_report_qweb/report/general_ledger_xlsx.py

@ -25,32 +25,37 @@ class GeneralLedgerXslx(abstract_report_xlsx.AbstractReportXslx):
1: {'header': _('Entry'), 'field': 'entry', 'width': 18},
2: {'header': _('Journal'), 'field': 'journal', 'width': 8},
3: {'header': _('Account'), 'field': 'account', 'width': 9},
4: {'header': _('Partner'), 'field': 'partner', 'width': 25},
5: {'header': _('Ref - Label'), 'field': 'label', 'width': 40},
6: {'header': _('Cost center'),
4: {'header': _('Taxes'),
'field': 'taxes_description',
'width': 15},
5: {'header': _('Partner'), 'field': 'partner', 'width': 25},
6: {'header': _('Ref - Label'), 'field': 'label', 'width': 40},
7: {'header': _('Cost center'),
'field': 'cost_center',
'width': 15},
7: {'header': _('Rec.'), 'field': 'matching_number', 'width': 5},
8: {'header': _('Debit'),
8: {'header': _('Rec.'), 'field': 'matching_number', 'width': 5},
9: {'header': _('Debit'),
'field': 'debit',
'field_initial_balance': 'initial_debit',
'field_final_balance': 'final_debit',
'type': 'amount',
'width': 14},
9: {'header': _('Credit'),
10: {
'header': _('Credit'),
'field': 'credit',
'field_initial_balance': 'initial_credit',
'field_final_balance': 'final_credit',
'type': 'amount',
'width': 14},
10: {'header': _('Cumul. Bal.'),
'width': 14
},
11: {'header': _('Cumul. Bal.'),
'field': 'cumul_balance',
'field_initial_balance': 'initial_balance',
'field_final_balance': 'final_balance',
'type': 'amount',
'width': 14},
11: {'header': _('Cur.'), 'field': 'currency_name', 'width': 7},
12: {'header': _('Amount cur.'),
12: {'header': _('Cur.'), 'field': 'currency_name', 'width': 7},
13: {'header': _('Amount cur.'),
'field': 'amount_currency',
'type': 'amount',
'width': 14},
@ -58,15 +63,23 @@ class GeneralLedgerXslx(abstract_report_xlsx.AbstractReportXslx):
def _get_report_filters(self, report):
return [
[_('Date range filter'),
_('From: %s To: %s') % (report.date_from, report.date_to)],
[_('Target moves filter'),
[
_('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')],
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'),
],
]
def _get_col_count_filter_name(self):

1
account_financial_report_qweb/report/open_items.py

@ -257,6 +257,7 @@ FROM
def _inject_partner_values(self):
""" Inject report values for report_open_items_qweb_partner. """
# pylint: disable=sql-injection
query_inject_partner = """
WITH
accounts_partners AS

17
account_financial_report_qweb/report/open_items_xlsx.py

@ -49,12 +49,19 @@ class OpenItemsXslx(abstract_report_xlsx.AbstractReportXslx):
def _get_report_filters(self, report):
return [
[_('Date at filter'), report.date_at],
[_('Target moves filter'),
[
_('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')],
else _('All entries'),
],
[
_('Account balance at 0 filter'),
_('Hide') if report.hide_account_balance_at_0 else _('Show'),
],
]
def _get_col_count_filter_name(self):

8
account_financial_report_qweb/report/templates/general_ledger.xml

@ -110,10 +110,12 @@
<div class="act_as_cell" style="width: 40px;">Journal</div>
<!--## account code-->
<div class="act_as_cell" style="width: 50px;">Account</div>
<!--## account code-->
<div class="act_as_cell" style="width: 90px;">Taxes</div>
<!--## partner-->
<div class="act_as_cell" style="width: 140px;">Partner</div>
<!--## ref - label-->
<div class="act_as_cell" style="width: 290px;">Ref - Label</div>
<div class="act_as_cell" style="width: 250px;">Ref - Label</div>
<t t-if="show_cost_center">
<!--## cost_center-->
<div class="act_as_cell" style="width: 100px;">Cost center</div>
@ -143,6 +145,8 @@
<div class="act_as_cell"></div>
<!--## account code-->
<div class="act_as_cell"></div>
<!--## taxes-->
<div class="act_as_cell"></div>
<!--## partner-->
<div class="act_as_cell"></div>
<!--## ref - label-->
@ -183,6 +187,8 @@
<div class="act_as_cell left"><span t-field="line.journal"/></div>
<!--## account code-->
<div class="act_as_cell left"><span t-field="line.account"/></div>
<!--## taxes-->
<div class="act_as_cell left"><span t-field="line.taxes_description"/></div>
<!--## partner-->
<div class="act_as_cell left"><span t-field="line.partner"/></div>
<!--## ref - label-->

Loading…
Cancel
Save