Browse Source

[UPDT] Report Updated 'cash_flow_statement'

pull/150/head
Ajmal JK 5 years ago
parent
commit
6f2233cc5a
  1. 4
      cash_flow_statement/__manifest__.py
  2. 60
      cash_flow_statement/data/cash_flow_data.xml
  3. 7
      cash_flow_statement/doc/RELEASE_NOTES.md
  4. 10
      cash_flow_statement/models/cash_flow.py
  5. 184
      cash_flow_statement/reports/cash_flow_report.py
  6. 205
      cash_flow_statement/reports/cash_flow_report.xml
  7. BIN
      cash_flow_statement/static/description/images/cash_flow_statements-3.png
  8. BIN
      cash_flow_statement/static/description/images/cash_flow_statements-4.png
  9. BIN
      cash_flow_statement/static/description/images/cash_flow_statements-5.png
  10. BIN
      cash_flow_statement/static/description/images/cash_flow_statements-7.png
  11. BIN
      cash_flow_statement/static/description/images/cash_flow_statements-8.png
  12. BIN
      cash_flow_statement/static/description/images/cash_flow_statements.gif
  13. BIN
      cash_flow_statement/static/description/images/cash_flow_statements.png
  14. 39
      cash_flow_statement/static/description/index.html
  15. 26
      cash_flow_statement/wizard/account_report.py
  16. 41
      cash_flow_statement/wizard/account_report_view.xml

4
cash_flow_statement/__manifest__.py

