Skip to content
Snippets Groups Projects
Commit c394fdd21ad6 authored by Houzefa Abbasbhay's avatar Houzefa Abbasbhay :slight_smile:
Browse files

Account consultation: Statement print button

parent 46c0292c6375
No related branches found
No related tags found
No related merge requests found
......@@ -12,3 +12,13 @@
This module adds:
* Account consultation.
Configuration
-------------
Account consultation relies on an Odoo report that has to be set up as follows:
* Model (``model``): ``account.move.line``.
* Technical name (``report_name``): ``account_report.account_statement``.
......@@ -35,6 +35,16 @@
This module adds:
* Account consultation.
Configuration
-------------
Account consultation relies on an Odoo report that has to be set up as follows:
* Model (``model``): ``account.move.line``.
* Technical name (``report_name``): ``account_report.account_statement``.
''',
'version': '8.0.1.2.0',
'category': 'Accounting',
......
......@@ -237,6 +237,40 @@
'account_report.account_consultation_analytic_aml_list',
)
@api.multi
def print_statement(self, list_view_ref):
"""Print an account statement report (which needs to have been set up
in advance).
:return: Action to print the report.
:rtype: Dictionary.
"""
self.ensure_one()
amls = self.env['account.move.line'].search(self._build_aml_domain())
if not amls:
raise exceptions.Warning(_(
'No accounting entry could be found with the specified '
'parameters.'
))
# Build a context that points to our accounting entries.
report_context = self.env.context.copy()
report_context.update({
'active_ids': amls.ids,
'active_model': 'account.move.line',
})
report_context.pop('active_id', None)
# Let the reporting engine do the rest.
return {
'context': report_context,
'datas': {'ids': amls.ids, 'model': 'account.move.line'},
'report_name': 'account_report.account_statement',
'type': 'ir.actions.report.xml',
}
def _build_aml_domain(self):
"""Return a domain built based on the specified parameters made to find
accounting entries.
......
......@@ -63,4 +63,5 @@
</group>
<footer>
<button name="open_general_list" type="object"
......@@ -66,3 +67,9 @@
<button name="open_general_list" type="object"
string="Open the general list" class="oe_highlight" />
class="oe_highlight" style="margin-right: 10px;">
<span>
<i class="fa fa-list" aria-hidden="true"></i>
Open the general list
</span>
</button>
<button name="open_analytic_list" type="object"
......@@ -68,3 +75,17 @@
<button name="open_analytic_list" type="object"
string="Open the analytic list" class="oe_highlight" />
class="oe_highlight" style="margin-right: 10px;">
<span>
<i class="fa fa-list" aria-hidden="true"></i>
Open the analytic list
</span>
</button>
<button name="print_statement" type="object"
class="oe_highlight" style="margin-right: 10px;">
<span>
<i class="fa fa-file-text-o" aria-hidden="true"></i>
Print the statement
</span>
</button>
<button string="Close" special="cancel" class="oe_link" />
......@@ -70,4 +91,5 @@
<button string="Close" special="cancel" class="oe_link" />
</footer>
</form>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment