Global review, fix and make fields translatable
parent
81bbcb5bf1
commit
b8a52a5b06
|
@ -31,7 +31,7 @@
|
||||||
'report/templates/aged_partner_balance.xml',
|
'report/templates/aged_partner_balance.xml',
|
||||||
'report/templates/general_ledger.xml',
|
'report/templates/general_ledger.xml',
|
||||||
'report/templates/layouts.xml',
|
'report/templates/layouts.xml',
|
||||||
'report/templates/open_items_report.xml',
|
'report/templates/open_items.xml',
|
||||||
'view/account_view.xml'
|
'view/account_view.xml'
|
||||||
],
|
],
|
||||||
'test': [
|
'test': [
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<menuitem
|
<menuitem
|
||||||
parent="account.menu_finance_reports"
|
parent="account.menu_finance_reports"
|
||||||
id="menu_oca_reports"
|
id="menu_oca_reports"
|
||||||
name="OCA reports"
|
name="OCA Reports"
|
||||||
groups="account.group_account_manager,account.group_account_user"
|
groups="account.group_account_manager,account.group_account_user"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ class AbstractReportXslx(ReportXlsx):
|
||||||
self.columns = None
|
self.columns = None
|
||||||
|
|
||||||
# row_pos must be incremented at each writing lines
|
# row_pos must be incremented at each writing lines
|
||||||
self.row_pos = 0
|
self.row_pos = None
|
||||||
|
|
||||||
# Formats
|
# Formats
|
||||||
self.format_right = None
|
self.format_right = None
|
||||||
|
@ -34,6 +34,8 @@ class AbstractReportXslx(ReportXlsx):
|
||||||
def generate_xlsx_report(self, workbook, data, objects):
|
def generate_xlsx_report(self, workbook, data, objects):
|
||||||
report = objects
|
report = objects
|
||||||
|
|
||||||
|
self.row_pos = 0
|
||||||
|
|
||||||
self._define_formats(workbook)
|
self._define_formats(workbook)
|
||||||
|
|
||||||
report_name = self._get_report_name()
|
report_name = self._get_report_name()
|
||||||
|
|
|
@ -181,7 +181,8 @@ class GeneralLedgerReportCompute(models.TransientModel):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
self.compute_data_for_report()
|
self.compute_data_for_report()
|
||||||
if xlsx_report:
|
if xlsx_report:
|
||||||
report_name = 'ledger.report.wizard.xlsx'
|
report_name = 'account_financial_report_qweb.' \
|
||||||
|
'report_general_ledger_xlsx'
|
||||||
else:
|
else:
|
||||||
report_name = 'account_financial_report_qweb.' \
|
report_name = 'account_financial_report_qweb.' \
|
||||||
'report_general_ledger_qweb'
|
'report_general_ledger_qweb'
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
from . import abstract_report_xlsx
|
from . import abstract_report_xlsx
|
||||||
from openerp.report import report_sxw
|
from openerp.report import report_sxw
|
||||||
|
from openerp import _
|
||||||
|
|
||||||
|
|
||||||
class GeneralLedgerXslx(abstract_report_xlsx.AbstractReportXslx):
|
class GeneralLedgerXslx(abstract_report_xlsx.AbstractReportXslx):
|
||||||
|
@ -21,38 +22,40 @@ class GeneralLedgerXslx(abstract_report_xlsx.AbstractReportXslx):
|
||||||
self.col_pos_final_balance_label = 5
|
self.col_pos_final_balance_label = 5
|
||||||
|
|
||||||
def _get_report_name(self):
|
def _get_report_name(self):
|
||||||
return 'General Ledger'
|
return _('General Ledger')
|
||||||
|
|
||||||
def _get_report_columns(self):
|
def _get_report_columns(self):
|
||||||
return {
|
return {
|
||||||
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},
|
||||||
3: {'header': 'Account', 'field': 'account', 'width': 9},
|
3: {'header': _('Account'), 'field': 'account', 'width': 9},
|
||||||
4: {'header': 'Partner', 'field': 'partner', 'width': 25},
|
4: {'header': _('Partner'), 'field': 'partner', 'width': 25},
|
||||||
5: {'header': 'Ref - Label', 'field': 'label', 'width': 40},
|
5: {'header': _('Ref - Label'), 'field': 'label', 'width': 40},
|
||||||
6: {'header': 'Cost center', 'field': 'cost_center', 'width': 15},
|
6: {'header': _('Cost center'),
|
||||||
7: {'header': 'Rec.', 'field': 'matching_number', 'width': 5},
|
'field': 'cost_center',
|
||||||
8: {'header': 'Debit',
|
'width': 15},
|
||||||
|
7: {'header': _('Rec.'), 'field': 'matching_number', 'width': 5},
|
||||||
|
8: {'header': _('Debit'),
|
||||||
'field': 'debit',
|
'field': 'debit',
|
||||||
'field_initial_balance': 'initial_debit',
|
'field_initial_balance': 'initial_debit',
|
||||||
'field_final_balance': 'final_debit',
|
'field_final_balance': 'final_debit',
|
||||||
'type': 'amount',
|
'type': 'amount',
|
||||||
'width': 14},
|
'width': 14},
|
||||||
9: {'header': 'Credit',
|
9: {'header': _('Credit'),
|
||||||
'field': 'credit',
|
'field': 'credit',
|
||||||
'field_initial_balance': 'initial_credit',
|
'field_initial_balance': 'initial_credit',
|
||||||
'field_final_balance': 'final_credit',
|
'field_final_balance': 'final_credit',
|
||||||
'type': 'amount',
|
'type': 'amount',
|
||||||
'width': 14},
|
'width': 14},
|
||||||
10: {'header': 'Cumul. Bal.',
|
10: {'header': _('Cumul. Bal.'),
|
||||||
'field': 'cumul_balance',
|
'field': 'cumul_balance',
|
||||||
'field_initial_balance': 'initial_balance',
|
'field_initial_balance': 'initial_balance',
|
||||||
'field_final_balance': 'final_balance',
|
'field_final_balance': 'final_balance',
|
||||||
'type': 'amount',
|
'type': 'amount',
|
||||||
'width': 14},
|
'width': 14},
|
||||||
11: {'header': 'Cur.', 'field': 'currency_name', 'width': 7},
|
11: {'header': _('Cur.'), 'field': 'currency_name', 'width': 7},
|
||||||
12: {'header': 'Amount cur.',
|
12: {'header': _('Amount cur.'),
|
||||||
'field': 'amount_currency',
|
'field': 'amount_currency',
|
||||||
'type': 'amount',
|
'type': 'amount',
|
||||||
'width': 14},
|
'width': 14},
|
||||||
|
@ -60,15 +63,15 @@ class GeneralLedgerXslx(abstract_report_xlsx.AbstractReportXslx):
|
||||||
|
|
||||||
def _get_report_filters(self, report):
|
def _get_report_filters(self, report):
|
||||||
return [
|
return [
|
||||||
['Date range filter',
|
[_('Date range filter'),
|
||||||
'From: '+report.date_from+' To: '+report.date_to],
|
_('From: %s To: %s') % (report.date_from, report.date_to)],
|
||||||
['Target moves filter',
|
[_('Target moves filter'),
|
||||||
'All posted entries' if report.only_posted_moves
|
_('All posted entries') if report.only_posted_moves
|
||||||
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')],
|
||||||
['Centralize filter',
|
[_('Centralize filter'),
|
||||||
'Yes' if report.centralize else 'No'],
|
_('Yes') if report.centralize else _('No')],
|
||||||
]
|
]
|
||||||
|
|
||||||
def _get_col_count_filter_name(self):
|
def _get_col_count_filter_name(self):
|
||||||
|
@ -83,7 +86,7 @@ class GeneralLedgerXslx(abstract_report_xlsx.AbstractReportXslx):
|
||||||
# Write account title
|
# Write account title
|
||||||
self.write_array_title(account.code + ' - ' + account.name)
|
self.write_array_title(account.code + ' - ' + account.name)
|
||||||
|
|
||||||
if account.move_line_ids:
|
if not account.partner_ids:
|
||||||
# Display array header for move lines
|
# Display array header for move lines
|
||||||
self.write_array_header()
|
self.write_array_header()
|
||||||
|
|
||||||
|
@ -94,7 +97,7 @@ class GeneralLedgerXslx(abstract_report_xlsx.AbstractReportXslx):
|
||||||
for line in account.move_line_ids:
|
for line in account.move_line_ids:
|
||||||
self.write_line(line)
|
self.write_line(line)
|
||||||
|
|
||||||
elif account.is_partner_account:
|
else:
|
||||||
# For each partner
|
# For each partner
|
||||||
for partner in account.partner_ids:
|
for partner in account.partner_ids:
|
||||||
# Write partner title
|
# Write partner title
|
||||||
|
@ -125,7 +128,7 @@ class GeneralLedgerXslx(abstract_report_xlsx.AbstractReportXslx):
|
||||||
def write_initial_balance(self, my_object):
|
def write_initial_balance(self, my_object):
|
||||||
"""Specific function to write initial balance for General Ledger"""
|
"""Specific function to write initial balance for General Ledger"""
|
||||||
col_pos_label = self.col_pos_initial_balance_label
|
col_pos_label = self.col_pos_initial_balance_label
|
||||||
self.sheet.write(self.row_pos, col_pos_label, 'Initial balance',
|
self.sheet.write(self.row_pos, col_pos_label, _('Initial balance'),
|
||||||
self.format_right)
|
self.format_right)
|
||||||
for col_pos, column in self.columns.iteritems():
|
for col_pos, column in self.columns.iteritems():
|
||||||
if column.get('field_initial_balance'):
|
if column.get('field_initial_balance'):
|
||||||
|
@ -143,10 +146,10 @@ class GeneralLedgerXslx(abstract_report_xlsx.AbstractReportXslx):
|
||||||
"""Specific function to write ending balance for General Ledger"""
|
"""Specific function to write ending balance for General Ledger"""
|
||||||
if type_object == 'partner':
|
if type_object == 'partner':
|
||||||
name = my_object.name
|
name = my_object.name
|
||||||
label = 'Partner ending balance'
|
label = _('Partner ending balance')
|
||||||
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')
|
||||||
for i in range(0, len(self.columns)):
|
for i in range(0, len(self.columns)):
|
||||||
self.sheet.write(self.row_pos, i, '', self.format_header_right)
|
self.sheet.write(self.row_pos, i, '', self.format_header_right)
|
||||||
row_count_name = self.col_count_final_balance_name
|
row_count_name = self.col_count_final_balance_name
|
||||||
|
@ -173,5 +176,8 @@ class GeneralLedgerXslx(abstract_report_xlsx.AbstractReportXslx):
|
||||||
self.row_pos += 1
|
self.row_pos += 1
|
||||||
|
|
||||||
|
|
||||||
GeneralLedgerXslx('report.ledger.report.wizard.xlsx',
|
GeneralLedgerXslx(
|
||||||
'report_general_ledger_qweb', parser=report_sxw.rml_parse)
|
'report.account_financial_report_qweb.report_general_ledger_xlsx',
|
||||||
|
'report_general_ledger_qweb',
|
||||||
|
parser=report_sxw.rml_parse
|
||||||
|
)
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
<t t-call="account_financial_report_qweb.internal_layout">
|
<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" t-value='"Aged Partner Balance"'/>
|
<t t-set="title">Aged Partner Balance</t>
|
||||||
<t t-set="company_name" t-value="o.company_id.name"/>
|
<t t-set="company_name" t-value="o.company_id.name"/>
|
||||||
|
|
||||||
<div class="page">
|
<div class="page">
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
<t t-call="account_financial_report_qweb.internal_layout">
|
<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" t-value='"General Ledger"'/>
|
<t t-set="title">General Ledger</t>
|
||||||
<t t-set="company_name" t-value="o.company_id.name"/>
|
<t t-set="company_name" t-value="o.company_id.name"/>
|
||||||
|
|
||||||
<div class="page">
|
<div class="page">
|
||||||
|
@ -25,36 +25,33 @@
|
||||||
<span t-field="account.code"/> - <span t-field="account.name"/>
|
<span t-field="account.code"/> - <span t-field="account.name"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Display account move lines -->
|
<t t-if="not account.partner_ids">
|
||||||
<t t-if="account.move_line_ids">
|
<!-- Display account move lines without partner regroup -->
|
||||||
<t t-call="account_financial_report_qweb.report_general_ledger_qweb_lines">
|
<t t-call="account_financial_report_qweb.report_general_ledger_qweb_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>
|
||||||
|
|
||||||
<t t-if="not account.move_line_ids">
|
<t t-if="account.partner_ids">
|
||||||
|
|
||||||
<!-- Display account partners -->
|
<!-- Display account partners -->
|
||||||
<t t-if="account.is_partner_account">
|
<t t-foreach="account.partner_ids" t-as="partner">
|
||||||
<t t-foreach="account.partner_ids" t-as="partner">
|
<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">
|
<span t-field="partner.name"/>
|
||||||
<span t-field="partner.name"/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Display partner move lines -->
|
|
||||||
<t t-call="account_financial_report_qweb.report_general_ledger_qweb_lines">
|
|
||||||
<t t-set="account_or_partner_object" t-value="partner"/>
|
|
||||||
</t>
|
|
||||||
|
|
||||||
<!-- Display partner footer -->
|
|
||||||
<t t-call="account_financial_report_qweb.report_general_ledger_qweb_ending_cumul">
|
|
||||||
<t t-set="account_or_partner_object" t-value="partner"/>
|
|
||||||
<t t-set="type" t-value='"partner_type"'/>
|
|
||||||
</t>
|
|
||||||
</div>
|
</div>
|
||||||
</t>
|
|
||||||
|
<!-- Display partner move lines -->
|
||||||
|
<t t-call="account_financial_report_qweb.report_general_ledger_qweb_lines">
|
||||||
|
<t t-set="account_or_partner_object" t-value="partner"/>
|
||||||
|
</t>
|
||||||
|
|
||||||
|
<!-- Display partner footer -->
|
||||||
|
<t t-call="account_financial_report_qweb.report_general_ledger_qweb_ending_cumul">
|
||||||
|
<t t-set="account_or_partner_object" t-value="partner"/>
|
||||||
|
<t t-set="type" t-value='"partner_type"'/>
|
||||||
|
</t>
|
||||||
|
</div>
|
||||||
</t>
|
</t>
|
||||||
</t>
|
</t>
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
<t t-call="account_financial_report_qweb.internal_layout">
|
<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" t-value='"Open Items Report"'/>
|
<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"/>
|
||||||
|
|
||||||
<div class="page">
|
<div class="page">
|
|
@ -63,23 +63,14 @@
|
||||||
|
|
||||||
<!-- XLSX REPORTS -->
|
<!-- XLSX REPORTS -->
|
||||||
|
|
||||||
<record id="general_ledger_xls_export" model="ir.actions.report.xml">
|
<record id="action_report_general_ledger_xlsx" model="ir.actions.report.xml">
|
||||||
<field name="name">General Ledger XLSX report</field>
|
<field name="name">General Ledger XLSX</field>
|
||||||
<field name="model">report_general_ledger_qweb</field>
|
<field name="model">report_general_ledger_qweb</field>
|
||||||
<field name="type">ir.actions.report.xml</field>
|
<field name="type">ir.actions.report.xml</field>
|
||||||
<field name="report_name">ledger.report.wizard.xlsx</field>
|
<field name="report_name">account_financial_report_qweb.report_general_ledger_xlsx</field>
|
||||||
<field name="report_type">xlsx</field>
|
<field name="report_type">xlsx</field>
|
||||||
<field name="auto" eval="False"/>
|
<field name="auto" eval="False"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<report
|
|
||||||
id="action_report_general_ledger_xlsx"
|
|
||||||
model="report_general_ledger_qweb"
|
|
||||||
string="General Ledger"
|
|
||||||
report_type="xlsx"
|
|
||||||
name="account_financial_report_qweb.report_general_ledger_xlsx"
|
|
||||||
file="account_financial_report_qweb.report_general_ledger_xlsx"
|
|
||||||
/>
|
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</openerp>
|
</openerp>
|
||||||
|
|
Loading…
Reference in New Issue