@ -22,7 +22,7 @@
{
'name': 'Cash Flow Statement In Odoo',
'version': '12.0.2.0.0',
'version': '12.0.2.1.1',
'summary': """Print pdf reports of cash flow statements """,
'description': """Print pdf reports of cash flow statements,Cashflow statement""",
'author': "Cybrosys Techno Solutions",
@ -32,12 +32,12 @@
'category': 'Accounting',
'depends': [
'account',
'report_xlsx',
],
'data': [
'security/ir.model.access.csv',
'data/cash_flow_data.xml',
'views/account_configuration.xml',
'wizard/account_report_view.xml',
'reports/cash_flow_report.xml',
],
'images': ['static/description/banner.png'],

60
cash_flow_statement/data/cash_flow_data.xml

@ -1,11 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="account_financial_report_cash_flow0" model="account.financial.report">
<field name="name">Cash Flow Statement</field>
<field name="type">sum</field>
</record>
<record id="account_financial_report_operation0" model="account.financial.report">
<field name="name">Operations</field>
<field name="sequence">1</field>
@ -15,19 +13,16 @@
</record>
<record id="cash_in_from_operation0" model="account.financial.report">
<field name="name">Cash In</field>
<field name="sequence">1</field>
<field name="parent_id" ref="account_financial_report_operation0"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">accounts</field>
</record>
<record id="cash_out_operation1" model="account.financial.report">
<field name="name">Cash Out</field>
<field name="sequence">2</field>
<field name="parent_id" ref="account_financial_report_operation0"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">accounts</field>
</record>
<record id="account_financial_report_investing_activity0" model="account.financial.report">
<field name="name">Investing Activities</field>
<field name="sequence">2</field>
@ -56,7 +51,6 @@
<field name="type">sum</field>
</record>
<record id="cash_in_financial0" model="account.financial.report">
<field name="name">Cash In</field>
<field name="parent_id" ref="account_financial_report_financing_activity1"/>
@ -69,58 +63,4 @@
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">accounts</field>
</record>
<record id="accounting_report_view" model="ir.ui.view">
<field name="name">Accounting Report</field>
<field name="model">accounting.report</field>
<field name="inherit_id" ref="account.account_common_report_view"/>
<field name="arch" type="xml">
<field name="target_move" position="before">
<field name="account_report_id" domain="[('parent_id','=',False)]"/>
</field>
<field name="target_move" position="after">
<field name="enable_filter"/>
<field name="debit_credit" attrs="{'invisible': [('enable_filter','=',True)]}"/>
</field>
<field name="journal_ids" position="after">
<notebook tabpos="up" colspan="4">
<page string="Comparison" name="comparison" attrs="{'invisible': [('enable_filter','=',False)]}">
<group>
<field name="label_filter" attrs="{'required': [('enable_filter', '=', True)]}"/>
<field name="filter_cmp"/>
</group>
<group string="Dates" attrs="{'invisible':[('filter_cmp', '!=', 'filter_date')]}">
<field name="date_from_cmp" attrs="{'required':[('filter_cmp', '=', 'filter_date')]}"/>
<field name="date_to_cmp" attrs="{'required':[('filter_cmp', '=', 'filter_date')]}"/>
</group>
</page>
</notebook>
</field>
<field name="journal_ids" position="replace"/>
</field>
</record>
<record id="action_account_report_cfs" model="ir.actions.act_window">
<field name="name">Cash Flow Statement</field>
<field name="res_model">accounting.report</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="accounting_report_view"/>
<field name="target">new</field>
<field name="context"
eval="{'default_account_report_id':ref('cash_flow_statement.account_financial_report_cash_flow0')}"/>
</record>
<menuitem id="menu_financial_reports"
name="Financial reports"
sequence="1"
parent="account.menu_finance_reports"
groups="account.group_account_user"/>
<menuitem id="menu_account_report_cfs"
name="Cash Flow Statement"
sequence="5"
action="action_account_report_cfs"
parent="menu_financial_reports"
groups="account.group_account_user"/>
</odoo>

7
cash_flow_statement/doc/RELEASE_NOTES.md

@ -9,6 +9,11 @@
#### 11.11.2019
#### Version 12.0.2.0.0
##### RMV
- DEpendency Removed
- Dependency Removed
#### 07.03.2020
#### Version 12.0.2.1.1
##### Report format changed.

10
cash_flow_statement/models/cash_flow.py

@ -25,13 +25,13 @@ from odoo import api, models, fields
class AccountFinancialReport(models.Model):
_name = "account.financial.report"
_description = "Account Report"
_description = "Cash Flow Report"
@api.multi
@api.depends('parent_id', 'parent_id.level')
def _get_level(self):
'''Returns a dictionary with key=the ID of a record and value = the level of this
record in the tree structure.'''
"""Returns a dictionary with key=the ID of a record and value = the level of this
record in the tree structure."""
for report in self:
level = 0
if report.parent_id:
@ -39,8 +39,8 @@ class AccountFinancialReport(models.Model):
report.level = level
def _get_children_by_order(self):
'''returns a recordset of all the children computed recursively,
and sorted by sequence. Ready for the printing'''
"""returns a recordset of all the children computed recursively,
and sorted by sequence. Ready for the printing"""
res = self
children = self.search([('parent_id', 'in', self.ids)], order='sequence ASC')
if children:

184
cash_flow_statement/reports/cash_flow_report.py

@ -21,6 +21,7 @@
#############################################################################
import time
import datetime
from odoo import api, models, fields, _
from odoo.exceptions import UserError
@ -57,7 +58,6 @@ class ReportFinancial(models.AbstractModel):
return res
def _compute_report_balance(self, reports):
res = {}
fields = ['credit', 'debit', 'balance']
for report in reports:
@ -66,20 +66,23 @@ class ReportFinancial(models.AbstractModel):
res[report.id] = dict((fn, 0.0) for fn in fields)
if report.type == 'accounts':
# it's the sum of credit or debit
res2 = self._compute_report_balance(report.parent_id)
for key, value in res2.items():
cash_in_operation = self.env.ref('cash_flow_statement.cash_in_from_operation0')
cash_out_operation = self.env.ref('cash_flow_statement.cash_out_operation1')
cash_in_financial = self.env.ref('cash_flow_statement.cash_in_financial0')
cash_out_financial = self.env.ref('cash_flow_statement.cash_out_financial1')
cash_in_investing = self.env.ref('cash_flow_statement.cash_in_investing0')
cash_out_investing = self.env.ref('cash_flow_statement.cash_out_investing1')
cash_in_operation = self.env.ref('cash_flow_statement.cash_in_from_operation0')
cash_out_operation = self.env.ref('cash_flow_statement.cash_out_operation1')
cash_in_financial = self.env.ref('cash_flow_statement.cash_in_financial0')
cash_out_financial = self.env.ref('cash_flow_statement.cash_out_financial1')
cash_in_investing = self.env.ref('cash_flow_statement.cash_in_investing0')
cash_out_investing = self.env.ref('cash_flow_statement.cash_out_investing1')
res[report.id]['account'] = self._compute_account_balance(report.parent_id.account_ids)
for value in res[report.id]['account'].values():
if report == cash_in_operation or report == cash_in_financial or report == cash_in_investing:
res[report.id]['debit'] += value['debit']
res[report.id]['balance'] += value['debit']
elif report == cash_out_operation or report == cash_out_financial or report == cash_out_investing:
res[report.id]['credit'] += value['credit']
res[report.id]['balance'] += -(value['credit'])
elif report.type == 'account_type':
# it's the sum the leaf accounts with such an account type
accounts = self.env['account.account'].search([('user_type_id', 'in', report.account_type_ids.ids)])
@ -95,11 +98,11 @@ class ReportFinancial(models.AbstractModel):
res[report.id][field] += value.get(field)
elif report.type == 'sum':
# it's the sum of the linked accounts
res[report.id]['account'] = self._compute_account_balance(report.account_ids)
for values in res[report.id]['account'].values():
# it's the sum of the child records
res2 = self._compute_report_balance(report.children_ids)
for key, value in res2.items():
for field in fields:
res[report.id][field] += values.get(field)
res[report.id][field] += value.get(field)
return res
def get_account_lines(self, data):
@ -107,77 +110,139 @@ class ReportFinancial(models.AbstractModel):
account_report = self.env['account.financial.report'].search([('id', '=', data['account_report_id'][0])])
child_reports = account_report._get_children_by_order()
res = self.with_context(data.get('used_context'))._compute_report_balance(child_reports)
if data['enable_filter']:
comparison_res = self.with_context(data.get('comparison_context'))._compute_report_balance(child_reports)
for report_id, value in comparison_res.items():
res[report_id]['comp_bal'] = value['balance']
report_acc = res[report_id].get('account')
if report_acc:
for account_id, val in comparison_res[report_id].get('account').items():
report_acc[account_id]['comp_bal'] = val['balance']
for report in child_reports:
vals = {
'name': report.name,
'id': report.id,
'balance': res[report.id]['balance'] * report.sign,
'type': 'report',
'level': bool(report.style_overwrite) and report.style_overwrite or report.level,
'account_type': report.type or False, # used to underline the financial report balances
'account_type': report.type or False, # used to underline the financial report balances,
'debit': res[report.id]['debit'],
'credit': res[report.id]['credit']
}
if data['debit_credit']:
vals['debit'] = res[report.id]['debit']
vals['credit'] = res[report.id]['credit']
if data['enable_filter']:
vals['balance_cmp'] = res[report.id]['comp_bal'] * report.sign
lines.append(vals)
if report.display_detail == 'no_detail':
# the rest of the loop is used to display the details of the financial report, so it's not needed here.
continue
if res[report.id].get('account'):
# if res[report.id].get('debit'):
sub_lines = []
for account_id, value in res[report.id]['account'].items():
# if there are accounts to display, we add them to the lines with a level equals to their level in
# the COA + 1 (to avoid having them with a too low level that would conflicts with the level of data
# financial reports for Assets, liabilities...)
flag = False
account = self.env['account.account'].browse(account_id)
vals = {
'name': account.code + ' ' + account.name,
'balance': value['balance'] * report.sign or 0.0,
'type': 'account',
'level': report.display_detail == 'detail_with_hierarchy' and 4,
'account_type': account.internal_type,
}
if data['debit_credit']:
vals['debit'] = value['debit']
vals['credit'] = value['credit']
cash_in_operation = self.env.ref('cash_flow_statement.cash_in_from_operation0')
cash_out_operation = self.env.ref('cash_flow_statement.cash_out_operation1')
cash_in_financial = self.env.ref('cash_flow_statement.cash_in_financial0')
cash_out_financial = self.env.ref('cash_flow_statement.cash_out_financial1')
cash_in_investing = self.env.ref('cash_flow_statement.cash_in_investing0')
cash_out_investing = self.env.ref('cash_flow_statement.cash_out_investing1')
if report == cash_in_operation or report == cash_in_financial or report == cash_in_investing:
sub_lines = []
for account_id, value in res[report.id]['account'].items():
flag = False
account = self.env['account.account'].browse(account_id)
vals = {
'name': account.code + ' ' + account.name,
'id': account.id,
'balance': value['balance'] * report.sign or 0.0,
'type': 'account',
'level': report.display_detail == 'detail_with_hierarchy' and 4,
'account_type': account.internal_type,
'cash_flow_type': account.cash_flow_type.id,
'debit': value['debit'],
'credit': value['credit']
}
if not account.company_id.currency_id.is_zero(
vals['debit']) or not account.company_id.currency_id.is_zero(vals['credit']):
flag = True
if not account.company_id.currency_id.is_zero(vals['balance']):
flag = True
if flag:
if vals['debit'] != 0:
vals['credit'] = 0
vals['balance'] = vals['debit']
sub_lines.append(vals)
lines += sorted(sub_lines, key=lambda sub_line: sub_line['name'])
elif report == cash_out_operation or report == cash_out_financial or report == cash_out_investing:
sub_lines = []
for account_id, value in res[report.id]['account'].items():
flag = False
account = self.env['account.account'].browse(account_id)
vals = {
'name': account.code + ' ' + account.name,
'id': account.id,
'balance': value['balance'] * report.sign or 0.0,
'type': 'account',
'level': report.display_detail == 'detail_with_hierarchy' and 4,
'account_type': account.internal_type,
'cash_flow_type': account.cash_flow_type.id,
'debit': value['debit'],
'credit': value['credit']
}
if not account.company_id.currency_id.is_zero(
vals['debit']) or not account.company_id.currency_id.is_zero(vals['credit']):
flag = True
if not account.company_id.currency_id.is_zero(vals['balance']):
flag = True
if data['enable_filter']:
vals['balance_cmp'] = value['comp_bal'] * report.sign
if not account.company_id.currency_id.is_zero(vals['balance_cmp']):
if not account.company_id.currency_id.is_zero(vals['balance']):
flag = True
if flag:
sub_lines.append(vals)
lines += sorted(sub_lines, key=lambda sub_line: sub_line['name'])
if flag:
if vals['credit'] != 0:
vals['debit'] = 0
vals['balance'] = -(vals['credit'])
sub_lines.append(vals)
lines += sorted(sub_lines, key=lambda sub_line: sub_line['name'])
return lines
def find_cash_at_beginning(self, form):
cr = self.env.cr
accounts = self.env['account.account'].search([('cash_flow_type', '!=', False)])
account_ids = []
for account in accounts:
account_ids.append(account['id'])
sum_deb = 0
sum_cred = 0
sum_bal = 0
for acnt in account_ids:
query = "SELECT sum(debit) as debit,sum(credit) as credit, sum(debit) - sum(credit)" \
"balance from account_move_line aml where aml.account_id = %s"
vals = []
if form['date_from']:
query += " and aml.date<%s"
vals += [acnt, form['date_from']]
else:
vals += [acnt]
cr.execute(query, tuple(vals))
values = cr.dictfetchall()
for vals in values:
if vals['balance']:
sum_deb += vals['debit']
sum_cred += vals['credit']
sum_bal += vals['balance']
return sum_deb,sum_cred,sum_bal
@api.model
def _get_report_values(self, docids, data=None):
print('success')
if not data.get('form') or not self.env.context.get('active_model') or not self.env.context.get('active_id'):
raise UserError(_("Form content is missing, this report cannot be printed."))
end_date = []
if data['form']['date_from']:
from_date = datetime.datetime.strptime(data['form']['date_from'], '%Y-%m-%d').date()
end_date = from_date - (datetime.timedelta(days=1))
self.model = self.env.context.get('active_model')
docs = self.env[self.model].browse(self.env.context.get('active_id'))
report_lines = self.get_account_lines(data.get('form'))
cash_beginning = self.find_cash_at_beginning(data.get('form'))
print('cash_beginning', cash_beginning[2])
return {
'doc_ids': self.ids,
'doc_model': self.model,
@ -185,6 +250,10 @@ class ReportFinancial(models.AbstractModel):
'docs': docs,
'time': time,
'get_account_lines': report_lines,
'end_date': end_date,
'sum_deb': cash_beginning[0],
'sum_cred': cash_beginning[1],
'sum_bal': cash_beginning[2],
}
@ -200,10 +269,8 @@ class CashFlow(models.Model):
@api.onchange('cash_flow_type')
def onchange_cash_flow_type(self):
print(self._origin.id, "self.cash_flow_type", self._origin.cash_flow_type)
for rec in self.cash_flow_type:
print('rec', rec)
# update new record
rec.write({
'account_ids': [(4, self._origin.id)]
@ -211,7 +278,6 @@ class CashFlow(models.Model):
if self._origin.cash_flow_type.ids:
for rec in self._origin.cash_flow_type:
print('delete', rec.name)
# remove old record
rec.write({
'account_ids': [(3, self._origin.id)]

205
cash_flow_statement/reports/cash_flow_report.xml

@ -9,7 +9,7 @@
<div class="row mt32 mb32">
<div class="col-4">
<strong>Target Moves:</strong>
<b>Target Moves:</b>
<p>
<span t-if="data['target_move'] == 'all'">All Entries</span>
<span t-if="data['target_move'] == 'posted'">All Posted Entries</span>
@ -17,11 +17,29 @@
</div>
<div class="col-4">
<p>
<strong>Date from :</strong> <span t-esc="data['date_from']"/><br/>
<strong>Date to :</strong> <span t-esc="data['date_to']"/>
<b>Date from :</b>
<span t-esc="data['date_from']"/>
<br/>
<b>Date to :</b>
<span t-esc="data['date_to']"/>
</p>
</div>
</div>
<t t-if="data['date_from']">
<div class="row mt32 mb32">
<div class="col-8">
<p>
<b>For the Period / Year End :</b>&amp;nbsp;
<span t-esc="end_date"/>
<br/>
<b>Cash at the beginning of the Period / Year :</b>&amp;nbsp;
<span t-esc="round(sum_bal, 2)"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</p>
</div>
</div>
</t>
<table class="table table-sm table-reports" t-if="data['debit_credit'] == 1">
<thead>
@ -29,37 +47,116 @@
<th>Name</th>
<th class="text-right">Debit</th>
<th class="text-right">Credit</th>
<th class="text-right"/>
<th class="text-right">Balance</th>
</tr>
</thead>
<tbody>
<t t-set="net_deb_increases" t-value="0"/>
<t t-set="net_cred_increases" t-value="0"/>
<t t-set="net_bal_increases" t-value="0"/>
<tr t-foreach="get_account_lines" t-as="a">
<t t-if="a['level'] != 0">
<t t-if="a.get('level') &gt; 3"><t t-set="style" t-value="'font-weight: normal;'"/></t>
<t t-if="not a.get('level') &gt; 3"><t t-set="style" t-value="'font-weight: bold;'"/></t>
<t t-if="a.get('level') &gt; 3">
<t t-set="style" t-value="'font-weight: normal;'"/>
</t>
<t t-if="not a.get('level') &gt; 3">
<t t-set="style" t-value="'font-weight: bold;'"/>
</t>
<td>
<span style="color: white;" t-esc="'..' * a.get('level', 0)"/>
<span t-att-style="style" t-esc="a.get('name')"/>
<t t-if="a['level'] == 1">
<span t-att-style="style" t-esc="a.get('name')"/>
<span>(Net Cash From)</span>
<t t-set="net_deb_increases"
t-value="net_deb_increases+a.get('debit')"/>
<t t-set="net_cred_increases"
t-value="net_cred_increases+a.get('credit')"/>
<t t-set="net_bal_increases"
t-value="net_bal_increases+a.get('balance')"/>
</t>
<t t-if="a['level'] != 1">
<span t-att-style="style" t-esc="a.get('name')"/>
</t>
</td>
<td class="text-right" style="white-space: text-nowrap;">
<!-- <t t-if="a.get('debit')">-->
<span t-att-style="style" t-esc="a.get('debit')" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
<!-- </t>-->
<span t-att-style="style" t-esc="a.get('debit')"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</td>
<td class="text-right" style="white-space: text-nowrap;">
<!-- <t t-if="a.get('credit')">-->
<span t-att-style="style" t-esc="a.get('credit')" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
<!-- </t>-->
<span t-att-style="style" t-esc="a.get('credit')"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</td>
<td class="text-right" style="white-space: text-nowrap;">
<span t-att-style="style" t-esc="a.get('balance')" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
<span t-att-style="style" t-esc="a.get('balance')"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</td>
</t>
</tr>
<tr>
<td>
<b>Net Cash Increases</b>
</td>
<td>
<b>
<span t-esc="round(net_deb_increases, 2)" style="float:right;"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</b>
</td>
<td>
<b>
<span t-esc="round(net_cred_increases, 2)" style="float:right;"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</b>
</td>
<td>
<b>
<span t-esc="round(net_bal_increases, 2)" style="float:right;"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</b>
</td>
</tr>
<t t-if="data['date_from']">
<tr>
<td>
<b>Cash at Year End</b>
</td>
<td>
<t t-set="year_end_cash_deb"
t-value="net_deb_increases+sum_deb"/>
<b>
<span t-esc="round(year_end_cash_deb, 2)" style="float:right;"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</b>
</td>
<td>
<t t-set="year_end_cash_cred"
t-value="net_cred_increases+sum_cred"/>
<b>
<span t-esc="round(year_end_cash_cred, 2)" style="float:right;"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</b>
</td>
<td>
<t t-set="year_end_cash_bal"
t-value="net_bal_increases+sum_bal"/>
<b>
<span t-esc="round(year_end_cash_bal, 2)" style="float:right;"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</b>
</td>
</tr>
</t>
</tbody>
</table>
<table class="table table-sm table-reports" t-if="not data['enable_filter'] and not data['debit_credit']">
<table class="table table-sm table-reports"
t-if="not data['debit_credit']">
<thead>
<tr>
<th>Name</th>
@ -67,48 +164,76 @@
</tr>
</thead>
<tbody>
<!-- <t t-set="net_deb_increases" t-value="0"/>-->
<!-- <t t-set="net_cred_increases" t-value="0"/>-->
<t t-set="net_bal_increases" t-value="0"/>
<tr t-foreach="get_account_lines" t-as="a">
<t t-if="a['level'] != 0">
<t t-if="a.get('level') &gt; 3"><t t-set="style" t-value="'font-weight: normal;'"/></t>
<t t-if="not a.get('level') &gt; 3"><t t-set="style" t-value="'font-weight: bold;'"/></t>
<t t-if="a.get('level') &gt; 3">
<t t-set="style" t-value="'font-weight: normal;'"/>
</t>
<t t-if="not a.get('level') &gt; 3">
<t t-set="style" t-value="'font-weight: bold;'"/>
</t>
<td>
<span style="color: white;" t-esc="'..' * a.get('level', 0)"/>
<span t-att-style="style" t-esc="a.get('name')"/>
<t t-if="a['level'] == 1">
<span t-att-style="style" t-esc="a.get('name')"/>
<span>(Net Cash From)</span>
<!-- <t t-set="net_deb_increases"-->
<!-- t-value="net_deb_increases+a.get('debit')"/>-->
<!-- <t t-set="net_cred_increases"-->
<!-- t-value="net_cred_increases+a.get('credit')"/>-->
<t t-set="net_bal_increases"
t-value="net_bal_increases+a.get('balance')"/>
</t>
<t t-if="a['level'] != 1">
<span t-att-style="style" t-esc="a.get('name')"/>
</t>
</td>
<td class="text-right">
<span t-att-style="style" t-esc="a.get('balance')"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</td>
<td class="text-right"><span t-att-style="style" t-esc="a.get('balance')" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td>
</t>
</tr>
</tbody>
</table>
<table class="table table-sm table-reports" t-if="data['enable_filter'] == 1 and not data['debit_credit']">
<thead>
<tr>
<th>Name</th>
<th class="text-right">Balance</th>
<th class="text-right"><span t-esc="data['label_filter']"/></th>
<td>
<b>Net Cash Increases</b>
</td>
<td>
<b>
<span t-esc="round(net_bal_increases, 2)" style="float:right;"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</b>
</td>
</tr>
</thead>
<tbody>
<tr t-foreach="get_account_lines" t-as="a">
<t t-if="a['level'] != 0">
<t t-if="a.get('level') &gt; 3"><t t-set="style" t-value="'font-weight: normal;'"/></t>
<t t-if="not a.get('level') &gt; 3"><t t-set="style" t-value="'font-weight: bold;'"/></t>
<t t-if="data['date_from']">
<tr>
<td>
<span style="color: white;" t-esc="'..'"/>
<span t-att-style="style" t-esc="a.get('name')"/>
<b>Cash at Year End</b>
</td>
<td class="text-right"><span t-att-style="style" t-esc="a.get('balance')" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td>
<td class="text-right"><span t-att-style="style" t-esc="a.get('balance_cmp')"/></td>
</t>
</tr>
<td>
<t t-set="year_end_cash"
t-value="net_bal_increases+sum_bal"/>
<b>
<span t-esc="round(year_end_cash, 2)" style="float:right;"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</b>
</td>
</tr>
</t>
</tbody>
</table>
</div>
</t>
</t>
</t>
</template>
<report
id="action_report_financial"
model="account.financial.report"
@ -117,5 +242,5 @@
report_type="qweb-pdf"
name="cash_flow_statement.report_financial"
file="cash_flow_statement.report_financial"
/>
/>
</odoo>

BIN
cash_flow_statement/static/description/images/cash_flow_statements-3.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 78 KiB

BIN
cash_flow_statement/static/description/images/cash_flow_statements-4.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 57 KiB

BIN
cash_flow_statement/static/description/images/cash_flow_statements-5.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

BIN
cash_flow_statement/static/description/images/cash_flow_statements-7.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

BIN
cash_flow_statement/static/description/images/cash_flow_statements-8.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

BIN
cash_flow_statement/static/description/images/cash_flow_statements.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
cash_flow_statement/static/description/images/cash_flow_statements.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

39
cash_flow_statement/static/description/index.html

@ -6,7 +6,7 @@
<div class="col-md-7 col-sm-12 col-xs-12" style="padding: 0px">
<div style=" margin: 0 0 0px;padding: 20px 0 10;font-size: 23px;line-height: 35px;font-weight: 400;color: #000;border-top: 1px solid rgba(255,255,255,0.1);border-bottom: 1px solid rgba(255,255,255,0.11);text-align: left;">
<h1 style="font-size: 39px;font-weight: 600;margin: 0px !important;">Cash Flow Statement In Odoo</h1>
<h3 style="font-size: 21px;margin-top: 8px;position: relative;">Print pdf reports of cash flow statements</h3>
<h3 style="font-size: 21px;margin-top: 8px;position: relative;">Print PDF Reports of Cash Flow Statements</h3>
</div>
<h2 style="font-weight: 600;font-size: 1.8rem;margin-top: 15px;">Key Highlights</h2>
<ul style=" padding: 0 1px; list-style: none; ">
@ -24,7 +24,7 @@
</ul>
</div>
<div class="col-md-5 col-sm-12 col-xs-12"> <img src="images/cash_flow_statements.png" class="img-responsive" alt=""> </div>
<div class="col-md-5 col-sm-12 col-xs-12"> <img src="images/cash_flow_statements.gif" class="img-responsive" alt=""> </div>
</div>
<div>
@ -45,9 +45,6 @@
<li class="nav-item mr-1 mb-3" style="font-size: 1.05rem;font-weight: 400;transition: all .15s ease;color: #ffffff;background-color: #d31c22;box-shadow: 0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08);border: 0;font-family: 'Open Sans',sans-serif;width: 140px;border-radius: 0.30rem;"> <a class="nav-link" id="pills-profile-tab" data-toggle="pill" href="#pills-profile" role="tab" aria-controls="pills-profile" aria-selected="false" style="color: #000000;line-height: 33px;border: 0;border-radius: .25rem;font-weight: 400; text-align: center;
color: #fff;">Screenshots </a> </li>
<!-- <li class="nav-item mr-1 mb-3" style="font-size: 1.05rem;font-weight: 400;transition: all .15s ease;color: #ffffff;background-color: #d31c22;box-shadow: 0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08);border: 0;font-family: 'Open Sans',sans-serif;width: 140px;border-radius: 0.30rem;"> <a class="nav-link" id="pills-profile-tab" data-toggle="pill" href="#pills-video" role="tab" aria-controls="pills-profile" aria-selected="false" style="color: #000000;line-height: 33px;border: 0;border-radius: .25rem;font-weight: 400; text-align: center;
color: #fff;">Video </a> </li> -->
</ul>
@ -154,6 +151,24 @@
<img class="img img-responsive center-block" style="border-top-left-radius: 10px;border-top-right-radius: 10px;" src="images/cash_flow_statements-5.png"> </div>
</div>
</div>
<div class="carousel-item" style="min-height: 0px;">
<div class="col-xs-12 col-sm-12 col-md-12 mb16 mt16" style="float: left;">
<h3 class="mb32 alert" style="font-weight:400;color: #091E42;background: #fff;text-align: left;border-radius: 0; font-size: 18px; "> <img src="images/checked.png" style=" width: 22px; margin-right: 6px; " alt="check">If we provide start date while printing, then it shows some additional lines.</h3>
<div style=""> <img class="img img-responsive center-block" style="border-top-left-radius: 10px;border-top-right-radius: 10px;" src="images/cash_flow_statements-7.png"> </div>
</div>
</div>
<div class="carousel-item" style="min-height: 0px;">
<div class="col-xs-12 col-sm-12 col-md-12 mb16 mt16" style="float: left;">
<h3 class="mb32 alert" style="font-weight:400;color: #091E42;background: #fff;text-align: left;border-radius: 0; font-size: 18px; "> <img src="images/checked.png" style=" width: 22px; margin-right: 6px; " alt="check">Enabled debit/credit option.</h3>
<div style=""> <img class="img img-responsive center-block" style="border-top-left-radius: 10px;border-top-right-radius: 10px;" src="images/cash_flow_statements-8.png"> </div>
</div>
</div>
</div>
@ -164,19 +179,6 @@
</div>
</div>
<!-- <div class="px-3 pt-1 tab-pane fade" id="pills-video" role="tabpanel" aria-labelledby="
pills-home-tab"> -->
<!-- Video-->
<!-- <h2 style="font-weight: 600;text-align: center;width: 100%;">Video</h2>
<hr style="margin-top: 0px;margin-bottom: 2%;border: 0;text-align: center;border-top: 3px solid #d21c22;width: 5%;"> -->
<!-- <center><p>Cash Flow Statements Demo</p> -->
<!--<a href="https://www.youtube.com/watch?v=57QWXrMYe84&feature=youtu.be" target="_blank"> <img src="addon-youtube.png" style="width:80%;"></a>-->
<!-- <div class="s_panel_video" data-video-id="h95gK1oNLHA?rel=0" style="cursor:pointer;">
<img class="img-fluid s_tooltip_tabs_tooltip_image s_figure_link pb0" src="images/pos_multivariant_youtube.png" alt="Cybrosys Cover Video" style="max-width:100%;">
</div> -->
</center>
</div>
@ -388,4 +390,3 @@
</div>
</section>
</div>

26
cash_flow_statement/wizard/account_report.py

@ -36,30 +36,27 @@ class AccountingReport(models.TransientModel):
reports = self.env['account.financial.report'].search([('name', 'ilike', menu)])
return reports and reports[0] or False
enable_filter = fields.Boolean(string='Enable Comparison')
account_report_id = fields.Many2one('account.financial.report', string='Account Reports', required=True, default=_get_account_report)
label_filter = fields.Char(string='Column Label', help="This label will be displayed on report to show the balance"
" computed for the given comparison filter.")
filter_cmp = fields.Selection([('filter_no', 'No Filters'), ('filter_date', 'Date')], string='Filter by', required=True, default='filter_no')
date_from_cmp = fields.Date(string='Start Date')
date_to_cmp = fields.Date(string='End Date')
debit_credit = fields.Boolean(string='Display Debit/Credit Columns', help="This option allows you to get more details about the way your balances are computed. Because it is space consuming, we do not allow to use it while doing a comparison.")
account_report_id = fields.Many2one('account.financial.report', string='Account Reports', required=True,
default=_get_account_report)
debit_credit = fields.Boolean(string='Enable Debit/Credit',
help="This option allows you to get more details about the way"
" your balances are computed. Because it is space consuming,"
" we do not allow to use it while doing a comparison.")
def _build_comparison_context(self, data):
result = {}
result['journal_ids'] = 'journal_ids' in data['form'] and data['form']['journal_ids'] or False
result['state'] = 'target_move' in data['form'] and data['form']['target_move'] or ''
if data['form']['filter_cmp'] == 'filter_date':
result['date_from'] = data['form']['date_from_cmp']
result['date_to'] = data['form']['date_to_cmp']
result['strict_range'] = True
return result
@api.multi
def check_report(self):
res = super(AccountingReport, self).check_report()
data = {}
data['form'] = self.read(['account_report_id', 'date_from_cmp', 'date_to_cmp', 'journal_ids', 'filter_cmp', 'target_move'])[0]
data['form'] = \
self.read(
['account_report_id', 'journal_ids', 'target_move'])[0]
for field in ['account_report_id']:
if isinstance(data['form'][field], tuple):
data['form'][field] = data['form'][field][0]
@ -68,5 +65,6 @@ class AccountingReport(models.TransientModel):
return res
def _print_report(self, data):
data['form'].update(self.read(['date_from_cmp', 'debit_credit', 'date_to_cmp', 'filter_cmp', 'account_report_id', 'enable_filter', 'label_filter', 'target_move'])[0])
data['form'].update(self.read(
['debit_credit', 'account_report_id', 'target_move'])[0])
return self.env.ref('cash_flow_statement.action_report_financial').report_action(self, data=data, config=False)

41
cash_flow_statement/wizard/account_report_view.xml

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="accounting_report_view" model="ir.ui.view">
<field name="name">Accounting Report</field>
<field name="model">accounting.report</field>
<field name="inherit_id" ref="account.account_common_report_view"/>
<field name="arch" type="xml">
<field name="target_move" position="before">
<field name="account_report_id" domain="[('parent_id','=',False)]"/>
</field>
<field name="date_to" position="after">
<field name="debit_credit"/>
</field>
<field name="journal_ids" position="replace"/>
</field>
</record>
<record id="action_account_report_cfs" model="ir.actions.act_window">
<field name="name">Cash Flow Statement</field>
<field name="res_model">accounting.report</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="accounting_report_view"/>
<field name="target">new</field>
<field name="context"
eval="{'default_account_report_id':ref('cash_flow_statement.account_financial_report_cash_flow0')}"/>
</record>
<menuitem id="menu_financial_reports"
name="Financial reports"
sequence="1"
parent="account.menu_finance_reports"
groups="account.group_account_user"/>
<menuitem id="menu_account_report_cfs"
name="Cash Flow Statement"
sequence="5"
action="action_account_report_cfs"
parent="menu_financial_reports"
groups="account.group_account_user"/>
</odoo>
Loading…
Cancel
Save