@ -0,0 +1,44 @@ |
|||||
|
Dynamic Financial Reports |
||||
|
========================= |
||||
|
* Dynamic financial reports for Odoo 13 community editions |
||||
|
|
||||
|
Installation |
||||
|
============ |
||||
|
- www.odoo.com/documentation/13.0/setup/install.html |
||||
|
- Install our custom addon |
||||
|
|
||||
|
License |
||||
|
------- |
||||
|
General Public License, Version 3 (LGPL v3). |
||||
|
(https://www.odoo.com/documentation/user/13.0/legal/licenses/licenses.html) |
||||
|
|
||||
|
Company |
||||
|
------- |
||||
|
* 'Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
||||
|
|
||||
|
Credits |
||||
|
------- |
||||
|
* Developer: |
||||
|
(v13) Jibin @ Cybrosys |
||||
|
(v13) Mehjabin @ Cybrosys |
||||
|
(v13) Mily @ Cybrosys |
||||
|
(v13) Aneesh @ Cybrosys |
||||
|
|
||||
|
Contacts |
||||
|
-------- |
||||
|
* Mail Contact : odoo@cybrosys.com |
||||
|
|
||||
|
Bug Tracker |
||||
|
----------- |
||||
|
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
||||
|
|
||||
|
Maintainer |
||||
|
========== |
||||
|
This module is maintained by Cybrosys Technologies. |
||||
|
|
||||
|
For support and more information, please visit https://www.cybrosys.com |
||||
|
|
||||
|
Further information |
||||
|
=================== |
||||
|
HTML Description: `<static/description/index.html>`__ |
||||
|
|
@ -0,0 +1,5 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
|
||||
|
from . import controllers |
||||
|
from . import wizard |
||||
|
from . import report |
@ -0,0 +1,65 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2020-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
|
||||
|
{ |
||||
|
'name': 'Dynamic Financial Reports', |
||||
|
'version': '13.0.1.0.0', |
||||
|
'category': 'Accounting', |
||||
|
'summary': """Dynamic Financial Reports with drill |
||||
|
down and filters– Community Edition""", |
||||
|
'description': "This module creates dynamic Accounting General Ledger, Trial Balance, Balance Sheet " |
||||
|
"Proft and Loss, Cash Flow Statements, Partner Ledger," |
||||
|
"Partner Ageing, Day book" |
||||
|
"Bank book and Cash book reports in Odoo 14 community edition.", |
||||
|
'author': 'Cybrosys Techno Solutions', |
||||
|
'website': "https://www.cybrosys.com", |
||||
|
'company': 'Cybrosys Techno Solutions', |
||||
|
'maintainer': 'Cybrosys Techno Solutions', |
||||
|
'depends': ['base', 'base_accounting_kit'], |
||||
|
'data': [ |
||||
|
'security/ir.model.access.csv', |
||||
|
'views/templates.xml', |
||||
|
'views/views.xml', |
||||
|
'views/kit_menus.xml', |
||||
|
'report/trial_balance.xml', |
||||
|
'report/general_ledger.xml', |
||||
|
'report/cash_flow_report.xml', |
||||
|
'report/financial_report_template.xml', |
||||
|
'report/partner_ledger.xml', |
||||
|
'report/ageing.xml', |
||||
|
'report/daybook.xml', |
||||
|
], |
||||
|
'qweb': [ |
||||
|
'static/src/xml/general_ledger_view.xml', |
||||
|
'static/src/xml/trial_balance_view.xml', |
||||
|
'static/src/xml/cash_flow_view.xml', |
||||
|
'static/src/xml/financial_reports_view.xml', |
||||
|
'static/src/xml/partner_ledger_view.xml', |
||||
|
'static/src/xml/ageing.xml', |
||||
|
'static/src/xml/daybook.xml', |
||||
|
], |
||||
|
'license': 'LGPL-3', |
||||
|
'images': ['static/description/banner.jpg'], |
||||
|
'installable': True, |
||||
|
'auto_install': False, |
||||
|
'application': True, |
||||
|
} |
@ -0,0 +1,3 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
|
||||
|
from . import controllers |
@ -0,0 +1,37 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
|
||||
|
import json |
||||
|
from odoo import http |
||||
|
from odoo.http import content_disposition, request |
||||
|
from odoo.addons.web.controllers.main import _serialize_exception |
||||
|
from odoo.tools import html_escape |
||||
|
|
||||
|
|
||||
|
class TBXLSXReportController(http.Controller): |
||||
|
@http.route('/dynamic_xlsx_reports', type='http', auth='user', methods=['POST'], csrf=False) |
||||
|
def get_report_xlsx(self, model, options, output_format, token, report_data, report_name, dfr_data, **kw): |
||||
|
|
||||
|
uid = request.session.uid |
||||
|
report_obj = request.env[model].with_user(uid) |
||||
|
dfr_data = dfr_data |
||||
|
options = options |
||||
|
try: |
||||
|
if output_format == 'xlsx': |
||||
|
response = request.make_response( |
||||
|
None, |
||||
|
headers=[ |
||||
|
('Content-Type', 'application/vnd.ms-excel'), |
||||
|
('Content-Disposition', content_disposition(report_name + '.xlsx')) |
||||
|
] |
||||
|
) |
||||
|
report_obj.get_dynamic_xlsx_report(options, response, report_data, dfr_data) |
||||
|
response.set_cookie('fileToken', token) |
||||
|
return response |
||||
|
except Exception as e: |
||||
|
se = _serialize_exception(e) |
||||
|
error = { |
||||
|
'code': 200, |
||||
|
'message': 'Odoo Server Error', |
||||
|
'data': se |
||||
|
} |
||||
|
return request.make_response(html_escape(json.dumps(error))) |
@ -0,0 +1,11 @@ |
|||||
|
## Module <dynamic_accounts_report> |
||||
|
|
||||
|
#### 03.05.2021 |
||||
|
#### Version 13.0.1.0.0 |
||||
|
#### ADD |
||||
|
- Initial commit for Odoo 13 dynamic financial reports |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
@ -0,0 +1,7 @@ |
|||||
|
from . import trial_balance |
||||
|
from . import general_ledger |
||||
|
from . import cash_flow_report |
||||
|
from . import financial_reports |
||||
|
from . import partner_ledger |
||||
|
from . import ageing |
||||
|
from . import daybook |
@ -0,0 +1,18 @@ |
|||||
|
from odoo import api, models, _ |
||||
|
|
||||
|
|
||||
|
class PartnerAgeing(models.AbstractModel): |
||||
|
_name = 'report.dynamic_accounts_report.partner_ageing' |
||||
|
|
||||
|
@api.model |
||||
|
def _get_report_values(self, docids, data=None): |
||||
|
if self.env.context.get('ageing_pdf_report'): |
||||
|
|
||||
|
if data.get('report_data'): |
||||
|
data.update( |
||||
|
{'account_data': data.get('report_data')['report_lines'][0], |
||||
|
'Filters': data.get('report_data')['filters'], |
||||
|
|
||||
|
}) |
||||
|
|
||||
|
return data |
@ -0,0 +1,168 @@ |
|||||
|
<odoo> |
||||
|
<template id="dynamic_accounts_report.partner_ageing"> |
||||
|
<t t-call="web.html_container"> |
||||
|
<t t-set="data_report_margin_top" t-value="12"/> |
||||
|
<t t-set="data_report_header_spacing" t-value="9"/> |
||||
|
<t t-set="data_report_dpi" t-value="110"/> |
||||
|
<t t-call="web.internal_layout"> |
||||
|
<div class="page"> |
||||
|
<div class="oe_structure"/> |
||||
|
<h3 style="text-align:centre;left:50%;"><span t-esc="res_company.name"/>: Partner Ageing |
||||
|
</h3> |
||||
|
<strong> As On Date:</strong> |
||||
|
<t t-esc="Filters['date_from']"/> |
||||
|
<div> |
||||
|
<div style="text-align:centre;left:50%;" class="row"> |
||||
|
<div class="col-3"> |
||||
|
<strong>Target move:</strong> |
||||
|
<li> |
||||
|
<t t-esc="Filters['target_move']"/> |
||||
|
</li> |
||||
|
</div> |
||||
|
<div class="col-3"> |
||||
|
<strong>Account Type:</strong> |
||||
|
<li> |
||||
|
<t t-esc="Filters['result_selection']"/> |
||||
|
</li> |
||||
|
</div> |
||||
|
<div class="col-3" style=""> |
||||
|
<strong>Partners :</strong> |
||||
|
<t t-foreach="Filters['partners']" t-as="pa"> |
||||
|
<li> |
||||
|
<t t-esc="pa"/> |
||||
|
</li> |
||||
|
</t> |
||||
|
</div> |
||||
|
<div class="col-3" style=""> |
||||
|
<strong>Partner Tag :</strong> |
||||
|
<t t-foreach="Filters['partner_tags']" t-as="pt"> |
||||
|
<li> |
||||
|
<t t-esc="pt"/> |
||||
|
</li> |
||||
|
</t> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<br></br> |
||||
|
<table class="table table-sm table-reports"> |
||||
|
<thead> |
||||
|
<tr class="text-center"> |
||||
|
<th>Entry Label</th> |
||||
|
<th>Due date</th> |
||||
|
<th>JRNL</th> |
||||
|
<th>Account</th> |
||||
|
<th>Not Due</th> |
||||
|
<th>0 - 20</th> |
||||
|
<th>20 - 40</th> |
||||
|
<th>40 - 60</th> |
||||
|
<th>60 - 80</th> |
||||
|
<th>80 +</th> |
||||
|
<th> Total</th> |
||||
|
<th groups="base.group_multi_currency">Currency</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<t t-foreach="account_data" t-as="account"> |
||||
|
<tr style="font-weight: bold;"> |
||||
|
<td colspan="4"> |
||||
|
<span style="color: white;" t-esc="'..'"/> |
||||
|
<span t-esc="account['name']"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="account['direction']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="account['4']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="account['3']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="account['2']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="account['1']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="account['0']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="account['total']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
</td> |
||||
|
|
||||
|
<td groups="base.group_multi_currency"/> |
||||
|
</tr> |
||||
|
<tr t-foreach="account['child_lines']" t-as="line"> |
||||
|
<td><span t-esc="line['move']"/></td> |
||||
|
<td><span t-esc="line['date']"/></td> |
||||
|
<td><span t-esc="line['jrnl']"/></td> |
||||
|
<td><span t-esc="line['acc_code']"/></td> |
||||
|
<td class="text-right"> |
||||
|
<span t-if="line.get('period6')" |
||||
|
t-esc="line['amount']" |
||||
|
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
<span t-else=""> |
||||
|
<span>-</span> |
||||
|
</span> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-if="line.get('period5')" |
||||
|
t-esc="line['amount']" |
||||
|
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
<span t-else=""> |
||||
|
<span>-</span> |
||||
|
</span> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-if="line.get('period4')" |
||||
|
t-esc="line['amount']" |
||||
|
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
<span t-else=""> |
||||
|
<span>-</span> |
||||
|
</span> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-if="line.get('period3')" |
||||
|
t-esc="line['amount']" |
||||
|
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
<span t-else=""> |
||||
|
<span>-</span> |
||||
|
</span> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-if="line.get('period2')" |
||||
|
t-esc="line['amount']" |
||||
|
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
<span t-else=""> |
||||
|
<span>-</span> |
||||
|
</span> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-if="line.get('period1')" |
||||
|
t-esc="line['amount']" |
||||
|
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
<span t-else=""> |
||||
|
<span>-</span> |
||||
|
</span> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</t> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
<br></br> |
||||
|
</div> |
||||
|
</t> |
||||
|
</t> |
||||
|
</template> |
||||
|
|
||||
|
<record id="action_print_ageing_partner" model="ir.actions.report"> |
||||
|
<field name="name">Partner Ageing</field> |
||||
|
<field name="model">account.partner.ageing</field> |
||||
|
<field name="report_type">qweb-pdf</field> |
||||
|
<field name="report_name">dynamic_accounts_report.partner_ageing</field> |
||||
|
<field name="report_file">dynamic_accounts_report.partner_ageing</field> |
||||
|
</record> |
||||
|
|
||||
|
</odoo> |
@ -0,0 +1,16 @@ |
|||||
|
from odoo import api, models, _ |
||||
|
|
||||
|
|
||||
|
class GeneralLedger(models.AbstractModel): |
||||
|
_name = 'report.dynamic_accounts_report.cash_flow' |
||||
|
|
||||
|
@api.model |
||||
|
def _get_report_values(self, docids, data=None): |
||||
|
|
||||
|
if self.env.context.get('trial_pdf_report'): |
||||
|
|
||||
|
if data.get('report_data'): |
||||
|
data.update({'account_data': data.get('report_data')['report_lines'], |
||||
|
'Filters': data.get('report_data')['filters'], |
||||
|
}) |
||||
|
return data |
@ -0,0 +1,261 @@ |
|||||
|
<odoo> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<template id="dynamic_accounts_report.cash_flow"> |
||||
|
<t t-call="web.html_container"> |
||||
|
<t t-call="web.internal_layout"> |
||||
|
<div style="font-size:12px" class="col-4"> |
||||
|
|
||||
|
<b>Report Date :</b> |
||||
|
<span t-esc="context_timestamp(datetime.datetime.now()).strftime('%Y-%m-%d %H:%M')"/> |
||||
|
<span t-esc='today'/> |
||||
|
<br/> |
||||
|
<span t-esc='logged_users'/> |
||||
|
</div> |
||||
|
|
||||
|
<div class="page"> |
||||
|
<h4 style="padding-left:10px !important">Cash Flow statements</h4> |
||||
|
<div style="width:90%;margin:1px auto;font-size:12px" class="row mt32 mb32"> |
||||
|
|
||||
|
<div class="col-4"> |
||||
|
<t t-if="Filters.get('target_moves')"> |
||||
|
<p> |
||||
|
<strong>Target Moves:</strong> |
||||
|
|
||||
|
<span t-esc="Filters['target_moves']"/> |
||||
|
<br/> |
||||
|
<t t-if="Filters.get('levels')"> |
||||
|
<strong>Level :</strong> |
||||
|
<span t-esc="Filters['levels']"/> |
||||
|
</t> |
||||
|
|
||||
|
</p> |
||||
|
</t> |
||||
|
</div> |
||||
|
|
||||
|
<div class="col-4"> |
||||
|
|
||||
|
<p> |
||||
|
<t t-if="Filters.get('date_from')"> |
||||
|
<strong>Date from :</strong> |
||||
|
<span t-esc="Filters.get('date_from')"/> |
||||
|
</t> |
||||
|
<br/> |
||||
|
<t t-if="Filters.get('date_to')"> |
||||
|
<strong>Date to :</strong> |
||||
|
<span t-esc="Filters.get('date_to')"/> |
||||
|
</t> |
||||
|
</p> |
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
<div> |
||||
|
|
||||
|
<br></br> |
||||
|
<table style="width:90%;margin:2px auto;" class="table table-condensed"> |
||||
|
<thead> |
||||
|
<tr style="font-size:13px; padding: 0.25rem !important;"> |
||||
|
<th>Name</th> |
||||
|
<th class="text-right">Cash In</th> |
||||
|
<th class="text-right">Cash Out</th> |
||||
|
<th class="text-right">Balance</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
|
||||
|
<tbody style="font-size:12px" t-foreach="account_data['fetched_data']" t-as="fetch"> |
||||
|
<tr t-if="Filters['levels' ] == 'summary'"> |
||||
|
<td> |
||||
|
<span t-esc="fetch['month_part']"/> |
||||
|
|
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="fetch['total_debit']" |
||||
|
t-options="{'widget': 'monetary', |
||||
|
'display_currency': res_company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="fetch['total_credit']" |
||||
|
t-options="{'widget': 'monetary', |
||||
|
'display_currency': res_company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="fetch['total_balance']" |
||||
|
t-options="{'widget': 'monetary', |
||||
|
'display_currency': res_company.currency_id}"/> |
||||
|
</td> |
||||
|
</tr> |
||||
|
|
||||
|
<tr style="font-size:13px" t-if="Filters['levels' ] == 'consolidated'"> |
||||
|
<td> |
||||
|
<span t-esc="fetch['name']"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="fetch['total_debit']" |
||||
|
t-options="{'widget': 'monetary', |
||||
|
'display_currency': res_company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="fetch['total_credit']" |
||||
|
t-options="{'widget': 'monetary', |
||||
|
'display_currency': res_company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="fetch['total_balance']" |
||||
|
t-options="{'widget': 'monetary', |
||||
|
'display_currency': res_company.currency_id}"/> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
|
||||
|
<tbody style="font-size:12px" t-if="Filters['levels' ] == 'detailed' " t-foreach="account_data['journal_res']" t-as="res"> |
||||
|
<tr t-if="fet['name'] == res['account']" t-foreach="account_data['fetched_data']" t-as="fet"> |
||||
|
<td> |
||||
|
<strong> |
||||
|
<span t-esc="fet['code']"/> |
||||
|
<span t-esc="fet['name']"/> |
||||
|
</strong> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<strong> |
||||
|
<span t-esc="fet['total_debit']" |
||||
|
t-options="{'widget': 'monetary', |
||||
|
'display_currency': res_company.currency_id}"/> |
||||
|
</strong> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<strong> |
||||
|
<span t-esc="fet['total_credit']" |
||||
|
t-options="{'widget': 'monetary', |
||||
|
'display_currency': res_company.currency_id}"/> |
||||
|
</strong> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<strong> |
||||
|
<span t-esc="fet['total_debit'] - fet['total_credit']" |
||||
|
t-options="{'widget': 'monetary', |
||||
|
'display_currency': res_company.currency_id}"/> |
||||
|
</strong> |
||||
|
</td> |
||||
|
<tr t-foreach="res['journal_lines']" t-as="mov"> |
||||
|
<td style="padding-left:50px !important" class="text-left"> |
||||
|
<span t-esc="mov['name']"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="mov['total_debit']" |
||||
|
t-options="{'widget': 'monetary', |
||||
|
'display_currency': res_company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="mov['total_credit']" |
||||
|
t-options="{'widget': 'monetary', |
||||
|
'display_currency': res_company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="mov['total_debit'] - mov['total_credit']" |
||||
|
t-options="{'widget': 'monetary', |
||||
|
'display_currency': res_company.currency_id}"/> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
<tbody style="font-size:12px" t-if="Filters['levels' ] == 'very' or Filters['levels' ] ==false " t-foreach="account_data['account_res']" t-as="res"> |
||||
|
<tr t-if="fet['name'] == res['account']" t-foreach="account_data['fetched_data']" t-as="fet"> |
||||
|
<td> |
||||
|
<strong> |
||||
|
<span t-esc="fet['code']"/> |
||||
|
<span t-esc="fet['name']"/> |
||||
|
</strong> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<strong> |
||||
|
<span t-esc="fet['total_debit']" |
||||
|
t-options="{'widget': 'monetary', |
||||
|
'display_currency': res_company.currency_id}"/> |
||||
|
</strong> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<strong> |
||||
|
<span t-esc="fet['total_credit']" |
||||
|
t-options="{'widget': 'monetary', |
||||
|
'display_currency': res_company.currency_id}"/> |
||||
|
</strong> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<strong> |
||||
|
<span t-esc="fet['total_debit'] - fet['total_credit']" |
||||
|
t-options="{'widget': 'monetary', |
||||
|
'display_currency': res_company.currency_id}"/> |
||||
|
</strong> |
||||
|
</td> |
||||
|
|
||||
|
|
||||
|
<tr t-if="line['account_name'] == res['account']" |
||||
|
t-foreach="res['journal_lines']" t-as="line"> |
||||
|
<td style="padding-left:20px !important" class="text-left"> |
||||
|
<span t-esc="line['name']"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="line['total_debit']" |
||||
|
t-options="{'widget': 'monetary', |
||||
|
'display_currency': res_company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="line['total_credit']" |
||||
|
t-options="{'widget': 'monetary', |
||||
|
'display_currency': res_company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="line['total_debit'] - line['total_credit']" |
||||
|
t-options="{'widget': 'monetary', |
||||
|
'display_currency': res_company.currency_id}"/> |
||||
|
</td> |
||||
|
<tr t-if="mov['name'] == line['name']" t-foreach="res['move_lines']" |
||||
|
t-as="mov"> |
||||
|
<td style="padding-left:50px !important" class="text-left"> |
||||
|
<span t-esc="mov['move_name']"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="mov['total_debit']" |
||||
|
t-options="{'widget': 'monetary', |
||||
|
'display_currency': res_company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="mov['total_credit']" |
||||
|
t-options="{'widget': 'monetary', |
||||
|
'display_currency': res_company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="mov['total_debit'] - mov['total_credit']" |
||||
|
t-options="{'widget': 'monetary', |
||||
|
'display_currency': res_company.currency_id}"/> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</tr> |
||||
|
</tr> |
||||
|
|
||||
|
</tbody> |
||||
|
|
||||
|
</table> |
||||
|
</div> |
||||
|
<br></br> |
||||
|
</div> |
||||
|
</t> |
||||
|
</t> |
||||
|
</template> |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
<record id="action_print_cash_flow" model="ir.actions.report"> |
||||
|
<field name="name">cash_flow</field> |
||||
|
<field name="model">account.cash.flow</field> |
||||
|
<field name="report_type">qweb-pdf</field> |
||||
|
<field name="report_name">dynamic_accounts_report.cash_flow</field> |
||||
|
<field name="report_file">dynamic_accounts_report.cash_flow</field> |
||||
|
</record> |
||||
|
</odoo> |
@ -0,0 +1,16 @@ |
|||||
|
from odoo import api, models, _ |
||||
|
|
||||
|
|
||||
|
class DayBook(models.AbstractModel): |
||||
|
_name = 'report.dynamic_accounts_report.day_book' |
||||
|
|
||||
|
@api.model |
||||
|
def _get_report_values(self, docids, data=None): |
||||
|
|
||||
|
if self.env.context.get('daybook_pdf_report'): |
||||
|
|
||||
|
if data.get('report_data'): |
||||
|
data.update({'account_data': data.get('report_data')['report_lines'], |
||||
|
'Filters': data.get('report_data')['filters'], |
||||
|
}) |
||||
|
return data |
@ -0,0 +1,121 @@ |
|||||
|
<odoo> |
||||
|
<template id="dynamic_accounts_report.day_book"> |
||||
|
<t t-call="web.html_container"> |
||||
|
<t t-set="data_report_margin_top" t-value="12"/> |
||||
|
<t t-set="data_report_header_spacing" t-value="9"/> |
||||
|
<t t-set="data_report_dpi" t-value="110"/> |
||||
|
<t t-call="web.internal_layout"> |
||||
|
<div class="page"> |
||||
|
<div class="oe_structure"/> |
||||
|
<h3 style="text-align:centre;left:50%;"><span t-esc="res_company.name"/>: Day Book |
||||
|
</h3> |
||||
|
|
||||
|
<span t-if="Filters.get('date_from')"> |
||||
|
<strong> From:</strong> |
||||
|
<t t-esc="Filters['date_from']"/> |
||||
|
</span> |
||||
|
<br></br> |
||||
|
<span t-if="Filters.get('date_to')"> |
||||
|
<strong> To:</strong> |
||||
|
<t t-esc="Filters['date_to']"/> |
||||
|
</span> |
||||
|
<div> |
||||
|
<div style="text-align:centre;left:50%;" class="row"> |
||||
|
<div class="col-3"> |
||||
|
<strong>Target move:</strong> |
||||
|
<li> |
||||
|
<t t-esc="Filters['target_move']"/> |
||||
|
</li> |
||||
|
</div> |
||||
|
<div class="col-3" style=""> |
||||
|
<strong>Journals:</strong> |
||||
|
<t t-foreach="Filters['journals']" t-as="ps"> |
||||
|
<li> |
||||
|
<t t-esc="ps"/> |
||||
|
</li> |
||||
|
</t> |
||||
|
</div> |
||||
|
<div class="col-3" style=""> |
||||
|
<strong>Accounts :</strong> |
||||
|
<t t-foreach="Filters['accounts']" t-as="ac"> |
||||
|
<li> |
||||
|
<t t-esc="ac"/> |
||||
|
</li> |
||||
|
</t> |
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<br></br> |
||||
|
<table class="table table-sm table-reports"> |
||||
|
<thead> |
||||
|
<tr class="text-center"> |
||||
|
<th>Date</th> |
||||
|
<th>JRNL</th> |
||||
|
<th>Partner</th> |
||||
|
<th>Move</th> |
||||
|
<th>Entry Label</th> |
||||
|
<th>Debit</th> |
||||
|
<th>Credit</th> |
||||
|
<th>Balance</th> |
||||
|
<th groups="base.group_multi_currency">Currency</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<t t-foreach="account_data" t-as="account"> |
||||
|
<tr style="font-weight: bold;"> |
||||
|
<td colspan="5"> |
||||
|
<span style="color: white;" t-esc="'..'"/> |
||||
|
<span t-esc="account['date']"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="account['debit']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="account['credit']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="account['balance']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
</td> |
||||
|
|
||||
|
|
||||
|
<td groups="base.group_multi_currency"/> |
||||
|
</tr> |
||||
|
<tr t-foreach="account['child_lines']" t-as="line"> |
||||
|
<td><span t-esc="line['ldate']"/></td> |
||||
|
<td><span t-esc="line['lcode']"/></td> |
||||
|
<td><span t-esc="line['partner_name']"/></td> |
||||
|
|
||||
|
<td><span t-esc="line['move_name']"/></td> |
||||
|
<td><span t-esc="line['lname']"/></td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="line['debit']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="line['credit']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="line['balance']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</t> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
<br></br> |
||||
|
</div> |
||||
|
</t> |
||||
|
</t> |
||||
|
</template> |
||||
|
|
||||
|
<record id="action_print_day_book" model="ir.actions.report"> |
||||
|
<field name="name">Day Book</field> |
||||
|
<field name="model">account.day.book</field> |
||||
|
<field name="report_type">qweb-pdf</field> |
||||
|
<field name="report_name">dynamic_accounts_report.day_book</field> |
||||
|
<field name="report_file">dynamic_accounts_report.day_book</field> |
||||
|
</record> |
||||
|
|
||||
|
</odoo> |
@ -0,0 +1,170 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<template id="dynamic_accounts_report.balance_sheet"> |
||||
|
<t t-call="web.html_container"> |
||||
|
<t t-call="web.internal_layout"> |
||||
|
<t t-set="data_report_margin_top" t-value="12"/> |
||||
|
<t t-set="data_report_header_spacing" t-value="9"/> |
||||
|
<t t-set="data_report_dpi" t-value="110"/> |
||||
|
<div class="page"> |
||||
|
<h3><span t-esc="res_company.name"/>: <span t-esc="report_name"/> |
||||
|
</h3> |
||||
|
|
||||
|
<div> |
||||
|
<span t-if="Filters.get('date_from')"> |
||||
|
<strong> From:</strong> |
||||
|
<t t-esc="Filters['date_from']"/> |
||||
|
</span> |
||||
|
|
||||
|
<span t-if="Filters.get('date_to')"> |
||||
|
<strong>To:</strong> |
||||
|
<t t-esc="Filters['date_to']"/> |
||||
|
</span> |
||||
|
|
||||
|
<div style="width:100%;"> |
||||
|
<div style="text-align:centre;" class="row"> |
||||
|
|
||||
|
<div class="col-2"> |
||||
|
<strong>Journals:</strong> |
||||
|
<t t-foreach="Filters['journals']" t-as="ps"> |
||||
|
<li> |
||||
|
<t t-esc="ps"/> |
||||
|
</li> |
||||
|
</t> |
||||
|
</div> |
||||
|
|
||||
|
<div class="col-2"> |
||||
|
<strong>Accounts:</strong> |
||||
|
<t t-foreach="Filters['accounts']" t-as="ps"> |
||||
|
<li> |
||||
|
<t t-esc="ps"/> |
||||
|
</li> |
||||
|
</t> |
||||
|
</div> |
||||
|
|
||||
|
<div class="col-2"> |
||||
|
<strong>Account Tags:</strong> |
||||
|
<t t-foreach="Filters['account_tags']" t-as="ps"> |
||||
|
<li> |
||||
|
<t t-esc="ps"/> |
||||
|
</li> |
||||
|
</t> |
||||
|
</div> |
||||
|
<div class="col-2"> |
||||
|
<strong>Analytic:</strong> |
||||
|
<t t-foreach="Filters['analytics']" t-as="ps"> |
||||
|
<li> |
||||
|
<t t-esc="ps"/> |
||||
|
</li> |
||||
|
</t> |
||||
|
</div> |
||||
|
|
||||
|
<div class="col-2"> |
||||
|
<strong>Analytic Tag:</strong> |
||||
|
<t t-foreach="Filters['analytic_tags']" t-as="ps"> |
||||
|
<li> |
||||
|
<t t-esc="ps"/> |
||||
|
</li> |
||||
|
</t> |
||||
|
</div> |
||||
|
|
||||
|
<div class="col-3"> |
||||
|
<strong>Target move:</strong> |
||||
|
<li> |
||||
|
<t t-if="Filters['target_move'] == 'all'"> |
||||
|
<span>All</span> |
||||
|
</t> |
||||
|
<t t-if="Filters['target_move'] == 'posted'"> |
||||
|
<span>Posted</span> |
||||
|
</t> |
||||
|
</li> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<br></br> |
||||
|
|
||||
|
<table class="table table-sm table-reports"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th></th> |
||||
|
<th class="text-right">Debit</th> |
||||
|
<th class="text-right">Credit</th> |
||||
|
<th class="text-right">Balance</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<tr t-foreach="report_lines" t-as="a"> |
||||
|
|
||||
|
<t t-if="a['level'] != 0"> |
||||
|
<t t-if="a.get('level') > 2"> |
||||
|
<t t-set="style" t-value="'font-weight: normal;'"/> |
||||
|
</t> |
||||
|
<t t-if="not a.get('level') > 2"> |
||||
|
<t t-set="style" t-value="'font-weight: bold;'"/> |
||||
|
</t> |
||||
|
<t t-if="a.get('code')"> |
||||
|
<t t-foreach="account_data" t-as="line"> |
||||
|
<t t-if="line['code'] == a.get('code')"> |
||||
|
<tr> |
||||
|
<td> |
||||
|
<span style="color: white;" t-esc="'..' * a.get('level', 0) * 3"/> |
||||
|
<span t-att-style="style" t-esc="line['name']"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="line['debit']" |
||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="line['credit']" |
||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="line['balance']" |
||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</t> |
||||
|
</t> |
||||
|
</t> |
||||
|
|
||||
|
<t t-else=""> |
||||
|
|
||||
|
<td> |
||||
|
<span style="color: white;" t-esc="'..' * a.get('level', 0) * 3"/> |
||||
|
<span t-att-style="style" t-esc="a.get('name')"/> |
||||
|
</td> |
||||
|
<td class="text-right" style="white-space: text-nowrap;"> |
||||
|
<span t-att-style="style" t-esc="a.get('debit')" |
||||
|
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right" style="white-space: text-nowrap;"> |
||||
|
<span t-att-style="style" t-esc="a.get('credit')" |
||||
|
t-options="{'widget': 'monetary', 'display_currency': env.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': env.company.currency_id}"/> |
||||
|
</td> |
||||
|
</t> |
||||
|
|
||||
|
</t> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
|
||||
|
|
||||
|
</div> |
||||
|
</t> |
||||
|
</t> |
||||
|
</template> |
||||
|
|
||||
|
<record id="action_print_balance_sheet" model="ir.actions.report"> |
||||
|
<field name="name">Financial Report</field> |
||||
|
<field name="model">dynamic.balance.sheet.report</field> |
||||
|
<field name="report_type">qweb-pdf</field> |
||||
|
<field name="report_name">dynamic_accounts_report.balance_sheet</field> |
||||
|
<field name="report_file">dynamic_accounts_report.balance_sheet</field> |
||||
|
</record> |
||||
|
|
||||
|
</odoo> |
@ -0,0 +1,19 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
from odoo import api, models, _ |
||||
|
|
||||
|
|
||||
|
class InsReportBalanceSheet(models.AbstractModel): |
||||
|
_name = 'report.dynamic_accounts_report.balance_sheet' |
||||
|
|
||||
|
@api.model |
||||
|
def _get_report_values(self, docids, data=None): |
||||
|
if self.env.context.get('bs_report'): |
||||
|
if data.get('report_data'): |
||||
|
data.update({ |
||||
|
'Filters': data.get('report_data')['filters'], |
||||
|
'account_data': data.get('report_data')['report_lines'], |
||||
|
'report_lines': data.get('report_data')['bs_lines'], |
||||
|
'report_name': data.get('report_name'), |
||||
|
'title': data.get('report_data')['name'], |
||||
|
}) |
||||
|
return data |
@ -0,0 +1,19 @@ |
|||||
|
from odoo import api, models, _ |
||||
|
|
||||
|
|
||||
|
class GeneralLedger(models.AbstractModel): |
||||
|
_name = 'report.dynamic_accounts_report.general_ledger' |
||||
|
|
||||
|
@api.model |
||||
|
def _get_report_values(self, docids, data=None): |
||||
|
|
||||
|
if self.env.context.get('trial_pdf_report'): |
||||
|
|
||||
|
if data.get('report_data'): |
||||
|
data.update({'account_data': data.get('report_data')['report_lines'], |
||||
|
'Filters': data.get('report_data')['filters'], |
||||
|
'debit_total': data.get('report_data')['debit_total'], |
||||
|
'credit_total': data.get('report_data')['credit_total'], |
||||
|
'title': data.get('report_data')['name'], |
||||
|
}) |
||||
|
return data |
@ -0,0 +1,126 @@ |
|||||
|
<odoo> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<template id="dynamic_accounts_report.general_ledger"> |
||||
|
<t t-call="web.html_container"> |
||||
|
<t t-set="data_report_margin_top" t-value="12"/> |
||||
|
<t t-set="data_report_header_spacing" t-value="9"/> |
||||
|
<t t-set="data_report_dpi" t-value="110"/> |
||||
|
<t t-call="web.internal_layout"> |
||||
|
<div class="page"> |
||||
|
<div class="oe_structure"/> |
||||
|
<h3 style="text-align:centre;left:50%;"><span t-esc="res_company.name"/>: <t t-esc="title"/> |
||||
|
</h3> |
||||
|
|
||||
|
<span t-if="Filters.get('date_from')"> |
||||
|
<strong> From:</strong> |
||||
|
<t t-esc="Filters['date_from']"/> |
||||
|
</span> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<span t-if="Filters.get('date_to')"> |
||||
|
<strong>To:</strong> |
||||
|
<t t-esc="Filters['date_to']"/> |
||||
|
</span> |
||||
|
|
||||
|
|
||||
|
<div> |
||||
|
<div style="text-align:centre;left:50%;" class="row"> |
||||
|
|
||||
|
<div class="col-3" style=""> |
||||
|
<strong>Journals:</strong> |
||||
|
<t t-foreach="Filters['journals']" t-as="ps"> |
||||
|
<li> |
||||
|
<t t-esc="ps"/> |
||||
|
</li> |
||||
|
</t> |
||||
|
</div> |
||||
|
|
||||
|
<div class="col-3"> |
||||
|
<strong>Target move:</strong> |
||||
|
<li> |
||||
|
<t t-esc="Filters['target_move']"/> |
||||
|
</li> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<br></br> |
||||
|
<table class="table table-sm table-reports"> |
||||
|
<thead> |
||||
|
<tr class="text-center"> |
||||
|
<th>Date</th> |
||||
|
<th>JRNL</th> |
||||
|
<th>Partner</th> |
||||
|
<th>Ref</th> |
||||
|
<th>Move</th> |
||||
|
<th>Entry Label</th> |
||||
|
<th>Debit</th> |
||||
|
<th>Credit</th> |
||||
|
<th>Balance</th> |
||||
|
<th groups="base.group_multi_currency">Currency</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<t t-foreach="account_data" t-as="account"> |
||||
|
<tr style="font-weight: bold;"> |
||||
|
<td colspan="6"> |
||||
|
<span style="color: white;" t-esc="'..'"/> |
||||
|
<span t-esc="account['code']"/> |
||||
|
<span t-esc="account['name']"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="account['debit']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="account['credit']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="account['balance']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
</td> |
||||
|
<td groups="base.group_multi_currency"/> |
||||
|
</tr> |
||||
|
<tr t-foreach="account['move_lines']" t-as="line"> |
||||
|
<td><span t-esc="line['ldate']"/></td> |
||||
|
<td><span t-esc="line['lcode']"/></td> |
||||
|
<td><span t-esc="line['partner_name']"/></td> |
||||
|
<td><span t-if="line['lref']" t-esc="line['lref']"/></td> |
||||
|
<td><span t-esc="line['move_name']"/></td> |
||||
|
<td><span t-esc="line['lname']"/></td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="line['debit']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="line['credit']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="line['balance']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
</td> |
||||
|
<t t-if="line['amount_currency']"> |
||||
|
<td class="text-right" groups="base.group_multi_currency"> |
||||
|
<span t-esc="line['amount_currency'] if line['amount_currency'] > 0.00 else ''"/> |
||||
|
<span t-esc="line['currency_code'] if line['amount_currency'] > 0.00 else ''"/> |
||||
|
</td> |
||||
|
</t> |
||||
|
</tr> |
||||
|
</t> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
<br></br> |
||||
|
</div> |
||||
|
</t> |
||||
|
</t> |
||||
|
</template> |
||||
|
|
||||
|
<record id="action_print_General_ledger" model="ir.actions.report"> |
||||
|
<field name="name">Report</field> |
||||
|
<field name="model">account.general.ledger</field> |
||||
|
<field name="report_type">qweb-pdf</field> |
||||
|
<field name="report_name">dynamic_accounts_report.general_ledger</field> |
||||
|
<field name="report_file">dynamic_accounts_report.general_ledger</field> |
||||
|
</record> |
||||
|
|
||||
|
</odoo> |
@ -0,0 +1,15 @@ |
|||||
|
from odoo import api, models, _ |
||||
|
|
||||
|
|
||||
|
class PartnerLedgerReport(models.AbstractModel): |
||||
|
_name = 'report.dynamic_accounts_report.partner_ledger' |
||||
|
|
||||
|
@api.model |
||||
|
def _get_report_values(self, docids, data=None): |
||||
|
if self.env.context.get('partner_ledger_pdf_report'): |
||||
|
|
||||
|
if data.get('report_data'): |
||||
|
data.update({'account_data': data.get('report_data')['report_lines'], |
||||
|
'Filters': data.get('report_data')['filters'], |
||||
|
}) |
||||
|
return data |
@ -0,0 +1,155 @@ |
|||||
|
<odoo> |
||||
|
|
||||
|
<template id="dynamic_accounts_report.partner_ledger"> |
||||
|
<t t-call="web.html_container"> |
||||
|
<t t-set="data_report_margin_top" t-value="12"/> |
||||
|
<t t-set="data_report_header_spacing" t-value="9"/> |
||||
|
<t t-set="data_report_dpi" t-value="110"/> |
||||
|
<t t-call="web.internal_layout"> |
||||
|
<div class="page"> |
||||
|
<div class="oe_structure"/> |
||||
|
<h3 style="text-align:centre;left:50%;"><span t-esc="res_company.name"/>: Partner Ledger |
||||
|
</h3> |
||||
|
|
||||
|
<span t-if="Filters.get('date_from')"> |
||||
|
<strong> From:</strong> |
||||
|
<t t-esc="Filters['date_from']"/> |
||||
|
</span> |
||||
|
|
||||
|
<span t-if="Filters.get('date_to')"> |
||||
|
<strong>To:</strong> |
||||
|
<t t-esc="Filters['date_to']"/> |
||||
|
</span> |
||||
|
|
||||
|
|
||||
|
<div> |
||||
|
<div style="text-align:centre;left:50%;" class="row"> |
||||
|
|
||||
|
<div class="col-2" style=""> |
||||
|
<strong>Journals:</strong> |
||||
|
<t t-foreach="Filters['journals']" t-as="ps"> |
||||
|
<li> |
||||
|
<t t-esc="ps"/> |
||||
|
</li> |
||||
|
</t> |
||||
|
</div> |
||||
|
<div class="col-2"> |
||||
|
<strong>Accounts:</strong> |
||||
|
<t t-foreach="Filters['accounts']" t-as="ps"> |
||||
|
<li> |
||||
|
<t t-esc="ps"/> |
||||
|
</li> |
||||
|
</t> |
||||
|
</div> |
||||
|
<div class="col-2"> |
||||
|
<strong>Partners:</strong> |
||||
|
<t t-foreach="Filters['partners']" t-as="ps"> |
||||
|
<li> |
||||
|
<t t-esc="ps"/> |
||||
|
</li> |
||||
|
</t> |
||||
|
</div> |
||||
|
<div class="col-2"> |
||||
|
<strong>Partner Tags:</strong> |
||||
|
<t t-foreach="Filters['partner_tags']" t-as="ps"> |
||||
|
<li> |
||||
|
<t t-esc="ps"/> |
||||
|
</li> |
||||
|
</t> |
||||
|
</div> |
||||
|
<div class="col-2"> |
||||
|
<strong>Account Type:</strong> |
||||
|
<t t-foreach="Filters['account_type']" t-as="ps"> |
||||
|
<li> |
||||
|
<t t-esc="ps"/> |
||||
|
</li> |
||||
|
</t> |
||||
|
</div> |
||||
|
<div class="col-2"> |
||||
|
<strong>Target move:</strong> |
||||
|
<li> |
||||
|
<t t-esc="Filters['target_move']"/> |
||||
|
</li> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
<div style="text-align:centre;left:50%;" class="row"> |
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<br></br> |
||||
|
<table class="table table-sm table-reports" style="padding:5px;"> |
||||
|
<thead> |
||||
|
<tr class="text-center"> |
||||
|
<th style="text-align:left;">Date</th> |
||||
|
<th style="text-align:left;">Journal</th> |
||||
|
<th style="text-align:left;">Account</th> |
||||
|
<th style="text-align:left;">Move</th> |
||||
|
<th style="text-align:left;">Entry Label</th> |
||||
|
<th style="text-align:right;">Debit</th> |
||||
|
<th style="text-align:right;">Credit</th> |
||||
|
<th style="text-align:right;">Balance</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<t t-foreach="account_data" t-as="account"> |
||||
|
<tr style="font-weight: bold;"> |
||||
|
<td colspan="5"> |
||||
|
<span style="color: white;" t-esc="'..'"/> |
||||
|
<!-- <span t-esc="account['code']"/>--> |
||||
|
<span t-esc="account['name']"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="account['debit']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="account['credit']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="account['balance']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
</td> |
||||
|
<td groups="base.group_multi_currency"/> |
||||
|
</tr> |
||||
|
<tr t-foreach="account['move_lines']" t-as="line"> |
||||
|
<td><span t-esc="line['ldate']"/></td> |
||||
|
<td><span t-esc="line['lcode']"/></td> |
||||
|
<td><span t-esc="line['account_name']"/></td> |
||||
|
<!-- <td><span t-if="line['lref']" t-esc="line['lref']"/></td>--> |
||||
|
<td><span t-esc="line['move_name']"/></td> |
||||
|
<td><span t-esc="line['lname']"/></td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="line['debit']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="line['credit']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="line['balance']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> |
||||
|
</td> |
||||
|
<t t-if="line['amount_currency']"> |
||||
|
<td class="text-right" groups="base.group_multi_currency"> |
||||
|
<span t-esc="line['amount_currency'] if line['amount_currency'] > 0.00 else ''"/> |
||||
|
<span t-esc="line['currency_code'] if line['amount_currency'] > 0.00 else ''"/> |
||||
|
</td> |
||||
|
</t> |
||||
|
</tr> |
||||
|
</t> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
<br></br> |
||||
|
</div> |
||||
|
</t> |
||||
|
</t> |
||||
|
</template> |
||||
|
|
||||
|
<record id="action_print_partner_ledger" model="ir.actions.report"> |
||||
|
<field name="name">Partner ledger</field> |
||||
|
<field name="model">account.partner.ledger</field> |
||||
|
<field name="report_type">qweb-pdf</field> |
||||
|
<field name="report_name">dynamic_accounts_report.partner_ledger</field> |
||||
|
<field name="report_file">dynamic_accounts_report.partner_ledger</field> |
||||
|
</record> |
||||
|
|
||||
|
</odoo> |
@ -0,0 +1,17 @@ |
|||||
|
from odoo import api, models, _ |
||||
|
|
||||
|
|
||||
|
class TrialBalance(models.AbstractModel): |
||||
|
_name = 'report.dynamic_accounts_report.trial_balance' |
||||
|
|
||||
|
@api.model |
||||
|
def _get_report_values(self, docids, data=None): |
||||
|
if self.env.context.get('trial_pdf_report'): |
||||
|
|
||||
|
if data.get('report_data'): |
||||
|
data.update({'account_data': data.get('report_data')['report_lines'], |
||||
|
'Filters': data.get('report_data')['filters'], |
||||
|
'debit_total': data.get('report_data')['debit_total'], |
||||
|
'credit_total': data.get('report_data')['credit_total'], |
||||
|
}) |
||||
|
return data |
@ -0,0 +1,129 @@ |
|||||
|
<odoo> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<template id="dynamic_accounts_report.trial_balance"> |
||||
|
<t t-call="web.html_container"> |
||||
|
<t t-call="web.internal_layout"> |
||||
|
<div class="page"> |
||||
|
<div class="oe_structure"/> |
||||
|
<h3 style="text-align:centre;left:50%;"><span t-esc="res_company.name"/>: Trial Balance |
||||
|
</h3> |
||||
|
|
||||
|
<span t-if="Filters.get('date_from')"> |
||||
|
<strong> From:</strong> |
||||
|
<t t-esc="Filters['date_from']"/> |
||||
|
</span> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<span t-if="Filters.get('date_to')"> |
||||
|
<strong>To:</strong> |
||||
|
<t t-esc="Filters['date_to']"/> |
||||
|
</span> |
||||
|
|
||||
|
|
||||
|
<div> |
||||
|
<div style="text-align:centre;left:50%;" class="row"> |
||||
|
|
||||
|
<div class="col-3" style=""> |
||||
|
<strong>Journals:</strong> |
||||
|
<t t-foreach="Filters['journals']" t-as="ps"> |
||||
|
<li> |
||||
|
<t t-esc="ps"/> |
||||
|
</li> |
||||
|
</t> |
||||
|
</div> |
||||
|
|
||||
|
<div class="col-3"> |
||||
|
<strong>Target move:</strong> |
||||
|
<li> |
||||
|
<t t-esc="Filters['target_move']"/> |
||||
|
</li> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<br></br> |
||||
|
<table class="table table-sm table-reports"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th style="text-align:left;">Code</th> |
||||
|
<th colspan="5">Account</th> |
||||
|
<t t-if="Filters.get('date_from')"> |
||||
|
<th class="mon_fld">Initial Debit</th> |
||||
|
<th class="mon_fld">Initial Credit</th> |
||||
|
|
||||
|
</t> |
||||
|
<th class="text-right">Debit</th> |
||||
|
<th class="text-right">Credit</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<t t-foreach="account_data" t-as="line"> |
||||
|
|
||||
|
<tr> |
||||
|
|
||||
|
<td style="text-align:left;"> |
||||
|
<span style="color: white;" t-esc="'..'"/> |
||||
|
<span t-esc="line['code']"/> |
||||
|
</td> |
||||
|
<td colspan="5"> |
||||
|
<span style="color: white;" t-esc="'..'"/> |
||||
|
<span t-esc="line['name']"/> |
||||
|
</td> |
||||
|
<t t-if="Filters.get('date_from')"> |
||||
|
<t t-if="line['Init_balance']"> |
||||
|
|
||||
|
<td class="mon_fld"> |
||||
|
<t t-raw="line['Init_balance']['debit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="mon_fld"> |
||||
|
<t t-raw="line['Init_balance']['credit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> |
||||
|
</td> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
|
||||
|
<td class="mon_fld"> |
||||
|
</td> |
||||
|
<td class="mon_fld"> |
||||
|
</td> |
||||
|
</t> |
||||
|
|
||||
|
</t> |
||||
|
|
||||
|
<td class="text-right"> |
||||
|
<span t-esc="line['debit']" |
||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> |
||||
|
</td> |
||||
|
<td class="text-right"> |
||||
|
<span t-esc="line['credit']" |
||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</t> |
||||
|
<td colspan="6" style="border-bottom: 1px solid ;" class="mon_fld"><strong>Total</strong></td> |
||||
|
<t t-if="Filters.get('date_from')"> |
||||
|
<td class="mon_fld" style="border-bottom: 1px solid ;"><strong></strong></td> |
||||
|
<td class="mon_fld" style="border-bottom: 1px solid ;"><strong></strong></td> |
||||
|
</t> |
||||
|
|
||||
|
<td class="text-right" style="border-bottom: 1px solid ;"><strong><t t-esc="debit_total" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></strong></td> |
||||
|
<td class="text-right" style="border-bottom: 1px solid;"><strong><t t-esc="debit_total" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></strong></td> |
||||
|
|
||||
|
</table> |
||||
|
</div> |
||||
|
<br></br> |
||||
|
</div> |
||||
|
</t> |
||||
|
</t> |
||||
|
</template> |
||||
|
|
||||
|
<record id="action_print_trial_balance" model="ir.actions.report"> |
||||
|
<field name="name">Trial Balance</field> |
||||
|
<field name="model">account.trial.balance</field> |
||||
|
<field name="report_type">qweb-pdf</field> |
||||
|
<field name="report_name">dynamic_accounts_report.trial_balance</field> |
||||
|
<field name="report_file">dynamic_accounts_report.trial_balance</field> |
||||
|
</record> |
||||
|
|
||||
|
</odoo> |
|
After Width: | Height: | Size: 181 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 471 KiB |
After Width: | Height: | Size: 67 KiB |
After Width: | Height: | Size: 328 KiB |
After Width: | Height: | Size: 712 KiB |
After Width: | Height: | Size: 99 KiB |
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 86 KiB |
After Width: | Height: | Size: 59 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 39 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 52 KiB |
After Width: | Height: | Size: 51 KiB |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 111 KiB |
After Width: | Height: | Size: 51 KiB |
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 97 KiB |
After Width: | Height: | Size: 125 KiB |
After Width: | Height: | Size: 63 KiB |
After Width: | Height: | Size: 97 KiB |
After Width: | Height: | Size: 61 KiB |
After Width: | Height: | Size: 129 KiB |
After Width: | Height: | Size: 82 KiB |
After Width: | Height: | Size: 122 KiB |
After Width: | Height: | Size: 147 KiB |
After Width: | Height: | Size: 64 KiB |
After Width: | Height: | Size: 53 KiB |
After Width: | Height: | Size: 112 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 79 KiB |
After Width: | Height: | Size: 62 KiB |
After Width: | Height: | Size: 93 KiB |
After Width: | Height: | Size: 106 KiB |
After Width: | Height: | Size: 342 KiB |
After Width: | Height: | Size: 112 KiB |
After Width: | Height: | Size: 148 KiB |
After Width: | Height: | Size: 67 KiB |
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 28 KiB |
@ -0,0 +1,9 @@ |
|||||
|
.mon_fld{ |
||||
|
text-align: right; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
.cf_fld{ |
||||
|
text-align: right; |
||||
|
width: 300px !important; |
||||
|
} |
@ -0,0 +1,52 @@ |
|||||
|
odoo.define('dynamic_accounts_report.action_manager', function (require) { |
||||
|
"use strict"; |
||||
|
/** |
||||
|
* The purpose of this file is to add the actions of type |
||||
|
* 'xlsx' to the ActionManager. |
||||
|
*/ |
||||
|
var ActionManager = require('web.ActionManager'); |
||||
|
var framework = require('web.framework'); |
||||
|
var session = require('web.session'); |
||||
|
|
||||
|
|
||||
|
ActionManager.include({ |
||||
|
|
||||
|
/** |
||||
|
* Executes actions of type 'ir.actions.report'. |
||||
|
* |
||||
|
* @private |
||||
|
* @param {Object} action the description of the action to execute |
||||
|
* @param {Object} options @see doAction for details |
||||
|
* @returns {Promise} resolved when the action has been executed |
||||
|
*/ |
||||
|
_executedynamicxlsxReportDownloadAction: function (action) { |
||||
|
framework.blockUI(); |
||||
|
var def = $.Deferred(); |
||||
|
session.get_file({ |
||||
|
url: '/dynamic_xlsx_reports', |
||||
|
data: action.data, |
||||
|
success: def.resolve.bind(def), |
||||
|
error: (error) => this.call('crash_manager', 'rpc_error', error), |
||||
|
complete: framework.unblockUI, |
||||
|
}); |
||||
|
return def; |
||||
|
}, |
||||
|
/** |
||||
|
* Overrides to handle the 'ir.actions.report' actions. |
||||
|
* |
||||
|
* @override |
||||
|
* @private |
||||
|
*/ |
||||
|
|
||||
|
_handleAction: function (action, options) { |
||||
|
|
||||
|
if (action.type === 'ir_actions_dynamic_xlsx_download') { |
||||
|
return this._executedynamicxlsxReportDownloadAction(action, options); |
||||
|
} |
||||
|
return this._super.apply(this, arguments); |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
}); |
||||
|
|
||||
|
}); |
@ -0,0 +1,376 @@ |
|||||
|
odoo.define('dynamic_accounts_report.ageing', function (require) { |
||||
|
'use strict'; |
||||
|
var AbstractAction = require('web.AbstractAction'); |
||||
|
var core = require('web.core'); |
||||
|
var field_utils = require('web.field_utils'); |
||||
|
var rpc = require('web.rpc'); |
||||
|
var session = require('web.session'); |
||||
|
var utils = require('web.utils'); |
||||
|
var QWeb = core.qweb; |
||||
|
var _t = core._t; |
||||
|
|
||||
|
window.click_num = 0; |
||||
|
var PartnerAgeing = AbstractAction.extend({ |
||||
|
template: 'AgeingTemp', |
||||
|
events: { |
||||
|
'click .parent-line': 'journal_line_click', |
||||
|
'click .child_col1': 'journal_line_click', |
||||
|
'click #apply_filter': 'apply_filter', |
||||
|
'click #pdf': 'print_pdf', |
||||
|
'click #xlsx': 'print_xlsx', |
||||
|
'click .gl-line': 'show_drop_down', |
||||
|
'click .view-account-move': 'view_acc_move', |
||||
|
}, |
||||
|
|
||||
|
init: function(parent, action) { |
||||
|
this._super(parent, action); |
||||
|
this.currency=action.currency; |
||||
|
this.report_lines = action.report_lines; |
||||
|
|
||||
|
this.wizard_id = action.context.wizard | null; |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
|
||||
|
start: function() { |
||||
|
var self = this; |
||||
|
self.initial_render = true; |
||||
|
rpc.query({ |
||||
|
model: 'account.partner.ageing', |
||||
|
method: 'create', |
||||
|
args: [{ |
||||
|
|
||||
|
}] |
||||
|
}).then(function(t_res) { |
||||
|
self.wizard_id = t_res; |
||||
|
|
||||
|
self.load_data(self.initial_render); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
load_data: function (initial_render = true) { |
||||
|
|
||||
|
var self = this; |
||||
|
|
||||
|
self.$(".categ").empty(); |
||||
|
try{ |
||||
|
var self = this; |
||||
|
rpc.query({ |
||||
|
model: 'account.partner.ageing', |
||||
|
method: 'view_report', |
||||
|
args: [[this.wizard_id]], |
||||
|
}).then(function(datas) { |
||||
|
|
||||
|
if (initial_render) { |
||||
|
self.$('.filter_view_tb').html(QWeb.render('AgeingFilterView', { |
||||
|
filter_data: datas['filters'], |
||||
|
})); |
||||
|
self.$el.find('.partners').select2({ |
||||
|
placeholder: ' Partners...', |
||||
|
}); |
||||
|
self.$el.find('.category').select2({ |
||||
|
placeholder: ' Partner Category...', |
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
var child=[]; |
||||
|
|
||||
|
self.$('.table_view_tb').html(QWeb.render('Ageingtable', { |
||||
|
|
||||
|
report_lines : datas['report_lines'], |
||||
|
move_lines :datas['report_lines'][2], |
||||
|
filter : datas['filters'], |
||||
|
currency : datas['currency'], |
||||
|
})); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
catch (el) { |
||||
|
window.location.href |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
print_pdf: function(e) { |
||||
|
e.preventDefault(); |
||||
|
|
||||
|
var self = this; |
||||
|
self._rpc({ |
||||
|
model: 'account.partner.ageing', |
||||
|
method: 'view_report', |
||||
|
args: [ |
||||
|
[self.wizard_id] |
||||
|
], |
||||
|
}).then(function(data) { |
||||
|
var action = { |
||||
|
'type': 'ir.actions.report', |
||||
|
'report_type': 'qweb-pdf', |
||||
|
'report_name': 'dynamic_accounts_report.partner_ageing', |
||||
|
'report_file': 'dynamic_accounts_report.partner_ageing', |
||||
|
'data': { |
||||
|
'report_data': data |
||||
|
}, |
||||
|
'context': { |
||||
|
'active_model': 'account.partner.ageing', |
||||
|
'landscape': 1, |
||||
|
'ageing_pdf_report': true |
||||
|
|
||||
|
}, |
||||
|
'display_name': 'Partner Ageing', |
||||
|
}; |
||||
|
|
||||
|
return self.do_action(action); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
|
||||
|
print_xlsx: function() { |
||||
|
var self = this; |
||||
|
self._rpc({ |
||||
|
model: 'account.partner.ageing', |
||||
|
method: 'view_report', |
||||
|
args: [ |
||||
|
[self.wizard_id] |
||||
|
], |
||||
|
}).then(function(data) { |
||||
|
|
||||
|
var action = { |
||||
|
'type': 'ir_actions_dynamic_xlsx_download', |
||||
|
'data': { |
||||
|
'model': 'account.partner.ageing', |
||||
|
'options': JSON.stringify(data['filters']), |
||||
|
'output_format': 'xlsx', |
||||
|
'report_data': JSON.stringify(data['report_lines']), |
||||
|
'report_name': 'Partner Ageing', |
||||
|
'dfr_data': JSON.stringify(data), |
||||
|
}, |
||||
|
}; |
||||
|
return self.do_action(action); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
create_lines_with_style: function(rec, attr, datas) { |
||||
|
var temp_str = ""; |
||||
|
var style_name = "border-bottom: 1px solid #e6e6e6;"; |
||||
|
var attr_name = attr + " style="+style_name; |
||||
|
|
||||
|
|
||||
|
|
||||
|
temp_str += "<td class='child_col1' "+attr_name+" >"+rec['code'] +rec['name'] +"</td>"; |
||||
|
if(datas.currency[1]=='after'){ |
||||
|
temp_str += "<td class='child_col2' "+attr_name+" >"+rec['debit'].toFixed(2)+datas.currency[0]+"</td>"; |
||||
|
temp_str += "<td class='child_col3' "+attr_name+" >"+rec['credit'].toFixed(2) +datas.currency[0]+ "</td>"; |
||||
|
|
||||
|
} |
||||
|
else{ |
||||
|
temp_str += "<td class='child_col2' "+attr_name+" >"+datas.currency[0]+rec['debit'].toFixed(2) + "</td>"; |
||||
|
temp_str += "<td class='child_col3' "+attr_name+">"+datas.currency[0]+rec['credit'].toFixed(2) + "</td>"; |
||||
|
|
||||
|
} |
||||
|
return temp_str; |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
journal_line_click: function (el){ |
||||
|
|
||||
|
click_num++; |
||||
|
var self = this; |
||||
|
var line = $(el.target).parent().data('id'); |
||||
|
|
||||
|
return self.do_action({ |
||||
|
type: 'ir.actions.act_window', |
||||
|
view_type: 'form', |
||||
|
view_mode: 'form', |
||||
|
res_model: 'account.move', |
||||
|
views: [ |
||||
|
[false, 'form'] |
||||
|
], |
||||
|
res_id: line, |
||||
|
target: 'current', |
||||
|
}); |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
show_drop_down: function(event) { |
||||
|
event.preventDefault(); |
||||
|
var self = this; |
||||
|
var account_id = $(event.currentTarget).data('account-id'); |
||||
|
|
||||
|
var partner_id = $(event.currentTarget)[0].cells[0].innerText; |
||||
|
|
||||
|
var offset = 0; |
||||
|
var td = $(event.currentTarget).next('tr').find('td'); |
||||
|
if (td.length == 1) { |
||||
|
|
||||
|
|
||||
|
|
||||
|
self._rpc({ |
||||
|
model: 'account.partner.ageing', |
||||
|
method: 'view_report', |
||||
|
args: [ |
||||
|
[self.wizard_id] |
||||
|
], |
||||
|
}).then(function(data) { |
||||
|
for (var i = 0; i < data['report_lines'][0].length; i++) { |
||||
|
|
||||
|
|
||||
|
if (account_id == data['report_lines'][0][i]['partner_id'] ){ |
||||
|
|
||||
|
|
||||
|
$(event.currentTarget).next('tr').find('td .gl-table-div').remove(); |
||||
|
$(event.currentTarget).next('tr').find('td ul').after( |
||||
|
QWeb.render('SubSectional', { |
||||
|
account_data: data['report_lines'][0][i]['child_lines'], |
||||
|
|
||||
|
})) |
||||
|
|
||||
|
$(event.currentTarget).next('tr').find('td ul li:first a').css({ |
||||
|
'background-color': '#00ede8', |
||||
|
'font-weight': 'bold', |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
view_acc_move: function(event) { |
||||
|
event.preventDefault(); |
||||
|
var self = this; |
||||
|
var context = {}; |
||||
|
var show_acc_move = function(res_model, res_id, view_id) { |
||||
|
var action = { |
||||
|
type: 'ir.actions.act_window', |
||||
|
view_type: 'form', |
||||
|
view_mode: 'form', |
||||
|
res_model: res_model, |
||||
|
views: [ |
||||
|
[view_id || false, 'form'] |
||||
|
], |
||||
|
res_id: res_id, |
||||
|
target: 'current', |
||||
|
context: context, |
||||
|
}; |
||||
|
return self.do_action(action); |
||||
|
}; |
||||
|
rpc.query({ |
||||
|
model: 'account.move', |
||||
|
method: 'search_read', |
||||
|
domain: [ |
||||
|
['id', '=', $(event.currentTarget).data('move-id')] |
||||
|
], |
||||
|
fields: ['id'], |
||||
|
limit: 1, |
||||
|
}) |
||||
|
.then(function(record) { |
||||
|
if (record.length > 0) { |
||||
|
show_acc_move('account.move', record[0].id); |
||||
|
} else { |
||||
|
show_acc_move('account.move', $(event.currentTarget).data('move-id')); |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
apply_filter: function(event) { |
||||
|
|
||||
|
event.preventDefault(); |
||||
|
var self = this; |
||||
|
self.initial_render = false; |
||||
|
|
||||
|
var filter_data_selected = {}; |
||||
|
|
||||
|
if ($("#date_from").val()) { |
||||
|
var dateString = $("#date_from").val(); |
||||
|
|
||||
|
filter_data_selected.date_from= dateString; |
||||
|
} |
||||
|
var partner_ids = []; |
||||
|
var partner_text = []; |
||||
|
var span_res = document.getElementById("partner_res") |
||||
|
var partner_list = $(".partners").select2('data') |
||||
|
for (var i = 0; i < partner_list.length; i++) { |
||||
|
if(partner_list[i].element[0].selected === true) |
||||
|
{partner_ids.push(parseInt(partner_list[i].id)) |
||||
|
if(partner_text.includes(partner_list[i].text) === false) |
||||
|
{partner_text.push(partner_list[i].text) |
||||
|
} |
||||
|
span_res.value = partner_text |
||||
|
span_res.innerHTML=span_res.value; |
||||
|
} |
||||
|
} |
||||
|
if (partner_list.length == 0){ |
||||
|
span_res.value = "" |
||||
|
span_res.innerHTML=""; |
||||
|
} |
||||
|
filter_data_selected.partner_ids = partner_ids |
||||
|
|
||||
|
var partner_category_ids = []; |
||||
|
var partner_category_text = []; |
||||
|
var span_res = document.getElementById("category_res") |
||||
|
var category_list = $(".category").select2('data') |
||||
|
|
||||
|
for (var i = 0; i < category_list.length; i++) { |
||||
|
if(category_list[i].element[0].selected === true) |
||||
|
{partner_category_ids.push(parseInt(category_list[i].id)) |
||||
|
if(partner_category_text.includes(category_list[i].text) === false) |
||||
|
{partner_category_text.push(category_list[i].text) |
||||
|
} |
||||
|
span_res.value = partner_category_text |
||||
|
span_res.innerHTML=span_res.value; |
||||
|
} |
||||
|
} |
||||
|
if (category_list.length == 0){ |
||||
|
span_res.value = "" |
||||
|
span_res.innerHTML=""; |
||||
|
} |
||||
|
filter_data_selected.partner_category_ids = partner_category_ids |
||||
|
|
||||
|
|
||||
|
if ($(".target_move").length) { |
||||
|
|
||||
|
var post_res = document.getElementById("post_res") |
||||
|
filter_data_selected.target_move = $(".target_move")[0].value |
||||
|
post_res.value = $(".target_move")[0].value |
||||
|
post_res.innerHTML=post_res.value; |
||||
|
if ($(".target_move")[0].value == "") { |
||||
|
post_res.innerHTML="all"; |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if ($(".result_selection").length) { |
||||
|
var account_res = document.getElementById("account_res") |
||||
|
filter_data_selected.result_selection = $(".result_selection")[0].value |
||||
|
account_res.value = $(".result_selection")[0].value |
||||
|
account_res.innerHTML=account_res.value; |
||||
|
if ($(".result_selection")[0].value == "") { |
||||
|
account_res.innerHTML="customer"; |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
rpc.query({ |
||||
|
model: 'account.partner.ageing', |
||||
|
method: 'write', |
||||
|
args: [ |
||||
|
self.wizard_id, filter_data_selected |
||||
|
], |
||||
|
}).then(function(res) { |
||||
|
self.initial_render = false; |
||||
|
self.load_data(self.initial_render); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
}); |
||||
|
core.action_registry.add("p_a", PartnerAgeing); |
||||
|
return PartnerAgeing; |
||||
|
}); |
@ -0,0 +1,277 @@ |
|||||
|
odoo.define('dynamic_cash_flow_statements.cash_flow', function (require) { |
||||
|
'use strict'; |
||||
|
var AbstractAction = require('web.AbstractAction'); |
||||
|
var core = require('web.core'); |
||||
|
var field_utils = require('web.field_utils'); |
||||
|
var rpc = require('web.rpc'); |
||||
|
var session = require('web.session'); |
||||
|
var utils = require('web.utils'); |
||||
|
var QWeb = core.qweb; |
||||
|
var _t = core._t; |
||||
|
|
||||
|
window.click_num = 0; |
||||
|
var CashFlow = AbstractAction.extend({ |
||||
|
template: 'CFTemp', |
||||
|
events: { |
||||
|
'click .parent-line': 'journal_line_click', |
||||
|
'click .child_col1': 'journal_line_click', |
||||
|
'click #apply_filter': 'apply_filter', |
||||
|
'click #pdf': 'print_pdf', |
||||
|
'click #xlsx': 'print_xlsx', |
||||
|
'click .cf-line': 'get_move_lines', |
||||
|
}, |
||||
|
|
||||
|
init: function(parent, action) { |
||||
|
this._super(parent, action); |
||||
|
this.currency=action.currency; |
||||
|
this.report_lines = action.report_lines; |
||||
|
this.wizard_id = action.context.wizard | null; |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
start: function() { |
||||
|
var self = this; |
||||
|
self.initial_render = true; |
||||
|
rpc.query({ |
||||
|
model: 'account.cash.flow', |
||||
|
method: 'create', |
||||
|
args: [{ |
||||
|
|
||||
|
}] |
||||
|
}).then(function(t_res) { |
||||
|
self.wizard_id = t_res; |
||||
|
self.load_data(self.initial_render); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
get_move_lines: function(event) { |
||||
|
event.preventDefault(); |
||||
|
var self = this; |
||||
|
var account_id = $(event.currentTarget).data('account-id'); |
||||
|
var offset = 0; |
||||
|
var td = $(event.currentTarget).next('tr').find('td'); |
||||
|
if (td.length == 1) { |
||||
|
rpc.query({ |
||||
|
model: 'account.cash.flow', |
||||
|
method: 'view_report', |
||||
|
args: [ |
||||
|
[self.wizard_id] |
||||
|
], |
||||
|
}).then(function(datas) { |
||||
|
|
||||
|
if(datas['levels']== 'detailed'){ |
||||
|
$(event.currentTarget).next('tr').find('td ul').after( |
||||
|
QWeb.render('SubSectionCF', { |
||||
|
count: 3, |
||||
|
offset: 0, |
||||
|
account_data: datas['journal_res'], |
||||
|
level:datas['levels'], |
||||
|
currency : datas['currency'], |
||||
|
line_id:parseInt(event.currentTarget.attributes[3].value), |
||||
|
})) |
||||
|
}else if(datas['levels']== 'very' || datas['levels']== false){ |
||||
|
$(event.currentTarget).next('tr').find('td ul').after( |
||||
|
QWeb.render('ChildSubSectionCF', { |
||||
|
count: 3, |
||||
|
offset: 0, |
||||
|
account_data: datas['account_res'], |
||||
|
level:datas['levels'], |
||||
|
currency : datas['currency'], |
||||
|
line_id:parseInt(event.currentTarget.attributes[3].value), |
||||
|
})) |
||||
|
} |
||||
|
|
||||
|
$(event.currentTarget).next('tr').find('td ul li:first a').css({ |
||||
|
'background-color': '#00ede8', |
||||
|
'font-weight': 'bold', |
||||
|
}); |
||||
|
}) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
load_data: function (initial_render = true) { |
||||
|
var self = this; |
||||
|
self.$(".categ").empty(); |
||||
|
try{ |
||||
|
var self = this; |
||||
|
rpc.query({ |
||||
|
model: 'account.cash.flow', |
||||
|
method: 'view_report', |
||||
|
args: [[this.wizard_id]], |
||||
|
}).then(function(datas) { |
||||
|
if (initial_render) { |
||||
|
self.$('.filter_view_tb').html(QWeb.render('CashFilterView', { |
||||
|
filter_data: datas['filters'], |
||||
|
})); |
||||
|
self.$el.find('.journals').select2({ |
||||
|
placeholder: 'Select Journals...', |
||||
|
}); |
||||
|
} |
||||
|
var child=[]; |
||||
|
|
||||
|
self.$('.table_view_tb').html(QWeb.render('CashTable', { |
||||
|
|
||||
|
account_data: datas['fetched_data'], |
||||
|
level:datas['levels'], |
||||
|
currency : datas['currency'], |
||||
|
})); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
catch (el) { |
||||
|
window.location.href |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
show_gl: function(e) { |
||||
|
var self = this; |
||||
|
var account_id = $(e.target).attr('data-account-id'); |
||||
|
var options = { |
||||
|
account_ids: [account_id], |
||||
|
} |
||||
|
|
||||
|
var action = { |
||||
|
type: 'ir.actions.client', |
||||
|
name: 'GL View', |
||||
|
tag: 'g_l', |
||||
|
target: 'new', |
||||
|
|
||||
|
domain: [['account_ids','=', account_id]], |
||||
|
|
||||
|
|
||||
|
} |
||||
|
return this.do_action(action); |
||||
|
|
||||
|
}, |
||||
|
print_pdf: function(e) { |
||||
|
e.preventDefault(); |
||||
|
var self = this; |
||||
|
self._rpc({ |
||||
|
model: 'account.cash.flow', |
||||
|
method: 'view_report', |
||||
|
args: [ |
||||
|
[self.wizard_id] |
||||
|
], |
||||
|
}).then(function(data) { |
||||
|
var action = { |
||||
|
'type': 'ir.actions.report', |
||||
|
'report_type': 'qweb-pdf', |
||||
|
'report_name': 'dynamic_accounts_report.cash_flow', |
||||
|
'report_file': 'dynamic_accounts_report.cash_flow', |
||||
|
'data': { |
||||
|
'report_data': data |
||||
|
}, |
||||
|
'context': { |
||||
|
'active_model': 'account.cash.flow', |
||||
|
'landscape': 1, |
||||
|
'trial_pdf_report': true |
||||
|
}, |
||||
|
'display_name': 'Cash Flow Statements', |
||||
|
}; |
||||
|
return self.do_action(action); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
|
||||
|
print_xlsx: function() { |
||||
|
var self = this; |
||||
|
self._rpc({ |
||||
|
model: 'account.cash.flow', |
||||
|
method: 'view_report', |
||||
|
args: [ |
||||
|
[self.wizard_id] |
||||
|
], |
||||
|
}).then(function(data) { |
||||
|
var action = { |
||||
|
'type': 'ir_actions_dynamic_xlsx_download', |
||||
|
'data': { |
||||
|
'model': 'account.cash.flow', |
||||
|
'options': JSON.stringify(data['filters']), |
||||
|
'output_format': 'xlsx', |
||||
|
'report_data': JSON.stringify(data['report_lines']), |
||||
|
'report_name': 'Cash Flow Statements', |
||||
|
'dfr_data': JSON.stringify(data), |
||||
|
}, |
||||
|
}; |
||||
|
return self.do_action(action); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
journal_line_click: function (el){ |
||||
|
click_num++; |
||||
|
var self = this; |
||||
|
var line = $(el.target).parent().data('id'); |
||||
|
return self.do_action({ |
||||
|
type: 'ir.actions.act_window', |
||||
|
view_type: 'form', |
||||
|
view_mode: 'form', |
||||
|
res_model: 'account.move', |
||||
|
views: [ |
||||
|
[false, 'form'] |
||||
|
], |
||||
|
res_id: line, |
||||
|
target: 'current', |
||||
|
}); |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
|
||||
|
apply_filter: function(event) { |
||||
|
|
||||
|
event.preventDefault(); |
||||
|
var self = this; |
||||
|
self.initial_render = false; |
||||
|
|
||||
|
var filter_data_selected = {}; |
||||
|
|
||||
|
|
||||
|
|
||||
|
if ($(".levels").length){ |
||||
|
var level_res = document.getElementById("level_res") |
||||
|
filter_data_selected.levels = $(".levels")[0].value |
||||
|
level_res.value = $(".levels")[0].value |
||||
|
level_res.innerHTML=level_res.value; |
||||
|
if ($(".levels").value==""){ |
||||
|
type_res.innerHTML="summary"; |
||||
|
filter_data_selected.type = "Summary" |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if ($("#date_from").val()) { |
||||
|
var dateString = $("#date_from").val(); |
||||
|
filter_data_selected.date_from = dateString; |
||||
|
} |
||||
|
if ($("#date_to").val()) { |
||||
|
var dateString = $("#date_to").val(); |
||||
|
filter_data_selected.date_to = dateString; |
||||
|
} |
||||
|
|
||||
|
if ($(".target_move").length) { |
||||
|
var post_res = document.getElementById("post_res") |
||||
|
filter_data_selected.target_move = $(".target_move")[0].value |
||||
|
post_res.value = $(".target_move")[0].value |
||||
|
post_res.innerHTML=post_res.value; |
||||
|
if ($(".target_move")[0].value == "") { |
||||
|
post_res.innerHTML="all"; |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
rpc.query({ |
||||
|
model: 'account.cash.flow', |
||||
|
method: 'write', |
||||
|
args: [ |
||||
|
self.wizard_id, filter_data_selected |
||||
|
], |
||||
|
}).then(function(res) { |
||||
|
self.initial_render = false; |
||||
|
self.load_data(self.initial_render); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
}); |
||||
|
core.action_registry.add("c_f", CashFlow); |
||||
|
return CashFlow; |
||||
|
}); |
@ -0,0 +1,355 @@ |
|||||
|
odoo.define('dynamic_partner_daybook.daybook', function (require) { |
||||
|
'use strict'; |
||||
|
var AbstractAction = require('web.AbstractAction'); |
||||
|
var core = require('web.core'); |
||||
|
var field_utils = require('web.field_utils'); |
||||
|
var rpc = require('web.rpc'); |
||||
|
var session = require('web.session'); |
||||
|
var utils = require('web.utils'); |
||||
|
var QWeb = core.qweb; |
||||
|
var _t = core._t; |
||||
|
|
||||
|
window.click_num = 0; |
||||
|
var DayBook = AbstractAction.extend({ |
||||
|
template: 'DaybookTemp', |
||||
|
events: { |
||||
|
'click .parent-line': 'journal_line_click', |
||||
|
'click .child_col1': 'journal_line_click', |
||||
|
'click #apply_filter': 'apply_filter', |
||||
|
'click #pdf': 'print_pdf', |
||||
|
'click #xlsx': 'print_xlsx', |
||||
|
'click .db-line': 'show_drop_down', |
||||
|
'click .view-account-move': 'view_acc_move', |
||||
|
}, |
||||
|
|
||||
|
init: function(parent, action) { |
||||
|
this._super(parent, action); |
||||
|
this.currency=action.currency; |
||||
|
this.report_lines = action.report_lines; |
||||
|
this.wizard_id = action.context.wizard | null; |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
start: function() { |
||||
|
var self = this; |
||||
|
self.initial_render = true; |
||||
|
rpc.query({ |
||||
|
model: 'account.day.book', |
||||
|
method: 'create', |
||||
|
args: [{ |
||||
|
|
||||
|
}] |
||||
|
}).then(function(t_res) { |
||||
|
self.wizard_id = t_res; |
||||
|
self.load_data(self.initial_render); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
load_data: function (initial_render = true) { |
||||
|
var self = this; |
||||
|
self.$(".categ").empty(); |
||||
|
try{ |
||||
|
var self = this; |
||||
|
self._rpc({ |
||||
|
model: 'account.day.book', |
||||
|
method: 'view_report', |
||||
|
args: [[this.wizard_id]], |
||||
|
}).then(function(datas) { |
||||
|
|
||||
|
if (initial_render) { |
||||
|
|
||||
|
self.$('.filter_view_db').html(QWeb.render('DayFilterView', { |
||||
|
filter_data: datas['filters'], |
||||
|
})); |
||||
|
self.$el.find('.journals').select2({ |
||||
|
placeholder: ' Journals...', |
||||
|
}); |
||||
|
self.$el.find('.account').select2({ |
||||
|
placeholder: ' Accounts...', |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
} |
||||
|
var child=[]; |
||||
|
|
||||
|
self.$('.table_view_db').html(QWeb.render('Daytable', { |
||||
|
|
||||
|
report_lines : datas['report_lines'], |
||||
|
filter : datas['filters'], |
||||
|
currency : datas['currency'], |
||||
|
})); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
catch (el) { |
||||
|
window.location.href |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
print_pdf: function(e) { |
||||
|
e.preventDefault(); |
||||
|
|
||||
|
var self = this; |
||||
|
self._rpc({ |
||||
|
model: 'account.day.book', |
||||
|
method: 'view_report', |
||||
|
args: [ |
||||
|
[self.wizard_id] |
||||
|
], |
||||
|
}).then(function(data) { |
||||
|
|
||||
|
var action = { |
||||
|
'type': 'ir.actions.report', |
||||
|
'report_type': 'qweb-pdf', |
||||
|
'report_name': 'dynamic_accounts_report.day_book', |
||||
|
'report_file': 'dynamic_accounts_report.day_book', |
||||
|
'data': { |
||||
|
'report_data': data |
||||
|
}, |
||||
|
'context': { |
||||
|
'active_model': 'account.day.book', |
||||
|
'landscape': 1, |
||||
|
'daybook_pdf_report': true |
||||
|
}, |
||||
|
'display_name': 'Day Book', |
||||
|
}; |
||||
|
|
||||
|
return self.do_action(action); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
print_xlsx: function() { |
||||
|
var self = this; |
||||
|
self._rpc({ |
||||
|
model: 'account.day.book', |
||||
|
method: 'view_report', |
||||
|
args: [ |
||||
|
[self.wizard_id] |
||||
|
], |
||||
|
}).then(function(data) { |
||||
|
|
||||
|
var action = { |
||||
|
'type': 'ir_actions_dynamic_xlsx_download', |
||||
|
'data': { |
||||
|
'model': 'account.day.book', |
||||
|
'options': JSON.stringify(data['filters']), |
||||
|
'output_format': 'xlsx', |
||||
|
'report_data': JSON.stringify(data['report_lines']), |
||||
|
'report_name': 'Day Book', |
||||
|
'dfr_data': JSON.stringify(data), |
||||
|
}, |
||||
|
}; |
||||
|
return self.do_action(action); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
create_lines_with_style: function(rec, attr, datas) { |
||||
|
|
||||
|
var temp_str = ""; |
||||
|
var style_name = "border-bottom: 1px solid #e6e6e6;"; |
||||
|
var attr_name = attr + " style="+style_name; |
||||
|
temp_str += "<td class='child_col1' "+attr_name+" >"+rec['code'] +rec['name'] +"</td>"; |
||||
|
if(datas.currency[1]=='after'){ |
||||
|
temp_str += "<td class='child_col2' "+attr_name+" >"+rec['debit'].toFixed(2)+datas.currency[0]+"</td>"; |
||||
|
temp_str += "<td class='child_col3' "+attr_name+" >"+rec['credit'].toFixed(2) +datas.currency[0]+ "</td>"; |
||||
|
} |
||||
|
else{ |
||||
|
temp_str += "<td class='child_col2' "+attr_name+" >"+datas.currency[0]+rec['debit'].toFixed(2) + "</td>"; |
||||
|
temp_str += "<td class='child_col3' "+attr_name+">"+datas.currency[0]+rec['credit'].toFixed(2) + "</td>"; |
||||
|
} |
||||
|
return temp_str; |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
journal_line_click: function (el){ |
||||
|
click_num++; |
||||
|
var self = this; |
||||
|
var line = $(el.target).parent().data('id'); |
||||
|
return self.do_action({ |
||||
|
type: 'ir.actions.act_window', |
||||
|
view_type: 'form', |
||||
|
view_mode: 'form', |
||||
|
res_model: 'account.move', |
||||
|
views: [ |
||||
|
[false, 'form'] |
||||
|
], |
||||
|
res_id: line, |
||||
|
target: 'current', |
||||
|
}); |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
show_drop_down: function(event) { |
||||
|
event.preventDefault(); |
||||
|
var self = this; |
||||
|
var account_id = $(event.currentTarget).data('account-id'); |
||||
|
var offset = 0; |
||||
|
var td = $(event.currentTarget).next('tr').find('td'); |
||||
|
if (td.length == 1) { |
||||
|
|
||||
|
self._rpc({ |
||||
|
model: 'account.day.book', |
||||
|
method: 'view_report', |
||||
|
args: [ |
||||
|
[self.wizard_id] |
||||
|
], |
||||
|
}).then(function(data) { |
||||
|
for (var i = 0; i < data['report_lines'].length; i++) { |
||||
|
|
||||
|
if (account_id == data['report_lines'][i]['id'] ){ |
||||
|
$(event.currentTarget).next('tr').find('td .db-table-div').remove(); |
||||
|
$(event.currentTarget).next('tr').find('td ul').after( |
||||
|
QWeb.render('SubSectiondb', { |
||||
|
|
||||
|
account_data: data['report_lines'][i]['child_lines'], |
||||
|
})) |
||||
|
|
||||
|
$(event.currentTarget).next('tr').find('td ul li:first a').css({ |
||||
|
'background-color': '#00ede8', |
||||
|
'font-weight': 'bold', |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
view_acc_move: function(event) { |
||||
|
|
||||
|
event.preventDefault(); |
||||
|
var self = this; |
||||
|
var context = {}; |
||||
|
var show_acc_move = function(res_model, res_id, view_id) { |
||||
|
var action = { |
||||
|
type: 'ir.actions.act_window', |
||||
|
view_type: 'form', |
||||
|
view_mode: 'form', |
||||
|
res_model: res_model, |
||||
|
views: [ |
||||
|
[view_id || false, 'form'] |
||||
|
], |
||||
|
res_id: res_id, |
||||
|
target: 'current', |
||||
|
context: context, |
||||
|
}; |
||||
|
return self.do_action(action); |
||||
|
}; |
||||
|
rpc.query({ |
||||
|
model: 'account.move', |
||||
|
method: 'search_read', |
||||
|
domain: [ |
||||
|
['id', '=', $(event.currentTarget).data('move-id')] |
||||
|
], |
||||
|
fields: ['id'], |
||||
|
limit: 1, |
||||
|
}) |
||||
|
.then(function(record) { |
||||
|
|
||||
|
if (record.length > 0) { |
||||
|
show_acc_move('account.move', record[0].id); |
||||
|
} else { |
||||
|
show_acc_move('account.move', $(event.currentTarget).data('move-id')); |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
apply_filter: function(event) { |
||||
|
|
||||
|
event.preventDefault(); |
||||
|
var self = this; |
||||
|
self.initial_render = false; |
||||
|
|
||||
|
var filter_data_selected = {}; |
||||
|
|
||||
|
|
||||
|
var account_ids = []; |
||||
|
var account_text = []; |
||||
|
|
||||
|
var account_res = document.getElementById("acc_res") |
||||
|
|
||||
|
var account_list = $(".account").select2('data') |
||||
|
for (var i = 0; i < account_list.length; i++) { |
||||
|
if(account_list[i].element[0].selected === true){ |
||||
|
|
||||
|
account_ids.push(parseInt(account_list[i].id)) |
||||
|
if(account_text.includes(account_list[i].text) === false){ |
||||
|
account_text.push(account_list[i].text) |
||||
|
} |
||||
|
account_res.value = account_text |
||||
|
account_res.innerHTML=account_res.value; |
||||
|
} |
||||
|
} |
||||
|
if (account_list.length == 0){ |
||||
|
account_res.value = "" |
||||
|
account_res.innerHTML=""; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
filter_data_selected.account_ids = account_ids |
||||
|
|
||||
|
|
||||
|
|
||||
|
var journal_ids = []; |
||||
|
var journal_text = []; |
||||
|
var journal_res = document.getElementById("journal_res") |
||||
|
var journal_list = $(".journals").select2('data') |
||||
|
for (var i = 0; i < journal_list.length; i++) { |
||||
|
if(journal_list[i].element[0].selected === true){ |
||||
|
|
||||
|
journal_ids.push(parseInt(journal_list[i].id)) |
||||
|
if(journal_text.includes(journal_list[i].text) === false){ |
||||
|
journal_text.push(journal_list[i].text) |
||||
|
} |
||||
|
journal_res.value = journal_text |
||||
|
journal_res.innerHTML=journal_res.value; |
||||
|
} |
||||
|
} |
||||
|
if (journal_list.length == 0){ |
||||
|
journal_res.value = "" |
||||
|
journal_res.innerHTML=""; |
||||
|
|
||||
|
} |
||||
|
filter_data_selected.journal_ids = journal_ids |
||||
|
|
||||
|
if ($("#date_from").val()) { |
||||
|
var dateString = $("#date_from").val(); |
||||
|
|
||||
|
filter_data_selected.date_from = dateString; |
||||
|
} |
||||
|
if ($("#date_to").val()) { |
||||
|
var dateString = $("#date_to").val(); |
||||
|
filter_data_selected.date_to = dateString; |
||||
|
} |
||||
|
|
||||
|
if ($(".target_move").length) { |
||||
|
|
||||
|
var post_res = document.getElementById("post_res") |
||||
|
filter_data_selected.target_move = $(".target_move")[0].value |
||||
|
post_res.value = $(".target_move")[0].value |
||||
|
post_res.innerHTML=post_res.value; |
||||
|
if ($(".target_move")[0].value == "") { |
||||
|
post_res.innerHTML="all"; |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
rpc.query({ |
||||
|
model: 'account.day.book', |
||||
|
method: 'write', |
||||
|
args: [ |
||||
|
self.wizard_id, filter_data_selected |
||||
|
], |
||||
|
}).then(function(res) { |
||||
|
self.initial_render = false; |
||||
|
self.load_data(self.initial_render); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
}); |
||||
|
core.action_registry.add("d_b", DayBook); |
||||
|
return DayBook; |
||||
|
}); |
@ -0,0 +1,343 @@ |
|||||
|
odoo.define('dynamic_accounts_report.financial_reports', function (require) { |
||||
|
'use strict'; |
||||
|
var AbstractAction = require('web.AbstractAction'); |
||||
|
var core = require('web.core'); |
||||
|
var field_utils = require('web.field_utils'); |
||||
|
var rpc = require('web.rpc'); |
||||
|
var session = require('web.session'); |
||||
|
var utils = require('web.utils'); |
||||
|
var QWeb = core.qweb; |
||||
|
var _t = core._t; |
||||
|
|
||||
|
window.click_num = 0; |
||||
|
var ProfitAndLoss = AbstractAction.extend({ |
||||
|
template: 'dfr_template_new', |
||||
|
events: { |
||||
|
'click .parent-line': 'journal_line_click', |
||||
|
'click .child_col1': 'journal_line_click', |
||||
|
'click #apply_filter': 'apply_filter', |
||||
|
'click #pdf': 'print_pdf', |
||||
|
'click #xlsx': 'print_xlsx', |
||||
|
'click .show-gl': 'show_gl', |
||||
|
}, |
||||
|
|
||||
|
init: function(parent, action) { |
||||
|
this._super(parent, action); |
||||
|
this.currency=action.currency; |
||||
|
this.report_lines = action.report_lines; |
||||
|
this.wizard_id = action.context.wizard | null; |
||||
|
}, |
||||
|
start: function() { |
||||
|
var self = this; |
||||
|
self.initial_render = true; |
||||
|
rpc.query({ |
||||
|
model: 'dynamic.balance.sheet.report', |
||||
|
method: 'create', |
||||
|
args: [{ |
||||
|
}] |
||||
|
}).then(function(t_res) { |
||||
|
self.wizard_id = t_res; |
||||
|
self.load_data(self.initial_render); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
load_data: function (initial_render = true) { |
||||
|
var self = this; |
||||
|
var action_title = self._title; |
||||
|
self.$(".categ").empty(); |
||||
|
try{ |
||||
|
var self = this; |
||||
|
rpc.query({ |
||||
|
model: 'dynamic.balance.sheet.report', |
||||
|
method: 'view_report', |
||||
|
args: [[this.wizard_id], action_title], |
||||
|
}).then(function(datas) { |
||||
|
if (initial_render) { |
||||
|
self.$('.filter_view_dfr').html(QWeb.render('DfrFilterView', { |
||||
|
filter_data: datas['filters'], |
||||
|
title : datas['name'], |
||||
|
})); |
||||
|
self.$el.find('.journals').select2({ |
||||
|
placeholder: ' Journals...', |
||||
|
}); |
||||
|
self.$el.find('.account').select2({ |
||||
|
placeholder: ' Accounts...', |
||||
|
}); |
||||
|
self.$el.find('.account-tag').select2({ |
||||
|
placeholder: 'Account Tag...', |
||||
|
}); |
||||
|
self.$el.find('.analytics').select2({ |
||||
|
placeholder: 'Analytic Accounts...', |
||||
|
}); |
||||
|
self.$el.find('.analytic-tag').select2({ |
||||
|
placeholder: 'Analytic Tag...', |
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
var child=[]; |
||||
|
self.$('.table_view_dfr').html(QWeb.render('dfr_table', { |
||||
|
|
||||
|
report_lines : datas['report_lines'], |
||||
|
filter : datas['filters'], |
||||
|
currency : datas['currency'], |
||||
|
credit_total : datas['credit_total'], |
||||
|
debit_total : datas['debit_total'], |
||||
|
debit_balance : datas['debit_balance'], |
||||
|
bs_lines : datas['bs_lines'], |
||||
|
})); |
||||
|
}); |
||||
|
} |
||||
|
catch (el) { |
||||
|
window.location.href |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
show_gl: function(e) { |
||||
|
var self = this; |
||||
|
var account_id = $(e.target).attr('data-account-id'); |
||||
|
var options = { |
||||
|
account_ids: [account_id], |
||||
|
} |
||||
|
var action = { |
||||
|
type: 'ir.actions.client', |
||||
|
name: 'GL View', |
||||
|
tag: 'g_l', |
||||
|
target: 'new', |
||||
|
domain: [['account_ids','=', account_id]], |
||||
|
|
||||
|
} |
||||
|
return this.do_action(action); |
||||
|
}, |
||||
|
|
||||
|
print_pdf: function(e) { |
||||
|
e.preventDefault(); |
||||
|
var self = this; |
||||
|
var action_title = self._title; |
||||
|
self._rpc({ |
||||
|
model: 'dynamic.balance.sheet.report', |
||||
|
method: 'view_report', |
||||
|
args: [ |
||||
|
[self.wizard_id], action_title |
||||
|
], |
||||
|
}).then(function(data) { |
||||
|
var action = { |
||||
|
'type': 'ir.actions.report', |
||||
|
'report_type': 'qweb-pdf', |
||||
|
'report_name': 'dynamic_accounts_report.balance_sheet', |
||||
|
'report_file': 'dynamic_accounts_report.balance_sheet', |
||||
|
'data': { |
||||
|
'report_data': data, |
||||
|
'report_name': action_title |
||||
|
}, |
||||
|
'context': { |
||||
|
'active_model': 'dynamic.balance.sheet.report', |
||||
|
'landscape': 1, |
||||
|
'bs_report': true |
||||
|
}, |
||||
|
'display_name': action_title, |
||||
|
}; |
||||
|
return self.do_action(action); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
print_xlsx: function() { |
||||
|
var self = this; |
||||
|
var action_title = self._title; |
||||
|
self._rpc({ |
||||
|
model: 'dynamic.balance.sheet.report', |
||||
|
method: 'view_report', |
||||
|
args: [ |
||||
|
[self.wizard_id], action_title |
||||
|
], |
||||
|
}).then(function(data) { |
||||
|
var action = { |
||||
|
'type': 'ir_actions_dynamic_xlsx_download', |
||||
|
'data': { |
||||
|
'model': 'dynamic.balance.sheet.report', |
||||
|
'options': JSON.stringify(data['filters']), |
||||
|
'output_format': 'xlsx', |
||||
|
'report_data': action_title, |
||||
|
'report_name': action_title, |
||||
|
'dfr_data': JSON.stringify(data['bs_lines']), |
||||
|
}, |
||||
|
}; |
||||
|
return self.do_action(action); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
journal_line_click: function (el){ |
||||
|
click_num++; |
||||
|
var self = this; |
||||
|
var line = $(el.target).parent().data('id'); |
||||
|
return self.do_action({ |
||||
|
type: 'ir.actions.act_window', |
||||
|
view_type: 'form', |
||||
|
view_mode: 'form', |
||||
|
res_model: 'account.move', |
||||
|
views: [ |
||||
|
[false, 'form'] |
||||
|
], |
||||
|
res_id: line, |
||||
|
target: 'current', |
||||
|
}); |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
apply_filter: function(event) { |
||||
|
|
||||
|
event.preventDefault(); |
||||
|
var self = this; |
||||
|
self.initial_render = false; |
||||
|
var filter_data_selected = {}; |
||||
|
var account_ids = []; |
||||
|
var account_text = []; |
||||
|
var account_res = document.getElementById("acc_res") |
||||
|
var account_list = $(".account").select2('data') |
||||
|
for (var i = 0; i < account_list.length; i++) { |
||||
|
if(account_list[i].element[0].selected === true){ |
||||
|
|
||||
|
account_ids.push(parseInt(account_list[i].id)) |
||||
|
if(account_text.includes(account_list[i].text) === false){ |
||||
|
account_text.push(account_list[i].text) |
||||
|
} |
||||
|
account_res.value = account_text |
||||
|
account_res.innerHTML=account_res.value; |
||||
|
} |
||||
|
} |
||||
|
if (account_list.length == 0){ |
||||
|
account_res.value = "" |
||||
|
account_res.innerHTML=""; |
||||
|
|
||||
|
} |
||||
|
filter_data_selected.account_ids = account_ids |
||||
|
|
||||
|
|
||||
|
var journal_ids = []; |
||||
|
var journal_text = []; |
||||
|
var journal_res = document.getElementById("journal_res") |
||||
|
var journal_list = $(".journals").select2('data') |
||||
|
for (var i = 0; i < journal_list.length; i++) { |
||||
|
if(journal_list[i].element[0].selected === true){ |
||||
|
|
||||
|
journal_ids.push(parseInt(journal_list[i].id)) |
||||
|
if(journal_text.includes(journal_list[i].text) === false){ |
||||
|
journal_text.push(journal_list[i].text) |
||||
|
} |
||||
|
journal_res.value = journal_text |
||||
|
journal_res.innerHTML=journal_res.value; |
||||
|
} |
||||
|
} |
||||
|
if (journal_list.length == 0){ |
||||
|
journal_res.value = "" |
||||
|
journal_res.innerHTML=""; |
||||
|
|
||||
|
} |
||||
|
filter_data_selected.journal_ids = journal_ids |
||||
|
|
||||
|
var account_tag_ids = []; |
||||
|
var account_tag_text = []; |
||||
|
var account_tag_res = document.getElementById("acc_tag_res") |
||||
|
|
||||
|
var account_tag_list = $(".account-tag").select2('data') |
||||
|
for (var i = 0; i < account_tag_list.length; i++) { |
||||
|
if(account_tag_list[i].element[0].selected === true){ |
||||
|
|
||||
|
account_tag_ids.push(parseInt(account_tag_list[i].id)) |
||||
|
if(account_tag_text.includes(account_tag_list[i].text) === false){ |
||||
|
account_tag_text.push(account_tag_list[i].text) |
||||
|
} |
||||
|
|
||||
|
account_tag_res.value = account_tag_text |
||||
|
account_tag_res.innerHTML=account_tag_res.value; |
||||
|
} |
||||
|
} |
||||
|
if (account_tag_list.length == 0){ |
||||
|
account_tag_res.value = "" |
||||
|
account_tag_res.innerHTML=""; |
||||
|
|
||||
|
} |
||||
|
filter_data_selected.account_tag_ids = account_tag_ids |
||||
|
|
||||
|
var analytic_ids = [] |
||||
|
var analytic_text = []; |
||||
|
var analytic_res = document.getElementById("analytic_res") |
||||
|
var analytic_list = $(".analytics").select2('data') |
||||
|
|
||||
|
for (var i = 0; i < analytic_list.length; i++) { |
||||
|
if(analytic_list[i].element[0].selected === true){ |
||||
|
|
||||
|
analytic_ids.push(parseInt(analytic_list[i].id)) |
||||
|
if(analytic_text.includes(analytic_list[i].text) === false){ |
||||
|
analytic_text.push(analytic_list[i].text) |
||||
|
} |
||||
|
analytic_res.value = analytic_text |
||||
|
analytic_res.innerHTML=analytic_res.value; |
||||
|
} |
||||
|
} |
||||
|
if (analytic_list.length == 0){ |
||||
|
analytic_res.value = "" |
||||
|
analytic_res.innerHTML=""; |
||||
|
|
||||
|
} |
||||
|
filter_data_selected.analytic_ids = analytic_ids |
||||
|
|
||||
|
var analytic_tag_ids = []; |
||||
|
var analytic_tag_text = []; |
||||
|
var analytic_tag_res = document.getElementById("analic_tag_res") |
||||
|
var analytic_tag_list = $(".analytic-tag").select2('data') |
||||
|
for (var i = 0; i < analytic_tag_list.length; i++) { |
||||
|
if(analytic_tag_list[i].element[0].selected === true){ |
||||
|
|
||||
|
analytic_tag_ids.push(parseInt(analytic_tag_list[i].id)) |
||||
|
if(analytic_tag_text.includes(analytic_tag_list[i].text) === false){ |
||||
|
analytic_tag_text.push(analytic_tag_list[i].text) |
||||
|
|
||||
|
} |
||||
|
|
||||
|
analytic_tag_res.value = analytic_tag_text |
||||
|
analytic_tag_res.innerHTML=analytic_tag_res.value; |
||||
|
} |
||||
|
} |
||||
|
if (analytic_tag_list.length == 0){ |
||||
|
analytic_tag_res.value = "" |
||||
|
analytic_tag_res.innerHTML=""; |
||||
|
|
||||
|
} |
||||
|
filter_data_selected.analytic_tag_ids = analytic_tag_ids |
||||
|
|
||||
|
|
||||
|
if ($("#date_from").val()) { |
||||
|
var dateString = $("#date_from").val(); |
||||
|
filter_data_selected.date_from = dateString; |
||||
|
} |
||||
|
if ($("#date_to").val()) { |
||||
|
var dateString = $("#date_from").val(); |
||||
|
filter_data_selected.date_to = dateString; |
||||
|
} |
||||
|
|
||||
|
if ($(".target_move").length) { |
||||
|
var post_res = document.getElementById("post_res") |
||||
|
filter_data_selected.target_move = $(".target_move")[0].value |
||||
|
post_res.value = $(".target_move")[0].value |
||||
|
post_res.innerHTML=post_res.value; |
||||
|
if ($(".target_move")[0].value == "") { |
||||
|
post_res.innerHTML="all"; |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
rpc.query({ |
||||
|
model: 'dynamic.balance.sheet.report', |
||||
|
method: 'write', |
||||
|
args: [ |
||||
|
self.wizard_id, filter_data_selected |
||||
|
], |
||||
|
}).then(function(res) { |
||||
|
self.initial_render = false; |
||||
|
self.load_data(self.initial_render); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
}); |
||||
|
core.action_registry.add("dfr_n", ProfitAndLoss); |
||||
|
return ProfitAndLoss; |
||||
|
}); |
@ -0,0 +1,421 @@ |
|||||
|
odoo.define('dynamic_cash_flow_statements.general_ledger', function (require) { |
||||
|
'use strict'; |
||||
|
var AbstractAction = require('web.AbstractAction'); |
||||
|
var core = require('web.core'); |
||||
|
var field_utils = require('web.field_utils'); |
||||
|
var rpc = require('web.rpc'); |
||||
|
var session = require('web.session'); |
||||
|
var utils = require('web.utils'); |
||||
|
var QWeb = core.qweb; |
||||
|
var _t = core._t; |
||||
|
|
||||
|
window.click_num = 0; |
||||
|
var GeneralLedger = AbstractAction.extend({ |
||||
|
template: 'GeneralTemp', |
||||
|
events: { |
||||
|
'click .parent-line': 'journal_line_click', |
||||
|
'click .child_col1': 'journal_line_click', |
||||
|
'click #apply_filter': 'apply_filter', |
||||
|
'click #pdf': 'print_pdf', |
||||
|
'click #xlsx': 'print_xlsx', |
||||
|
'click .gl-line': 'show_drop_down', |
||||
|
'click .view-account-move': 'view_acc_move', |
||||
|
}, |
||||
|
|
||||
|
init: function(parent, action) { |
||||
|
this._super(parent, action); |
||||
|
this.currency=action.currency; |
||||
|
this.report_lines = action.report_lines; |
||||
|
this.wizard_id = action.context.wizard | null; |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
start: function() { |
||||
|
var self = this; |
||||
|
self.initial_render = true; |
||||
|
var view_act = this.__parentedParent.actions |
||||
|
var act_id = view_act[Object.keys(view_act).pop()] |
||||
|
if (act_id.domain) { |
||||
|
rpc.query({ |
||||
|
model: 'account.general.ledger', |
||||
|
method: 'create', |
||||
|
args: [{ |
||||
|
account_ids: [act_id.domain[0][2]] |
||||
|
}] |
||||
|
}).then(function(t_res) { |
||||
|
self.wizard_id = t_res; |
||||
|
self.load_data(self.initial_render); |
||||
|
}) |
||||
|
}else{ |
||||
|
rpc.query({ |
||||
|
model: 'account.general.ledger', |
||||
|
method: 'create', |
||||
|
args: [{ |
||||
|
|
||||
|
}] |
||||
|
}).then(function(t_res) { |
||||
|
self.wizard_id = t_res; |
||||
|
self.load_data(self.initial_render); |
||||
|
}) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
load_data: function (initial_render = true) { |
||||
|
var self = this; |
||||
|
self.$(".categ").empty(); |
||||
|
try{ |
||||
|
var self = this; |
||||
|
var action_title = self._title |
||||
|
rpc.query({ |
||||
|
model: 'account.general.ledger', |
||||
|
method: 'view_report', |
||||
|
args: [[this.wizard_id], action_title], |
||||
|
}).then(function(datas) { |
||||
|
|
||||
|
if (initial_render) { |
||||
|
self.$('.filter_view_tb').html(QWeb.render('GLFilterView', { |
||||
|
filter_data: datas['filters'], |
||||
|
title : datas['name'], |
||||
|
})); |
||||
|
self.$el.find('.journals').select2({ |
||||
|
placeholder: ' Journals...', |
||||
|
}); |
||||
|
self.$el.find('.account').select2({ |
||||
|
placeholder: ' Accounts...', |
||||
|
}); |
||||
|
self.$el.find('.analytics').select2({ |
||||
|
placeholder: 'Analytic Accounts...', |
||||
|
}); |
||||
|
self.$el.find('.analytic_tags').select2({ |
||||
|
placeholder: 'Analytic Tags...', |
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
var child=[]; |
||||
|
|
||||
|
self.$('.table_view_tb').html(QWeb.render('GLTable', { |
||||
|
|
||||
|
report_lines : datas['report_lines'], |
||||
|
filter : datas['filters'], |
||||
|
currency : datas['currency'], |
||||
|
credit_total : datas['credit_total'], |
||||
|
debit_total : datas['debit_total'], |
||||
|
debit_balance : datas['debit_balance'] |
||||
|
})); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
catch (el) { |
||||
|
window.location.href |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
print_pdf: function(e) { |
||||
|
e.preventDefault(); |
||||
|
var self = this; |
||||
|
var action_title = self._title |
||||
|
self._rpc({ |
||||
|
model: 'account.general.ledger', |
||||
|
method: 'view_report', |
||||
|
args: [ |
||||
|
[self.wizard_id], action_title |
||||
|
], |
||||
|
}).then(function(data) { |
||||
|
var action = { |
||||
|
'type': 'ir.actions.report', |
||||
|
'report_type': 'qweb-pdf', |
||||
|
'report_name': 'dynamic_accounts_report.general_ledger', |
||||
|
'report_file': 'dynamic_accounts_report.general_ledger', |
||||
|
'data': { |
||||
|
'report_data': data |
||||
|
}, |
||||
|
'context': { |
||||
|
'active_model': 'account.general.ledger', |
||||
|
'landscape': 1, |
||||
|
'trial_pdf_report': true |
||||
|
}, |
||||
|
'display_name': action_title, |
||||
|
}; |
||||
|
return self.do_action(action); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
print_xlsx: function() { |
||||
|
var self = this; |
||||
|
var action_title = self._title |
||||
|
self._rpc({ |
||||
|
model: 'account.general.ledger', |
||||
|
method: 'view_report', |
||||
|
args: [ |
||||
|
[self.wizard_id], action_title |
||||
|
], |
||||
|
}).then(function(data) { |
||||
|
var action = { |
||||
|
'type': 'ir_actions_dynamic_xlsx_download', |
||||
|
'data': { |
||||
|
'model': 'account.general.ledger', |
||||
|
'options': JSON.stringify(data['filters']), |
||||
|
'output_format': 'xlsx', |
||||
|
'report_data': JSON.stringify(data['report_lines']), |
||||
|
'report_name': action_title, |
||||
|
'dfr_data': JSON.stringify(data), |
||||
|
}, |
||||
|
}; |
||||
|
return self.do_action(action); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
create_lines_with_style: function(rec, attr, datas) { |
||||
|
var temp_str = ""; |
||||
|
var style_name = "border-bottom: 1px solid #e6e6e6;"; |
||||
|
var attr_name = attr + " style="+style_name; |
||||
|
|
||||
|
temp_str += "<td class='child_col1' "+attr_name+" >"+rec['code'] +rec['name'] +"</td>"; |
||||
|
if(datas.currency[1]=='after'){ |
||||
|
temp_str += "<td class='child_col2' "+attr_name+" >"+rec['debit'].toFixed(2)+datas.currency[0]+"</td>"; |
||||
|
temp_str += "<td class='child_col3' "+attr_name+" >"+rec['credit'].toFixed(2) +datas.currency[0]+ "</td>"; |
||||
|
} |
||||
|
else{ |
||||
|
temp_str += "<td class='child_col2' "+attr_name+" >"+datas.currency[0]+rec['debit'].toFixed(2) + "</td>"; |
||||
|
temp_str += "<td class='child_col3' "+attr_name+">"+datas.currency[0]+rec['credit'].toFixed(2) + "</td>"; |
||||
|
|
||||
|
} |
||||
|
return temp_str; |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
journal_line_click: function (el){ |
||||
|
click_num++; |
||||
|
var self = this; |
||||
|
var line = $(el.target).parent().data('id'); |
||||
|
return self.do_action({ |
||||
|
type: 'ir.actions.act_window', |
||||
|
view_type: 'form', |
||||
|
view_mode: 'form', |
||||
|
res_model: 'account.move', |
||||
|
views: [ |
||||
|
[false, 'form'] |
||||
|
], |
||||
|
res_id: line, |
||||
|
target: 'current', |
||||
|
}); |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
show_drop_down: function(event) { |
||||
|
event.preventDefault(); |
||||
|
var self = this; |
||||
|
var account_id = $(event.currentTarget).data('account-id'); |
||||
|
var offset = 0; |
||||
|
var td = $(event.currentTarget).next('tr').find('td'); |
||||
|
if (td.length == 1) { |
||||
|
var action_title = self._title |
||||
|
self._rpc({ |
||||
|
model: 'account.general.ledger', |
||||
|
method: 'view_report', |
||||
|
args: [ |
||||
|
[self.wizard_id], action_title |
||||
|
], |
||||
|
}).then(function(data) { |
||||
|
|
||||
|
for (var i = 0; i < data['report_lines'].length; i++) { |
||||
|
|
||||
|
if (account_id == data['report_lines'][i]['id'] ){ |
||||
|
|
||||
|
$(event.currentTarget).next('tr').find('td .gl-table-div').remove(); |
||||
|
$(event.currentTarget).next('tr').find('td ul').after( |
||||
|
QWeb.render('SubSection', { |
||||
|
account_data: data['report_lines'][i]['move_lines'], |
||||
|
})) |
||||
|
$(event.currentTarget).next('tr').find('td ul li:first a').css({ |
||||
|
'background-color': '#00ede8', |
||||
|
'font-weight': 'bold', |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
view_acc_move: function(event) { |
||||
|
event.preventDefault(); |
||||
|
var self = this; |
||||
|
var context = {}; |
||||
|
var show_acc_move = function(res_model, res_id, view_id) { |
||||
|
var action = { |
||||
|
type: 'ir.actions.act_window', |
||||
|
view_type: 'form', |
||||
|
view_mode: 'form', |
||||
|
res_model: res_model, |
||||
|
views: [ |
||||
|
[view_id || false, 'form'] |
||||
|
], |
||||
|
res_id: res_id, |
||||
|
target: 'current', |
||||
|
context: context, |
||||
|
}; |
||||
|
return self.do_action(action); |
||||
|
}; |
||||
|
rpc.query({ |
||||
|
model: 'account.move', |
||||
|
method: 'search_read', |
||||
|
domain: [ |
||||
|
['id', '=', $(event.currentTarget).data('move-id')] |
||||
|
], |
||||
|
fields: ['id'], |
||||
|
limit: 1, |
||||
|
}) |
||||
|
.then(function(record) { |
||||
|
if (record.length > 0) { |
||||
|
show_acc_move('account.move', record[0].id); |
||||
|
} else { |
||||
|
show_acc_move('account.move', $(event.currentTarget).data('move-id')); |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
apply_filter: function(event) { |
||||
|
|
||||
|
event.preventDefault(); |
||||
|
var self = this; |
||||
|
self.initial_render = false; |
||||
|
|
||||
|
var filter_data_selected = {}; |
||||
|
|
||||
|
|
||||
|
var account_ids = []; |
||||
|
var account_text = []; |
||||
|
|
||||
|
var account_res = document.getElementById("acc_res") |
||||
|
var account_list = $(".account").select2('data') |
||||
|
for (var i = 0; i < account_list.length; i++) { |
||||
|
if(account_list[i].element[0].selected === true){ |
||||
|
|
||||
|
account_ids.push(parseInt(account_list[i].id)) |
||||
|
if(account_text.includes(account_list[i].text) === false){ |
||||
|
account_text.push(account_list[i].text) |
||||
|
} |
||||
|
account_res.value = account_text |
||||
|
account_res.innerHTML=account_res.value; |
||||
|
} |
||||
|
} |
||||
|
if (account_list.length == 0){ |
||||
|
account_res.value = "" |
||||
|
account_res.innerHTML=""; |
||||
|
|
||||
|
} |
||||
|
filter_data_selected.account_ids = account_ids |
||||
|
|
||||
|
|
||||
|
|
||||
|
var journal_ids = []; |
||||
|
var journal_text = []; |
||||
|
var journal_res = document.getElementById("journal_res") |
||||
|
var journal_list = $(".journals").select2('data') |
||||
|
|
||||
|
for (var i = 0; i < journal_list.length; i++) { |
||||
|
if(journal_list[i].element[0].selected === true){ |
||||
|
|
||||
|
journal_ids.push(parseInt(journal_list[i].id)) |
||||
|
if(journal_text.includes(journal_list[i].text) === false){ |
||||
|
journal_text.push(journal_list[i].text) |
||||
|
} |
||||
|
journal_res.value = journal_text |
||||
|
journal_res.innerHTML=journal_res.value; |
||||
|
} |
||||
|
} |
||||
|
if (journal_list.length == 0){ |
||||
|
journal_res.value = "" |
||||
|
journal_res.innerHTML=""; |
||||
|
|
||||
|
} |
||||
|
filter_data_selected.journal_ids = journal_ids |
||||
|
|
||||
|
var analytic_ids = [] |
||||
|
var analytic_text = []; |
||||
|
var analytic_res = document.getElementById("analytic_res") |
||||
|
var analytic_list = $(".analytics").select2('data') |
||||
|
|
||||
|
for (var i = 0; i < analytic_list.length; i++) { |
||||
|
if(analytic_list[i].element[0].selected === true){ |
||||
|
|
||||
|
analytic_ids.push(parseInt(analytic_list[i].id)) |
||||
|
if(analytic_text.includes(analytic_list[i].text) === false){ |
||||
|
analytic_text.push(analytic_list[i].text) |
||||
|
} |
||||
|
analytic_res.value = analytic_text |
||||
|
analytic_res.innerHTML=analytic_res.value; |
||||
|
} |
||||
|
} |
||||
|
if (analytic_list.length == 0){ |
||||
|
analytic_res.value = "" |
||||
|
analytic_res.innerHTML=""; |
||||
|
|
||||
|
} |
||||
|
filter_data_selected.analytic_ids = analytic_ids |
||||
|
|
||||
|
var analytic_tag_ids = [] |
||||
|
var analytic_tag_text = []; |
||||
|
var analytic_tag_res = document.getElementById("analytic_tag_res") |
||||
|
var analytic_tag_list = $(".analytic_tags").select2('data') |
||||
|
for (var i = 0; i < analytic_tag_list.length; i++) { |
||||
|
if(analytic_tag_list[i].element[0].selected === true){ |
||||
|
|
||||
|
analytic_tag_ids.push(parseInt(analytic_tag_list[i].id)) |
||||
|
if(analytic_tag_text.includes(analytic_tag_list[i].text) === false){ |
||||
|
analytic_tag_text.push(analytic_tag_list[i].text) |
||||
|
} |
||||
|
analytic_tag_res.value = analytic_tag_text |
||||
|
analytic_tag_res.innerHTML=analytic_tag_res.value; |
||||
|
} |
||||
|
} |
||||
|
if (analytic_tag_list.length == 0){ |
||||
|
analytic_tag_res.value = "" |
||||
|
analytic_tag_res.innerHTML=""; |
||||
|
|
||||
|
} |
||||
|
filter_data_selected.analytic_tag_ids = analytic_tag_ids |
||||
|
|
||||
|
if ($("#date_from").val()) { |
||||
|
|
||||
|
var dateString = $("#date_from").val(); |
||||
|
filter_data_selected.date_from = dateString; |
||||
|
} |
||||
|
if ($("#date_to").val()) { |
||||
|
var dateString = $("#date_from").val(); |
||||
|
filter_data_selected.date_to = dateString; |
||||
|
} |
||||
|
|
||||
|
if ($(".target_move").length) { |
||||
|
var post_res = document.getElementById("post_res") |
||||
|
filter_data_selected.target_move = $(".target_move")[0].value |
||||
|
post_res.value = $(".target_move")[0].value |
||||
|
post_res.innerHTML=post_res.value; |
||||
|
if ($(".target_move")[0].value == "") { |
||||
|
post_res.innerHTML="all"; |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
rpc.query({ |
||||
|
model: 'account.general.ledger', |
||||
|
method: 'write', |
||||
|
args: [ |
||||
|
self.wizard_id, filter_data_selected |
||||
|
], |
||||
|
}).then(function(res) { |
||||
|
self.initial_render = false; |
||||
|
self.load_data(self.initial_render); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
}); |
||||
|
core.action_registry.add("g_l", GeneralLedger); |
||||
|
return GeneralLedger; |
||||
|
}); |
@ -0,0 +1,394 @@ |
|||||
|
odoo.define('dynamic_accounts_report.partner_ledger', function (require) { |
||||
|
'use strict'; |
||||
|
var AbstractAction = require('web.AbstractAction'); |
||||
|
var core = require('web.core'); |
||||
|
var field_utils = require('web.field_utils'); |
||||
|
var rpc = require('web.rpc'); |
||||
|
var session = require('web.session'); |
||||
|
var utils = require('web.utils'); |
||||
|
var QWeb = core.qweb; |
||||
|
var _t = core._t; |
||||
|
|
||||
|
window.click_num = 0; |
||||
|
var PartnerLedger = AbstractAction.extend({ |
||||
|
template: 'PartnerTemp', |
||||
|
events: { |
||||
|
'click .parent-line': 'journal_line_click', |
||||
|
'click .child_col1': 'journal_line_click', |
||||
|
'click #apply_filter': 'apply_filter', |
||||
|
'click #pdf': 'print_pdf', |
||||
|
'click #xlsx': 'print_xlsx', |
||||
|
'click .pl-line': 'show_drop_down', |
||||
|
'click .view-account-move': 'view_acc_move', |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
init: function(parent, action) { |
||||
|
this._super(parent, action); |
||||
|
this.currency=action.currency; |
||||
|
this.report_lines = action.report_lines; |
||||
|
this.wizard_id = action.context.wizard | null; |
||||
|
}, |
||||
|
|
||||
|
start: function() { |
||||
|
var self = this; |
||||
|
self.initial_render = true; |
||||
|
rpc.query({ |
||||
|
model: 'account.partner.ledger', |
||||
|
method: 'create', |
||||
|
args: [{ |
||||
|
}] |
||||
|
}).then(function(t_res) { |
||||
|
self.wizard_id = t_res; |
||||
|
self.load_data(self.initial_render); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
load_data: function (initial_render = true) { |
||||
|
var self = this; |
||||
|
self.$(".categ").empty(); |
||||
|
try{ |
||||
|
var self = this; |
||||
|
rpc.query({ |
||||
|
model: 'account.partner.ledger', |
||||
|
method: 'view_report', |
||||
|
args: [[this.wizard_id]], |
||||
|
}).then(function(datas) { |
||||
|
if (initial_render) { |
||||
|
self.$('.filter_view_tb').html(QWeb.render('PLFilterView', { |
||||
|
filter_data: datas['filters'], |
||||
|
})); |
||||
|
self.$el.find('.journals').select2({ |
||||
|
placeholder: ' Journals...', |
||||
|
}); |
||||
|
|
||||
|
self.$el.find('.account').select2({ |
||||
|
placeholder: ' Accounts...', |
||||
|
}); |
||||
|
self.$el.find('.partners').select2({ |
||||
|
placeholder: 'Partners...', |
||||
|
}); |
||||
|
self.$el.find('.reconciled').select2({ |
||||
|
placeholder: 'Reconciled status...', |
||||
|
}); |
||||
|
self.$el.find('.type').select2({ |
||||
|
placeholder: 'Account Type...', |
||||
|
}); |
||||
|
self.$el.find('.category').select2({ |
||||
|
placeholder: 'Partner Tag...', |
||||
|
}); |
||||
|
self.$el.find('.acc').select2({ |
||||
|
placeholder: 'Select Acc...', |
||||
|
}); |
||||
|
} |
||||
|
var child=[]; |
||||
|
|
||||
|
self.$('.table_view_tb').html(QWeb.render('PLTable', { |
||||
|
report_lines : datas['report_lines'], |
||||
|
filter : datas['filters'], |
||||
|
currency : datas['currency'], |
||||
|
credit_total : datas['credit_total'], |
||||
|
debit_total : datas['debit_total'], |
||||
|
debit_balance : datas['debit_balance'] |
||||
|
})); |
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
catch (el) { |
||||
|
window.location.href |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
print_pdf: function(e) { |
||||
|
e.preventDefault(); |
||||
|
var self = this; |
||||
|
self._rpc({ |
||||
|
model: 'account.partner.ledger', |
||||
|
method: 'view_report', |
||||
|
args: [ |
||||
|
[self.wizard_id] |
||||
|
], |
||||
|
}).then(function(data) { |
||||
|
var action = { |
||||
|
'type': 'ir.actions.report', |
||||
|
'report_type': 'qweb-pdf', |
||||
|
'report_name': 'dynamic_accounts_report.partner_ledger', |
||||
|
'report_file': 'dynamic_accounts_report.partner_ledger', |
||||
|
'data': { |
||||
|
'report_data': data |
||||
|
}, |
||||
|
'context': { |
||||
|
'active_model': 'account.partner.ledger', |
||||
|
'landscape': 1, |
||||
|
'partner_ledger_pdf_report': true |
||||
|
}, |
||||
|
'display_name': 'Partner Ledger', |
||||
|
}; |
||||
|
return self.do_action(action); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
|
||||
|
print_xlsx: function() { |
||||
|
var self = this; |
||||
|
self._rpc({ |
||||
|
model: 'account.partner.ledger', |
||||
|
method: 'view_report', |
||||
|
args: [ |
||||
|
[self.wizard_id] |
||||
|
], |
||||
|
}).then(function(data) { |
||||
|
var action = { |
||||
|
'type': 'ir_actions_dynamic_xlsx_download', |
||||
|
'data': { |
||||
|
'model': 'account.partner.ledger', |
||||
|
'options': JSON.stringify(data['filters']), |
||||
|
'output_format': 'xlsx', |
||||
|
'report_data': JSON.stringify(data['report_lines']), |
||||
|
'report_name': 'Partner Ledger', |
||||
|
'dfr_data': JSON.stringify(data), |
||||
|
}, |
||||
|
}; |
||||
|
return self.do_action(action); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
journal_line_click: function (el){ |
||||
|
click_num++; |
||||
|
var self = this; |
||||
|
var line = $(el.target).parent().data('id'); |
||||
|
return self.do_action({ |
||||
|
type: 'ir.actions.act_window', |
||||
|
view_type: 'form', |
||||
|
view_mode: 'form', |
||||
|
res_model: 'account.move', |
||||
|
views: [ |
||||
|
[false, 'form'] |
||||
|
], |
||||
|
res_id: line, |
||||
|
target: 'current', |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
show_drop_down: function(event) { |
||||
|
event.preventDefault(); |
||||
|
var self = this; |
||||
|
var account_id = $(event.currentTarget).data('account-id'); |
||||
|
var offset = 0; |
||||
|
var td = $(event.currentTarget).next('tr').find('td'); |
||||
|
if (td.length == 1) { |
||||
|
self._rpc({ |
||||
|
model: 'account.partner.ledger', |
||||
|
method: 'view_report', |
||||
|
args: [ |
||||
|
[self.wizard_id] |
||||
|
], |
||||
|
}).then(function(data) { |
||||
|
for (var i = 0; i < data['report_lines'].length; i++) { |
||||
|
|
||||
|
if (account_id == data['report_lines'][i]['id'] ){ |
||||
|
$(event.currentTarget).next('tr').find('td .pl-table-div').remove(); |
||||
|
$(event.currentTarget).next('tr').find('td ul').after( |
||||
|
QWeb.render('SubSectionPL', { |
||||
|
account_data: data['report_lines'][i]['move_lines'], |
||||
|
})) |
||||
|
$(event.currentTarget).next('tr').find('td ul li:first a').css({ |
||||
|
'background-color': '#00ede8', |
||||
|
'font-weight': 'bold', |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
view_acc_move: function(event) { |
||||
|
event.preventDefault(); |
||||
|
var self = this; |
||||
|
var context = {}; |
||||
|
var show_acc_move = function(res_model, res_id, view_id) { |
||||
|
var action = { |
||||
|
type: 'ir.actions.act_window', |
||||
|
view_type: 'form', |
||||
|
view_mode: 'form', |
||||
|
res_model: res_model, |
||||
|
views: [ |
||||
|
[view_id || false, 'form'] |
||||
|
], |
||||
|
res_id: res_id, |
||||
|
target: 'current', |
||||
|
context: context, |
||||
|
}; |
||||
|
return self.do_action(action); |
||||
|
}; |
||||
|
rpc.query({ |
||||
|
model: 'account.move', |
||||
|
method: 'search_read', |
||||
|
domain: [ |
||||
|
['id', '=', $(event.currentTarget).data('move-id')] |
||||
|
], |
||||
|
fields: ['id'], |
||||
|
limit: 1, |
||||
|
}) |
||||
|
.then(function(record) { |
||||
|
if (record.length > 0) { |
||||
|
show_acc_move('account.move', record[0].id); |
||||
|
} else { |
||||
|
show_acc_move('account.move', $(event.currentTarget).data('move-id')); |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
apply_filter: function(event) { |
||||
|
event.preventDefault(); |
||||
|
var self = this; |
||||
|
self.initial_render = false; |
||||
|
var filter_data_selected = {}; |
||||
|
|
||||
|
var account_ids = []; |
||||
|
var account_text = []; |
||||
|
var span_res = document.getElementById("account_res") |
||||
|
var account_list = $(".account").select2('data') |
||||
|
for (var i = 0; i < account_list.length; i++) { |
||||
|
if(account_list[i].element[0].selected === true) |
||||
|
{account_ids.push(parseInt(account_list[i].id)) |
||||
|
if(account_text.includes(account_list[i].text) === false) |
||||
|
{account_text.push(account_list[i].text) |
||||
|
} |
||||
|
span_res.value = account_text |
||||
|
span_res.innerHTML=span_res.value; |
||||
|
} |
||||
|
} |
||||
|
if (account_list.length == 0){ |
||||
|
span_res.value = "" |
||||
|
span_res.innerHTML=""; } |
||||
|
filter_data_selected.account_ids = account_ids |
||||
|
|
||||
|
|
||||
|
var journal_ids = []; |
||||
|
var journal_text = []; |
||||
|
var journal_res = document.getElementById("journal_res") |
||||
|
var journal_list = $(".journals").select2('data') |
||||
|
for (var i = 0; i < journal_list.length; i++) { |
||||
|
if(journal_list[i].element[0].selected === true){ |
||||
|
journal_ids.push(parseInt(journal_list[i].id)) |
||||
|
if(journal_text.includes(journal_list[i].text) === false){ |
||||
|
journal_text.push(journal_list[i].text) |
||||
|
} |
||||
|
journal_res.value = journal_text |
||||
|
journal_res.innerHTML=journal_res.value; |
||||
|
} |
||||
|
} |
||||
|
if (journal_list.length == 0){ |
||||
|
journal_res.value = "" |
||||
|
journal_res.innerHTML=""; |
||||
|
} |
||||
|
filter_data_selected.journal_ids = journal_ids |
||||
|
|
||||
|
var partner_ids = []; |
||||
|
var partner_text = []; |
||||
|
var span_res = document.getElementById("partner_res") |
||||
|
var partner_list = $(".partners").select2('data') |
||||
|
for (var i = 0; i < partner_list.length; i++) { |
||||
|
if(partner_list[i].element[0].selected === true) |
||||
|
{partner_ids.push(parseInt(partner_list[i].id)) |
||||
|
if(partner_text.includes(partner_list[i].text) === false) |
||||
|
{partner_text.push(partner_list[i].text) |
||||
|
} |
||||
|
span_res.value = partner_text |
||||
|
span_res.innerHTML=span_res.value; |
||||
|
} |
||||
|
} |
||||
|
if (partner_list.length == 0){ |
||||
|
span_res.value = "" |
||||
|
span_res.innerHTML=""; |
||||
|
} |
||||
|
filter_data_selected.partner_ids = partner_ids |
||||
|
|
||||
|
var account_type_ids = []; |
||||
|
var account_type_ids_text = []; |
||||
|
var span_res = document.getElementById("type_res") |
||||
|
var type_list = $(".type").select2('data') |
||||
|
for (var i = 0; i < type_list.length; i++) { |
||||
|
if(type_list[i].element[0].selected === true) |
||||
|
{account_type_ids.push(parseInt(type_list[i].id)) |
||||
|
if(account_type_ids_text.includes(type_list[i].text) === false) |
||||
|
{account_type_ids_text.push(type_list[i].text) |
||||
|
} |
||||
|
span_res.value = account_type_ids_text |
||||
|
span_res.innerHTML=span_res.value; |
||||
|
} |
||||
|
} |
||||
|
if (type_list.length == 0){ |
||||
|
span_res.value = "" |
||||
|
span_res.innerHTML=""; |
||||
|
} |
||||
|
filter_data_selected.account_type_ids = account_type_ids |
||||
|
|
||||
|
var partner_category_ids = []; |
||||
|
var partner_category_text = []; |
||||
|
var span_res = document.getElementById("category_res") |
||||
|
var category_list = $(".category").select2('data') |
||||
|
for (var i = 0; i < category_list.length; i++) { |
||||
|
if(category_list[i].element[0].selected === true) |
||||
|
{partner_category_ids.push(parseInt(category_list[i].id)) |
||||
|
if(partner_category_text.includes(category_list[i].text) === false) |
||||
|
{partner_category_text.push(category_list[i].text) |
||||
|
} |
||||
|
span_res.value = partner_category_text |
||||
|
span_res.innerHTML=span_res.value; |
||||
|
} |
||||
|
} |
||||
|
if (category_list.length == 0){ |
||||
|
span_res.value = "" |
||||
|
span_res.innerHTML=""; |
||||
|
} |
||||
|
filter_data_selected.partner_category_ids = partner_category_ids |
||||
|
|
||||
|
if ($("#date_from").val()) { |
||||
|
var dateString = $("#date_from").val(); |
||||
|
filter_data_selected.date_from = dateString; |
||||
|
} |
||||
|
if ($("#date_to").val()) { |
||||
|
var dateString = $("#date_to").val(); |
||||
|
filter_data_selected.date_to = dateString; |
||||
|
} |
||||
|
|
||||
|
if ($(".reconciled").length){ |
||||
|
var reconciled_res = document.getElementById("reconciled_res") |
||||
|
filter_data_selected.reconciled = $(".reconciled")[1].value |
||||
|
reconciled_res.value = $(".reconciled")[0].value |
||||
|
reconciled_res.innerHTML=reconciled_res.value; |
||||
|
if ($(".reconciled").value==""){ |
||||
|
reconciled_res.innerHTML="unreconciled"; |
||||
|
filter_data_selected.reconciled = "unreconciled" |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if ($(".target_move").length) { |
||||
|
var post_res = document.getElementById("post_res") |
||||
|
filter_data_selected.target_move = $(".target_move")[0].value |
||||
|
post_res.value = $(".target_move")[0].value |
||||
|
post_res.innerHTML=post_res.value; |
||||
|
if ($(".target_move")[0].value == "") { |
||||
|
post_res.innerHTML="posted"; |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
rpc.query({ |
||||
|
model: 'account.partner.ledger', |
||||
|
method: 'write', |
||||
|
args: [ |
||||
|
self.wizard_id, filter_data_selected |
||||
|
], |
||||
|
}).then(function(res) { |
||||
|
self.initial_render = false; |
||||
|
self.load_data(self.initial_render); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
}); |
||||
|
core.action_registry.add("p_l", PartnerLedger); |
||||
|
return PartnerLedger; |
||||
|
}); |
@ -0,0 +1,241 @@ |
|||||
|
odoo.define('dynamic_cash_flow_statements.trial', function (require) { |
||||
|
'use strict'; |
||||
|
var AbstractAction = require('web.AbstractAction'); |
||||
|
var core = require('web.core'); |
||||
|
var field_utils = require('web.field_utils'); |
||||
|
var rpc = require('web.rpc'); |
||||
|
var session = require('web.session'); |
||||
|
var utils = require('web.utils'); |
||||
|
var QWeb = core.qweb; |
||||
|
var _t = core._t; |
||||
|
|
||||
|
window.click_num = 0; |
||||
|
var TrialBalance = AbstractAction.extend({ |
||||
|
template: 'TrialTemp', |
||||
|
events: { |
||||
|
'click .parent-line': 'journal_line_click', |
||||
|
'click .child_col1': 'journal_line_click', |
||||
|
'click #apply_filter': 'apply_filter', |
||||
|
'click #pdf': 'print_pdf', |
||||
|
'click #xlsx': 'print_xlsx', |
||||
|
'click .show-gl': 'show_gl', |
||||
|
}, |
||||
|
|
||||
|
init: function(parent, action) { |
||||
|
this._super(parent, action); |
||||
|
this.currency=action.currency; |
||||
|
this.report_lines = action.report_lines; |
||||
|
this.wizard_id = action.context.wizard | null; |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
start: function() { |
||||
|
var self = this; |
||||
|
self.initial_render = true; |
||||
|
rpc.query({ |
||||
|
model: 'account.trial.balance', |
||||
|
method: 'create', |
||||
|
args: [{ |
||||
|
|
||||
|
}] |
||||
|
}).then(function(t_res) { |
||||
|
self.wizard_id = t_res; |
||||
|
self.load_data(self.initial_render); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
load_data: function (initial_render = true) { |
||||
|
var self = this; |
||||
|
self.$(".categ").empty(); |
||||
|
try{ |
||||
|
var self = this; |
||||
|
rpc.query({ |
||||
|
model: 'account.trial.balance', |
||||
|
method: 'view_report', |
||||
|
args: [[this.wizard_id]], |
||||
|
}).then(function(datas) { |
||||
|
if (initial_render) { |
||||
|
self.$('.filter_view_tb').html(QWeb.render('TrialFilterView', { |
||||
|
filter_data: datas['filters'], |
||||
|
})); |
||||
|
self.$el.find('.journals').select2({ |
||||
|
placeholder: 'Select Journals...', |
||||
|
}); |
||||
|
} |
||||
|
var child=[]; |
||||
|
|
||||
|
self.$('.table_view_tb').html(QWeb.render('TrialTable', { |
||||
|
|
||||
|
report_lines : datas['report_lines'], |
||||
|
filter : datas['filters'], |
||||
|
currency : datas['currency'], |
||||
|
credit_total : datas['credit_total'], |
||||
|
debit_total : datas['debit_total'], |
||||
|
})); |
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
catch (el) { |
||||
|
window.location.href |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
show_gl: function(e) { |
||||
|
var self = this; |
||||
|
var account_id = $(e.target).attr('data-account-id'); |
||||
|
var options = { |
||||
|
account_ids: [account_id], |
||||
|
} |
||||
|
|
||||
|
var action = { |
||||
|
type: 'ir.actions.client', |
||||
|
name: 'GL View', |
||||
|
tag: 'g_l', |
||||
|
target: 'new', |
||||
|
|
||||
|
domain: [['account_ids','=', account_id]], |
||||
|
|
||||
|
|
||||
|
} |
||||
|
return this.do_action(action); |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
print_pdf: function(e) { |
||||
|
e.preventDefault(); |
||||
|
var self = this; |
||||
|
self._rpc({ |
||||
|
model: 'account.trial.balance', |
||||
|
method: 'view_report', |
||||
|
args: [ |
||||
|
[self.wizard_id] |
||||
|
], |
||||
|
}).then(function(data) { |
||||
|
var action = { |
||||
|
'type': 'ir.actions.report', |
||||
|
'report_type': 'qweb-pdf', |
||||
|
'report_name': 'dynamic_accounts_report.trial_balance', |
||||
|
'report_file': 'dynamic_accounts_report.trial_balance', |
||||
|
'data': { |
||||
|
'report_data': data |
||||
|
}, |
||||
|
'context': { |
||||
|
'active_model': 'account.trial.balance', |
||||
|
'landscape': 1, |
||||
|
'trial_pdf_report': true |
||||
|
}, |
||||
|
'display_name': 'Trial Balance', |
||||
|
}; |
||||
|
return self.do_action(action); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
print_xlsx: function() { |
||||
|
var self = this; |
||||
|
self._rpc({ |
||||
|
model: 'account.trial.balance', |
||||
|
method: 'view_report', |
||||
|
args: [ |
||||
|
[self.wizard_id] |
||||
|
], |
||||
|
}).then(function(data) { |
||||
|
var action = { |
||||
|
'type': 'ir_actions_dynamic_xlsx_download', |
||||
|
'data': { |
||||
|
'model': 'account.trial.balance', |
||||
|
'options': JSON.stringify(data['filters']), |
||||
|
'output_format': 'xlsx', |
||||
|
'report_data': JSON.stringify(data['report_lines']), |
||||
|
'report_name': 'Trial Balance', |
||||
|
'dfr_data': JSON.stringify(data), |
||||
|
}, |
||||
|
}; |
||||
|
return self.do_action(action); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
journal_line_click: function (el){ |
||||
|
click_num++; |
||||
|
var self = this; |
||||
|
var line = $(el.target).parent().data('id'); |
||||
|
return self.do_action({ |
||||
|
type: 'ir.actions.act_window', |
||||
|
view_type: 'form', |
||||
|
view_mode: 'form', |
||||
|
res_model: 'account.move', |
||||
|
views: [ |
||||
|
[false, 'form'] |
||||
|
], |
||||
|
res_id: line, |
||||
|
target: 'current', |
||||
|
}); |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
|
||||
|
apply_filter: function(event) { |
||||
|
|
||||
|
event.preventDefault(); |
||||
|
var self = this; |
||||
|
self.initial_render = false; |
||||
|
|
||||
|
var filter_data_selected = {}; |
||||
|
var journal_ids = []; |
||||
|
var journal_text = []; |
||||
|
var journal_res = document.getElementById("journal_res") |
||||
|
var journal_list = $(".journals").select2('data') |
||||
|
|
||||
|
for (var i = 0; i < journal_list.length; i++) { |
||||
|
if(journal_list[i].element[0].selected === true){ |
||||
|
|
||||
|
journal_ids.push(parseInt(journal_list[i].id)) |
||||
|
if(journal_text.includes(journal_list[i].text) === false){ |
||||
|
journal_text.push(journal_list[i].text) |
||||
|
} |
||||
|
journal_res.value = journal_text |
||||
|
journal_res.innerHTML=journal_res.value; |
||||
|
} |
||||
|
} |
||||
|
if (journal_list.length == 0){ |
||||
|
journal_res.value = "" |
||||
|
journal_res.innerHTML=""; |
||||
|
|
||||
|
} |
||||
|
filter_data_selected.journal_ids = journal_ids |
||||
|
|
||||
|
if ($("#date_from").val()) { |
||||
|
var dateString = $("#date_from").val(); |
||||
|
filter_data_selected.date_from = dateString; |
||||
|
} |
||||
|
if ($("#date_to").val()) { |
||||
|
var dateString = $("#date_to").val(); |
||||
|
filter_data_selected.date_to = dateString; |
||||
|
} |
||||
|
|
||||
|
if ($(".target_move").length) { |
||||
|
var post_res = document.getElementById("post_res") |
||||
|
filter_data_selected.target_move = $(".target_move")[0].value |
||||
|
post_res.value = $(".target_move")[0].value |
||||
|
post_res.innerHTML=post_res.value; |
||||
|
if ($(".target_move")[0].value == "") { |
||||
|
post_res.innerHTML="all"; |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
rpc.query({ |
||||
|
model: 'account.trial.balance', |
||||
|
method: 'write', |
||||
|
args: [ |
||||
|
self.wizard_id, filter_data_selected |
||||
|
], |
||||
|
}).then(function(res) { |
||||
|
self.initial_render = false; |
||||
|
self.load_data(self.initial_render); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
}); |
||||
|
core.action_registry.add("t_b", TrialBalance); |
||||
|
return TrialBalance; |
||||
|
}); |
@ -0,0 +1,475 @@ |
|||||
|
|
||||
|
<templates> |
||||
|
<t t-name="AgeingTemp"> |
||||
|
<div class=""> |
||||
|
<div class=""> |
||||
|
<h1> |
||||
|
PARTNER AGEING |
||||
|
</h1> |
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
<div> |
||||
|
<div class="filter_view_tb"></div> |
||||
|
</div> |
||||
|
<br></br> |
||||
|
<div> |
||||
|
<div class="table_view_tb" style="right:20px;"></div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</t> |
||||
|
<t t-name="Ageingtable"> |
||||
|
<div> |
||||
|
<div class="table_main_view"> |
||||
|
<table cellspacing="0" width="100%"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th colspan="6">Partner</th> |
||||
|
<th class="mon_fld">Not Due</th> |
||||
|
<th class="mon_fld">0-20</th> |
||||
|
<th class="mon_fld">20-40</th> |
||||
|
<th class="mon_fld">40-60</th> |
||||
|
<th class="mon_fld">60-80</th> |
||||
|
<th class="mon_fld">80+</th> |
||||
|
|
||||
|
<th class="mon_fld">Total</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody style="width:100%;"> |
||||
|
</tbody> |
||||
|
<tbody> |
||||
|
<t t-set="none_value" t-value="_"/> |
||||
|
<t t-foreach="report_lines[0]" t-as="account"> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<t t-set="common_id" t-value="0"/> |
||||
|
|
||||
|
<tr style="border: 1.5px solid black;" class="gl-line" |
||||
|
data-toggle="collapse" |
||||
|
t-att-data-account-id="account['partner_id']" |
||||
|
t-attf-data-target=".a{{account['partner_id']}}"> |
||||
|
<td colspan="6" style="border: 0px solid black;"> |
||||
|
<i class="fa fa-caret-down" role="img" aria-label="Unfolded" title="Unfolded"></i> |
||||
|
|
||||
|
<span> |
||||
|
|
||||
|
<t t-esc="account['name']"/> |
||||
|
</span> |
||||
|
<t t-if="currency[1] == 'before'"> |
||||
|
<td style="text-align:right;"> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
<t t-raw="account['direction']"/> |
||||
|
</td> |
||||
|
<td style="text-align:right;"> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
<t t-raw="account['4']"/> |
||||
|
</td> |
||||
|
<td style="text-align:right;"> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
<t t-raw="account['3']"/> |
||||
|
</td> |
||||
|
<td style="text-align:right;"> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
<t t-raw="account['2']"/> |
||||
|
</td> |
||||
|
<td style="text-align:right;"> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
<t t-raw="account['1']"/> |
||||
|
</td> |
||||
|
<td style="text-align:right;"> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
<t t-raw="account['0']"/> |
||||
|
</td> |
||||
|
<td style="text-align:right;"> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
<t t-raw="account['total']"/> |
||||
|
</td> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<td style="text-align:right;"> |
||||
|
<t t-raw="account['direction']"/><t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
<td style="text-align:right;"> |
||||
|
<t t-raw="account['4']"/><t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
<td style="text-align:right;"> |
||||
|
<t t-raw="account['3']"/><t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
<td style="text-align:right;"> |
||||
|
<t t-raw="account['2']"/><t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
<td style="text-align:right;"> |
||||
|
<t t-raw="account['1']"/><t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
<td style="text-align:right;"> |
||||
|
<t t-raw="account['0']"/><t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
<td style="text-align:right;"> |
||||
|
<t t-raw="account['total']"/><t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
|
||||
|
</t> |
||||
|
<!-- |
||||
|
|
||||
|
< </div>--> |
||||
|
</td> |
||||
|
<tr t-attf-class="collapse a{{account['partner_id']}}"> |
||||
|
<td colspan="14"> |
||||
|
<ul> |
||||
|
|
||||
|
</ul> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</tr> |
||||
|
</t> |
||||
|
|
||||
|
</tbody> |
||||
|
|
||||
|
</table> |
||||
|
</div> |
||||
|
</div> |
||||
|
</t> |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
<t t-name="AgeingFilterView"> |
||||
|
<div class="" style="position: relative;"> |
||||
|
<div class="sub_container_left"> |
||||
|
<div class="report_print"> |
||||
|
<button type="button" class="btn btn-primary" id="pdf" style="height:25px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD;">Print (PDF)</button> |
||||
|
<button type="button" class="btn btn-primary" id="xlsx" style="height:25px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD;">Export (XLSX)</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
<br></br> |
||||
|
<div class="sub_container_right" style="width:50%;height:3%;right:0px;top:0px;position: absolute;"> |
||||
|
<div class="" style="right:80x;"> |
||||
|
|
||||
|
<br></br> |
||||
|
<div class="row" style="right:80px;top:0px;position: absolute;width:50;"> |
||||
|
<div class="time_range" style=""> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> |
||||
|
<span class="fa fa-calendar" title="Dates" role="img" aria-label="Dates"></span> |
||||
|
As On Date |
||||
|
</a> |
||||
|
<div class="dropdown-menu" role="menu"> |
||||
|
<div class="" > |
||||
|
<label class="" for="date_from">As On Date :</label> |
||||
|
<div class=""> |
||||
|
<div class="" aria-atomic="true" id="" > |
||||
|
<input type="date" id="date_from"></input> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="search-Result-Selection" style=""> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown"> |
||||
|
<span class="fa fa-book"></span> |
||||
|
Account Type: |
||||
|
</a> |
||||
|
<select id="selection" class="dropdown-menu result_selection" name="states[]" > |
||||
|
<div role="separator" class="dropdown-divider"></div> |
||||
|
<option value="customer_supplier">Receivable and Payable Accounts</option> |
||||
|
<option value="customer">Receivable Accounts </option> |
||||
|
<option value="supplier">Payable Accounts</option> |
||||
|
</select> |
||||
|
<span id="account_res"></span> |
||||
|
</div> |
||||
|
<div class="partner_filter"> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown"> |
||||
|
<span class="fa fa-users"></span> |
||||
|
Partners: |
||||
|
</a> |
||||
|
<select class="dropdown-menu partners" name="states[]" multiple="multiple"> |
||||
|
<t t-foreach="filter_data.partners_list" t-as="partner"> |
||||
|
<option t-attf-value="{{partner[0]}}"> |
||||
|
<t t-esc="partner[1]"/> |
||||
|
</option> |
||||
|
</t> |
||||
|
</select> |
||||
|
<span id="partner_res"></span> |
||||
|
</div> |
||||
|
<div class="category_filter"> |
||||
|
<a type="button" class="dropdown-toggle" |
||||
|
data-toggle="dropdown"> |
||||
|
<span class="fa fa-filter"></span> |
||||
|
Partner tag: |
||||
|
</a> |
||||
|
<select class="dropdown-menu category" |
||||
|
name="states[]" multiple="multiple"> |
||||
|
<t t-foreach="filter_data.category_list" |
||||
|
t-as="category"> |
||||
|
<option t-attf-value="{{category[0]}}"> |
||||
|
<t t-esc="category[1]"/> |
||||
|
</option> |
||||
|
</t> |
||||
|
</select> |
||||
|
<span id="category_res"></span> |
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="search-Target-move" style=""> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown"> |
||||
|
<span class="fa fa-filter"></span> |
||||
|
Target Move: |
||||
|
</a> |
||||
|
<select id="entries" class="dropdown-menu target_move" name="states[]" > |
||||
|
<div role="separator" class="dropdown-divider"></div> |
||||
|
<option value="posted">Posted Entries</option> |
||||
|
<option value="all">All Entries </option> |
||||
|
|
||||
|
</select> |
||||
|
<span id="post_res"></span> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
<div style=""> |
||||
|
<button type="button" id="apply_filter" class="btn btn-primary" style="top:0px;height:25px;right:0px;position: absolute;color:white;background-color: #00A0AD;border-color: #00A0AD;">Apply</button> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</t> |
||||
|
|
||||
|
<t t-name="SubSectional"> |
||||
|
<div class="gl-table-div"> |
||||
|
<table class="table table-sm o_main_table" |
||||
|
style="border: 0px solid black;display compact;"> |
||||
|
<thead> |
||||
|
<tr style=""> |
||||
|
<th>Entry Label</th> |
||||
|
<th>DueDate</th> |
||||
|
<th>JRNL</th> |
||||
|
<th>Account</th> |
||||
|
<th >Not Due</th> |
||||
|
<th >0-20</th> |
||||
|
<th >21-40</th> |
||||
|
<th >41-60</th> |
||||
|
<th >61-80</th> |
||||
|
<th >80+</th> |
||||
|
|
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<t t-foreach="account_data" t-as="account_line"> |
||||
|
|
||||
|
|
||||
|
<tr> |
||||
|
<td> |
||||
|
<t t-if="account_line.mov_id"> |
||||
|
<div class="dropdown dropdown-toggle"> |
||||
|
<a data-toggle="dropdown" href="#"> |
||||
|
<span class="caret"></span> |
||||
|
<span> |
||||
|
<t t-esc="account_line.move"/> |
||||
|
</span> |
||||
|
</a> |
||||
|
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu"> |
||||
|
<li> |
||||
|
<a class="view-account-move" tabindex="-1" href="#" |
||||
|
t-att-data-move-id="account_line.mov_id"> |
||||
|
View Source move |
||||
|
|
||||
|
</a> |
||||
|
</li> |
||||
|
</ul> |
||||
|
</div> |
||||
|
</t> |
||||
|
</td> |
||||
|
<td> |
||||
|
<t t-esc="account_line.date"/> |
||||
|
</td> |
||||
|
<td> |
||||
|
<t t-esc="account_line.jrnl"/> |
||||
|
</td> |
||||
|
<td> |
||||
|
<span> |
||||
|
<t t-esc="account_line.acc_code"/> |
||||
|
- |
||||
|
<t t-esc="account_line.acc_name"/> |
||||
|
</span> |
||||
|
</td> |
||||
|
<t t-if="account_line.currency== 'before'"> |
||||
|
<td> |
||||
|
<t t-if="account_line.period6"> |
||||
|
<t t-if="account_line.amount== 0"> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-esc="account_line.symbol"/> |
||||
|
<t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
</t> |
||||
|
|
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
</td> |
||||
|
<td> |
||||
|
<t t-if="account_line.period5"> |
||||
|
<t t-if="account_line.amount== 0"> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-esc="account_line.symbol"/> |
||||
|
<t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
</t> |
||||
|
|
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
</td> |
||||
|
<td> |
||||
|
<t t-if="account_line.period4"> |
||||
|
<t t-if="account_line.amount== 0"> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-esc="account_line.symbol"/> |
||||
|
<t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
</t> |
||||
|
|
||||
|
|
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
</td> |
||||
|
<td> |
||||
|
<t t-if="account_line.period3"> |
||||
|
<t t-if="account_line.amount== 0"> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-esc="account_line.symbol"/> |
||||
|
<t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
</t> |
||||
|
|
||||
|
|
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
</td> |
||||
|
<td> |
||||
|
<t t-if="account_line.period2"> |
||||
|
<t t-if="account_line.amount== 0"> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-esc="account_line.symbol"/> |
||||
|
<t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
</t> |
||||
|
|
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
</td> |
||||
|
<td> |
||||
|
<t t-if="account_line.period1"> |
||||
|
<t t-if="account_line.amount== 0"> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-esc="account_line.symbol"/> |
||||
|
<t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
</t> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
</td> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<td> |
||||
|
<t t-if="account_line.period6"> |
||||
|
<t t-if="account_line.amount == 0"> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
<t t-esc="account_line.symbol"/> |
||||
|
</t> |
||||
|
</t> |
||||
|
|
||||
|
</td> |
||||
|
<td> |
||||
|
<t t-if="account_line.period5"> |
||||
|
<t t-if="account_line.amount == 0"> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
<t t-esc="account_line.symbol"/> |
||||
|
</t> |
||||
|
</t> |
||||
|
|
||||
|
</td> |
||||
|
<td> |
||||
|
<t t-if="account_line.period4"> |
||||
|
<t t-if="account_line.amount == 0"> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
<t t-esc="account_line.symbol"/> |
||||
|
</t> |
||||
|
</t> |
||||
|
|
||||
|
</td> |
||||
|
<td> |
||||
|
<t t-if="account_line.period3"> |
||||
|
<t t-if="account_line.amount == 0"> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
<t t-esc="account_line.symbol"/> |
||||
|
</t> |
||||
|
</t> |
||||
|
|
||||
|
</td> |
||||
|
<td> |
||||
|
<t t-if="account_line.period2"> |
||||
|
<t t-if="account_line.amount == 0"> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
<t t-esc="account_line.symbol"/> |
||||
|
</t> |
||||
|
</t> |
||||
|
|
||||
|
</td> |
||||
|
<td> |
||||
|
<t t-if="account_line.period1"> |
||||
|
<t t-if="account_line.amount == 0"> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
<t t-esc="account_line.symbol"/> |
||||
|
</t> |
||||
|
</t> |
||||
|
|
||||
|
</td> |
||||
|
|
||||
|
|
||||
|
</t> |
||||
|
|
||||
|
</tr> |
||||
|
</t> |
||||
|
|
||||
|
|
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
</t> |
||||
|
|
||||
|
</templates> |
@ -0,0 +1,351 @@ |
|||||
|
|
||||
|
<templates> |
||||
|
<t t-name="CFTemp"> |
||||
|
<div class=""> |
||||
|
<div class=""> |
||||
|
<h1> |
||||
|
CASH FLOW STATEMENTS |
||||
|
</h1> |
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
<div> |
||||
|
<div class="filter_view_tb"></div> |
||||
|
</div> |
||||
|
<br></br> |
||||
|
<div> |
||||
|
<div class="table_view_tb" style="right:20px;"></div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</t> |
||||
|
<t t-name="CashTable"> |
||||
|
<div> |
||||
|
<div class="table_main_view"> |
||||
|
<table cellspacing="0" width="100%"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th colspan="6">Name</th> |
||||
|
<th class="cf_fld">Cash In</th> |
||||
|
<th class="cf_fld">Cash Out</th> |
||||
|
<th class="cf_fld">Balance</th> |
||||
|
|
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<t t-foreach="account_data" t-as="account"> |
||||
|
<t t-set="common_id" t-value=""/> |
||||
|
<t t-if="(level=='detailed' or level=='very' or level==false )"> |
||||
|
<tr style="border: .5px solid black;" class="cf-line" |
||||
|
data-toggle="collapse" |
||||
|
t-att-data-account-id="account['id']" |
||||
|
t-attf-data-target=".a{{account['id']}}"> |
||||
|
|
||||
|
<td colspan="6" style="border: 0px solid black;"> |
||||
|
<i class="fa fa-caret-down" role="img" aria-label="Unfolded" title="Unfolded"></i> |
||||
|
<span> |
||||
|
<t t-if="account['month_part']"> |
||||
|
<t t-esc="account['month_part']"/> |
||||
|
</t> |
||||
|
<t t-esc="account['code']"/> |
||||
|
<t t-esc="account['name']"/> |
||||
|
</span> |
||||
|
</td> |
||||
|
<t t-if="currency[1] == 'before'"> |
||||
|
<td class="cf_fld"> |
||||
|
<t t-esc="currency[0]"/> <t t-raw="account['total_debit']"/> |
||||
|
</td> |
||||
|
<td class="cf_fld"> |
||||
|
<t t-esc="currency[0]"/> <t t-raw="account['total_credit']"/> |
||||
|
</td> |
||||
|
<td class="cf_fld"> |
||||
|
<t t-esc="currency[0]"/> <t t-raw="account['total_balance']"/> |
||||
|
</td> |
||||
|
|
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<td class="cf_fld"> |
||||
|
<t t-raw="account['total_debit']"/><t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
<td class="cf_fld"> |
||||
|
<t t-raw="account['total_credit']"/><t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
<td class="cf_fld"> |
||||
|
<t t-raw="account['total_balance']"/><t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
</t> |
||||
|
</tr> |
||||
|
|
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
|
||||
|
<tr style="border: 1.5px solid black;" class="" |
||||
|
data-toggle="collapse" |
||||
|
t-att-data-account-id="account['id']" |
||||
|
t-attf-data-target=".a{{account['id']}}"> |
||||
|
|
||||
|
<td colspan="6" style="border: 0px solid black;"> |
||||
|
<span> |
||||
|
<t t-if="account['month_part']"> |
||||
|
<t t-esc="account['month_part']"/> |
||||
|
</t> |
||||
|
<t t-esc="account['code']"/> |
||||
|
|
||||
|
<t t-esc="account['name']"/> |
||||
|
</span> |
||||
|
</td> |
||||
|
<t t-if="currency[1] == 'before'"> |
||||
|
<td class="cf_fld"> |
||||
|
<t t-esc="currency[0]"/> <t t-raw="account['total_debit']"/> |
||||
|
</td> |
||||
|
<td class="cf_fld"> |
||||
|
<t t-esc="currency[0]"/> <t t-raw="account['total_credit']"/> |
||||
|
</td> |
||||
|
<td class="cf_fld"> |
||||
|
<t t-esc="currency[0]"/> <t t-raw="account['total_balance']"/> |
||||
|
</td> |
||||
|
|
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<td class="cf_fld"> |
||||
|
<t t-raw="account['total_debit']"/><t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
<td class="cf_fld"> |
||||
|
<t t-raw="account['total_credit']"/><t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
<td class="cf_fld"> |
||||
|
<t t-raw="account['total_balance']"/><t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
</t> |
||||
|
</tr> |
||||
|
</t> |
||||
|
<tr t-attf-class="collapse a{{account['id']}}"> |
||||
|
<td colspan="10"> |
||||
|
<ul> |
||||
|
|
||||
|
</ul> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</t> |
||||
|
</tbody> |
||||
|
|
||||
|
|
||||
|
</table> |
||||
|
</div> |
||||
|
</div> |
||||
|
</t> |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
<t t-name="CashFilterView"> |
||||
|
|
||||
|
<div class="" style="position: relative;"> |
||||
|
<div class="sub_container_left"> |
||||
|
<div class="report_print"> |
||||
|
<button type="button" class="btn btn-primary" id="pdf" style="height:25px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD;">Print (PDF)</button> |
||||
|
<button type="button" class="btn btn-primary" id="xlsx" style="height:25px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD;">Export (XLSX)</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
<br></br> |
||||
|
<div class="sub_container_right" style="width:50%;height:3%;right:0px;top:0px;position: absolute;"> |
||||
|
<div class="" style="right:80x;"> |
||||
|
|
||||
|
<br></br> |
||||
|
<div class="row" style="right:80px;top:0px;position: absolute;width:50;"> |
||||
|
<div class="time_range" style=""> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> |
||||
|
<span class="fa fa-calendar" title="Dates" role="img" aria-label="Dates"></span> |
||||
|
Date Range |
||||
|
</a> |
||||
|
<div class="dropdown-menu" role="menu"> |
||||
|
<div class="" > |
||||
|
<label class="" for="date_from">Start Date :</label> |
||||
|
<div class=""> |
||||
|
<div class="" aria-atomic="true" id="" > |
||||
|
<input type="date" id="date_from"></input> |
||||
|
</div> |
||||
|
</div> |
||||
|
<label class="" for="date_to">End Date :</label> |
||||
|
<div class=""> |
||||
|
<div class="" aria-atomic="true" id="" > |
||||
|
<input type="date" id="date_to"></input> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="search-Target-move" style=""> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown"> |
||||
|
<span class="fa fa-filter"></span> |
||||
|
Target Move: |
||||
|
</a> |
||||
|
<select id="entries" class="dropdown-menu target_move" name="states[]" > |
||||
|
<div role="separator" class="dropdown-divider"></div> |
||||
|
<option value="all">All Entries </option> |
||||
|
<option value="posted">Posted Entries</option> |
||||
|
</select> |
||||
|
<span id="post_res"></span> |
||||
|
</div> |
||||
|
|
||||
|
<div class="search-levels"> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown"> |
||||
|
<span class="fa fa-book"></span> |
||||
|
Level: |
||||
|
</a> |
||||
|
<select class="dropdown-menu levels" id="levels" name="states[]"> |
||||
|
<option value="summary">Summary</option> |
||||
|
<option value="consolidated">Consolidated</option> |
||||
|
<option value="detailed">Detailed</option> |
||||
|
<option value="very">Very Detailed</option> |
||||
|
</select> |
||||
|
<span id="level_res"> </span> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
<div style=""> |
||||
|
<button type="button" id="apply_filter" class="btn btn-primary" style="top:0px;height:25px;right:0px;position: absolute;color:white;background-color: #00A0AD;border-color: #00A0AD;">Apply</button> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</t> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<t t-name="SubSectionCF"> |
||||
|
|
||||
|
<table cellspacing="0" width="100%"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th colspan="6">Name</th> |
||||
|
<th class="cf_fld">Cash In</th> |
||||
|
<th class="cf_fld">Cash Out</th> |
||||
|
<th class="cf_fld">Balance</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<t t-foreach="account_data" t-as="data"> |
||||
|
|
||||
|
<t t-if="data.id == line_id"> |
||||
|
<t t-foreach="data.journal_lines" t-as="account_line"> |
||||
|
<t t-set="style" t-value="'font-style: italic;'"/> |
||||
|
<tr data-toggle="" |
||||
|
t-att-data-account-id="data.id" |
||||
|
t-attf-data-target=".a{{data.id}}"> |
||||
|
<td colspan="6" style="border: 0px solid black;"> |
||||
|
<t t-esc="account_line.name"/> |
||||
|
</td> |
||||
|
<t t-if="currency[1] == 'before'"> |
||||
|
<td class="cf_fld"> |
||||
|
<t t-esc="currency[0]"/><t t-raw="account_line.total_debit"/> |
||||
|
</td> |
||||
|
<td class="cf_fld"> |
||||
|
<t t-esc="currency[0]"/><t t-raw="account_line.total_credit"/> |
||||
|
</td> |
||||
|
<td class="cf_fld"> |
||||
|
<t t-esc="currency[0]"/><t t-raw="account_line.balance"/> |
||||
|
</td> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<td class="cf_fld"> |
||||
|
<t t-raw="account_line.total_debit"/><t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
<td class="cf_fld"> |
||||
|
<t t-raw="account_line.total_credit"/><t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
<td class="cf_fld"> |
||||
|
<t t-raw="account_line.balance"/><t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
</t> |
||||
|
</tr> |
||||
|
</t> |
||||
|
</t> |
||||
|
</t> |
||||
|
</tbody> |
||||
|
|
||||
|
|
||||
|
</table> |
||||
|
|
||||
|
</t> |
||||
|
|
||||
|
<t t-name="ChildSubSectionCF"> |
||||
|
<div class="c-cf-table-div"> |
||||
|
<table cellspacing="1" width="100%"> |
||||
|
<thead> |
||||
|
<t t-foreach="account_data" t-as="acc_data"> |
||||
|
<t t-if="acc_data.id == line_id"> |
||||
|
<t t-foreach="acc_data.journal_lines" t-as="data"> |
||||
|
<tr style=""> |
||||
|
<th colspan="6"><t t-esc="data.name"/> </th> |
||||
|
<t t-if="currency[1] == 'before'"> |
||||
|
<th class="cf_fld" style="left: 100px;"><t t-esc="currency[0]"/><t t-esc="data.total_debit"/></th> |
||||
|
<th class="cf_fld"><t t-esc="currency[0]"/><t t-esc="data.total_credit"/></th> |
||||
|
<th class="cf_fld"><t t-esc="currency[0]"/><t t-esc="data.total_balance"/></th> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<th class="cf_fld" style="left: 100px;"><t t-esc="data.total_debit"/><t t-esc="currency[0]"/></th> |
||||
|
<th class="cf_fld"><t t-esc="data.total_credit"/><t t-esc="currency[0]"/></th> |
||||
|
<th class="cf_fld"><t t-esc="data.total_balance"/><t t-esc="currency[0]"/></th> |
||||
|
</t> |
||||
|
|
||||
|
</tr> |
||||
|
|
||||
|
<t t-foreach="acc_data.move_lines" t-as="account_line"> |
||||
|
<t t-if="account_line.j_id == data.id"> |
||||
|
<tr> |
||||
|
|
||||
|
<td colspan="6"> |
||||
|
<t t-esc="account_line.move_name"/> |
||||
|
</td> |
||||
|
<t t-if="currency[1] == 'before'"> |
||||
|
<td class="cf_fld"> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
<t t-raw="account_line.total_debit"/> |
||||
|
</td> |
||||
|
<td class="cf_fld"> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
<t t-raw="account_line.total_credit"/> |
||||
|
</td> |
||||
|
<td class="cf_fld"> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
<t t-raw="account_line.balance"/> |
||||
|
</td> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<td class="cf_fld"> |
||||
|
<t t-if="account_line.total_debit==0"/> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
<td class="cf_fld"> |
||||
|
|
||||
|
<t t-raw="account_line.total_credit"/> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
<td class="cf_fld"> |
||||
|
|
||||
|
<t t-raw="account_line.balance"/> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
</t> |
||||
|
</tr> |
||||
|
</t> |
||||
|
</t> |
||||
|
|
||||
|
<tr t-attf-class="collapse a{{data.id}}"> |
||||
|
|
||||
|
<td colspan=""></td> |
||||
|
</tr> |
||||
|
</t> |
||||
|
</t> |
||||
|
</t> |
||||
|
</thead> |
||||
|
</table> |
||||
|
</div> |
||||
|
</t> |
||||
|
|
||||
|
</templates> |
@ -0,0 +1,288 @@ |
|||||
|
|
||||
|
<templates> |
||||
|
<t t-name="DaybookTemp"> |
||||
|
<div class=""> |
||||
|
<div class=""> |
||||
|
<h1> |
||||
|
Day Book |
||||
|
</h1> |
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
<div> |
||||
|
<div class="filter_view_db"></div> |
||||
|
</div> |
||||
|
<br></br> |
||||
|
<div> |
||||
|
<div class="table_view_db" style="right:20px;"></div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</t> |
||||
|
<t t-name="Daytable"> |
||||
|
<div> |
||||
|
<div class="table_main_view"> |
||||
|
<table cellspacing="0" width="100%"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th colspan="6">Date</th> |
||||
|
<th class="mon_fld">Debit</th> |
||||
|
<th class="mon_fld">Credit</th> |
||||
|
<th class="mon_fld">Balance</th> |
||||
|
|
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody style="width:100%;"> |
||||
|
</tbody> |
||||
|
<tbody> |
||||
|
<t t-foreach="report_lines" t-as="account"> |
||||
|
<t t-set="common_id" t-value="0"/> |
||||
|
<tr style="border: 1.5px solid black;" class="db-line" |
||||
|
data-toggle="collapse" |
||||
|
t-att-data-account-id="account['id']" |
||||
|
t-attf-data-target=".a{{account['id']}}"> |
||||
|
<td colspan="6" style="border: 0px solid black;"> |
||||
|
<i class="fa fa-caret-down" role="img" aria-label="Unfolded" title="Unfolded"></i> |
||||
|
<span> |
||||
|
<t t-esc="account['date']"/> |
||||
|
</span> |
||||
|
<td class="mon_fld"> |
||||
|
<t t-raw="account['debit']"/><t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
<td class="mon_fld"> |
||||
|
<t t-raw="account['credit']"/><t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
<td class="mon_fld"> |
||||
|
<t t-raw="account['balance']"/><t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
<t t-set="common_id" t-value="'a'+account['id']"/> |
||||
|
</td> |
||||
|
<tr t-attf-class="collapse a{{account['id']}}"> |
||||
|
<td colspan="10"> |
||||
|
<ul> |
||||
|
</ul> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</tr> |
||||
|
</t> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
</div> |
||||
|
</t> |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
<t t-name="DayFilterView"> |
||||
|
<div class="" style="position: relative;"> |
||||
|
<div class="sub_container_left"> |
||||
|
<div class="report_print"> |
||||
|
<button type="button" class="btn btn-primary" id="pdf" style="height:25px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD;">Print (PDF)</button> |
||||
|
<button type="button" class="btn btn-primary" id="xlsx" style="height:25px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD;">Export (XLSX)</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
<br></br> |
||||
|
<div class="sub_container_right" style="width:50%;height:3%;right:0px;top:0px;position: absolute;"> |
||||
|
|
||||
|
<div class="" style="right:80x;"> |
||||
|
|
||||
|
<br></br> |
||||
|
<div class="row" style="right:80px;top:0px;position: absolute;width:50;"> |
||||
|
<div class="time_range" style=""> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> |
||||
|
<span class="fa fa-calendar" title="Dates" role="img" aria-label="Dates"></span> |
||||
|
Date Range |
||||
|
</a> |
||||
|
<div class="dropdown-menu" role="menu"> |
||||
|
<div class="" > |
||||
|
<label class="" for="date_from">Start Date :</label> |
||||
|
<div class=""> |
||||
|
<div class="" aria-atomic="true" id="" > |
||||
|
<input type="date" id="date_from"></input> |
||||
|
</div> |
||||
|
</div> |
||||
|
<label class="" for="date_to">End Date :</label> |
||||
|
<div class=""> |
||||
|
<div class="" aria-atomic="true" id="" > |
||||
|
<input type="date" id="date_to"></input> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="journals_filter" style=""> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown"> |
||||
|
<span class="fa fa-book"></span> |
||||
|
Journals: |
||||
|
</a> |
||||
|
<select class="dropdown-menu journals" name="states[]" multiple="multiple"> |
||||
|
<div role="separator" class="dropdown-divider"></div> |
||||
|
<t t-foreach="filter_data.journals_list" t-as="journal"> |
||||
|
<option t-attf-value="{{journal[0]}}"><t t-esc="journal[1]"/> |
||||
|
</option> |
||||
|
</t> |
||||
|
</select> |
||||
|
<span id="journal_res"></span> |
||||
|
</div> |
||||
|
<div class="accounts_filter"> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown"> |
||||
|
<span class="fa fa-book"></span> |
||||
|
Accounts: |
||||
|
</a> |
||||
|
<select class="dropdown-menu account" name="states[]" multiple="multiple"> |
||||
|
<t t-foreach="filter_data.accounts_list" t-as="account"> |
||||
|
<option t-attf-value="{{account[0]}}"> |
||||
|
<t t-esc="account[1]"/> |
||||
|
</option> |
||||
|
</t> |
||||
|
</select> |
||||
|
<span id="acc_res"></span> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="search-Target-move" style=""> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown"> |
||||
|
<span class="fa fa-filter"></span> |
||||
|
Target Move: |
||||
|
</a> |
||||
|
<select id="entries" class="dropdown-menu target_move" name="states[]" > |
||||
|
<div role="separator" class="dropdown-divider"></div> |
||||
|
<option value="all">All Entries </option> |
||||
|
<option value="posted">Posted Entries</option> |
||||
|
</select> |
||||
|
<span id="post_res"></span> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
<div style=""> |
||||
|
<button type="button" id="apply_filter" class="btn btn-primary" style="top:0px;height:25px;right:0px;position: absolute;color:white;background-color: #00A0AD;border-color: #00A0AD;">Apply</button> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</t> |
||||
|
|
||||
|
<t t-name="SubSectiondb"> |
||||
|
<div class="db-table-div"> |
||||
|
<table class="table table-sm o_main_table" |
||||
|
style="border: 0px solid black;display compact;"> |
||||
|
<thead> |
||||
|
<tr style=""> |
||||
|
<th>Date</th> |
||||
|
<th>JRNL</th> |
||||
|
<th>Partner</th> |
||||
|
<th>Move</th> |
||||
|
<th>Entry Label</th> |
||||
|
<th >Debit</th> |
||||
|
<th >Credit</th> |
||||
|
<th >Balance</th> |
||||
|
|
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<t t-foreach="account_data" t-as="account_line"> |
||||
|
<t t-set="style" t-value="''"/> |
||||
|
<tr> |
||||
|
<td> |
||||
|
<t t-if="account_line.ldate"> |
||||
|
<div class="dropdown dropdown-toggle"> |
||||
|
<a data-toggle="dropdown" href="#"> |
||||
|
<span class="caret"/> |
||||
|
<span data-id="17"> |
||||
|
<t t-esc="account_line.ldate"/> |
||||
|
</span> |
||||
|
</a> |
||||
|
<ul class="dropdown-menu" |
||||
|
role="menu" |
||||
|
aria-labelledby="dropdownMenu"> |
||||
|
<li> |
||||
|
<a class="view-account-move" |
||||
|
tabindex="-1" href="#" |
||||
|
t-att-data-move-id="account_line.move_id"> |
||||
|
View Source move |
||||
|
</a> |
||||
|
</li> |
||||
|
</ul> |
||||
|
</div> |
||||
|
</t> |
||||
|
</td> |
||||
|
<td> |
||||
|
<t t-esc="account_line.lcode"/> |
||||
|
</td> |
||||
|
<td> |
||||
|
<t t-esc="account_line.partner_name"/> |
||||
|
</td> |
||||
|
<td t-att-style="style"> |
||||
|
<t t-esc="account_line.move_name"/> |
||||
|
</td> |
||||
|
<td t-att-style="style"> |
||||
|
<t t-esc="account_line.lname"/> |
||||
|
</td> |
||||
|
<t t-if="account_line.currency_position == 'before'"> |
||||
|
<td t-att-style="style" class="text-right"> |
||||
|
<t t-if="account_line.debit == 0"> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-esc="account_line.currency_code"/> |
||||
|
<t t-esc="Math.round(account_line.debit * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
</t> |
||||
|
</td> |
||||
|
<td t-att-style="style" class="text-right"> |
||||
|
<t t-if="account_line.credit == 0"> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-esc="account_line.currency_code"/> |
||||
|
<t t-esc="Math.round(account_line.credit * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
</t> |
||||
|
</td> |
||||
|
<td t-att-style="style" class="text-right"> |
||||
|
<t t-if="account_line.balance == 0"> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-esc="account_line.currency_code"/> |
||||
|
<t t-esc="Math.round(account_line.balance * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
</t> |
||||
|
</td> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<td t-att-style="style" class="amt"> |
||||
|
<t t-if="account_line.debit == 0"> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-esc="Math.round(account_line.debit * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
<t t-esc="account_line.currency_code"/> |
||||
|
</t> |
||||
|
</td> |
||||
|
<td t-att-style="style" class="amt"> |
||||
|
<t t-if="account_line.credit == 0"> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-esc="Math.round(account_line.credit * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
<t t-esc="account_line.currency_code"/> |
||||
|
</t> |
||||
|
</td> |
||||
|
<td t-att-style="style" class="amt"> |
||||
|
<t t-if="account_line.balance == 0"> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-esc="Math.round(account_line.balance * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
<t t-esc="account_line.currency_code"/> |
||||
|
</t> |
||||
|
</td> |
||||
|
|
||||
|
</t> |
||||
|
</tr> |
||||
|
</t> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
</t> |
||||
|
|
||||
|
</templates> |
@ -0,0 +1,265 @@ |
|||||
|
|
||||
|
<templates> |
||||
|
<t t-name="dfr_template_new"> |
||||
|
<div class=""> |
||||
|
<div> |
||||
|
<div class="filter_view_dfr"></div> |
||||
|
</div> |
||||
|
<br></br> |
||||
|
<div> |
||||
|
<div class="table_view_dfr" style="right:20px;"></div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</t> |
||||
|
|
||||
|
<t t-name="dfr_table"> |
||||
|
<div> |
||||
|
<div class="table_main_view"> |
||||
|
<table cellspacing="0" width="100%"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th colspan="6"></th> |
||||
|
<th style="text-align: right; padding-right: 50px;">Debit</th> |
||||
|
<th style="text-align: right; padding-right: 50px;">Credit</th> |
||||
|
<th style="text-align: right; padding-right: 50px;">Balance</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
|
||||
|
<t t-set="none_value" t-value="_"/> |
||||
|
<t t-foreach="bs_lines" t-as="a"> |
||||
|
<t t-if="a['code']"> |
||||
|
<t t-foreach="report_lines" t-as="account"> |
||||
|
|
||||
|
|
||||
|
<t t-set="common_id" t-value="0"/> |
||||
|
<t t-if="account['code'] == a['code']"> |
||||
|
<tr style="border: 1.5px solid black;" class="gl-line" |
||||
|
data-toggle="collapse" |
||||
|
t-att-data-account-id="account['id']" |
||||
|
t-attf-data-target=".a{{account['id']}}"> |
||||
|
<td colspan="6" style="border: 0px solid black; padding-left: 50px;"> |
||||
|
<span> |
||||
|
<t t-esc="account['code']"/> |
||||
|
- |
||||
|
<t t-esc="account['name']"/> |
||||
|
</span> |
||||
|
<div class="" style="display: inline-block;"> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> |
||||
|
</a> |
||||
|
<div class="dropdown-menu " role="menu"> |
||||
|
<div class="o_foldable_menu o_closed_menu " > |
||||
|
<div class="form-group "> |
||||
|
<div class="show-gl" aria-atomic="true" id="" data-target-input=""> |
||||
|
<li role="presentation"> |
||||
|
<a role="menuitem" style="background-color:grey;" t-att-data-account-id="account['id']" class="show-gl" >View General Ledger</a> |
||||
|
</li> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</td> |
||||
|
<td t-att-style="fr_padding"><t t-esc="a['m_debit']" t-att-style="style"/></td> |
||||
|
<td t-att-style="fr_padding"><t t-esc="a['m_credit']" t-att-style="style"/></td> |
||||
|
<td t-att-style="fr_padding"><t t-esc="a['m_balance']" t-att-style="style"/></td> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<t t-set="common_id" t-value="'a'+account['id']"/> |
||||
|
</tr> |
||||
|
</t> |
||||
|
</t> |
||||
|
|
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-set="style" t-value="'padding: 5px;padding-left: 25px;'"/> |
||||
|
<t t-set="fr_head" t-value="'border-bottom: double;'"/> |
||||
|
<t t-set="fr_padding" t-value="'padding-top: 5px; text-align: right;padding-right: 50px; vertical-align: bottom;'"/> |
||||
|
<t t-if="a['level'] == 1"> |
||||
|
<t t-set="style" t-value="'padding: 5px;padding-left: 15px; padding-top: 15px;'"/> |
||||
|
</t> |
||||
|
<t t-if="a['level'] == 2"> |
||||
|
<t t-set="style" t-value="'padding: 5px;padding-left: 25px; padding-top: 25px;'"/> |
||||
|
</t> |
||||
|
<t t-if="a['level'] == 3"> |
||||
|
<t t-set="style" t-value="'padding: 5px;padding-left: 50px;'"/> |
||||
|
<t t-set="fr_head" t-value="'border-bottom: 1px solid black;'"/> |
||||
|
</t> |
||||
|
<t t-if="a['level'] > 3"> |
||||
|
<t t-set="style" t-value="'padding: 5px;padding-left: 50px;'"/> |
||||
|
<t t-set="fr_head" t-value="'border-bottom: 1px solid black;'"/> |
||||
|
</t> |
||||
|
<tr t-att-style="fr_head"> |
||||
|
<th colspan="6" t-att-style="style"> |
||||
|
<t t-esc="a['name']"/> |
||||
|
</th> |
||||
|
<td t-att-style="fr_padding"><t t-esc="a['m_debit']"/></td> |
||||
|
<td t-att-style="fr_padding"><t t-esc="a['m_credit']"/></td> |
||||
|
<td t-att-style="fr_padding"><t t-esc="a['m_balance']"/></td> |
||||
|
</tr> |
||||
|
</t> |
||||
|
|
||||
|
</t> |
||||
|
|
||||
|
</tbody> |
||||
|
|
||||
|
</table> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
</t> |
||||
|
<t t-name="DfrFilterView"> |
||||
|
<div class=""> |
||||
|
<h1 style="padding:10px"> |
||||
|
<t t-esc="title"/> |
||||
|
</h1> |
||||
|
|
||||
|
</div> |
||||
|
<div class="" style="position: relative;"> |
||||
|
|
||||
|
<div class="sub_container_left"> |
||||
|
<div class="report_print"> |
||||
|
<button type="button" class="btn btn-primary" id="pdf" |
||||
|
style="left:10px; height:30px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD; |
||||
|
padding:3px;"> |
||||
|
Print (PDF) |
||||
|
</button> |
||||
|
<button type="button" class="btn btn-primary" id="xlsx" |
||||
|
style="left:20px; height:30px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD;"> |
||||
|
Export (XLSX) |
||||
|
</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
<br></br> |
||||
|
<div class="sub_container_right" style="width:50%;height:3%;right:0px;top:0px;position: absolute;"> |
||||
|
<div class="" style="right:80x;"> |
||||
|
|
||||
|
<br></br> |
||||
|
<div class="row" style="right:80px;top:0px;position: absolute;width:50;"> |
||||
|
<div class="time_range" style=""> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> |
||||
|
<span class="fa fa-calendar" title="Dates" role="img" aria-label="Dates"></span> |
||||
|
Date Range |
||||
|
</a> |
||||
|
<div class="dropdown-menu" role="menu"> |
||||
|
<div class="" > |
||||
|
<label class="" for="date_from">Start Date :</label> |
||||
|
<div class=""> |
||||
|
<div class="" aria-atomic="true" id="" > |
||||
|
<input type="date" id="date_from"></input> |
||||
|
</div> |
||||
|
</div> |
||||
|
<label class="" for="date_to">End Date :</label> |
||||
|
<div class=""> |
||||
|
<div class="" aria-atomic="true" id="" > |
||||
|
<input type="date" id="date_to"></input> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="journals_filter" style=""> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown"> |
||||
|
<span class="fa fa-book"></span> |
||||
|
Journals: |
||||
|
</a> |
||||
|
<select class="dropdown-menu journals" name="states[]" multiple="multiple"> |
||||
|
<div role="separator" class="dropdown-divider"></div> |
||||
|
<t t-foreach="filter_data.journals_list" t-as="journal"> |
||||
|
<option t-attf-value="{{journal[0]}}"><t t-esc="journal[1]"/> |
||||
|
</option> |
||||
|
</t> |
||||
|
</select> |
||||
|
<span id="journal_res"></span> |
||||
|
</div> |
||||
|
|
||||
|
<div class="accounts_filter"> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown"> |
||||
|
<span class="fa fa-book"></span> |
||||
|
Accounts: |
||||
|
</a> |
||||
|
<select class="dropdown-menu account" name="states[]" multiple="multiple"> |
||||
|
<t t-foreach="filter_data.accounts_list" t-as="account"> |
||||
|
<option t-attf-value="{{account[0]}}"> |
||||
|
<t t-esc="account[1]"/> |
||||
|
</option> |
||||
|
</t> |
||||
|
</select> |
||||
|
<span id="acc_res"></span> |
||||
|
</div> |
||||
|
|
||||
|
<div class="account_tags_filter"> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown"> |
||||
|
<span class="fa fa-book"></span> |
||||
|
Account Tags: |
||||
|
</a> |
||||
|
<select class="dropdown-menu account-tag" name="states[]" multiple="multiple"> |
||||
|
<t t-foreach="filter_data.account_tag_list" t-as="account_tag"> |
||||
|
<option t-attf-value="{{account_tag[0]}}"> |
||||
|
<t t-esc="account_tag[1]"/> |
||||
|
</option> |
||||
|
</t> |
||||
|
</select> |
||||
|
<span id="acc_tag_res"></span> |
||||
|
</div> |
||||
|
|
||||
|
<div class="analytics_filter"> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown"> |
||||
|
<span class="fa fa-book"></span> |
||||
|
Analytic Accounts: |
||||
|
</a> |
||||
|
<select class="dropdown-menu analytics" name="states[]" multiple="multiple"> |
||||
|
<t t-foreach="filter_data.analytic_list" t-as="analytic"> |
||||
|
<option t-attf-value="{{analytic[0]}}"> |
||||
|
<t t-esc="analytic[1]"/> |
||||
|
</option> |
||||
|
</t> |
||||
|
</select> |
||||
|
<span id="analytic_res"></span> |
||||
|
</div> |
||||
|
|
||||
|
<div class="analytic_tags_filter"> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown"> |
||||
|
<span class="fa fa-book"></span> |
||||
|
Analytic Tags: |
||||
|
</a> |
||||
|
<select class="dropdown-menu analytic-tag" name="states[]" multiple="multiple"> |
||||
|
<t t-foreach="filter_data.analytic_tag_list" t-as="analytic_tag"> |
||||
|
<option t-attf-value="{{analytic_tag[0]}}"> |
||||
|
<t t-esc="analytic_tag[1]"/> |
||||
|
</option> |
||||
|
</t> |
||||
|
</select> |
||||
|
<span id="analic_tag_res"></span> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="search-Target-move" style=""> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown"> |
||||
|
<span class="fa fa-filter"></span> |
||||
|
Target Move: |
||||
|
</a> |
||||
|
<select id="entries" class="dropdown-menu target_move" name="states[]" > |
||||
|
<div role="separator" class="dropdown-divider"></div> |
||||
|
<option value="posted">Posted Entries</option> |
||||
|
<option value="all">All Entries </option> |
||||
|
</select> |
||||
|
<span id="post_res"></span> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
<div style=""> |
||||
|
<button type="button" id="apply_filter" class="btn btn-primary" |
||||
|
style="top:0px;height:30px;right:20px;position: absolute;color:white;background-color: #00A0AD;border-color: #00A0AD;"> |
||||
|
Apply |
||||
|
</button> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</t> |
||||
|
|
||||
|
</templates> |
@ -0,0 +1,382 @@ |
|||||
|
<templates> |
||||
|
<t t-name="GeneralTemp"> |
||||
|
<div> |
||||
|
<div> |
||||
|
<div class="filter_view_tb"></div> |
||||
|
</div> |
||||
|
<br></br> |
||||
|
<div> |
||||
|
<div class="table_view_tb" style="right:20px;"></div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</t> |
||||
|
<t t-name="GLTable"> |
||||
|
<div> |
||||
|
<div class="table_main_view"> |
||||
|
<table cellspacing="0" width="100%"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th colspan="6">Account</th> |
||||
|
<th class="mon_fld">Debit</th> |
||||
|
<th class="mon_fld">Credit</th> |
||||
|
<th class="mon_fld">Balance</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<t t-set="none_value" t-value="_"/> |
||||
|
<t t-foreach="report_lines" t-as="account"> |
||||
|
<t t-set="common_id" t-value="0"/> |
||||
|
<tr style="border: 1.5px solid black;" class="gl-line" |
||||
|
data-toggle="collapse" |
||||
|
t-att-data-account-id="account['id']" |
||||
|
t-attf-data-target=".a{{account['id']}}"> |
||||
|
<td colspan="6" style="border: 0px solid black;"> |
||||
|
<i class="fa fa-caret-down" role="img" aria-label="Unfolded" title="Unfolded"></i> |
||||
|
<span> |
||||
|
<t t-esc="account['code']"/> |
||||
|
- |
||||
|
<t t-esc="account['name']"/> |
||||
|
</span> |
||||
|
</td> |
||||
|
|
||||
|
<t t-if="currency[1] == 'before'"> |
||||
|
<td class="mon_fld"> |
||||
|
<t t-if="account['debit'] == 0"> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
<t t-raw="Math.round(account['debit'] * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
</t> |
||||
|
</td> |
||||
|
<td class="mon_fld"> |
||||
|
<t t-if="account['credit'] == 0"> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
<t t-raw="Math.round(account['credit'] * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
</t> |
||||
|
</td> |
||||
|
<td class="mon_fld"> |
||||
|
<t t-if="account['balance'] == 0"> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
<t t-raw="Math.round(account['balance'] * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
</t> |
||||
|
</td> |
||||
|
|
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<td class="mon_fld"> |
||||
|
<t t-if="account['debit'] == 0"> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-raw="Math.round(account['debit'] * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
</t> |
||||
|
</td> |
||||
|
<td class="mon_fld"> |
||||
|
<t t-if="account['credit'] == 0"> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-raw="Math.round(account['credit'] * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
</t> |
||||
|
</td> |
||||
|
<td class="mon_fld"> |
||||
|
<t t-if="account['balance'] == 0"> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-raw="Math.round(account['balance'] * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
</t> |
||||
|
</td> |
||||
|
|
||||
|
</t> |
||||
|
|
||||
|
|
||||
|
<t t-set="common_id" t-value="'a'+account['id']"/> |
||||
|
</tr> |
||||
|
|
||||
|
<tr t-attf-class="collapse a{{account['id']}}"> |
||||
|
<td colspan="10"> |
||||
|
<ul> |
||||
|
</ul> |
||||
|
</td> |
||||
|
</tr> |
||||
|
|
||||
|
</t> |
||||
|
|
||||
|
</tbody> |
||||
|
|
||||
|
</table> |
||||
|
</div> |
||||
|
</div> |
||||
|
</t> |
||||
|
|
||||
|
|
||||
|
<t t-name="GLFilterView"> |
||||
|
<div> |
||||
|
<h1> |
||||
|
<t t-esc="title"/> |
||||
|
</h1> |
||||
|
|
||||
|
</div> |
||||
|
<div class="" style="position: relative;"> |
||||
|
<div class="sub_container_left"> |
||||
|
<div class="report_print"> |
||||
|
<button type="button" class="btn btn-primary" id="pdf" |
||||
|
style="height:25px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD;"> |
||||
|
Print (PDF) |
||||
|
</button> |
||||
|
<button type="button" class="btn btn-primary" id="xlsx" |
||||
|
style="height:25px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD;"> |
||||
|
Export (XLSX) |
||||
|
</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
<br></br> |
||||
|
<div class="sub_container_right" style="width:50%;height:3%;right:0px;top:0px;position: absolute;"> |
||||
|
<div class="" style="right:80x;"> |
||||
|
|
||||
|
<br></br> |
||||
|
<div class="row" style="right:80px;top:0px;position: absolute;width:50;"> |
||||
|
<div class="time_range" style=""> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> |
||||
|
<span class="fa fa-calendar" title="Dates" role="img" aria-label="Dates"></span> |
||||
|
Date Range |
||||
|
</a> |
||||
|
<div class="dropdown-menu" role="menu"> |
||||
|
<div class=""> |
||||
|
<label class="" for="date_from">Start Date :</label> |
||||
|
<div class=""> |
||||
|
<div class="" aria-atomic="true" id=""> |
||||
|
<input type="date" id="date_from"></input> |
||||
|
</div> |
||||
|
</div> |
||||
|
<label class="" for="date_to">End Date :</label> |
||||
|
<div class=""> |
||||
|
<div class="" aria-atomic="true" id=""> |
||||
|
<input type="date" id="date_to"></input> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="journals_filter" style=""> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown"> |
||||
|
<span class="fa fa-book"></span> |
||||
|
Journals: |
||||
|
</a> |
||||
|
<select class="dropdown-menu journals" name="states[]" multiple="multiple"> |
||||
|
<div role="separator" class="dropdown-divider"></div> |
||||
|
<t t-foreach="filter_data.journals_list" t-as="journal"> |
||||
|
<option t-attf-value="{{journal[0]}}"> |
||||
|
<t t-esc="journal[1]"/> |
||||
|
</option> |
||||
|
</t> |
||||
|
</select> |
||||
|
<span id="journal_res"></span> |
||||
|
</div> |
||||
|
|
||||
|
<div class="accounts_filter"> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown"> |
||||
|
<span class="fa fa-book"></span> |
||||
|
Accounts: |
||||
|
</a> |
||||
|
<select class="dropdown-menu account" name="states[]" multiple="multiple"> |
||||
|
<t t-foreach="filter_data.accounts_list" t-as="account"> |
||||
|
<option t-attf-value="{{account[0]}}"> |
||||
|
<t t-esc="account[1]"/> |
||||
|
</option> |
||||
|
</t> |
||||
|
</select> |
||||
|
<span id="acc_res"></span> |
||||
|
</div> |
||||
|
|
||||
|
<div class="analytics_filter"> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown"> |
||||
|
<span class="fa fa-book"></span> |
||||
|
Analytic Accounts: |
||||
|
</a> |
||||
|
<select class="dropdown-menu analytics" name="states[]" multiple="multiple"> |
||||
|
<t t-foreach="filter_data.analytic_list" t-as="analytic"> |
||||
|
<option t-attf-value="{{analytic[0]}}"> |
||||
|
<t t-esc="analytic[1]"/> |
||||
|
</option> |
||||
|
</t> |
||||
|
</select> |
||||
|
<span id="analytic_res"></span> |
||||
|
</div> |
||||
|
|
||||
|
<div class="analytic_tags_filter"> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown"> |
||||
|
<span class="fa fa-book"></span> |
||||
|
Analytic Tags: |
||||
|
</a> |
||||
|
<select class="dropdown-menu analytic_tags" name="states[]" multiple="multiple"> |
||||
|
<t t-foreach="filter_data.analytic_tag_list" t-as="analytic_tag"> |
||||
|
<option t-attf-value="{{analytic_tag[0]}}"> |
||||
|
<t t-esc="analytic_tag[1]"/> |
||||
|
</option> |
||||
|
</t> |
||||
|
</select> |
||||
|
<span id="analytic_tag_res"></span> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="search-Target-move" style=""> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown"> |
||||
|
<span class="fa fa-filter"></span> |
||||
|
Target Move: |
||||
|
</a> |
||||
|
<select id="entries" class="dropdown-menu target_move" name="states[]"> |
||||
|
<div role="separator" class="dropdown-divider"></div> |
||||
|
<option value="all">All Entries</option> |
||||
|
<option value="posted">Posted Entries</option> |
||||
|
</select> |
||||
|
<span id="post_res"></span> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
<div style=""> |
||||
|
<button type="button" id="apply_filter" class="btn btn-primary" |
||||
|
style="top:0px;height:25px;right:0px;position: absolute;color:white;background-color: #00A0AD;border-color: #00A0AD;"> |
||||
|
Apply |
||||
|
</button> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</t> |
||||
|
|
||||
|
|
||||
|
<t t-name="SubSection"> |
||||
|
<div class="gl-table-div"> |
||||
|
<table class="table table-sm o_main_table" |
||||
|
style="border: 0px solid black;display compact;"> |
||||
|
<thead> |
||||
|
<tr style=""> |
||||
|
<th>Date</th> |
||||
|
<th>JRNL</th> |
||||
|
<th>Partner</th> |
||||
|
<th>Move</th> |
||||
|
<th>Entry Label</th> |
||||
|
<th class="mon_fld">Debit</th> |
||||
|
<th class="mon_fld">Credit</th> |
||||
|
<th class="mon_fld">Balance</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<t t-foreach="account_data" t-as="account_line"> |
||||
|
<t t-set="style" t-value="''"/> |
||||
|
<tr> |
||||
|
<td> |
||||
|
<t t-if="account_line.ldate"> |
||||
|
<div class="dropdown dropdown-toggle"> |
||||
|
<a data-toggle="dropdown" href="#"> |
||||
|
<span class="caret"></span> |
||||
|
<span> |
||||
|
<t t-esc="account_line.ldate"/> |
||||
|
</span> |
||||
|
</a> |
||||
|
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu"> |
||||
|
<li> |
||||
|
<a class="view-account-move" tabindex="-1" href="#" |
||||
|
t-att-data-move-id="account_line.move_id"> |
||||
|
View Source move |
||||
|
|
||||
|
</a> |
||||
|
</li> |
||||
|
</ul> |
||||
|
</div> |
||||
|
</t> |
||||
|
</td> |
||||
|
<td> |
||||
|
<t t-esc="account_line.lcode"/> |
||||
|
</td> |
||||
|
<td> |
||||
|
<t t-esc="account_line.partner_name"/> |
||||
|
</td> |
||||
|
<td t-att-style="style"> |
||||
|
<t t-esc="account_line.move_name"/> |
||||
|
</td> |
||||
|
<td t-att-style="style"> |
||||
|
<t t-esc="account_line.lname"/> |
||||
|
</td> |
||||
|
<t t-if="account_line.currency_position == 'before'"> |
||||
|
<td t-att-style="style" class="amt"> |
||||
|
<t t-if="account_line.debit == 0"> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-esc="account_line.currency_code"/> |
||||
|
<t t-esc="Math.round(account_line.debit * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
</t> |
||||
|
</td> |
||||
|
<td t-att-style="style" class="amt"> |
||||
|
<t t-if="account_line.credit == 0"> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-esc="account_line.currency_code"/> |
||||
|
<t t-esc="Math.round(account_line.credit * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
</t> |
||||
|
</td> |
||||
|
<td t-att-style="style" class="amt"> |
||||
|
<t t-if="account_line.balance == 0"> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-esc="account_line.currency_code"/> |
||||
|
<t t-esc="Math.round(account_line.balance * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
</t> |
||||
|
</td> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<td t-att-style="style" class="amt"> |
||||
|
<t t-if="account_line.debit == 0"> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-esc="Math.round(account_line.debit * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
<t t-esc="account_line.currency_code"/> |
||||
|
</t> |
||||
|
</td> |
||||
|
<td t-att-style="style" class="amt"> |
||||
|
<t t-if="account_line.credit == 0"> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-esc="Math.round(account_line.credit * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
<t t-esc="account_line.currency_code"/> |
||||
|
</t> |
||||
|
</td> |
||||
|
<td t-att-style="style" class="amt"> |
||||
|
<t t-if="account_line.balance == 0"> |
||||
|
<span>-</span> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-esc="Math.round(account_line.balance * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
<t t-esc="account_line.currency_code"/> |
||||
|
</t> |
||||
|
</td> |
||||
|
</t> |
||||
|
|
||||
|
</tr> |
||||
|
|
||||
|
</t> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
</t> |
||||
|
|
||||
|
|
||||
|
</templates> |
@ -0,0 +1,349 @@ |
|||||
|
<templates> |
||||
|
<t t-name="PartnerTemp"> |
||||
|
<div class=""> |
||||
|
<div class=""> |
||||
|
<h1> |
||||
|
Partner Ledger |
||||
|
</h1> |
||||
|
</div> |
||||
|
|
||||
|
<div> |
||||
|
<div class="filter_view_tb"></div> |
||||
|
</div> |
||||
|
<br></br> |
||||
|
<div> |
||||
|
<div class="table_view_tb" style="right:20px;"></div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</t> |
||||
|
<t t-name="PLTable"> |
||||
|
<div> |
||||
|
<div class="table_main_view"> |
||||
|
<table cellspacing="0" width="100%"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th colspan="6">Partner</th> |
||||
|
<th style="text-align:right;">Debit</th> |
||||
|
<th style="text-align:right;">Credit</th> |
||||
|
<th style="text-align:right;">Balance</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
|
||||
|
<tbody> |
||||
|
<t t-set="none_value" t-value="_"/> |
||||
|
<t t-foreach="report_lines" t-as="account"> |
||||
|
<t t-set="common_id" t-value="0"/> |
||||
|
<tr style="border: 1.5px solid black;" class="pl-line" |
||||
|
data-toggle="collapse" |
||||
|
t-att-data-account-id="account['id']" |
||||
|
t-attf-data-target=".a{{account['id']}}"> |
||||
|
<td colspan="6" style="border: 0px solid black;"> |
||||
|
<i class="fa fa-caret-down" role="img" aria-label="Unfolded" title="Unfolded"></i> |
||||
|
<span> |
||||
|
<t t-esc="account['name']"/> |
||||
|
</span> |
||||
|
</td> |
||||
|
|
||||
|
<t t-if="currency[1] == 'before'"> |
||||
|
<td style="text-align:right;"> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
<t t-raw="account['debit']"/> |
||||
|
</td> |
||||
|
<td style="text-align:right;"> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
<t t-raw="account['credit']"/> |
||||
|
</td> |
||||
|
<td style="text-align:right;"> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
<t t-raw="account['balance']"/> |
||||
|
</td> |
||||
|
|
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<td style="text-align:right;"> |
||||
|
<t t-raw="account['debit']"/> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
<td style="text-align:right;"> |
||||
|
<t t-raw="account['credit']"/> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
<td style="text-align:right;"> |
||||
|
<t t-raw="account['balance']"/> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
|
||||
|
</t> |
||||
|
<t t-set="common_id" t-value="'a'+account['id']"/> |
||||
|
</tr> |
||||
|
<tr t-attf-class="collapse a{{account['id']}}"> |
||||
|
<td colspan="10"> |
||||
|
<ul> |
||||
|
</ul> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</t> |
||||
|
</tbody> |
||||
|
|
||||
|
</table> |
||||
|
</div> |
||||
|
</div> |
||||
|
</t> |
||||
|
|
||||
|
<t t-name="PLFilterView"> |
||||
|
<div class="" style="position: relative;"> |
||||
|
<div class="sub_container_left"> |
||||
|
<div class="report_print"> |
||||
|
<button type="button" class="btn btn-primary" id="pdf" |
||||
|
style="height:25px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD;"> |
||||
|
Print (PDF) |
||||
|
</button> |
||||
|
<button type="button" class="btn btn-primary" id="xlsx" |
||||
|
style="height:25px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD;"> |
||||
|
Export (XLSX) |
||||
|
</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
<br></br> |
||||
|
<div class="sub_container_right" style="width:50%;height:3%;right:0px;top:0px;position: absolute;"> |
||||
|
<div class="" style="right:80x;"> |
||||
|
|
||||
|
<br></br> |
||||
|
<div class="row" style="right:80px;top:0px;position: absolute;width:50;"> |
||||
|
<div class="time_range" style=""> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> |
||||
|
<span class="fa fa-calendar" title="Dates" role="img" aria-label="Dates"></span> |
||||
|
Date Range |
||||
|
</a> |
||||
|
<div class="dropdown-menu" role="menu"> |
||||
|
<div class=""> |
||||
|
<label class="" for="date_from">Start Date :</label> |
||||
|
<div class=""> |
||||
|
<div class="" aria-atomic="true" id=""> |
||||
|
<input type="date" id="date_from"></input> |
||||
|
</div> |
||||
|
</div> |
||||
|
<label class="" for="date_to">End Date :</label> |
||||
|
<div class=""> |
||||
|
<div class="" aria-atomic="true" id=""> |
||||
|
<input type="date" id="date_to"></input> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="partner_filter" style=""> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown"> |
||||
|
<span class="fa fa-users"></span> |
||||
|
Partners: |
||||
|
</a> |
||||
|
<select class="dropdown-menu partners " name="states[]" multiple="multiple"> |
||||
|
<t t-foreach="filter_data.partners_list" t-as="partner"> |
||||
|
<option t-attf-value="{{partner[0]}}"> |
||||
|
<t t-esc="partner[1]"/> |
||||
|
</option> |
||||
|
</t> |
||||
|
</select> |
||||
|
<span id="partner_res"></span> |
||||
|
|
||||
|
</div> |
||||
|
<div class="reconciliation_sts_filter"> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown"> |
||||
|
<span class="fa fa-book"></span> |
||||
|
Reconciliation Status: |
||||
|
</a> |
||||
|
<select class="dropdown-menu reconciled" name="states[]" multiple="multiple"> |
||||
|
<option value="unreconciled">Unreconciled</option> |
||||
|
</select> |
||||
|
<span id="reconciled_res"></span> |
||||
|
|
||||
|
</div> |
||||
|
<div class="acccount_type_filter"> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown"> |
||||
|
<span class="fa fa-book"></span> |
||||
|
Account Type |
||||
|
</a> |
||||
|
<select class="dropdown-menu type" name="states[]" multiple="multiple"> |
||||
|
<t t-foreach="filter_data.account_type_list" t-as="type"> |
||||
|
<option t-attf-value="{{type[0]}}"> |
||||
|
<t t-esc="type[1]"/> |
||||
|
</option> |
||||
|
</t> |
||||
|
</select> |
||||
|
<span id="type_res"></span> |
||||
|
|
||||
|
</div> |
||||
|
<div class="category_filter"> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown"> |
||||
|
<span class="fa fa-filter"></span> |
||||
|
Partner tag: |
||||
|
</a> |
||||
|
<select class="dropdown-menu category" name="states[]" multiple="multiple"> |
||||
|
<t t-foreach="filter_data.category_list" t-as="category"> |
||||
|
<option t-attf-value="{{category[0]}}"> |
||||
|
<t t-esc="category[1]"/> |
||||
|
</option> |
||||
|
</t> |
||||
|
</select> |
||||
|
<span id="category_res"></span> |
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
<div class="journals_filter" style=""> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown"> |
||||
|
<span class="fa fa-book"></span> |
||||
|
Journals: |
||||
|
</a> |
||||
|
<select class="dropdown-menu journals" name="states[]" multiple="multiple"> |
||||
|
<div role="separator" class="dropdown-divider"></div> |
||||
|
<t t-foreach="filter_data.journals_list" t-as="journal"> |
||||
|
<option t-attf-value="{{journal[0]}}"> |
||||
|
<t t-esc="journal[1]"/> |
||||
|
</option> |
||||
|
</t> |
||||
|
</select> |
||||
|
<span id="journal_res"></span> |
||||
|
</div> |
||||
|
<div class="acc_filter"> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown"> |
||||
|
<span class="fa fa-book"></span> |
||||
|
Accounts: |
||||
|
</a> |
||||
|
<select class="dropdown-menu account" name="states[]" multiple="multiple"> |
||||
|
<t t-foreach="filter_data.accounts_list" t-as="account"> |
||||
|
<option t-attf-value="{{account[0]}}"> |
||||
|
<t t-esc="account[1]"/> |
||||
|
</option> |
||||
|
</t> |
||||
|
</select> |
||||
|
<span id="account_res"></span> |
||||
|
|
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="search-Target-move" style=""> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown"> |
||||
|
<span class="fa fa-filter"></span> |
||||
|
Target Move: |
||||
|
</a> |
||||
|
<select id="entries" class="dropdown-menu target_move" name="states[]"> |
||||
|
<div role="separator" class="dropdown-divider"></div> |
||||
|
<option value="posted">Posted Entries</option> |
||||
|
<option value="all">All Entries</option> |
||||
|
</select> |
||||
|
<span id="post_res"></span> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
<div style=""> |
||||
|
<button type="button" id="apply_filter" class="btn btn-primary" |
||||
|
style="top:0px;height:25px;right:0px;position: absolute;color:white;background-color: #00A0AD;border-color: #00A0AD;"> |
||||
|
Apply |
||||
|
</button> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</t> |
||||
|
|
||||
|
<t t-name="SubSectionPL"> |
||||
|
<div class="pl-table-div"> |
||||
|
<table class="table table-sm o_main_table" |
||||
|
style="border: 0px solid black;display compact;"> |
||||
|
<thead> |
||||
|
<tr style=""> |
||||
|
<th>Date</th> |
||||
|
<th>JRNL</th> |
||||
|
<th>Account</th> |
||||
|
<th>Move</th> |
||||
|
<th>Entry Label</th> |
||||
|
<th style="text-align:right;">Debit</th> |
||||
|
<th style="text-align:right;">Credit</th> |
||||
|
<th style="text-align:right;">Balance</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<t t-foreach="account_data" t-as="account_line"> |
||||
|
|
||||
|
<t t-set="style" t-value="''"/> |
||||
|
<tr> |
||||
|
<td> |
||||
|
<t t-if="account_line.ldate"> |
||||
|
<div class="dropdown dropdown-toggle"> |
||||
|
<a data-toggle="dropdown" href="#"> |
||||
|
<span class="caret"></span> |
||||
|
<span> |
||||
|
<t t-esc="account_line.ldate"/> |
||||
|
</span> |
||||
|
</a> |
||||
|
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu"> |
||||
|
<li> |
||||
|
<a class="view-account-move" tabindex="-1" href="#" |
||||
|
t-att-data-move-id="account_line.move_id"> |
||||
|
View Source move |
||||
|
|
||||
|
</a> |
||||
|
</li> |
||||
|
</ul> |
||||
|
</div> |
||||
|
</t> |
||||
|
</td> |
||||
|
<td> |
||||
|
<t t-esc="account_line.lcode"/> |
||||
|
|
||||
|
</td> |
||||
|
<td> |
||||
|
<span> |
||||
|
<t t-esc="account_line.account_name"/> |
||||
|
</span> |
||||
|
</td> |
||||
|
<td t-att-style="style"> |
||||
|
<t t-esc="account_line.move_name"/> |
||||
|
</td> |
||||
|
<td t-att-style="style"> |
||||
|
<t t-esc="account_line.lname"/> |
||||
|
</td> |
||||
|
<t t-if="account_line.currency_position == 'before'"> |
||||
|
<td t-att-style="style" class="amt"> |
||||
|
<t t-raw="account_line.currency_code"/> |
||||
|
<t t-raw="account_line.debit"/> |
||||
|
|
||||
|
</td> |
||||
|
<td t-att-style="style" class="amt"> |
||||
|
<t t-raw="account_line.currency_code"/> |
||||
|
<t t-raw="account_line.credit"/> |
||||
|
|
||||
|
</td> |
||||
|
<td t-att-style="style" class="amt"> |
||||
|
<t t-raw="account_line.currency_code"/> |
||||
|
<t t-raw="account_line.balance"/> |
||||
|
|
||||
|
</td> |
||||
|
|
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<td t-att-style="style" class="amt"> |
||||
|
<t t-raw="account_line.debit"/> |
||||
|
<t t-raw="account_line.currency_code"/> |
||||
|
</td> |
||||
|
<td t-att-style="style" class="amt"> |
||||
|
<t t-raw="account_line.credit"/> |
||||
|
<t t-raw="account_line.currency_code"/> |
||||
|
</td> |
||||
|
<td t-att-style="style" class="amt"> |
||||
|
<t t-raw="account_line.balance"/> |
||||
|
<t t-raw="account_line.currency_code"/> |
||||
|
</td> |
||||
|
|
||||
|
</t> |
||||
|
|
||||
|
</tr> |
||||
|
</t> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
</t> |
||||
|
|
||||
|
</templates> |
@ -0,0 +1,281 @@ |
|||||
|
<templates> |
||||
|
<t t-name="TrialTemp"> |
||||
|
<div class=""> |
||||
|
<div class=""> |
||||
|
<h1> |
||||
|
TRIAL BALANCE |
||||
|
</h1> |
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
<div> |
||||
|
<div class="filter_view_tb"></div> |
||||
|
</div> |
||||
|
<br></br> |
||||
|
<div> |
||||
|
<div class="table_view_tb" style="right:20px;"></div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</t> |
||||
|
<t t-name="TrialTable"> |
||||
|
<div> |
||||
|
<div class="table_main_view"> |
||||
|
<table cellspacing="0" width="100%"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th colspan="6">Account</th> |
||||
|
<t t-if="filter['date_from']"> |
||||
|
<th class="mon_fld">Initial Debit</th> |
||||
|
<th class="mon_fld">Initial Credit</th> |
||||
|
|
||||
|
</t> |
||||
|
<th class="mon_fld">Debit</th> |
||||
|
<th class="mon_fld">Credit</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
|
||||
|
<tbody> |
||||
|
|
||||
|
<t t-set="none_value" t-value="_"/> |
||||
|
<t t-foreach="report_lines" t-as="account"> |
||||
|
<t t-set="common_id" t-value="0"/> |
||||
|
<tr style="border: 1.5px solid black;" class="gl-line" |
||||
|
data-toggle="collapse" |
||||
|
t-att-data-account-id="account['id']" |
||||
|
t-attf-data-target=".a{{account['id']}}"> |
||||
|
<td colspan="6" style="border: 0px solid black;"> |
||||
|
<span> |
||||
|
<t t-esc="account['code']"/> |
||||
|
- |
||||
|
<t t-esc="account['name']"/> |
||||
|
</span> |
||||
|
<div class="" style="display: inline-block;"> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown" |
||||
|
aria-expanded="false"> |
||||
|
</a> |
||||
|
<div class="dropdown-menu " role="menu"> |
||||
|
<div class="o_foldable_menu o_closed_menu "> |
||||
|
<div class="form-group "> |
||||
|
<div class="show-gl" aria-atomic="true" id="" data-target-input=""> |
||||
|
<li role="presentation"> |
||||
|
<a role="menuitem" style="background-color:grey;" |
||||
|
t-att-data-account-id="account['id']" class="show-gl"> |
||||
|
View General Ledger |
||||
|
</a> |
||||
|
</li> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</td> |
||||
|
<t t-if="filter['date_from']"> |
||||
|
<t t-if="account['Init_balance']"> |
||||
|
<t t-if="currency[1] == 'before'"> |
||||
|
|
||||
|
<td class="mon_fld"> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
<t t-raw="account['Init_balance']['debit']"/> |
||||
|
</td> |
||||
|
<td class="mon_fld"> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
<t t-raw="account['Init_balance']['credit']"/> |
||||
|
</td> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<td class="mon_fld"> |
||||
|
<t t-raw="account['Init_balance']['debit']"/> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
<td class="mon_fld"> |
||||
|
<t t-raw="account['Init_balance']['credit']"/> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
|
||||
|
|
||||
|
</t> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<t t-if="currency[1] == 'before'"> |
||||
|
<td class="mon_fld"> |
||||
|
<t t-esc="currency[0]"/>0 |
||||
|
</td> |
||||
|
<td class="mon_fld"> |
||||
|
<t t-esc="currency[0]"/>0 |
||||
|
</td> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<td class="mon_fld"> |
||||
|
0 |
||||
|
<t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
<td class="mon_fld"> |
||||
|
0 |
||||
|
<t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
</t> |
||||
|
</t> |
||||
|
</t> |
||||
|
<t t-if="currency[1] == 'before'"> |
||||
|
<td class="mon_fld"> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
<t t-raw="account['debit']"/> |
||||
|
</td> |
||||
|
<td class="mon_fld"> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
<t t-raw="account['credit']"/> |
||||
|
</td> |
||||
|
|
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
<td class="mon_fld"> |
||||
|
<t t-raw="account['debit']"/> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
<td class="mon_fld"> |
||||
|
<t t-raw="account['credit']"/> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
</td> |
||||
|
|
||||
|
</t> |
||||
|
|
||||
|
<t t-set="common_id" t-value="'a'+account['id']"/> |
||||
|
</tr> |
||||
|
</t> |
||||
|
<td colspan="6" style="" class=""> |
||||
|
<strong>Total</strong> |
||||
|
</td> |
||||
|
<t t-if="filter['date_from']"> |
||||
|
|
||||
|
<td class="mon_fld" style=""> |
||||
|
<strong></strong> |
||||
|
</td> |
||||
|
<td class="mon_fld" style=""> |
||||
|
<strong></strong> |
||||
|
</td> |
||||
|
</t> |
||||
|
<t t-if="currency[1] == 'before'"> |
||||
|
<td class="mon_fld" style=""> |
||||
|
<strong> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
<t t-raw="Math.round(debit_total * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
</strong> |
||||
|
</td> |
||||
|
<td class="mon_fld" style=""> |
||||
|
<strong> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
<t t-raw="Math.round(credit_total * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
</strong> |
||||
|
</td> |
||||
|
</t> |
||||
|
<t t-else=""> |
||||
|
|
||||
|
<td class="mon_fld" style=""> |
||||
|
<strong> |
||||
|
<t t-raw="Math.round(debit_total * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
</strong> |
||||
|
</td> |
||||
|
<td class="mon_fld" style=""> |
||||
|
<strong> |
||||
|
<t t-raw="Math.round(credit_total * Math.pow(10, 2)) / Math.pow(10, 2)"/> |
||||
|
<t t-esc="currency[0]"/> |
||||
|
</strong> |
||||
|
</td> |
||||
|
</t> |
||||
|
|
||||
|
</tbody> |
||||
|
|
||||
|
</table> |
||||
|
</div> |
||||
|
</div> |
||||
|
</t> |
||||
|
|
||||
|
|
||||
|
<t t-name="TrialFilterView"> |
||||
|
|
||||
|
<div class="" style="position: relative;"> |
||||
|
<div class="sub_container_left"> |
||||
|
<div class="report_print"> |
||||
|
<button type="button" class="btn btn-primary" id="pdf" |
||||
|
style="height:25px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD;"> |
||||
|
Print (PDF) |
||||
|
</button> |
||||
|
<button type="button" class="btn btn-primary" id="xlsx" |
||||
|
style="height:25px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD;"> |
||||
|
Export (XLSX) |
||||
|
</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
<br></br> |
||||
|
<div class="sub_container_right" style="width:50%;height:3%;right:0px;top:0px;position: absolute;"> |
||||
|
<div class="" style="right:80x;"> |
||||
|
|
||||
|
<br></br> |
||||
|
<div class="row" style="right:80px;top:0px;position: absolute;width:50;"> |
||||
|
<div class="time_range" style=""> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> |
||||
|
<span class="fa fa-calendar" title="Dates" role="img" aria-label="Dates"></span> |
||||
|
Date Range |
||||
|
</a> |
||||
|
<div class="dropdown-menu" role="menu"> |
||||
|
<div class=""> |
||||
|
<label class="" for="date_from">Start Date :</label> |
||||
|
<div class=""> |
||||
|
<div class="" aria-atomic="true" id=""> |
||||
|
<input type="date" id="date_from"></input> |
||||
|
</div> |
||||
|
</div> |
||||
|
<label class="" for="date_to">End Date :</label> |
||||
|
<div class=""> |
||||
|
<div class="" aria-atomic="true" id=""> |
||||
|
<input type="date" id="date_to"></input> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="journals_filter" style=""> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown"> |
||||
|
<span class="fa fa-book"></span> |
||||
|
Journals: |
||||
|
</a> |
||||
|
<select class="dropdown-menu journals" name="states[]" multiple="multiple"> |
||||
|
<div role="separator" class="dropdown-divider"></div> |
||||
|
<t t-foreach="filter_data.journals_list" t-as="journal"> |
||||
|
<option t-attf-value="{{journal[0]}}"> |
||||
|
<t t-esc="journal[1]"/> |
||||
|
</option> |
||||
|
</t> |
||||
|
</select> |
||||
|
<span id="journal_res"></span> |
||||
|
</div> |
||||
|
|
||||
|
<div class="search-Target-move" style=""> |
||||
|
<a type="button" class="dropdown-toggle" data-toggle="dropdown"> |
||||
|
<span class="fa fa-filter"></span> |
||||
|
Target Move: |
||||
|
</a> |
||||
|
<select id="entries" class="dropdown-menu target_move" name="states[]"> |
||||
|
<div role="separator" class="dropdown-divider"></div> |
||||
|
<option value="all">All Entries</option> |
||||
|
<option value="posted">Posted Entries</option> |
||||
|
</select> |
||||
|
<span id="post_res"></span> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
<div style=""> |
||||
|
<button type="button" id="apply_filter" class="btn btn-primary" |
||||
|
style="top:0px;height:25px;right:0px;position: absolute;color:white;background-color: #00A0AD;border-color: #00A0AD;"> |
||||
|
Apply |
||||
|
</button> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</t> |
||||
|
|
||||
|
</templates> |
@ -0,0 +1,31 @@ |
|||||
|
|
||||
|
<odoo> |
||||
|
|
||||
|
<record id="base_accounting_kit.menu_Balance_report" model="ir.ui.menu"> |
||||
|
<field name="active" eval="False"/> |
||||
|
</record> |
||||
|
<record id="base_accounting_kit.menu_general_ledger" model="ir.ui.menu"> |
||||
|
<field name="active" eval="False"/> |
||||
|
</record> |
||||
|
<record id="base_accounting_kit.menu_aged_trial_balance" model="ir.ui.menu"> |
||||
|
<field name="active" eval="False"/> |
||||
|
</record> |
||||
|
<record id="base_accounting_kit.menu_partner_ledger" model="ir.ui.menu"> |
||||
|
<field name="active" eval="False"/> |
||||
|
</record> |
||||
|
<record id="base_accounting_kit._account_financial_reports_balance_sheet" model="ir.ui.menu"> |
||||
|
<field name="active" eval="False"/> |
||||
|
</record> |
||||
|
<record id="base_accounting_kit.account_financial_reports_profit_loss" model="ir.ui.menu"> |
||||
|
<field name="active" eval="False"/> |
||||
|
</record> |
||||
|
<record id="base_accounting_kit.account_reports_daily_reports" model="ir.ui.menu"> |
||||
|
<field name="active" eval="False"/> |
||||
|
</record> |
||||
|
<record id="base_accounting_kit.menu_account_cash_flow_report" model="ir.ui.menu"> |
||||
|
<field name="active" eval="False"/> |
||||
|
</record> |
||||
|
|
||||
|
|
||||
|
</odoo> |
||||
|
|
@ -0,0 +1,23 @@ |
|||||
|
<odoo> |
||||
|
<data> |
||||
|
|
||||
|
<template id="assets" inherit_id="web.assets_backend"> |
||||
|
<xpath expr="." position="inside"> |
||||
|
<link rel="stylesheet" |
||||
|
href="/dynamic_accounts_report/static/src/css/report.css" |
||||
|
id="reports-stylesheet"/> |
||||
|
<script type="text/javascript" src="/dynamic_accounts_report/static/src/js/action_manager.js"/> |
||||
|
<script type="text/javascript" src="/dynamic_accounts_report/static/src/js/general_ledger.js"/> |
||||
|
<script type="text/javascript" src="/dynamic_accounts_report/static/src/js/trial_balance.js"/> |
||||
|
<script type="text/javascript" src="/dynamic_accounts_report/static/src/js/cash_flow.js"/> |
||||
|
<script type="text/javascript" src="/dynamic_accounts_report/static/src/js/financial_reports.js"/> |
||||
|
<script type="text/javascript" src="/dynamic_accounts_report/static/src/js/partner_ledger.js"/> |
||||
|
<script type="text/javascript" src="/dynamic_accounts_report/static/src/js/ageing.js"/> |
||||
|
<script type="text/javascript" src="/dynamic_accounts_report/static/src/js/daybook.js"/> |
||||
|
|
||||
|
</xpath> |
||||
|
</template> |
||||
|
|
||||
|
|
||||
|
</data> |
||||
|
</odoo> |
@ -0,0 +1,80 @@ |
|||||
|
<odoo> |
||||
|
<data> |
||||
|
<menuitem id="dynamic_report_accounting" sequence="19" |
||||
|
name="Dynamic Financial Reports" parent="account.menu_finance_reports"/> |
||||
|
|
||||
|
<record id="action_general_ledger" model="ir.actions.client"> |
||||
|
<field name="name">General Ledger</field> |
||||
|
<field name="tag">g_l</field> |
||||
|
</record> |
||||
|
<menuitem id="menu_general_ledger" action="action_general_ledger" |
||||
|
name="General Ledger" parent="dynamic_report_accounting"/> |
||||
|
|
||||
|
<record id="action_trial_balance" model="ir.actions.client"> |
||||
|
<field name="name">Trial Balance</field> |
||||
|
<field name="tag">t_b</field> |
||||
|
</record> |
||||
|
<menuitem id="menu_trial_balance" action="action_trial_balance" |
||||
|
name="Trial Balance" parent="dynamic_report_accounting"/> |
||||
|
|
||||
|
|
||||
|
<record id="action_partner_ledger" model="ir.actions.client"> |
||||
|
<field name="name">Partner Ledger</field> |
||||
|
<field name="tag">p_l</field> |
||||
|
</record> |
||||
|
<menuitem id="menu_partner_ledger" action="action_partner_ledger" |
||||
|
name="Partner Ledger" parent="dynamic_report_accounting"/> |
||||
|
|
||||
|
<record id="action_ageing_partner" model="ir.actions.client"> |
||||
|
<field name="name">Partner Ageing</field> |
||||
|
<field name="tag">p_a</field> |
||||
|
</record> |
||||
|
<menuitem id="menu_report_ageing" action="action_ageing_partner" |
||||
|
name="Partner Ageing" parent="dynamic_report_accounting"/> |
||||
|
|
||||
|
<record id="action_day_book" model="ir.actions.client"> |
||||
|
<field name="name">Day Book</field> |
||||
|
<field name="tag">d_b</field> |
||||
|
</record> |
||||
|
<menuitem id="menu_report_daybook" action="action_day_book" |
||||
|
name="Day Book" parent="dynamic_report_accounting"/> |
||||
|
|
||||
|
<record id="action_bank_book" model="ir.actions.client"> |
||||
|
<field name="name">Bank Book</field> |
||||
|
<field name="tag">g_l</field> |
||||
|
</record> |
||||
|
<menuitem id="menu_bank_book" action="action_bank_book" |
||||
|
name="Bank Book" parent="dynamic_report_accounting"/> |
||||
|
|
||||
|
<record id="action_cash_book" model="ir.actions.client"> |
||||
|
<field name="name">Cash Book</field> |
||||
|
<field name="tag">g_l</field> |
||||
|
</record> |
||||
|
<menuitem id="menu_cash_book" action="action_cash_book" |
||||
|
name="Cash Book" parent="dynamic_report_accounting"/> |
||||
|
|
||||
|
<record id="action_dynamic_balance_sheet" model="ir.actions.client"> |
||||
|
<field name="name">Balance Sheet</field> |
||||
|
<field name="tag">dfr_n</field> |
||||
|
</record> |
||||
|
|
||||
|
<record id="action_dynamic_profit_and_loss" model="ir.actions.client"> |
||||
|
<field name="name">Profit and Loss</field> |
||||
|
<field name="tag">dfr_n</field> |
||||
|
</record> |
||||
|
|
||||
|
<menuitem id="menu_balance_sheet_report" action="action_dynamic_balance_sheet" |
||||
|
name="Balance Sheet" parent="dynamic_report_accounting"/> |
||||
|
|
||||
|
<menuitem id="menu_profit_and_loss_report" action="action_dynamic_profit_and_loss" |
||||
|
name="Profit and Loss" parent="dynamic_report_accounting"/> |
||||
|
|
||||
|
<record id="action_cash_flow" model="ir.actions.client"> |
||||
|
<field name="name">Cash Flow Statements</field> |
||||
|
<field name="tag">c_f</field> |
||||
|
</record> |
||||
|
<menuitem id="menu_cash_flow" action="action_cash_flow" |
||||
|
name="Cash Flow Statements" parent="dynamic_report_accounting"/> |
||||
|
|
||||
|
</data> |
||||
|
</odoo> |
@ -0,0 +1,8 @@ |
|||||
|
from . import general_ledger |
||||
|
from . import trial_balance |
||||
|
from . import cash_flow |
||||
|
from . import balance_sheet |
||||
|
from . import balance_sheet_config |
||||
|
from . import partner_leadger |
||||
|
from . import ageing |
||||
|
from . import daybook |
@ -0,0 +1,678 @@ |
|||||
|
import time |
||||
|
from datetime import datetime |
||||
|
|
||||
|
from dateutil.relativedelta import relativedelta |
||||
|
from odoo import fields, models, api, _ |
||||
|
from odoo.tools import float_is_zero |
||||
|
|
||||
|
import io |
||||
|
import json |
||||
|
|
||||
|
try: |
||||
|
from odoo.tools.misc import xlsxwriter |
||||
|
except ImportError: |
||||
|
import xlsxwriter |
||||
|
|
||||
|
|
||||
|
class AgeingView(models.TransientModel): |
||||
|
_inherit = "account.common.report" |
||||
|
_name = 'account.partner.ageing' |
||||
|
|
||||
|
period_length = fields.Integer(string='Period Length (days)', |
||||
|
required=True, default=20) |
||||
|
date_from = fields.Date(default=lambda *a: time.strftime('%Y-%m-%d')) |
||||
|
result_selection = fields.Selection([('customer', 'Receivable Accounts'), |
||||
|
('supplier', 'Payable Accounts'), |
||||
|
('customer_supplier', |
||||
|
'Receivable and Payable Accounts') |
||||
|
], string="Partner's", required=True, |
||||
|
default='customer') |
||||
|
|
||||
|
partner_ids = fields.Many2many( |
||||
|
'res.partner', string='Partner' |
||||
|
) |
||||
|
partner_category_ids = fields.Many2many( |
||||
|
'res.partner.category', string='Partner Tag', |
||||
|
) |
||||
|
|
||||
|
@api.model |
||||
|
def view_report(self, option): |
||||
|
r = self.env['account.partner.ageing'].search([('id', '=', option[0])]) |
||||
|
|
||||
|
data = { |
||||
|
'result_selection': r.result_selection, |
||||
|
'model': self, |
||||
|
'journals': r.journal_ids, |
||||
|
'target_move': r.target_move, |
||||
|
'period_length': r.period_length, |
||||
|
'partners': r.partner_ids, |
||||
|
'partner_tags': r.partner_category_ids, |
||||
|
|
||||
|
} |
||||
|
if r.date_from: |
||||
|
data.update({ |
||||
|
'date_from': r.date_from, |
||||
|
}) |
||||
|
|
||||
|
filters = self.get_filter(option) |
||||
|
|
||||
|
records = self._get_report_values(data) |
||||
|
|
||||
|
currency = self._get_currency() |
||||
|
|
||||
|
return { |
||||
|
'name': "Partner Ageing", |
||||
|
'type': 'ir.actions.client', |
||||
|
'tag': 'p_a', |
||||
|
'filters': filters, |
||||
|
'report_lines': records['Partners'], |
||||
|
'currency': currency, |
||||
|
} |
||||
|
|
||||
|
def get_filter(self, option): |
||||
|
data = self.get_filter_data(option) |
||||
|
filters = {} |
||||
|
|
||||
|
if data.get('target_move'): |
||||
|
filters['target_move'] = data.get('target_move') |
||||
|
if data.get('date_from'): |
||||
|
filters['date_from'] = data.get('date_from') |
||||
|
if data.get('result_selection') == 'customer': |
||||
|
filters['result_selection'] = 'Receivable' |
||||
|
elif data.get('result_selection') == 'supplier': |
||||
|
filters['result_selection'] = 'Payable' |
||||
|
else: |
||||
|
filters['result_selection'] = 'Receivable and Payable' |
||||
|
|
||||
|
if data.get('partners'): |
||||
|
filters['partners'] = self.env['res.partner'].browse( |
||||
|
data.get('partners')).mapped('name') |
||||
|
else: |
||||
|
filters['partners'] = ['All'] |
||||
|
|
||||
|
if data.get('partner_tags', []): |
||||
|
filters['partner_tags'] = self.env['res.partner.category'].browse( |
||||
|
data.get('partner_tags', [])).mapped('name') |
||||
|
else: |
||||
|
filters['partner_tags'] = ['All'] |
||||
|
|
||||
|
filters['company_id'] = '' |
||||
|
filters['company_name'] = data.get('company_name') |
||||
|
filters['partners_list'] = data.get('partners_list') |
||||
|
filters['category_list'] = data.get('category_list') |
||||
|
filters['company_name'] = data.get('company_name') |
||||
|
|
||||
|
|
||||
|
return filters |
||||
|
|
||||
|
def get_filter_data(self, option): |
||||
|
r = self.env['account.partner.ageing'].search([('id', '=', option[0])]) |
||||
|
default_filters = {} |
||||
|
company_id = r.env.user.company_id |
||||
|
company_domain = [('company_id', '=', company_id.id)] |
||||
|
partner = r.partner_ids if r.partner_ids else self.env[ |
||||
|
'res.partner'].search([]) |
||||
|
categories = r.partner_category_ids if r.partner_category_ids \ |
||||
|
else self.env['res.partner.category'].search([]) |
||||
|
|
||||
|
filter_dict = { |
||||
|
'partners': r.partner_ids.ids, |
||||
|
'partner_tags': r.partner_category_ids.ids, |
||||
|
'company_id': company_id.id, |
||||
|
'date_from': r.date_from, |
||||
|
|
||||
|
'target_move': r.target_move, |
||||
|
'result_selection': r.result_selection, |
||||
|
'partners_list': [(p.id, p.name) for p in partner], |
||||
|
'category_list': [(c.id, c.name) for c in categories], |
||||
|
'company_name': company_id and company_id.name, |
||||
|
} |
||||
|
filter_dict.update(default_filters) |
||||
|
return filter_dict |
||||
|
|
||||
|
def _get_report_values(self, data): |
||||
|
docs = data['model'] |
||||
|
date_from = data.get('date_from').strftime('%Y-%m-%d') |
||||
|
if data['result_selection'] == 'customer': |
||||
|
account_type = ['receivable'] |
||||
|
elif data['result_selection'] == 'supplier': |
||||
|
account_type = ['payable'] |
||||
|
else: |
||||
|
account_type = ['payable', 'receivable'] |
||||
|
target_move = data['target_move'] |
||||
|
partners = data.get('partners') |
||||
|
if data['partner_tags']: |
||||
|
partners = self.env['res.partner'].search( |
||||
|
[('category_id', 'in', data['partner_tags'].ids)]) |
||||
|
|
||||
|
account_res = self._get_partner_move_lines(data, partners, date_from, |
||||
|
target_move, |
||||
|
account_type, |
||||
|
data['period_length']) |
||||
|
|
||||
|
return { |
||||
|
'doc_ids': self.ids, |
||||
|
'docs': docs, |
||||
|
'time': time, |
||||
|
'Partners': account_res, |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@api.model |
||||
|
def create(self, vals): |
||||
|
vals['target_move'] = 'all' |
||||
|
res = super(AgeingView, self).create(vals) |
||||
|
return res |
||||
|
|
||||
|
def write(self, vals): |
||||
|
|
||||
|
if vals.get('partner_ids'): |
||||
|
vals.update( |
||||
|
{'partner_ids': [(4, j) for j in vals.get('partner_ids')]}) |
||||
|
if not vals.get('partner_ids'): |
||||
|
vals.update({'partner_ids': [(5,)]}) |
||||
|
if vals.get('partner_category_ids'): |
||||
|
vals.update({'partner_category_ids': [(4, j) for j in vals.get( |
||||
|
'partner_category_ids')]}) |
||||
|
if not vals.get('partner_category_ids'): |
||||
|
vals.update({'partner_category_ids': [(5,)]}) |
||||
|
|
||||
|
res = super(AgeingView, self).write(vals) |
||||
|
return res |
||||
|
|
||||
|
def _get_partner_move_lines(self, data, partners, date_from, target_move, |
||||
|
account_type, |
||||
|
period_length): |
||||
|
|
||||
|
periods = {} |
||||
|
start = datetime.strptime(date_from, "%Y-%m-%d") |
||||
|
date_from = datetime.strptime(date_from, "%Y-%m-%d").date() |
||||
|
for i in range(5)[::-1]: |
||||
|
stop = start - relativedelta(days=period_length) |
||||
|
period_name = str((5 - (i + 1)) * period_length + 1) + '-' + str( |
||||
|
(5 - i) * period_length) |
||||
|
period_stop = (start - relativedelta(days=1)).strftime('%Y-%m-%d') |
||||
|
if i == 0: |
||||
|
period_name = '+' + str(4 * period_length) |
||||
|
periods[str(i)] = { |
||||
|
'name': period_name, |
||||
|
'stop': period_stop, |
||||
|
'start': (i != 0 and stop.strftime('%Y-%m-%d') or False), |
||||
|
} |
||||
|
start = stop |
||||
|
res = [] |
||||
|
total = [] |
||||
|
cr = self.env.cr |
||||
|
user_company = self.env.company |
||||
|
|
||||
|
user_currency = user_company.currency_id |
||||
|
ResCurrency = self.env['res.currency'].with_context(date=date_from) |
||||
|
company_ids = self._context.get('company_ids') or [user_company.id] |
||||
|
move_state = ['draft', 'posted'] |
||||
|
if target_move == 'posted': |
||||
|
move_state = ['posted'] |
||||
|
arg_list = (tuple(move_state), tuple(account_type)) |
||||
|
|
||||
|
reconciliation_clause = '(l.reconciled IS FALSE)' |
||||
|
cr.execute( |
||||
|
'SELECT debit_move_id, credit_move_id FROM account_partial_reconcile where max_date > %s', |
||||
|
(date_from,)) |
||||
|
reconciled_after_date = [] |
||||
|
for row in cr.fetchall(): |
||||
|
reconciled_after_date += [row[0], row[1]] |
||||
|
if reconciled_after_date: |
||||
|
reconciliation_clause = '(l.reconciled IS FALSE OR l.id IN %s)' |
||||
|
arg_list += (tuple(reconciled_after_date),) |
||||
|
|
||||
|
arg_list += (date_from, tuple(company_ids),) |
||||
|
partner_list = '(l.partner_id IS NOT NULL)' |
||||
|
if partners: |
||||
|
list = tuple(partners.ids) + tuple([0]) |
||||
|
if list: |
||||
|
partner_list = '(l.partner_id IS NULL OR l.partner_id IN %s)' |
||||
|
arg_list += (tuple(list),) |
||||
|
query = ''' |
||||
|
SELECT DISTINCT l.partner_id, UPPER(res_partner.name) |
||||
|
FROM account_move_line AS l left join res_partner on l.partner_id = res_partner.id, account_account, account_move am |
||||
|
WHERE (l.account_id = account_account.id) |
||||
|
AND (l.move_id = am.id) |
||||
|
AND (am.state IN %s) |
||||
|
AND (account_account.internal_type IN %s) |
||||
|
|
||||
|
AND ''' + reconciliation_clause + ''' |
||||
|
AND (l.date <= %s) |
||||
|
AND l.company_id IN %s |
||||
|
AND ''' + partner_list + ''' |
||||
|
|
||||
|
ORDER BY UPPER(res_partner.name)''' |
||||
|
cr.execute(query, arg_list) |
||||
|
|
||||
|
|
||||
|
partners = cr.dictfetchall() |
||||
|
|
||||
|
# put a total of 0 |
||||
|
for i in range(7): |
||||
|
total.append(0) |
||||
|
|
||||
|
# Build a string like (1,2,3) for easy use in SQL query |
||||
|
partner_ids = [partner['partner_id'] for partner in partners if |
||||
|
partner['partner_id']] |
||||
|
|
||||
|
lines = dict( |
||||
|
(partner['partner_id'] or False, []) for partner in partners) |
||||
|
if not partner_ids: |
||||
|
return [], [], {} |
||||
|
|
||||
|
# This dictionary will store the not due amount of all partners |
||||
|
undue_amounts = {} |
||||
|
query = '''SELECT l.id |
||||
|
FROM account_move_line AS l, account_account, account_move am |
||||
|
WHERE (l.account_id = account_account.id) AND (l.move_id = am.id) |
||||
|
AND (am.state IN %s) |
||||
|
AND (account_account.internal_type IN %s) |
||||
|
AND (COALESCE(l.date_maturity,l.date) >= %s)\ |
||||
|
AND ((l.partner_id IN %s) OR (l.partner_id IS NULL)) |
||||
|
AND (l.date <= %s) |
||||
|
AND l.company_id IN %s''' |
||||
|
cr.execute(query, ( |
||||
|
tuple(move_state), tuple(account_type), date_from, |
||||
|
tuple(partner_ids), date_from, tuple(company_ids))) |
||||
|
aml_ids = cr.fetchall() |
||||
|
aml_ids = aml_ids and [x[0] for x in aml_ids] or [] |
||||
|
for line in self.env['account.move.line'].browse(aml_ids): |
||||
|
partner_id = line.partner_id.id or False |
||||
|
move_id = line.move_id.id |
||||
|
move_name = line.move_id.name |
||||
|
date_maturity = line.date_maturity |
||||
|
account_id = line.account_id.name |
||||
|
account_code = line.account_id.code |
||||
|
jrnl_id = line.journal_id.name |
||||
|
currency_id = line.company_id.currency_id.position |
||||
|
currency_symbol = line.company_id.currency_id.symbol |
||||
|
|
||||
|
if partner_id not in undue_amounts: |
||||
|
undue_amounts[partner_id] = 0.0 |
||||
|
line_amount = ResCurrency._compute(line.company_id.currency_id, |
||||
|
user_currency, line.balance) |
||||
|
if user_currency.is_zero(line_amount): |
||||
|
continue |
||||
|
for partial_line in line.matched_debit_ids: |
||||
|
if partial_line.max_date <= date_from: |
||||
|
line_amount += ResCurrency._compute( |
||||
|
partial_line.company_id.currency_id, user_currency, |
||||
|
partial_line.amount) |
||||
|
for partial_line in line.matched_credit_ids: |
||||
|
if partial_line.max_date <= date_from: |
||||
|
line_amount -= ResCurrency._compute( |
||||
|
partial_line.company_id.currency_id, user_currency, |
||||
|
partial_line.amount) |
||||
|
if not self.env.company.currency_id.is_zero(line_amount): |
||||
|
undue_amounts[partner_id] += line_amount |
||||
|
lines[partner_id].append({ |
||||
|
'line': line, |
||||
|
'partner_id': partner_id, |
||||
|
'move': move_name, |
||||
|
'jrnl': jrnl_id, |
||||
|
'currency': currency_id, |
||||
|
'symbol': currency_symbol, |
||||
|
'acc_name': account_id, |
||||
|
'mov_id': move_id, |
||||
|
'acc_code': account_code, |
||||
|
'date': date_maturity, |
||||
|
'amount': line_amount, |
||||
|
'period6': 6, |
||||
|
}) |
||||
|
|
||||
|
# Use one query per period and store results in history (a list variable) |
||||
|
# Each history will contain: history[1] = {'<partner_id>': <partner_debit-credit>} |
||||
|
history = [] |
||||
|
for i in range(5): |
||||
|
args_list = ( |
||||
|
tuple(move_state), tuple(account_type), tuple(partner_ids),) |
||||
|
dates_query = '(COALESCE(l.date_maturity,l.date)' |
||||
|
|
||||
|
if periods[str(i)]['start'] and periods[str(i)]['stop']: |
||||
|
dates_query += ' BETWEEN %s AND %s)' |
||||
|
|
||||
|
args_list += ( |
||||
|
periods[str(i)]['start'], periods[str(i)]['stop']) |
||||
|
elif periods[str(i)]['start']: |
||||
|
dates_query += ' >= %s)' |
||||
|
|
||||
|
args_list += (periods[str(i)]['start'],) |
||||
|
else: |
||||
|
dates_query += ' <= %s)' |
||||
|
args_list += (periods[str(i)]['stop'],) |
||||
|
|
||||
|
args_list += (date_from, tuple(company_ids)) |
||||
|
|
||||
|
query = '''SELECT l.id |
||||
|
FROM account_move_line AS l, account_account, account_move am |
||||
|
WHERE (l.account_id = account_account.id) AND (l.move_id = am.id) |
||||
|
AND (am.state IN %s) |
||||
|
AND (account_account.internal_type IN %s) |
||||
|
AND ((l.partner_id IN %s) OR (l.partner_id IS NULL)) |
||||
|
AND ''' + dates_query + ''' |
||||
|
|
||||
|
|
||||
|
AND (l.date <= %s) |
||||
|
AND l.company_id IN %s''' |
||||
|
cr.execute(query, args_list) |
||||
|
|
||||
|
partners_amount = {} |
||||
|
aml_ids = cr.fetchall() |
||||
|
aml_ids = aml_ids and [x[0] for x in aml_ids] or [] |
||||
|
for line in self.env['account.move.line'].browse(aml_ids): |
||||
|
partner_id = line.partner_id.id or False |
||||
|
move_id = line.move_id.id |
||||
|
move_name = line.move_id.name |
||||
|
date_maturity = line.date_maturity |
||||
|
account_id = line.account_id.name |
||||
|
account_code = line.account_id.code |
||||
|
jrnl_id = line.journal_id.name |
||||
|
currency_id = line.company_id.currency_id.position |
||||
|
currency_symbol = line.company_id.currency_id.symbol |
||||
|
if partner_id not in partners_amount: |
||||
|
partners_amount[partner_id] = 0.0 |
||||
|
line_amount = ResCurrency._compute(line.company_id.currency_id, |
||||
|
user_currency, line.balance) |
||||
|
if user_currency.is_zero(line_amount): |
||||
|
continue |
||||
|
for partial_line in line.matched_debit_ids: |
||||
|
if partial_line.max_date <= date_from: |
||||
|
line_amount += ResCurrency._compute( |
||||
|
partial_line.company_id.currency_id, user_currency, |
||||
|
partial_line.amount) |
||||
|
for partial_line in line.matched_credit_ids: |
||||
|
if partial_line.max_date <= date_from: |
||||
|
line_amount -= ResCurrency._compute( |
||||
|
partial_line.company_id.currency_id, user_currency, |
||||
|
partial_line.amount) |
||||
|
|
||||
|
if not self.env.company.currency_id.is_zero( |
||||
|
line_amount): |
||||
|
partners_amount[partner_id] += line_amount |
||||
|
if i + 1 == 5: |
||||
|
period5 = i + 1 |
||||
|
lines[partner_id].append({ |
||||
|
'period5': period5, |
||||
|
'line': line, |
||||
|
'partner_id': partner_id, |
||||
|
'move': move_name, |
||||
|
'currency': currency_id, |
||||
|
'symbol': currency_symbol, |
||||
|
'jrnl': jrnl_id, |
||||
|
'acc_name': account_id, |
||||
|
'mov_id': move_id, |
||||
|
'acc_code': account_code, |
||||
|
'date': date_maturity, |
||||
|
'amount': line_amount, |
||||
|
}) |
||||
|
elif i + 1 == 4: |
||||
|
period4 = i + 1 |
||||
|
lines[partner_id].append({ |
||||
|
|
||||
|
'period4': period4, |
||||
|
'line': line, |
||||
|
'partner_id': partner_id, |
||||
|
'move': move_name, |
||||
|
'jrnl': jrnl_id, |
||||
|
'acc_name': account_id, |
||||
|
'currency': currency_id, |
||||
|
'symbol': currency_symbol, |
||||
|
'mov_id': move_id, |
||||
|
'acc_code': account_code, |
||||
|
'date': date_maturity, |
||||
|
'amount': line_amount, |
||||
|
}) |
||||
|
elif i + 1 == 3: |
||||
|
period3 = i + 1 |
||||
|
lines[partner_id].append({ |
||||
|
|
||||
|
'period3': period3, |
||||
|
'line': line, |
||||
|
'partner_id': partner_id, |
||||
|
'move': move_name, |
||||
|
'jrnl': jrnl_id, |
||||
|
'acc_name': account_id, |
||||
|
'currency': currency_id, |
||||
|
'symbol': currency_symbol, |
||||
|
'mov_id': move_id, |
||||
|
'acc_code': account_code, |
||||
|
'date': date_maturity, |
||||
|
'amount': line_amount, |
||||
|
}) |
||||
|
elif i + 1 == 2: |
||||
|
period2 = i + 1 |
||||
|
lines[partner_id].append({ |
||||
|
|
||||
|
'period2': period2, |
||||
|
'line': line, |
||||
|
'partner_id': partner_id, |
||||
|
'move': move_name, |
||||
|
'jrnl': jrnl_id, |
||||
|
'acc_name': account_id, |
||||
|
'currency': currency_id, |
||||
|
'symbol': currency_symbol, |
||||
|
'mov_id': move_id, |
||||
|
'acc_code': account_code, |
||||
|
'date': date_maturity, |
||||
|
'amount': line_amount, |
||||
|
}) |
||||
|
else: |
||||
|
period1 = i + 1 |
||||
|
lines[partner_id].append({ |
||||
|
|
||||
|
'period1': period1, |
||||
|
'line': line, |
||||
|
'partner_id': partner_id, |
||||
|
'move': move_name, |
||||
|
'jrnl': jrnl_id, |
||||
|
'acc_name': account_id, |
||||
|
'currency': currency_id, |
||||
|
'symbol': currency_symbol, |
||||
|
'mov_id': move_id, |
||||
|
'acc_code': account_code, |
||||
|
'date': date_maturity, |
||||
|
'amount': line_amount, |
||||
|
}) |
||||
|
|
||||
|
history.append(partners_amount) |
||||
|
|
||||
|
for partner in partners: |
||||
|
if partner['partner_id'] is None: |
||||
|
partner['partner_id'] = False |
||||
|
at_least_one_amount = False |
||||
|
values = {} |
||||
|
undue_amt = 0.0 |
||||
|
if partner[ |
||||
|
'partner_id'] in undue_amounts: # Making sure this partner actually was found by the query |
||||
|
undue_amt = undue_amounts[partner['partner_id']] |
||||
|
|
||||
|
total[6] = total[6] + undue_amt |
||||
|
values['direction'] = undue_amt |
||||
|
for rec in lines: |
||||
|
if partner['partner_id'] == rec: |
||||
|
child_lines = lines[rec] |
||||
|
values['child_lines'] = child_lines |
||||
|
if not float_is_zero(values['direction'], |
||||
|
precision_rounding=self.env.company.currency_id.rounding): |
||||
|
at_least_one_amount = True |
||||
|
|
||||
|
for i in range(5): |
||||
|
during = False |
||||
|
if partner['partner_id'] in history[i]: |
||||
|
during = [history[i][partner['partner_id']]] |
||||
|
# Adding counter |
||||
|
total[(i)] = total[(i)] + (during and during[0] or 0) |
||||
|
values[str(i)] = during and during[0] or 0.0 |
||||
|
if not float_is_zero(values[str(i)], |
||||
|
precision_rounding=self.env.company.currency_id.rounding): |
||||
|
at_least_one_amount = True |
||||
|
values['total'] = sum( |
||||
|
[values['direction']] + [values[str(i)] for i in range(5)]) |
||||
|
## Add for total |
||||
|
total[(i + 1)] += values['total'] |
||||
|
values['partner_id'] = partner['partner_id'] |
||||
|
if partner['partner_id']: |
||||
|
browsed_partner = self.env['res.partner'].browse( |
||||
|
partner['partner_id']) |
||||
|
values['name'] = browsed_partner.name and len( |
||||
|
browsed_partner.name) >= 45 and browsed_partner.name[ |
||||
|
0:40] + '...' or browsed_partner.name |
||||
|
values['trust'] = browsed_partner.trust |
||||
|
else: |
||||
|
values['name'] = _('Unknown Partner') |
||||
|
values['trust'] = False |
||||
|
|
||||
|
if at_least_one_amount or ( |
||||
|
self._context.get('include_nullified_amount') and lines[ |
||||
|
partner['partner_id']]): |
||||
|
res.append(values) |
||||
|
|
||||
|
|
||||
|
|
||||
|
return res, total, lines |
||||
|
|
||||
|
@api.model |
||||
|
def _get_currency(self): |
||||
|
journal = self.env['account.journal'].browse( |
||||
|
self.env.context.get('default_journal_id', False)) |
||||
|
if journal.currency_id: |
||||
|
return journal.currency_id.id |
||||
|
currency_array = [self.env.user.company_id.currency_id.symbol, |
||||
|
self.env.user.company_id.currency_id.position] |
||||
|
|
||||
|
return currency_array |
||||
|
|
||||
|
def get_dynamic_xlsx_report(self, data, response, report_data, dfr_data ): |
||||
|
|
||||
|
report_data_main = json.loads(report_data) |
||||
|
output = io.BytesIO() |
||||
|
|
||||
|
filters = json.loads(data) |
||||
|
|
||||
|
workbook = xlsxwriter.Workbook(output, {'in_memory': True}) |
||||
|
sheet = workbook.add_worksheet() |
||||
|
head = workbook.add_format({'align': 'center', 'bold': True, |
||||
|
'font_size': '20px'}) |
||||
|
sub_heading = workbook.add_format( |
||||
|
{'align': 'center', 'bold': True, 'font_size': '10px', |
||||
|
'border': 1, |
||||
|
'border_color': 'black'}) |
||||
|
heading = workbook.add_format( |
||||
|
{'align': 'center', 'bold': True, 'font_size': '10px', |
||||
|
'border': 2, |
||||
|
'border_color': 'black'}) |
||||
|
txt = workbook.add_format({'font_size': '10px', 'border': 1}) |
||||
|
txt_l = workbook.add_format( |
||||
|
{'font_size': '10px', 'border': 1, 'bold': True}) |
||||
|
txt_v = workbook.add_format( |
||||
|
{'align': 'right', 'font_size': '10px', 'border': 1}) |
||||
|
sheet.merge_range('A2:H3', |
||||
|
self.env.user.company_id.name + ':' + ' Partner Ageing', |
||||
|
head) |
||||
|
date_head = workbook.add_format({'align': 'center', 'bold': True, |
||||
|
'font_size': '10px'}) |
||||
|
date_style = workbook.add_format({'align': 'center', |
||||
|
'font_size': '10px'}) |
||||
|
if filters.get('date_from'): |
||||
|
sheet.merge_range('A4:B4', |
||||
|
'As On Date: ' + filters.get('date_from'), |
||||
|
date_head) |
||||
|
sheet.merge_range('C4:E4', |
||||
|
'Account Type: ' + filters.get('result_selection'), |
||||
|
date_head) |
||||
|
sheet.merge_range('A5:B5', |
||||
|
'Target Moves: ' + filters.get('target_move'), |
||||
|
date_head) |
||||
|
sheet.merge_range('D5:F5', ' Partners: ' + ', '.join( |
||||
|
[lt or '' for lt in |
||||
|
filters['partners']]), date_head) |
||||
|
sheet.merge_range('G5:H5', ' Partner Type: ' + ', '.join( |
||||
|
[lt or '' for lt in |
||||
|
filters['partner_tags']]), |
||||
|
date_head) |
||||
|
|
||||
|
sheet.merge_range('A7:C7', 'Partner', heading) |
||||
|
sheet.write('D7', 'Total', heading) |
||||
|
sheet.write('E7', 'Not Due', heading) |
||||
|
sheet.write('F7', '0-20', heading) |
||||
|
sheet.write('G7', '20-40', heading) |
||||
|
sheet.write('H7', '40-60', heading) |
||||
|
sheet.write('I7', '60-80', heading) |
||||
|
sheet.write('J7', '80+', heading) |
||||
|
|
||||
|
lst = [] |
||||
|
for rec in report_data_main[0]: |
||||
|
lst.append(rec) |
||||
|
row = 6 |
||||
|
col = 0 |
||||
|
sheet.set_column(5, 0, 15) |
||||
|
sheet.set_column(6, 1, 15) |
||||
|
sheet.set_column(7, 2, 15) |
||||
|
sheet.set_column(8, 3, 15) |
||||
|
sheet.set_column(9, 4, 15) |
||||
|
sheet.set_column(10, 5, 15) |
||||
|
sheet.set_column(11, 6, 15) |
||||
|
|
||||
|
for rec_data in report_data_main[0]: |
||||
|
one_lst = [] |
||||
|
two_lst = [] |
||||
|
|
||||
|
row += 1 |
||||
|
sheet.merge_range(row, col, row, col + 2, rec_data['name'], txt_l) |
||||
|
sheet.write(row, col + 3, rec_data['total'], txt_l) |
||||
|
sheet.write(row, col + 4, rec_data['direction'], txt_l) |
||||
|
sheet.write(row, col + 5, rec_data['4'], txt_l) |
||||
|
sheet.write(row, col + 6, rec_data['3'], txt_l) |
||||
|
sheet.write(row, col + 7, rec_data['2'], txt_l) |
||||
|
sheet.write(row, col + 8, rec_data['1'], txt_l) |
||||
|
sheet.write(row, col + 9, rec_data['0'], txt_l) |
||||
|
row += 1 |
||||
|
sheet.write(row, col, 'Entry Label', sub_heading) |
||||
|
sheet.write(row, col + 1, 'Due Date', sub_heading) |
||||
|
sheet.write(row, col + 2, 'Journal', sub_heading) |
||||
|
sheet.write(row, col + 3, 'Account', sub_heading) |
||||
|
sheet.write(row, col + 4, 'Not Due', sub_heading) |
||||
|
sheet.write(row, col + 5, '0 - 20', sub_heading) |
||||
|
sheet.write(row, col + 6, '21 - 40', sub_heading) |
||||
|
sheet.write(row, col + 7, '41 - 60', sub_heading) |
||||
|
sheet.write(row, col + 8, '61 - 80', sub_heading) |
||||
|
sheet.write(row, col + 9, '81 - 100', sub_heading) |
||||
|
|
||||
|
for line_data in rec_data['child_lines']: |
||||
|
row += 1 |
||||
|
sheet.write(row, col, line_data.get('move'), txt) |
||||
|
sheet.write(row, col + 1, line_data.get('date'), txt) |
||||
|
sheet.write(row, col + 2, line_data.get('jrnl'), txt) |
||||
|
sheet.write(row, col + 3, line_data.get('acc_code'), txt) |
||||
|
if line_data.get('period6'): |
||||
|
sheet.write(row, col + 4, line_data.get('amount'), txt) |
||||
|
else: |
||||
|
sheet.write(row, col + 4, "0", txt_v) |
||||
|
if line_data.get('period5'): |
||||
|
sheet.write(row, col + 5, line_data.get('amount'), txt) |
||||
|
else: |
||||
|
sheet.write(row, col + 5, "0", txt_v) |
||||
|
if line_data.get('period4'): |
||||
|
sheet.write(row, col + 6, line_data.get('amount'), txt) |
||||
|
else: |
||||
|
sheet.write(row, col + 6, "0", txt_v) |
||||
|
if line_data.get('period3'): |
||||
|
sheet.write(row, col + 7, line_data.get('amount'), txt) |
||||
|
else: |
||||
|
sheet.write(row, col + 7, "0", txt_v) |
||||
|
if line_data.get('period2'): |
||||
|
sheet.write(row, col + 8, line_data.get('amount'), txt) |
||||
|
else: |
||||
|
sheet.write(row, col + 8, "0", txt_v) |
||||
|
if line_data.get('period1'): |
||||
|
sheet.write(row, col + 9, line_data.get('amount'), txt) |
||||
|
else: |
||||
|
sheet.write(row, col + 9, "0", txt_v) |
||||
|
|
||||
|
workbook.close() |
||||
|
output.seek(0) |
||||
|
response.stream.write(output.read()) |
||||
|
output.close() |
@ -0,0 +1,628 @@ |
|||||
|
import time |
||||
|
from odoo import fields, models, api |
||||
|
|
||||
|
import io |
||||
|
import json |
||||
|
|
||||
|
try: |
||||
|
from odoo.tools.misc import xlsxwriter |
||||
|
except ImportError: |
||||
|
import xlsxwriter |
||||
|
|
||||
|
|
||||
|
class BalanceSheetView(models.TransientModel): |
||||
|
_name = 'dynamic.balance.sheet.report' |
||||
|
_inherit = "account.common.report" |
||||
|
|
||||
|
journal_ids = fields.Many2many('account.journal', |
||||
|
|
||||
|
string='Journals', required=True, |
||||
|
default=[]) |
||||
|
account_ids = fields.Many2many( |
||||
|
"account.account", |
||||
|
string="Accounts", |
||||
|
) |
||||
|
|
||||
|
account_tag_ids = fields.Many2many("account.account.tag", |
||||
|
string="Account Tags") |
||||
|
|
||||
|
analytic_ids = fields.Many2many( |
||||
|
"account.analytic.account", string="Analytic Accounts" |
||||
|
) |
||||
|
|
||||
|
analytic_tag_ids = fields.Many2many("account.analytic.tag", |
||||
|
string="Analytic Tags") |
||||
|
|
||||
|
display_account = fields.Selection( |
||||
|
[('all', 'All'), ('movement', 'With movements'), |
||||
|
('not_zero', 'With balance is not equal to 0')], |
||||
|
string='Display Accounts', required=True, default='movement') |
||||
|
|
||||
|
@api.model |
||||
|
def view_report(self, option, tag): |
||||
|
r = self.env['dynamic.balance.sheet.report'].search([('id', '=', option[0])]) |
||||
|
|
||||
|
data = { |
||||
|
'display_account': r.display_account, |
||||
|
'model': self, |
||||
|
'journals': r.journal_ids, |
||||
|
'target_move': r.target_move, |
||||
|
'accounts': r.account_ids, |
||||
|
'account_tags': r.account_tag_ids, |
||||
|
'analytics': r.analytic_ids, |
||||
|
'analytic_tags': r.analytic_tag_ids, |
||||
|
|
||||
|
} |
||||
|
if r.date_from: |
||||
|
data.update({ |
||||
|
'date_from': r.date_from, |
||||
|
}) |
||||
|
if r.date_to: |
||||
|
data.update({ |
||||
|
'date_to': r.date_to, |
||||
|
}) |
||||
|
|
||||
|
company_id = self.env.user.company_id |
||||
|
company_domain = [('company_id', '=', company_id.id)] |
||||
|
if r.account_tag_ids: |
||||
|
company_domain.append( |
||||
|
('tag_ids', 'in', r.account_tag_ids.ids)) |
||||
|
if r.account_ids: |
||||
|
company_domain.append(('id', 'in', r.account_ids.ids)) |
||||
|
|
||||
|
new_account_ids = self.env['account.account'].search(company_domain) |
||||
|
data.update({ |
||||
|
'accounts': new_account_ids, |
||||
|
}) |
||||
|
|
||||
|
filters = self.get_filter(option) |
||||
|
records = self._get_report_values(data) |
||||
|
|
||||
|
if filters['account_tags'] != ['All']: |
||||
|
tag_accounts = list(map(lambda x: x.code, new_account_ids)) |
||||
|
|
||||
|
def filter_code(rec_dict): |
||||
|
if rec_dict['code'] in tag_accounts: |
||||
|
return True |
||||
|
else: |
||||
|
return False |
||||
|
|
||||
|
new_records = list(filter(filter_code, records['Accounts'])) |
||||
|
records['Accounts'] = new_records |
||||
|
|
||||
|
account_report_id = self.env['account.financial.report'].search([ |
||||
|
('name', 'ilike', tag)]) |
||||
|
|
||||
|
new_data = {'id': self.id, 'date_from': False, |
||||
|
'enable_filter': True, |
||||
|
'debit_credit': True, |
||||
|
'date_to': False, 'account_report_id': account_report_id, |
||||
|
'target_move': filters['target_move'], |
||||
|
'view_format': 'vertical', |
||||
|
'company_id': self.company_id, |
||||
|
'used_context': {'journal_ids': False, |
||||
|
'state': filters['target_move'], |
||||
|
'date_from': filters['date_from'], |
||||
|
'date_to': filters['date_to'], |
||||
|
'strict_range': False, |
||||
|
'company_id': self.company_id, |
||||
|
'lang': 'en_US'}} |
||||
|
|
||||
|
account_lines = self.get_account_lines(new_data) |
||||
|
report_lines = self.view_report_pdf(account_lines, new_data)[ |
||||
|
'report_lines'] |
||||
|
move_line_accounts = [] |
||||
|
move_lines_dict = {} |
||||
|
|
||||
|
for rec in records['Accounts']: |
||||
|
move_line_accounts.append(rec['code']) |
||||
|
move_lines_dict[rec['code']] = {} |
||||
|
move_lines_dict[rec['code']]['debit'] = rec['debit'] |
||||
|
move_lines_dict[rec['code']]['credit'] = rec['credit'] |
||||
|
move_lines_dict[rec['code']]['balance'] = rec['balance'] |
||||
|
|
||||
|
report_lines_move = [] |
||||
|
parent_list = [] |
||||
|
|
||||
|
def filter_movelines_parents(obj): |
||||
|
for each in obj: |
||||
|
if each['report_type'] == 'accounts': |
||||
|
if each['code'] in move_line_accounts: |
||||
|
report_lines_move.append(each) |
||||
|
parent_list.append(each['p_id']) |
||||
|
|
||||
|
elif each['report_type'] == 'account_report': |
||||
|
report_lines_move.append(each) |
||||
|
else: |
||||
|
report_lines_move.append(each) |
||||
|
|
||||
|
filter_movelines_parents(report_lines) |
||||
|
|
||||
|
for rec in report_lines_move: |
||||
|
if rec['report_type'] == 'accounts': |
||||
|
if rec['code'] in move_line_accounts: |
||||
|
rec['debit'] = move_lines_dict[rec['code']]['debit'] |
||||
|
rec['credit'] = move_lines_dict[rec['code']]['credit'] |
||||
|
rec['balance'] = move_lines_dict[rec['code']]['balance'] |
||||
|
|
||||
|
parent_list = list(set(parent_list)) |
||||
|
|
||||
|
max_level = 0 |
||||
|
for rep in report_lines_move: |
||||
|
if rep['level'] > max_level: |
||||
|
max_level = rep['level'] |
||||
|
|
||||
|
def get_parents(obj): |
||||
|
for item in report_lines_move: |
||||
|
for each in obj: |
||||
|
if item['report_type'] != 'account_type' and each in item[ |
||||
|
'c_ids']: |
||||
|
obj.append(item['r_id']) |
||||
|
|
||||
|
if item['report_type'] == 'account_report': |
||||
|
obj.append(item['r_id']) |
||||
|
break |
||||
|
|
||||
|
get_parents(parent_list) |
||||
|
|
||||
|
for i in range(max_level): |
||||
|
get_parents(parent_list) |
||||
|
|
||||
|
parent_list = list(set(parent_list)) |
||||
|
|
||||
|
final_report_lines = [] |
||||
|
|
||||
|
for rec in report_lines_move: |
||||
|
if rec['report_type'] != 'accounts': |
||||
|
if rec['r_id'] in parent_list: |
||||
|
final_report_lines.append(rec) |
||||
|
else: |
||||
|
final_report_lines.append(rec) |
||||
|
|
||||
|
def filter_sum(obj): |
||||
|
sum_list = {} |
||||
|
for pl in parent_list: |
||||
|
sum_list[pl] = {} |
||||
|
sum_list[pl]['s_debit'] = 0 |
||||
|
sum_list[pl]['s_credit'] = 0 |
||||
|
sum_list[pl]['s_balance'] = 0 |
||||
|
|
||||
|
for each in obj: |
||||
|
if each['p_id'] and each['p_id'] in parent_list: |
||||
|
sum_list[each['p_id']]['s_debit'] += each['debit'] |
||||
|
sum_list[each['p_id']]['s_credit'] += each['credit'] |
||||
|
sum_list[each['p_id']]['s_balance'] += each['balance'] |
||||
|
return sum_list |
||||
|
|
||||
|
def assign_sum(obj): |
||||
|
for each in obj: |
||||
|
if each['r_id'] in parent_list and each[ |
||||
|
'report_type'] != 'account_report': |
||||
|
each['debit'] = sum_list_new[each['r_id']]['s_debit'] |
||||
|
each['credit'] = sum_list_new[each['r_id']]['s_credit'] |
||||
|
|
||||
|
for p in range(max_level): |
||||
|
sum_list_new = filter_sum(final_report_lines) |
||||
|
assign_sum(final_report_lines) |
||||
|
|
||||
|
company_id = self.env.user.company_id |
||||
|
currency = company_id.currency_id |
||||
|
symbol = currency.symbol |
||||
|
rounding = currency.rounding |
||||
|
position = currency.position |
||||
|
|
||||
|
for rec in final_report_lines: |
||||
|
rec['debit'] = round(rec['debit'], 2) |
||||
|
rec['credit'] = round(rec['credit'], 2) |
||||
|
rec['balance'] = rec['debit'] - rec['credit'] |
||||
|
rec['balance'] = round(rec['balance'], 2) |
||||
|
if position == "before": |
||||
|
rec['m_debit'] = symbol + " " + str(rec['debit']) |
||||
|
rec['m_credit'] = symbol + " " + str(rec['credit']) |
||||
|
rec['m_balance'] = symbol + " " + str(rec['balance']) |
||||
|
|
||||
|
else: |
||||
|
rec['m_debit'] = str(rec['debit']) + " " + symbol |
||||
|
rec['m_credit'] = str(rec['credit']) + " " + symbol |
||||
|
rec['m_balance'] = str(rec['balance']) + " " + symbol |
||||
|
|
||||
|
return { |
||||
|
'name': tag, |
||||
|
'type': 'ir.actions.client', |
||||
|
'tag': tag, |
||||
|
'filters': filters, |
||||
|
'report_lines': records['Accounts'], |
||||
|
'debit_total': records['debit_total'], |
||||
|
'credit_total': records['credit_total'], |
||||
|
'debit_balance': records['debit_balance'], |
||||
|
'currency': currency, |
||||
|
'bs_lines': final_report_lines, |
||||
|
} |
||||
|
|
||||
|
def get_filter(self, option): |
||||
|
data = self.get_filter_data(option) |
||||
|
filters = {} |
||||
|
if data.get('journal_ids'): |
||||
|
filters['journals'] = self.env['account.journal'].browse( |
||||
|
data.get('journal_ids')).mapped('code') |
||||
|
else: |
||||
|
filters['journals'] = ['All'] |
||||
|
if data.get('account_ids', []): |
||||
|
filters['accounts'] = self.env['account.account'].browse( |
||||
|
data.get('account_ids', [])).mapped('code') |
||||
|
else: |
||||
|
filters['accounts'] = ['All'] |
||||
|
if data.get('target_move'): |
||||
|
filters['target_move'] = data.get('target_move') |
||||
|
else: |
||||
|
filters['target_move'] = 'posted' |
||||
|
if data.get('date_from'): |
||||
|
filters['date_from'] = data.get('date_from') |
||||
|
else: |
||||
|
filters['date_from'] = False |
||||
|
if data.get('date_to'): |
||||
|
filters['date_to'] = data.get('date_to') |
||||
|
else: |
||||
|
filters['date_to'] = False |
||||
|
if data.get('analytic_ids', []): |
||||
|
filters['analytics'] = self.env['account.analytic.account'].browse( |
||||
|
data.get('analytic_ids', [])).mapped('name') |
||||
|
else: |
||||
|
filters['analytics'] = ['All'] |
||||
|
|
||||
|
if data.get('account_tag_ids'): |
||||
|
filters['account_tags'] = self.env['account.account.tag'].browse( |
||||
|
data.get('account_tag_ids', [])).mapped('name') |
||||
|
else: |
||||
|
filters['account_tags'] = ['All'] |
||||
|
|
||||
|
if data.get('analytic_tag_ids', []): |
||||
|
filters['analytic_tags'] = self.env['account.analytic.tag'].browse( |
||||
|
data.get('analytic_tag_ids', [])).mapped('name') |
||||
|
else: |
||||
|
filters['analytic_tags'] = ['All'] |
||||
|
|
||||
|
filters['company_id'] = '' |
||||
|
filters['accounts_list'] = data.get('accounts_list') |
||||
|
filters['journals_list'] = data.get('journals_list') |
||||
|
filters['analytic_list'] = data.get('analytic_list') |
||||
|
filters['account_tag_list'] = data.get('account_tag_list') |
||||
|
filters['analytic_tag_list'] = data.get('analytic_tag_list') |
||||
|
filters['company_name'] = data.get('company_name') |
||||
|
|
||||
|
return filters |
||||
|
|
||||
|
def get_filter_data(self, option): |
||||
|
r = self.env['dynamic.balance.sheet.report'].search([('id', '=', option[0])]) |
||||
|
default_filters = {} |
||||
|
company_id = r.env.user.company_id |
||||
|
company_domain = [('company_id', '=', company_id.id)] |
||||
|
|
||||
|
journals = r.journal_ids if r.journal_ids else self.env[ |
||||
|
'account.journal'].search(company_domain) |
||||
|
|
||||
|
|
||||
|
analytics = self.analytic_ids if self.analytic_ids else self.env[ |
||||
|
'account.analytic.account'].search( |
||||
|
company_domain) |
||||
|
account_tags = self.account_tag_ids if self.account_tag_ids else \ |
||||
|
self.env[ |
||||
|
'account.account.tag'].search([]) |
||||
|
analytic_tags = self.analytic_tag_ids if self.analytic_tag_ids else \ |
||||
|
self.env[ |
||||
|
'account.analytic.tag'].sudo().search( |
||||
|
['|', ('company_id', '=', company_id.id), |
||||
|
('company_id', '=', False)]) |
||||
|
|
||||
|
if r.account_tag_ids: |
||||
|
company_domain.append( |
||||
|
('tag_ids', 'in', r.account_tag_ids.ids)) |
||||
|
|
||||
|
accounts = self.account_ids if self.account_ids else self.env[ |
||||
|
'account.account'].search(company_domain) |
||||
|
|
||||
|
filter_dict = { |
||||
|
'journal_ids': r.journal_ids.ids, |
||||
|
'account_ids': r.account_ids.ids, |
||||
|
'analytic_ids': r.analytic_ids.ids, |
||||
|
|
||||
|
'company_id': company_id.id, |
||||
|
'date_from': r.date_from, |
||||
|
'date_to': r.date_to, |
||||
|
'target_move': r.target_move, |
||||
|
'journals_list': [(j.id, j.name, j.code) for j in journals], |
||||
|
'accounts_list': [(a.id, a.name) for a in accounts], |
||||
|
'analytic_list': [(anl.id, anl.name) for anl in analytics], |
||||
|
'company_name': company_id and company_id.name, |
||||
|
'analytic_tag_ids': r.analytic_tag_ids.ids, |
||||
|
'analytic_tag_list': [(anltag.id, anltag.name) for anltag in |
||||
|
analytic_tags], |
||||
|
'account_tag_ids': r.account_tag_ids.ids, |
||||
|
'account_tag_list': [(a.id, a.name) for a in account_tags], |
||||
|
} |
||||
|
filter_dict.update(default_filters) |
||||
|
return filter_dict |
||||
|
|
||||
|
def _get_report_values(self, data): |
||||
|
docs = data['model'] |
||||
|
display_account = data['display_account'] |
||||
|
init_balance = True |
||||
|
journals = data['journals'] |
||||
|
accounts = self.env['account.account'].search([]) |
||||
|
account_res = self._get_accounts(accounts, init_balance, |
||||
|
display_account, data) |
||||
|
debit_total = 0 |
||||
|
debit_total = sum(x['debit'] for x in account_res) |
||||
|
credit_total = sum(x['credit'] for x in account_res) |
||||
|
debit_balance = round(debit_total, 2) - round(credit_total, 2) |
||||
|
return { |
||||
|
'doc_ids': self.ids, |
||||
|
'debit_total': debit_total, |
||||
|
'credit_total': credit_total, |
||||
|
'debit_balance': debit_balance, |
||||
|
'docs': docs, |
||||
|
'time': time, |
||||
|
'Accounts': account_res, |
||||
|
} |
||||
|
|
||||
|
@api.model |
||||
|
def create(self, vals): |
||||
|
vals['target_move'] = 'all' |
||||
|
res = super(BalanceSheetView, self).create(vals) |
||||
|
return res |
||||
|
|
||||
|
def write(self, vals): |
||||
|
|
||||
|
if vals.get('journal_ids'): |
||||
|
vals.update({'journal_ids': [(6, 0, vals.get('journal_ids'))]}) |
||||
|
if vals.get('journal_ids') == []: |
||||
|
vals.update({'journal_ids': [(5,)]}) |
||||
|
if vals.get('account_ids'): |
||||
|
vals.update( |
||||
|
{'account_ids': [(4, j) for j in vals.get('account_ids')]}) |
||||
|
if vals.get('account_ids') == []: |
||||
|
vals.update({'account_ids': [(5,)]}) |
||||
|
if vals.get('analytic_ids'): |
||||
|
vals.update( |
||||
|
{'analytic_ids': [(4, j) for j in vals.get('analytic_ids')]}) |
||||
|
if vals.get('analytic_ids') == []: |
||||
|
vals.update({'analytic_ids': [(5,)]}) |
||||
|
|
||||
|
if vals.get('analytic_tags'): |
||||
|
vals.update( |
||||
|
{'analytic_tags': [(4, j) for j in vals.get('analytic_tags')]}) |
||||
|
if vals.get('analytic_tags') == []: |
||||
|
vals.update({'analytic_tags': [(5,)]}) |
||||
|
|
||||
|
if vals.get('account_tags'): |
||||
|
vals.update( |
||||
|
{'account_tags': [(4, j) for j in vals.get('account_tags')]}) |
||||
|
if vals.get('account_tags') == []: |
||||
|
vals.update({'account_tags': [(5,)]}) |
||||
|
|
||||
|
if vals.get('account_tag_ids'): |
||||
|
vals.update({'account_tag_ids': [(4, j) for j in |
||||
|
vals.get('account_tag_ids')]}) |
||||
|
if vals.get('account_tag_ids') == []: |
||||
|
vals.update({'account_tag_ids': [(5,)]}) |
||||
|
|
||||
|
if vals.get('analytic_tag_ids'): |
||||
|
vals.update({'analytic_tag_ids': [(4, j) for j in |
||||
|
vals.get('analytic_tag_ids')]}) |
||||
|
if vals.get('analytic_tag_ids') == []: |
||||
|
vals.update({'analytic_tag_ids': [(5,)]}) |
||||
|
|
||||
|
res = super(BalanceSheetView, self).write(vals) |
||||
|
return res |
||||
|
|
||||
|
def _get_accounts(self, accounts, init_balance, display_account, data): |
||||
|
cr = self.env.cr |
||||
|
MoveLine = self.env['account.move.line'] |
||||
|
move_lines = {x: [] for x in accounts.ids} |
||||
|
currency_id = self.env.company.currency_id |
||||
|
|
||||
|
# Prepare sql query base on selected parameters from wizard |
||||
|
tables, where_clause, where_params = MoveLine._query_get() |
||||
|
wheres = [""] |
||||
|
if where_clause.strip(): |
||||
|
wheres.append(where_clause.strip()) |
||||
|
final_filters = " AND ".join(wheres) |
||||
|
final_filters = final_filters.replace('account_move_line__move_id', |
||||
|
'm').replace( |
||||
|
'account_move_line', 'l') |
||||
|
new_final_filter = final_filters |
||||
|
|
||||
|
if data['target_move'] == 'posted': |
||||
|
new_final_filter += " AND m.state = 'posted'" |
||||
|
else: |
||||
|
new_final_filter += " AND m.state in ('draft','posted')" |
||||
|
if data.get('date_from'): |
||||
|
new_final_filter += " AND l.date >= '%s'" % data.get('date_from') |
||||
|
if data.get('date_to'): |
||||
|
new_final_filter += " AND l.date <= '%s'" % data.get('date_to') |
||||
|
|
||||
|
if data['journals']: |
||||
|
new_final_filter += ' AND j.id IN %s' % str( |
||||
|
tuple(data['journals'].ids) + tuple([0])) |
||||
|
|
||||
|
if data.get('accounts'): |
||||
|
WHERE = "WHERE l.account_id IN %s" % str( |
||||
|
tuple(data.get('accounts').ids) + tuple([0])) |
||||
|
else: |
||||
|
WHERE = "WHERE l.account_id IN %s" |
||||
|
|
||||
|
if data['analytics']: |
||||
|
WHERE += ' AND anl.id IN %s' % str( |
||||
|
tuple(data.get('analytics').ids) + tuple([0])) |
||||
|
|
||||
|
if data['analytic_tags']: |
||||
|
WHERE += ' AND anltag.account_analytic_tag_id IN %s' % str( |
||||
|
tuple(data.get('analytic_tags').ids) + tuple([0])) |
||||
|
|
||||
|
# Get move lines base on sql query and Calculate the total balance of move lines |
||||
|
sql = ('''SELECT l.id AS lid,m.id AS move_id, l.account_id AS account_id, |
||||
|
l.date AS ldate, j.code AS lcode, l.currency_id, l.amount_currency, l.ref AS lref, |
||||
|
l.name AS lname, COALESCE(l.debit,0) AS debit, COALESCE(l.credit,0) AS credit, |
||||
|
COALESCE(SUM(l.balance),0) AS balance,\ |
||||
|
m.name AS move_name, c.symbol AS currency_code,c.position AS currency_position, p.name AS partner_name\ |
||||
|
FROM account_move_line l\ |
||||
|
JOIN account_move m ON (l.move_id=m.id)\ |
||||
|
LEFT JOIN res_currency c ON (l.currency_id=c.id)\ |
||||
|
LEFT JOIN res_partner p ON (l.partner_id=p.id)\ |
||||
|
LEFT JOIN account_analytic_account anl ON (l.analytic_account_id=anl.id)\ |
||||
|
LEFT JOIN account_analytic_tag_account_move_line_rel anltag ON (anltag.account_move_line_id = l.id)\ |
||||
|
JOIN account_journal j ON (l.journal_id=j.id)\ |
||||
|
JOIN account_account acc ON (l.account_id = acc.id) ''' |
||||
|
+ WHERE + new_final_filter + ''' GROUP BY l.id, m.id, l.account_id, l.date, j.code, l.currency_id, l.amount_currency, l.ref, l.name, m.name, c.symbol, c.position, p.name''') |
||||
|
if data.get('accounts'): |
||||
|
params = tuple(where_params) |
||||
|
else: |
||||
|
params = (tuple(accounts.ids),) + tuple(where_params) |
||||
|
cr.execute(sql, params) |
||||
|
|
||||
|
for row in cr.dictfetchall(): |
||||
|
balance = 0 |
||||
|
for line in move_lines.get(row['account_id']): |
||||
|
balance += round(line['debit'], 2) - round(line['credit'], 2) |
||||
|
row['balance'] += (round(balance, 2)) |
||||
|
row['m_id'] = row['account_id'] |
||||
|
move_lines[row.pop('account_id')].append(row) |
||||
|
# Calculate the debit, credit and balance for Accounts |
||||
|
account_res = [] |
||||
|
for account in accounts: |
||||
|
currency = account.currency_id and account.currency_id or account.company_id.currency_id |
||||
|
res = dict((fn, 0.0) for fn in ['credit', 'debit', 'balance']) |
||||
|
res['code'] = account.code |
||||
|
res['name'] = account.name |
||||
|
res['id'] = account.id |
||||
|
res['move_lines'] = move_lines[account.id] |
||||
|
for line in res.get('move_lines'): |
||||
|
res['debit'] += round(line['debit'], 2) |
||||
|
res['credit'] += round(line['credit'], 2) |
||||
|
res['balance'] = round(line['balance'], 2) |
||||
|
if display_account == 'all': |
||||
|
account_res.append(res) |
||||
|
if display_account == 'movement' and res.get('move_lines'): |
||||
|
account_res.append(res) |
||||
|
if display_account == 'not_zero' and not currency.is_zero( |
||||
|
res['balance']): |
||||
|
account_res.append(res) |
||||
|
|
||||
|
return account_res |
||||
|
|
||||
|
@api.model |
||||
|
def _get_currency(self): |
||||
|
journal = self.env['account.journal'].browse( |
||||
|
self.env.context.get('default_journal_id', False)) |
||||
|
if journal.currency_id: |
||||
|
return journal.currency_id.id |
||||
|
currency_array = [self.env.user.company_id.currency_id.symbol, |
||||
|
self.env.user.company_id.currency_id.position] |
||||
|
return currency_array |
||||
|
|
||||
|
def get_dynamic_xlsx_report(self, options, response, report_data, dfr_data): |
||||
|
|
||||
|
i_data = str(report_data) |
||||
|
filters = json.loads(options) |
||||
|
j_data = dfr_data |
||||
|
rl_data = json.loads(j_data) |
||||
|
|
||||
|
output = io.BytesIO() |
||||
|
workbook = xlsxwriter.Workbook(output, {'in_memory': True}) |
||||
|
sheet = workbook.add_worksheet() |
||||
|
head = workbook.add_format({'align': 'center', 'bold': True, |
||||
|
'font_size': '20px'}) |
||||
|
sub_heading = workbook.add_format( |
||||
|
{'align': 'center', 'bold': True, 'font_size': '10px', |
||||
|
'border': 1, |
||||
|
'border_color': 'black'}) |
||||
|
side_heading_main = workbook.add_format( |
||||
|
{'align': 'left', 'bold': True, 'font_size': '10px', |
||||
|
'border': 1, |
||||
|
'border_color': 'black'}) |
||||
|
|
||||
|
side_heading_sub = workbook.add_format( |
||||
|
{'align': 'left', 'bold': True, 'font_size': '10px', |
||||
|
'border': 1, |
||||
|
'border_color': 'black'}) |
||||
|
|
||||
|
side_heading_sub.set_indent(1) |
||||
|
txt = workbook.add_format({'font_size': '10px', 'border': 1}) |
||||
|
txt_name = workbook.add_format({'font_size': '10px', 'border': 1}) |
||||
|
txt_name_bold = workbook.add_format({'font_size': '10px', 'border': 1, |
||||
|
'bold': True}) |
||||
|
txt_name.set_indent(2) |
||||
|
txt_name_bold.set_indent(2) |
||||
|
|
||||
|
txt = workbook.add_format({'font_size': '10px', 'border': 1}) |
||||
|
|
||||
|
sheet.merge_range('A2:D3', |
||||
|
self.env.user.company_id.name + ' : ' + i_data, |
||||
|
head) |
||||
|
date_head = workbook.add_format({'align': 'center', 'bold': True, |
||||
|
'font_size': '10px'}) |
||||
|
|
||||
|
date_head.set_align('vcenter') |
||||
|
date_head.set_text_wrap() |
||||
|
date_head.set_shrink() |
||||
|
date_head_left = workbook.add_format({'align': 'left', 'bold': True, |
||||
|
'font_size': '10px'}) |
||||
|
|
||||
|
date_head_right = workbook.add_format({'align': 'right', 'bold': True, |
||||
|
'font_size': '10px'}) |
||||
|
|
||||
|
date_head_left.set_indent(1) |
||||
|
date_head_right.set_indent(1) |
||||
|
|
||||
|
if filters.get('date_from'): |
||||
|
sheet.merge_range('A4:B4', 'From: ' + filters.get('date_from'), |
||||
|
date_head_left) |
||||
|
if filters.get('date_to'): |
||||
|
sheet.merge_range('C4:D4', 'To: ' + filters.get('date_to'), |
||||
|
date_head_right) |
||||
|
|
||||
|
sheet.merge_range('A5:D6', ' Accounts: ' + ', '.join( |
||||
|
[lt or '' for lt in |
||||
|
filters['accounts']]) + '; Journals: ' + ', '.join( |
||||
|
[lt or '' for lt in |
||||
|
filters['journals']]) + '; Account Tags: ' + ', '.join( |
||||
|
[lt or '' for lt in |
||||
|
filters['account_tags']]) + '; Analytic Tags: ' + ', '.join( |
||||
|
[lt or '' for lt in |
||||
|
filters['analytic_tags']]) + '; Analytic: ' + ', '.join( |
||||
|
[at or '' for at in |
||||
|
filters['analytics']]) + '; Target Moves: ' + filters.get( |
||||
|
'target_move').capitalize(), date_head) |
||||
|
|
||||
|
sheet.set_column(0, 0, 30) |
||||
|
sheet.set_column(1, 1, 20) |
||||
|
sheet.set_column(2, 2, 15) |
||||
|
sheet.set_column(3, 3, 15) |
||||
|
|
||||
|
row = 5 |
||||
|
col = 0 |
||||
|
|
||||
|
row += 2 |
||||
|
sheet.write(row, col, '', sub_heading) |
||||
|
sheet.write(row, col + 1, 'Debit', sub_heading) |
||||
|
sheet.write(row, col + 2, 'Credit', sub_heading) |
||||
|
sheet.write(row, col + 3, 'Balance', sub_heading) |
||||
|
|
||||
|
if rl_data: |
||||
|
for fr in rl_data: |
||||
|
|
||||
|
row += 1 |
||||
|
if fr['level'] == 1: |
||||
|
sheet.write(row, col, fr['name'], side_heading_main) |
||||
|
elif fr['level'] == 2: |
||||
|
sheet.write(row, col, fr['name'], side_heading_sub) |
||||
|
else: |
||||
|
sheet.write(row, col, fr['name'], txt_name) |
||||
|
sheet.write(row, col + 1, fr['debit'], txt) |
||||
|
sheet.write(row, col + 2, fr['credit'], txt) |
||||
|
sheet.write(row, col + 3, fr['balance'], txt) |
||||
|
|
||||
|
workbook.close() |
||||
|
output.seek(0) |
||||
|
response.stream.write(output.read()) |
||||
|
output.close() |
@ -0,0 +1,302 @@ |
|||||
|
import re |
||||
|
from odoo import models, fields, api |
||||
|
|
||||
|
|
||||
|
class BalanceSheet(models.TransientModel): |
||||
|
_inherit = "dynamic.balance.sheet.report" |
||||
|
|
||||
|
def view_report_pdf(self, acc, form): |
||||
|
"""This function will be executed when we click the view button |
||||
|
from the wizard. Based on the values provided in the wizard, this |
||||
|
function will print pdf report""" |
||||
|
|
||||
|
data = dict() |
||||
|
report_lines = acc |
||||
|
data['form'] = form |
||||
|
|
||||
|
# find the journal items of these accounts |
||||
|
journal_items = self.find_journal_items(report_lines, data['form']) |
||||
|
|
||||
|
def set_report_level(rec): |
||||
|
"""This function is used to set the level of each item. |
||||
|
This level will be used to set the alignment in the dynamic reports.""" |
||||
|
|
||||
|
level = 1 |
||||
|
if not rec['parent']: |
||||
|
return level |
||||
|
else: |
||||
|
for line in report_lines: |
||||
|
key = 'a_id' if line['type'] == 'account' else 'id' |
||||
|
if line[key] == rec['parent']: |
||||
|
return level + set_report_level(line) |
||||
|
|
||||
|
# finding the root |
||||
|
for item in report_lines: |
||||
|
item['balance'] = round(item['balance'], 2) |
||||
|
if not item['parent']: |
||||
|
item['level'] = 1 |
||||
|
parent = item |
||||
|
report_name = item['name'] |
||||
|
item_id = item['id'] |
||||
|
report_id = item['r_id'] |
||||
|
else: |
||||
|
item['level'] = set_report_level(item) |
||||
|
data['journal_items'] = journal_items |
||||
|
data['report_lines'] = report_lines |
||||
|
|
||||
|
return data |
||||
|
|
||||
|
def _compute_account_balance(self, accounts): |
||||
|
""" compute the balance, debit |
||||
|
and credit for the provided accounts |
||||
|
""" |
||||
|
|
||||
|
mapping = { |
||||
|
'balance': |
||||
|
"COALESCE(SUM(debit),0) - COALESCE(SUM(credit), 0)" |
||||
|
" as balance", |
||||
|
'debit': "COALESCE(SUM(debit), 0) as debit", |
||||
|
'credit': "COALESCE(SUM(credit), 0) as credit", |
||||
|
} |
||||
|
|
||||
|
res = {} |
||||
|
for account in accounts: |
||||
|
res[account.id] = dict((fn, 0.0) |
||||
|
for fn in mapping.keys()) |
||||
|
if accounts: |
||||
|
tables, where_clause, where_params = ( |
||||
|
self.env['account.move.line']._query_get()) |
||||
|
tables = tables.replace( |
||||
|
'"', '') if tables else "account_move_line" |
||||
|
wheres = [""] |
||||
|
if where_clause.strip(): |
||||
|
wheres.append(where_clause.strip()) |
||||
|
filters = " AND ".join(wheres) |
||||
|
request = ("SELECT account_id as id, " + |
||||
|
', '.join(mapping.values()) + |
||||
|
" FROM " + tables + |
||||
|
" WHERE account_id IN %s " + |
||||
|
filters + |
||||
|
" GROUP BY account_id") |
||||
|
params = (tuple(accounts._ids),) + tuple(where_params) |
||||
|
|
||||
|
self.env.cr.execute(request, params) |
||||
|
for row in self.env.cr.dictfetchall(): |
||||
|
res[row['id']] = row |
||||
|
|
||||
|
return res |
||||
|
|
||||
|
def _compute_report_balance(self, reports): |
||||
|
"""returns a dictionary with key=the ID of a record and |
||||
|
value=the credit, debit and balance amount |
||||
|
computed for this record. If the record is of type : |
||||
|
'accounts' : it's the sum of the linked accounts |
||||
|
'account_type' : it's the sum of leaf accounts with |
||||
|
such an account_type |
||||
|
'account_report' : it's the amount of the related report |
||||
|
'sum' : it's the sum of the children of this record |
||||
|
(aka a 'view' record)""" |
||||
|
|
||||
|
|
||||
|
res = {} |
||||
|
fields = ['credit', 'debit', 'balance'] |
||||
|
for report in reports: |
||||
|
if report.id in res: |
||||
|
continue |
||||
|
res[report.id] = dict((fn, 0.0) for fn in fields) |
||||
|
if report.type == 'accounts': |
||||
|
# it's the sum of the linked accounts |
||||
|
res[report.id]['account'] = self._compute_account_balance( |
||||
|
report.account_ids |
||||
|
) |
||||
|
for value in \ |
||||
|
res[report.id]['account'].values(): |
||||
|
for field in fields: |
||||
|
res[report.id][field] += value.get(field) |
||||
|
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) |
||||
|
]) |
||||
|
res[report.id]['account'] = self._compute_account_balance( |
||||
|
accounts) |
||||
|
for value in res[report.id]['account'].values(): |
||||
|
for field in fields: |
||||
|
res[report.id][field] += value.get(field) |
||||
|
elif report.type == 'account_report' and report.account_report_id: |
||||
|
# it's the amount of the linked report |
||||
|
res2 = self._compute_report_balance(report.account_report_id) |
||||
|
for key, value in res2.items(): |
||||
|
for field in fields: |
||||
|
res[report.id][field] += value[field] |
||||
|
elif report.type == 'sum': |
||||
|
# it's the sum of the children of this account.report |
||||
|
res2 = self._compute_report_balance(report.children_ids) |
||||
|
for key, value in res2.items(): |
||||
|
for field in fields: |
||||
|
res[report.id][field] += value[field] |
||||
|
return res |
||||
|
|
||||
|
def get_account_lines(self, data): |
||||
|
|
||||
|
lines = [] |
||||
|
account_report = data['account_report_id'] |
||||
|
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._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: |
||||
|
r_name = str(report.name) |
||||
|
r_name = re.sub('[^0-9a-zA-Z]+', '', r_name) |
||||
|
if report.parent_id: |
||||
|
p_name = str(report.parent_id.name) |
||||
|
p_name = re.sub('[^0-9a-zA-Z]+', '', p_name) + str( |
||||
|
report.parent_id.id) |
||||
|
else: |
||||
|
p_name = False |
||||
|
|
||||
|
child_ids = [] |
||||
|
for chd in report.children_ids: |
||||
|
child_ids.append(chd.id) |
||||
|
|
||||
|
vals = { |
||||
|
'r_id': report.id, |
||||
|
'p_id': report.parent_id.id, |
||||
|
'report_type': report.type, |
||||
|
'c_ids': child_ids, |
||||
|
'id': r_name + str(report.id), |
||||
|
'sequence': report.sequence, |
||||
|
'parent': p_name, |
||||
|
'name': report.name, |
||||
|
'balance': res[report.id]['balance'] * int(report.sign), |
||||
|
'type': 'report', |
||||
|
'level': bool( |
||||
|
report.style_overwrite) and report.style_overwrite or |
||||
|
report.level, |
||||
|
'account_type': report.type or False, |
||||
|
'is_present': False, |
||||
|
# used to underline the financial report balances |
||||
|
} |
||||
|
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'] * int( |
||||
|
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'): |
||||
|
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 = { |
||||
|
'r_id': False, |
||||
|
'p_id': report.id, |
||||
|
'report_type': 'accounts', |
||||
|
'c_ids': [], |
||||
|
'account': account.id, |
||||
|
'code': account.code, |
||||
|
'a_id': account.code + re.sub('[^0-9a-zA-Z]+', 'acnt', |
||||
|
account.name) + str( |
||||
|
account.id), |
||||
|
'name': account.code + '-' + account.name, |
||||
|
'balance': value['balance'] * int(report.sign) or 0.0, |
||||
|
'type': 'account', |
||||
|
'parent': r_name + str(report.id), |
||||
|
'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'] |
||||
|
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'] * int( |
||||
|
report.sign) |
||||
|
if not account.company_id.currency_id.is_zero( |
||||
|
vals['balance_cmp']): |
||||
|
flag = True |
||||
|
if flag: |
||||
|
sub_lines.append(vals) |
||||
|
lines += sorted(sub_lines, |
||||
|
key=lambda sub_line: sub_line['name']) |
||||
|
return lines |
||||
|
|
||||
|
def find_journal_items(self, report_lines, form): |
||||
|
cr = self.env.cr |
||||
|
journal_items = [] |
||||
|
for i in report_lines: |
||||
|
if i['type'] == 'account': |
||||
|
account = i['account'] |
||||
|
if form['target_move'] == 'posted': |
||||
|
search_query = "select aml.id, am.id as j_id, aml.account_id, aml.date," \ |
||||
|
" aml.name as label, am.name, " \ |
||||
|
+ "(aml.debit-aml.credit) as balance, aml.debit, aml.credit, aml.partner_id " \ |
||||
|
+ " from account_move_line aml join account_move am " \ |
||||
|
"on (aml.move_id=am.id and am.state=%s) " \ |
||||
|
+ " where aml.account_id=%s" |
||||
|
vals = [form['target_move']] |
||||
|
else: |
||||
|
search_query = "select aml.id, am.id as j_id, aml.account_id, aml.date, " \ |
||||
|
"aml.name as label, am.name, " \ |
||||
|
+ "(aml.debit-aml.credit) as balance, aml.debit, aml.credit, aml.partner_id " \ |
||||
|
+ " from account_move_line aml join account_move am on (aml.move_id=am.id) " \ |
||||
|
+ " where aml.account_id=%s" |
||||
|
vals = [] |
||||
|
if form['date_from'] and form['date_to']: |
||||
|
search_query += " and aml.date>=%s and aml.date<=%s" |
||||
|
vals += [account, form['date_from'], form['date_to']] |
||||
|
elif form['date_from']: |
||||
|
search_query += " and aml.date>=%s" |
||||
|
vals += [account, form['date_from']] |
||||
|
elif form['date_to']: |
||||
|
search_query += " and aml.date<=%s" |
||||
|
vals += [account, form['date_to']] |
||||
|
else: |
||||
|
vals += [account] |
||||
|
|
||||
|
cr.execute(search_query, tuple(vals)) |
||||
|
items = cr.dictfetchall() |
||||
|
|
||||
|
for j in items: |
||||
|
temp = j['id'] |
||||
|
j['id'] = re.sub('[^0-9a-zA-Z]+', '', i['name']) + str( |
||||
|
temp) |
||||
|
j['p_id'] = str(i['a_id']) |
||||
|
j['type'] = 'journal_item' |
||||
|
journal_items.append(j) |
||||
|
return journal_items |
@ -0,0 +1,596 @@ |
|||||
|
import time |
||||
|
from datetime import datetime |
||||
|
|
||||
|
from odoo import models, api, fields |
||||
|
FETCH_RANGE = 2000 |
||||
|
import io |
||||
|
import json |
||||
|
try: |
||||
|
from odoo.tools.misc import xlsxwriter |
||||
|
except ImportError: |
||||
|
import xlsxwriter |
||||
|
year = datetime.now().year |
||||
|
|
||||
|
|
||||
|
class AccountCasgFlow(models.TransientModel): |
||||
|
_name = "account.cash.flow" |
||||
|
_inherit = "account.common.report" |
||||
|
|
||||
|
date_from = fields.Date(string="Start Date", default=str(year)+'-01-01') |
||||
|
date_to = fields.Date(string="End Date", default=fields.Date.today) |
||||
|
today = fields.Date("Report Date", default=fields.Date.today) |
||||
|
levels = fields.Selection([('summary', 'Summary'), |
||||
|
('consolidated', 'Consolidated'), |
||||
|
('detailed', 'Detailed'), |
||||
|
('very', 'Very Detailed')], |
||||
|
string='Levels', required=True, default='summary', |
||||
|
help='Different levels for cash flow statements \n' |
||||
|
'Summary: Month wise report.\n' |
||||
|
'Consolidated: Based on account types.\n' |
||||
|
'Detailed: Based on accounts.\n' |
||||
|
'Very Detailed: Accounts with their move lines') |
||||
|
|
||||
|
account_ids = fields.Many2many( |
||||
|
"account.account", |
||||
|
string="Accounts", |
||||
|
) |
||||
|
|
||||
|
@api.model |
||||
|
def view_report(self, option): |
||||
|
r = self.env['account.cash.flow'].search([('id', '=', option[0])]) |
||||
|
data = { |
||||
|
'model': self, |
||||
|
'journals': r.journal_ids, |
||||
|
'target_move': r.target_move, |
||||
|
'levels': r.levels, |
||||
|
} |
||||
|
if r.date_from: |
||||
|
data.update({ |
||||
|
'date_from': r.date_from, |
||||
|
}) |
||||
|
if r.date_to: |
||||
|
data.update({ |
||||
|
'date_to': r.date_to, |
||||
|
}) |
||||
|
|
||||
|
filters = self.get_filter(option) |
||||
|
report_lines = self._get_report_values(data, option) |
||||
|
fetched_data = report_lines['fetched_data'] |
||||
|
fetched = report_lines['fetched'] |
||||
|
account_res = report_lines['account_res'] |
||||
|
journal_res = report_lines['journal_res'] |
||||
|
levels = report_lines['levels'] |
||||
|
currency = self._get_currency() |
||||
|
|
||||
|
return { |
||||
|
'name': "Cash Flow Statements", |
||||
|
'type': 'ir.actions.client', |
||||
|
'tag': 'c_f', |
||||
|
'report_lines': report_lines, |
||||
|
'fetched_data': fetched_data, |
||||
|
'fetched': fetched, |
||||
|
'account_res': account_res, |
||||
|
'journal_res': journal_res, |
||||
|
'levels': r.levels, |
||||
|
'filters': filters, |
||||
|
'currency': currency, |
||||
|
} |
||||
|
|
||||
|
def get_filter(self, option): |
||||
|
data = self.get_filter_data(option) |
||||
|
filters = {} |
||||
|
if data.get('journal_ids'): |
||||
|
filters['journals'] = self.env['account.journal'].browse(data.get('journal_ids')).mapped('code') |
||||
|
else: |
||||
|
filters['journals'] = ['All'] |
||||
|
if data.get('account_ids', []): |
||||
|
filters['accounts'] = self.env['account.account'].browse(data.get('account_ids', [])).mapped('code') |
||||
|
else: |
||||
|
filters['accounts'] = ['All'] |
||||
|
if data.get('target_move'): |
||||
|
filters['target_move'] = data.get('target_move') |
||||
|
if data.get('date_from'): |
||||
|
filters['date_from'] = data.get('date_from') |
||||
|
if data.get('date_to'): |
||||
|
filters['date_to'] = data.get('date_to') |
||||
|
if data.get('levels'): |
||||
|
filters['levels'] = data.get('levels') |
||||
|
|
||||
|
filters['company_id'] = '' |
||||
|
filters['accounts_list'] = data.get('accounts_list') |
||||
|
filters['journals_list'] = data.get('journals_list') |
||||
|
filters['company_name'] = data.get('company_name') |
||||
|
|
||||
|
return filters |
||||
|
|
||||
|
def get_filter_data(self, option): |
||||
|
r = self.env['account.cash.flow'].search([('id', '=', option[0])]) |
||||
|
default_filters = {} |
||||
|
company_id = r.env.user.company_id |
||||
|
company_domain = [('company_id', '=', company_id.id)] |
||||
|
journals = r.journal_ids if r.journal_ids else self.env['account.journal'].search(company_domain) |
||||
|
accounts = self.account_ids if self.account_ids else self.env['account.account'].search(company_domain) |
||||
|
|
||||
|
filter_dict = { |
||||
|
'journal_ids': r.journal_ids.ids, |
||||
|
'account_ids': self.account_ids.ids, |
||||
|
'company_id': company_id.id, |
||||
|
'date_from': r.date_from, |
||||
|
'date_to': r.date_to, |
||||
|
'levels': r.levels, |
||||
|
'target_move': r.target_move, |
||||
|
'journals_list': [(j.id, j.name, j.code) for j in journals], |
||||
|
'accounts_list': [(a.id, a.name) for a in accounts], |
||||
|
'company_name': company_id and company_id.name, |
||||
|
} |
||||
|
filter_dict.update(default_filters) |
||||
|
return filter_dict |
||||
|
|
||||
|
def _get_report_values(self, data, option): |
||||
|
cr = self.env.cr |
||||
|
data = self.get_filter(option) |
||||
|
company_id = self.env.user.company_id |
||||
|
currency = company_id.currency_id |
||||
|
symbol = company_id.currency_id.symbol |
||||
|
rounding = company_id.currency_id.rounding |
||||
|
position = company_id.currency_id.position |
||||
|
|
||||
|
fetched_data = [] |
||||
|
account_res = [] |
||||
|
journal_res = [] |
||||
|
fetched = [] |
||||
|
|
||||
|
account_type_id = self.env.ref('account.data_account_type_liquidity').id |
||||
|
model = self.env.context.get('active_model') |
||||
|
if data.get('levels') == 'summary': |
||||
|
state = """ WHERE am.state = 'posted' """ if data.get('target_move') == 'posted' else '' |
||||
|
query3 = """SELECT to_char(am.date, 'Month') as month_part, extract(YEAR from am.date) as year_part, |
||||
|
sum(aml.debit) AS total_debit, sum(aml.credit) AS total_credit, |
||||
|
sum(aml.balance) AS total_balance FROM (SELECT am.date, am.id, am.state FROM account_move as am |
||||
|
LEFT JOIN account_move_line aml ON aml.move_id = am.id |
||||
|
LEFT JOIN account_account aa ON aa.id = aml.account_id |
||||
|
LEFT JOIN account_account_type aat ON aat.id = aa.user_type_id |
||||
|
WHERE am.date BETWEEN '""" + str( |
||||
|
data.get('date_from')) + """' and '""" + str( |
||||
|
data.get('date_to')) + """' AND aat.id='""" + str( |
||||
|
account_type_id) + """' ) am |
||||
|
LEFT JOIN account_move_line aml ON aml.move_id = am.id |
||||
|
LEFT JOIN account_account aa ON aa.id = aml.account_id |
||||
|
LEFT JOIN account_account_type aat ON aat.id = aa.user_type_id |
||||
|
""" + state + """GROUP BY month_part,year_part""" |
||||
|
cr = self._cr |
||||
|
cr.execute(query3) |
||||
|
fetched_data = cr.dictfetchall() |
||||
|
elif data.get('date_from') is False: |
||||
|
account_type_id = self.env.ref( |
||||
|
'account.data_account_type_liquidity').id |
||||
|
state = """AND am.state = 'posted' """ if data.get( |
||||
|
'target_move') == 'posted' else '' |
||||
|
sql = """SELECT DISTINCT aa.id, aa.name,aa.code, sum(aml.debit) AS total_debit, |
||||
|
sum(aml.credit) AS total_credit,sum(aml.balance) AS total_balance |
||||
|
FROM (SELECT am.* FROM account_move as am |
||||
|
LEFT JOIN account_move_line aml ON aml.move_id = am.id |
||||
|
LEFT JOIN account_account aa ON aa.id = aml.account_id |
||||
|
LEFT JOIN account_account_type aat ON aat.id = aa.user_type_id |
||||
|
WHERE am.date BETWEEN '""" + str( |
||||
|
data.get('date_from')) + """' and '""" + str( |
||||
|
data.get('date_to')) + """' AND aat.id='""" + str( |
||||
|
account_type_id) + """' """ + state + """) am |
||||
|
LEFT JOIN account_move_line aml ON aml.move_id = am.id |
||||
|
LEFT JOIN account_account aa ON aa.id = aml.account_id |
||||
|
LEFT JOIN account_account_type aat ON aat.id = aa.user_type_id |
||||
|
GROUP BY aa.name, aa.code,aa.id""" |
||||
|
cr = self._cr |
||||
|
cr.execute(sql) |
||||
|
fetched_data = cr.dictfetchall() |
||||
|
elif data.get('date_from') is False and data.get('date_from') != False: |
||||
|
account_type_id = self.env.ref( |
||||
|
'account.data_account_type_liquidity').id |
||||
|
state = """AND am.state = 'posted' """ if data.get( |
||||
|
'target_move') == 'posted' else '' |
||||
|
sql = """SELECT DISTINCT aa.id, aa.name,aa.code, sum(aml.debit) AS total_debit, |
||||
|
sum(aml.credit) AS total_credit,sum(aml.balance) AS total_balance |
||||
|
FROM (SELECT am.* FROM account_move as am |
||||
|
LEFT JOIN account_move_line aml ON aml.move_id = am.id |
||||
|
LEFT JOIN account_account aa ON aa.id = aml.account_id |
||||
|
LEFT JOIN account_account_type aat ON aat.id = aa.user_type_id |
||||
|
WHERE am.date BETWEEN '""" + str( |
||||
|
data.get('date_from')) + """' and '""" + str( |
||||
|
data.get('date_to')) + """' AND aat.id='""" + str( |
||||
|
account_type_id) + """' """ + state + """) am |
||||
|
LEFT JOIN account_move_line aml ON aml.move_id = am.id |
||||
|
LEFT JOIN account_account aa ON aa.id = aml.account_id |
||||
|
LEFT JOIN account_account_type aat ON aat.id = aa.user_type_id |
||||
|
GROUP BY aa.name, aa.code,aa.id""" |
||||
|
cr = self._cr |
||||
|
cr.execute(sql) |
||||
|
fetched_data = cr.dictfetchall() |
||||
|
elif data.get('date_from') is False and data.get('date_from') != False: |
||||
|
account_type_id = self.env.ref( |
||||
|
'account.data_account_type_liquidity').id |
||||
|
state = """AND am.state = 'posted' """ if data.get( |
||||
|
'target_move') == 'posted' else '' |
||||
|
sql = """SELECT DISTINCT aa.id, aa.name,aa.code, sum(aml.debit) AS total_debit, |
||||
|
sum(aml.credit) AS total_credit,sum(aml.balance) AS total_balance |
||||
|
FROM (SELECT am.* FROM account_move as am |
||||
|
LEFT JOIN account_move_line aml ON aml.move_id = am.id |
||||
|
LEFT JOIN account_account aa ON aa.id = aml.account_id |
||||
|
LEFT JOIN account_account_type aat ON aat.id = aa.user_type_id |
||||
|
WHERE am.date BETWEEN '""" + str( |
||||
|
data.get('date_from')) + """' and '""" + str( |
||||
|
data.get('date_to')) + """' AND aat.id='""" + str( |
||||
|
account_type_id) + """' """ + state + """) am |
||||
|
LEFT JOIN account_move_line aml ON aml.move_id = am.id |
||||
|
LEFT JOIN account_account aa ON aa.id = aml.account_id |
||||
|
LEFT JOIN account_account_type aat ON aat.id = aa.user_type_id |
||||
|
GROUP BY aa.name, aa.code,aa.id""" |
||||
|
cr = self._cr |
||||
|
cr.execute(sql) |
||||
|
fetched_data = cr.dictfetchall() |
||||
|
|
||||
|
elif data.get('date_to') == " ": |
||||
|
account_type_id = self.env.ref( |
||||
|
'account.data_account_type_liquidity').id |
||||
|
state = """AND am.state = 'posted' """ if data.get( |
||||
|
'target_move') == 'posted' else '' |
||||
|
sql = """SELECT DISTINCT aa.id, aa.name,aa.code, sum(aml.debit) AS total_debit, |
||||
|
sum(aml.credit) AS total_credit,sum(aml.balance) AS total_balance |
||||
|
FROM (SELECT am.* FROM account_move as am |
||||
|
LEFT JOIN account_move_line aml ON aml.move_id = am.id |
||||
|
LEFT JOIN account_account aa ON aa.id = aml.account_id |
||||
|
LEFT JOIN account_account_type aat ON aat.id = aa.user_type_id |
||||
|
WHERE am.date BETWEEN '""" + str( |
||||
|
data.get('date_from')) + """' and '""" + str( |
||||
|
data.get('date_to')) + """' AND aat.id='""" + str( |
||||
|
account_type_id) + """' """ + state + """) am |
||||
|
LEFT JOIN account_move_line aml ON aml.move_id = am.id |
||||
|
LEFT JOIN account_account aa ON aa.id = aml.account_id |
||||
|
LEFT JOIN account_account_type aat ON aat.id = aa.user_type_id |
||||
|
GROUP BY aa.name, aa.code,aa.id""" |
||||
|
cr = self._cr |
||||
|
cr.execute(sql) |
||||
|
fetched_data = cr.dictfetchall() |
||||
|
|
||||
|
elif data.get('levels') == 'consolidated': |
||||
|
state = """ WHERE am.state = 'posted' """ if data.get('target_move') == 'posted' else '' |
||||
|
query2 = """SELECT aat.name, sum(aml.debit) AS total_debit, sum(aml.credit) AS total_credit, |
||||
|
sum(aml.balance) AS total_balance FROM ( SELECT am.id, am.state FROM account_move as am |
||||
|
LEFT JOIN account_move_line aml ON aml.move_id = am.id |
||||
|
LEFT JOIN account_account aa ON aa.id = aml.account_id |
||||
|
LEFT JOIN account_account_type aat ON aat.id = aa.user_type_id |
||||
|
WHERE am.date BETWEEN '""" + str(data.get('date_from')) + """' and '""" + str( |
||||
|
data.get('date_to')) + """' AND aat.id='""" + str( |
||||
|
account_type_id) + """' ) am |
||||
|
LEFT JOIN account_move_line aml ON aml.move_id = am.id |
||||
|
LEFT JOIN account_account aa ON aa.id = aml.account_id |
||||
|
LEFT JOIN account_account_type aat ON aat.id = aa.user_type_id |
||||
|
""" + state + """GROUP BY aat.name""" |
||||
|
cr = self._cr |
||||
|
cr.execute(query2) |
||||
|
fetched_data = cr.dictfetchall() |
||||
|
elif data.get('levels') == 'detailed': |
||||
|
state = """ WHERE am.state = 'posted' """ if data.get('target_move') == 'posted' else '' |
||||
|
query1 = """SELECT aa.id,aa.name,aa.code, sum(aml.debit) AS total_debit, sum(aml.credit) AS total_credit, |
||||
|
sum(aml.balance) AS total_balance FROM (SELECT am.id, am.state FROM account_move as am |
||||
|
LEFT JOIN account_move_line aml ON aml.move_id = am.id |
||||
|
LEFT JOIN account_account aa ON aa.id = aml.account_id |
||||
|
LEFT JOIN account_account_type aat ON aat.id = aa.user_type_id |
||||
|
WHERE am.date BETWEEN '""" + str( |
||||
|
data.get('date_from')) + """' and '""" + str( |
||||
|
data.get('date_to')) + """' AND aat.id='""" + str( |
||||
|
account_type_id) + """' ) am |
||||
|
LEFT JOIN account_move_line aml ON aml.move_id = am.id |
||||
|
LEFT JOIN account_account aa ON aa.id = aml.account_id |
||||
|
LEFT JOIN account_account_type aat ON aat.id = aa.user_type_id |
||||
|
""" + state + """GROUP BY aa.name, aa.code, aa.id""" |
||||
|
cr = self._cr |
||||
|
cr.execute(query1) |
||||
|
fetched_data = cr.dictfetchall() |
||||
|
for account in self.env['account.account'].search([]): |
||||
|
child_lines = self.get_journal_lines(account, data) |
||||
|
if child_lines: |
||||
|
journal_res.append(child_lines) |
||||
|
|
||||
|
else: |
||||
|
account_type_id = self.env.ref( |
||||
|
'account.data_account_type_liquidity').id |
||||
|
state = """AND am.state = 'posted' """ if data.get('target_move') == 'posted' else '' |
||||
|
sql = """SELECT DISTINCT aa.id, aa.name,aa.code, sum(aml.debit) AS total_debit, |
||||
|
sum(aml.credit) AS total_credit,sum(aml.balance) AS total_balance |
||||
|
FROM (SELECT am.* FROM account_move as am |
||||
|
LEFT JOIN account_move_line aml ON aml.move_id = am.id |
||||
|
LEFT JOIN account_account aa ON aa.id = aml.account_id |
||||
|
LEFT JOIN account_account_type aat ON aat.id = aa.user_type_id |
||||
|
WHERE am.date BETWEEN '""" + str( |
||||
|
data.get('date_from')) + """' and '""" + str( |
||||
|
data.get('date_to')) + """' AND aat.id='""" + str( |
||||
|
account_type_id) + """' """ + state + """) am |
||||
|
LEFT JOIN account_move_line aml ON aml.move_id = am.id |
||||
|
LEFT JOIN account_account aa ON aa.id = aml.account_id |
||||
|
LEFT JOIN account_account_type aat ON aat.id = aa.user_type_id |
||||
|
GROUP BY aa.name, aa.code,aa.id""" |
||||
|
cr = self._cr |
||||
|
cr.execute(sql) |
||||
|
fetched_data = cr.dictfetchall() |
||||
|
for account in self.env['account.account'].search([]): |
||||
|
child_lines = self._get_lines(account, data) |
||||
|
if child_lines: |
||||
|
account_res.append(child_lines) |
||||
|
journals = self.get_journal_lines(account, data) |
||||
|
if journals: |
||||
|
journal_res.append(journals) |
||||
|
|
||||
|
return { |
||||
|
'date_from': data.get('date_from'), |
||||
|
'date_to': data.get('date_to'), |
||||
|
'levels': data.get('level'), |
||||
|
'doc_ids': self.ids, |
||||
|
'doc_model': model, |
||||
|
'fetched_data': fetched_data, |
||||
|
'account_res': account_res, |
||||
|
'journal_res': journal_res, |
||||
|
'fetched': fetched, |
||||
|
'company_currency_id': currency, |
||||
|
'company_currency_symbol': symbol, |
||||
|
'company_currency_position': position, |
||||
|
} |
||||
|
|
||||
|
def _get_lines(self, account, data): |
||||
|
account_type_id = self.env.ref( |
||||
|
'account.data_account_type_liquidity').id |
||||
|
state = """AND am.state = 'posted' """ if data.get('target_move') == 'posted' else '' |
||||
|
query = """SELECT aml.account_id,aj.id as j_id,aj.name,am.id, am.name as move_name, sum(aml.debit) AS total_debit, |
||||
|
sum(aml.credit) AS total_credit, COALESCE(SUM(aml.debit - aml.credit),0) AS balance FROM (SELECT am.* FROM account_move as am |
||||
|
LEFT JOIN account_move_line aml ON aml.move_id = am.id |
||||
|
LEFT JOIN account_account aa ON aa.id = aml.account_id |
||||
|
LEFT JOIN account_account_type aat ON aat.id = aa.user_type_id |
||||
|
WHERE am.date BETWEEN '""" + str( |
||||
|
data.get('date_from')) + """' and '""" + str( |
||||
|
data.get('date_to')) + """' AND aat.id='""" + str( |
||||
|
account_type_id) + """' """ + state + """) am |
||||
|
LEFT JOIN account_move_line aml ON aml.move_id = am.id |
||||
|
LEFT JOIN account_account aa ON aa.id = aml.account_id |
||||
|
LEFT JOIN account_journal aj ON aj.id = am.journal_id |
||||
|
WHERE aa.id = """ + str(account.id) + """ |
||||
|
GROUP BY am.name, aml.account_id, aj.id, aj.name, am.id""" |
||||
|
|
||||
|
cr = self._cr |
||||
|
cr.execute(query) |
||||
|
fetched_data = cr.dictfetchall() |
||||
|
|
||||
|
sql2 = """SELECT aa.name as account_name,aa.id as account_id, aj.id, aj.name, sum(aml.debit) AS total_debit, |
||||
|
sum(aml.credit) AS total_credit, sum(aml.balance) AS total_balance FROM (SELECT am.* FROM account_move as am |
||||
|
LEFT JOIN account_move_line aml ON aml.move_id = am.id |
||||
|
LEFT JOIN account_account aa ON aa.id = aml.account_id |
||||
|
LEFT JOIN account_account_type aat ON aat.id = aa.user_type_id |
||||
|
WHERE am.date BETWEEN '""" + str( |
||||
|
data.get('date_from')) + """' and '""" + str( |
||||
|
data.get('date_to')) + """' AND aat.id='""" + str( |
||||
|
account_type_id) + """' """ + state + """) am |
||||
|
LEFT JOIN account_move_line aml ON aml.move_id = am.id |
||||
|
LEFT JOIN account_account aa ON aa.id = aml.account_id |
||||
|
LEFT JOIN account_journal aj ON aj.id = am.journal_id |
||||
|
WHERE aa.id = """ + str( |
||||
|
account.id) + """ |
||||
|
GROUP BY aa.name, aj.name, aj.id,aa.id""" |
||||
|
|
||||
|
cr = self._cr |
||||
|
cr.execute(sql2) |
||||
|
fetch_data = cr.dictfetchall() |
||||
|
if fetched_data: |
||||
|
return { |
||||
|
'account': account.name, |
||||
|
'id': account.id, |
||||
|
'code': account.code, |
||||
|
'move_lines': fetched_data, |
||||
|
'journal_lines': fetch_data, |
||||
|
} |
||||
|
|
||||
|
|
||||
|
def get_journal_lines(self, account, data, offset=0, fetch_range=FETCH_RANGE): |
||||
|
account_type_id = self.env.ref( |
||||
|
'account.data_account_type_liquidity').id |
||||
|
offset_count = offset * fetch_range |
||||
|
state = """AND am.state = 'posted' """ if data.get('target_move') == 'posted' else '' |
||||
|
sql2 = """SELECT aa.name as account_name, aj.name, sum(aml.debit) AS total_debit, |
||||
|
sum(aml.credit) AS total_credit, COALESCE(SUM(aml.debit - aml.credit),0) AS balance FROM (SELECT am.* FROM account_move as am |
||||
|
LEFT JOIN account_move_line aml ON aml.move_id = am.id |
||||
|
LEFT JOIN account_account aa ON aa.id = aml.account_id |
||||
|
LEFT JOIN account_account_type aat ON aat.id = aa.user_type_id |
||||
|
WHERE am.date BETWEEN '""" + str( |
||||
|
data.get('date_from')) + """' and '""" + str( |
||||
|
data.get('date_to')) + """' AND aat.id='""" + str( |
||||
|
account_type_id) + """' """ + state + """) am |
||||
|
LEFT JOIN account_move_line aml ON aml.move_id = am.id |
||||
|
LEFT JOIN account_account aa ON aa.id = aml.account_id |
||||
|
LEFT JOIN account_journal aj ON aj.id = am.journal_id |
||||
|
WHERE aa.id = """ + str(account.id) + """ |
||||
|
GROUP BY aa.name, aj.name""" |
||||
|
|
||||
|
cr = self._cr |
||||
|
cr.execute(sql2) |
||||
|
fetched_data = cr.dictfetchall() |
||||
|
if fetched_data: |
||||
|
return { |
||||
|
'account': account.name, |
||||
|
'id': account.id, |
||||
|
'journal_lines': fetched_data, |
||||
|
'offset': offset_count, |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
@api.model |
||||
|
def create(self, vals): |
||||
|
vals['target_move'] = 'all' |
||||
|
res = super(AccountCasgFlow, self).create(vals) |
||||
|
return res |
||||
|
|
||||
|
def write(self, vals): |
||||
|
if vals.get('journal_ids'): |
||||
|
vals.update({'journal_ids': [(6, 0, vals.get('journal_ids'))]}) |
||||
|
if vals.get('journal_ids') == []: |
||||
|
vals.update({'journal_ids': [(5,)]}) |
||||
|
if vals.get('account_ids'): |
||||
|
vals.update({'account_ids': [(4, j) for j in vals.get('account_ids')]}) |
||||
|
if vals.get('account_ids') == []: |
||||
|
vals.update({'account_ids': [(5,)]}) |
||||
|
|
||||
|
res = super(AccountCasgFlow, self).write(vals) |
||||
|
return res |
||||
|
|
||||
|
@api.model |
||||
|
def _get_currency(self): |
||||
|
journal = self.env['account.journal'].browse( |
||||
|
self.env.context.get('default_journal_id', False)) |
||||
|
if journal.currency_id: |
||||
|
return journal.currency_id.id |
||||
|
currency_array = [self.env.user.company_id.currency_id.symbol, self.env.user.company_id.currency_id.position] |
||||
|
return currency_array |
||||
|
|
||||
|
def get_dynamic_xlsx_report(self, data, response, report_data, dfr_data): |
||||
|
report_main_data = json.loads(dfr_data) |
||||
|
data = json.loads(data) |
||||
|
report_data = report_main_data.get('report_lines') |
||||
|
output = io.BytesIO() |
||||
|
workbook = xlsxwriter.Workbook(output, {'in_memory': True}) |
||||
|
fetched_data = report_data.get('fetched_data') |
||||
|
account_res = report_data.get('account_res') |
||||
|
journal_res = report_data.get('journal_res') |
||||
|
fetched = report_data.get('fetched') |
||||
|
account_type_id = self.env.ref('account.data_account_type_liquidity').id |
||||
|
currency_symbol = self.env.user.company_id.currency_id.symbol |
||||
|
|
||||
|
|
||||
|
logged_users = self.env['res.company']._company_default_get('account.account') |
||||
|
sheet = workbook.add_worksheet() |
||||
|
bold = workbook.add_format({'align': 'center', |
||||
|
'bold': True, |
||||
|
'font_size': '10px', |
||||
|
'border': 1}) |
||||
|
date = workbook.add_format({'font_size': '10px'}) |
||||
|
cell_format = workbook.add_format({'bold': True, |
||||
|
'font_size': '10px'}) |
||||
|
head = workbook.add_format({'align': 'center', |
||||
|
'bold': True, |
||||
|
'bg_color': '#D3D3D3', |
||||
|
'font_size': '15px'}) |
||||
|
txt = workbook.add_format({'align': 'left', |
||||
|
'font_size': '10px'}) |
||||
|
txt_left = workbook.add_format({'align': 'left', |
||||
|
'font_size': '10px', |
||||
|
'border': 1}) |
||||
|
txt_center = workbook.add_format({'align': 'center', |
||||
|
'font_size': '10px', |
||||
|
'border': 1}) |
||||
|
amount = workbook.add_format({'align': 'right', |
||||
|
'font_size': '10px', |
||||
|
'border': 1}) |
||||
|
amount_bold = workbook.add_format({'align': 'right', |
||||
|
'bold': True, |
||||
|
'font_size': '10px', |
||||
|
'border': 1}) |
||||
|
txt_bold = workbook.add_format({'align': 'left', |
||||
|
'bold': True, |
||||
|
'font_size': '10px', |
||||
|
'border': 1}) |
||||
|
|
||||
|
sheet.set_column('C:C', 30, cell_format) |
||||
|
sheet.set_column('D:E', 20, cell_format) |
||||
|
sheet.set_column('F:F', 20, cell_format) |
||||
|
sheet.merge_range('C3:F5', '') |
||||
|
sheet.merge_range('C3:F4', 'CASH FLOW STATEMENTS', head) |
||||
|
sheet.merge_range('C4:F4', '') |
||||
|
|
||||
|
sheet.write('C6', "Date From", cell_format) |
||||
|
sheet.write('D6', str(data['date_from']), date) |
||||
|
sheet.write('E6', "Date To", cell_format) |
||||
|
sheet.write('F6', str(data['date_to']), date) |
||||
|
if data.get('levels'): |
||||
|
sheet.write('C7', "Level", cell_format) |
||||
|
sheet.write('D7', data.get("levels"), date) |
||||
|
sheet.write('E7', "Target Moves", cell_format) |
||||
|
sheet.write('F7', data.get("target_move"), date) |
||||
|
sheet.write('C9', 'NAME', bold) |
||||
|
sheet.write('D9', 'CASH IN', bold) |
||||
|
sheet.write('E9', 'CASH OUT', bold) |
||||
|
sheet.write('F9', 'BALANCE', bold) |
||||
|
|
||||
|
row_num = 9 |
||||
|
col_num = 2 |
||||
|
fetched_data_list = fetched_data |
||||
|
account_res_list = account_res |
||||
|
journal_res_list = journal_res |
||||
|
fetched_list = fetched |
||||
|
|
||||
|
for i_rec in fetched_data_list: |
||||
|
if data['levels'] == 'summary': |
||||
|
sheet.write(row_num + 1, col_num, str(i_rec['month_part']) + str(int(i_rec['year_part'])), txt_left) |
||||
|
sheet.write(row_num + 1, col_num + 1, str(i_rec['total_debit']) + str(currency_symbol), amount) |
||||
|
sheet.write(row_num + 1, col_num + 2, str(i_rec['total_credit']) + str(currency_symbol), amount) |
||||
|
sheet.write(row_num + 1, col_num + 3, |
||||
|
str(i_rec['total_debit'] - i_rec['total_credit']) + str(currency_symbol), |
||||
|
amount) |
||||
|
row_num = row_num + 1 |
||||
|
elif data['levels'] == 'consolidated': |
||||
|
sheet.write(row_num + 1, col_num, i_rec['name'], txt_left) |
||||
|
sheet.write(row_num + 1, col_num + 1, str(i_rec['total_debit']) + str(currency_symbol), amount) |
||||
|
sheet.write(row_num + 1, col_num + 2, str(i_rec['total_credit']) + str(currency_symbol), amount) |
||||
|
sheet.write(row_num + 1, col_num + 3, |
||||
|
str(i_rec['total_debit'] - i_rec['total_credit']) + str(currency_symbol), |
||||
|
amount) |
||||
|
row_num = row_num + 1 |
||||
|
|
||||
|
for j_rec in journal_res_list: |
||||
|
if data['levels'] == 'detailed': |
||||
|
for k in fetched_data_list: |
||||
|
if k['name'] == j_rec['account']: |
||||
|
sheet.write(row_num + 1, col_num, str(k['code']) + str(k['name']), txt_bold) |
||||
|
sheet.write(row_num + 1, col_num + 1, str(k['total_debit']) + str(currency_symbol), amount_bold) |
||||
|
sheet.write(row_num + 1, col_num + 2, str(k['total_credit']) + str(currency_symbol), amount_bold) |
||||
|
sheet.write(row_num + 1, col_num + 3, |
||||
|
str(k['total_debit'] - k['total_credit']) + str(currency_symbol), amount_bold) |
||||
|
row_num = row_num + 1 |
||||
|
for l_jrec in j_rec['journal_lines']: |
||||
|
sheet.write(row_num + 1, col_num, l_jrec['name'], txt_left) |
||||
|
sheet.write(row_num + 1, col_num + 1, str(l_jrec['total_debit']) + str(currency_symbol), amount) |
||||
|
sheet.write(row_num + 1, col_num + 2, str(l_jrec['total_credit']) + str(currency_symbol), amount) |
||||
|
sheet.write(row_num + 1, col_num + 3, |
||||
|
str(l_jrec['total_debit'] - l_jrec['total_credit']) + str(currency_symbol), |
||||
|
amount) |
||||
|
row_num = row_num + 1 |
||||
|
|
||||
|
for j_rec in account_res_list: |
||||
|
if data['levels'] == 'very': |
||||
|
for k in fetched_data_list: |
||||
|
if k['name'] == j_rec['account']: |
||||
|
sheet.write(row_num + 1, col_num, str(k['code']) + str(k['name']), txt_bold) |
||||
|
sheet.write(row_num + 1, col_num + 1, str(k['total_debit']) + str(currency_symbol), amount_bold) |
||||
|
sheet.write(row_num + 1, col_num + 2, str(k['total_credit']) + str(currency_symbol), amount_bold) |
||||
|
sheet.write(row_num + 1, col_num + 3, |
||||
|
str(k['total_debit'] - k['total_credit']) + str(currency_symbol), amount_bold) |
||||
|
row_num = row_num + 1 |
||||
|
for l_jrec in j_rec['journal_lines']: |
||||
|
if l_jrec['account_name'] == j_rec['account']: |
||||
|
sheet.write(row_num + 1, col_num, l_jrec['name'], txt_left) |
||||
|
sheet.write(row_num + 1, col_num + 1, str(l_jrec['total_debit']) + str(currency_symbol), amount) |
||||
|
sheet.write(row_num + 1, col_num + 2, str(l_jrec['total_credit']) + str(currency_symbol), amount) |
||||
|
sheet.write(row_num + 1, col_num + 3, |
||||
|
str(l_jrec['total_debit'] - l_jrec['total_credit']) + str(currency_symbol), |
||||
|
amount) |
||||
|
row_num = row_num + 1 |
||||
|
for m_rec in j_rec['move_lines']: |
||||
|
if m_rec['name'] == l_jrec['name']: |
||||
|
sheet.write(row_num + 1, col_num, m_rec['move_name'], txt_center) |
||||
|
sheet.write(row_num + 1, col_num + 1, str(m_rec['total_debit']) + str(currency_symbol), amount) |
||||
|
sheet.write(row_num + 1, col_num + 2, str(m_rec['total_credit']) + str(currency_symbol), amount) |
||||
|
sheet.write(row_num + 1, col_num + 3, |
||||
|
str(m_rec['total_debit'] - m_rec['total_credit']) + str(currency_symbol), |
||||
|
amount) |
||||
|
row_num = row_num + 1 |
||||
|
|
||||
|
workbook.close() |
||||
|
output.seek(0) |
||||
|
response.stream.write(output.read()) |
||||
|
output.close() |
@ -0,0 +1,309 @@ |
|||||
|
import time |
||||
|
from datetime import date |
||||
|
from datetime import timedelta, datetime |
||||
|
from odoo import fields, models, api, _ |
||||
|
import io |
||||
|
import json |
||||
|
|
||||
|
try: |
||||
|
from odoo.tools.misc import xlsxwriter |
||||
|
except ImportError: |
||||
|
import xlsxwriter |
||||
|
|
||||
|
|
||||
|
class AgeingView(models.TransientModel): |
||||
|
_name = 'account.day.book' |
||||
|
|
||||
|
company_id = fields.Many2one('res.company', string='Company', |
||||
|
readonly=True, |
||||
|
default=lambda self: self.env.company) |
||||
|
journal_ids = fields.Many2many('account.journal', string='Journals', |
||||
|
required=True, |
||||
|
default=lambda self: self.env[ |
||||
|
'account.journal'].search([])) |
||||
|
|
||||
|
account_ids = fields.Many2many('account.account', |
||||
|
required=True, string='Accounts', |
||||
|
) |
||||
|
|
||||
|
date_from = fields.Date(string='Start Date', default=date.today(), |
||||
|
required=True) |
||||
|
date_to = fields.Date(string='End Date', default=date.today(), |
||||
|
required=True) |
||||
|
|
||||
|
target_move = fields.Selection([('posted', 'All Posted Entries'), |
||||
|
('all', 'All Entries')], |
||||
|
string='Target Moves', required=True, |
||||
|
default='posted') |
||||
|
|
||||
|
@api.model |
||||
|
def view_report(self, option): |
||||
|
r = self.env['account.day.book'].search([('id', '=', option[0])]) |
||||
|
data = {} |
||||
|
data['ids'] = self.env.context.get('active_ids', []) |
||||
|
data['model'] = self.env.context.get('active_model', 'ir.ui.menu') |
||||
|
data['form'] = \ |
||||
|
r.read(['date_from', 'date_to', 'journal_ids', 'target_move', |
||||
|
'account_ids'])[0] |
||||
|
filters = self.get_filter(option) |
||||
|
records = self._get_report_values(data) |
||||
|
currency = self._get_currency() |
||||
|
return { |
||||
|
'name': "Day Book", |
||||
|
'type': 'ir.actions.client', |
||||
|
'tag': 'd_b', |
||||
|
'filters': filters, |
||||
|
'report_lines': records['Accounts'], |
||||
|
'currency': currency, |
||||
|
} |
||||
|
|
||||
|
def get_filter(self, option): |
||||
|
data = self.get_filter_data(option) |
||||
|
filters = {} |
||||
|
|
||||
|
if data.get('target_move'): |
||||
|
filters['target_move'] = data.get('target_move') |
||||
|
if data.get('date_from'): |
||||
|
filters['date_from'] = data.get('date_from') |
||||
|
if data.get('date_to'): |
||||
|
filters['date_to'] = data.get('date_to') |
||||
|
if data.get('journal_ids'): |
||||
|
filters['journals'] = self.env['account.journal'].browse( |
||||
|
data.get('journal_ids')).mapped('code') |
||||
|
else: |
||||
|
filters['journals'] = ['All'] |
||||
|
if data.get('account_ids', []): |
||||
|
filters['accounts'] = self.env['account.account'].browse( |
||||
|
data.get('account_ids', [])).mapped('code') |
||||
|
else: |
||||
|
filters['accounts'] = ['All'] |
||||
|
filters['company_id'] = '' |
||||
|
filters['accounts_list'] = data.get('accounts_list') |
||||
|
filters['journals_list'] = data.get('journals_list') |
||||
|
filters['company_name'] = data.get('company_name') |
||||
|
|
||||
|
return filters |
||||
|
|
||||
|
def get_filter_data(self, option): |
||||
|
r = self.env['account.day.book'].search([('id', '=', option[0])]) |
||||
|
default_filters = {} |
||||
|
company_id = r.env.user.company_id |
||||
|
company_domain = [('company_id', '=', company_id.id)] |
||||
|
journals = self.journal_ids if self.journal_ids else self.env[ |
||||
|
'account.journal'].search(company_domain) |
||||
|
accounts = self.account_ids if self.account_ids else self.env[ |
||||
|
'account.account'].search(company_domain) |
||||
|
|
||||
|
filter_dict = { |
||||
|
'journal_ids': self.journal_ids.ids, |
||||
|
'account_ids': self.account_ids.ids, |
||||
|
'company_id': company_id.id, |
||||
|
'date_from': r.date_from, |
||||
|
'date_to':r.date_to, |
||||
|
|
||||
|
'target_move': r.target_move, |
||||
|
'journals_list': [(j.id, j.name, j.code) for j in journals], |
||||
|
'accounts_list': [(a.id, a.name) for a in accounts], |
||||
|
|
||||
|
'company_name': company_id and company_id.name, |
||||
|
} |
||||
|
filter_dict.update(default_filters) |
||||
|
return filter_dict |
||||
|
|
||||
|
def _get_report_values(self, data=None): |
||||
|
form_data = data['form'] |
||||
|
active_acc = data['form']['account_ids'] |
||||
|
accounts = self.env['account.account'].search( |
||||
|
[('id', 'in', active_acc)]) if data['form']['account_ids'] else \ |
||||
|
self.env['account.account'].search([]) |
||||
|
active_jrnl = data['form']['journal_ids'] |
||||
|
journals = self.env['account.journal'].search( |
||||
|
[('id', 'in', active_jrnl)]) if data['form']['journal_ids'] else \ |
||||
|
self.env['account.journal'].search([]) |
||||
|
|
||||
|
|
||||
|
date_start = datetime.strptime(str(form_data['date_from']), |
||||
|
'%Y-%m-%d').date() |
||||
|
date_end = datetime.strptime(str(form_data['date_to']), '%Y-%m-%d').date() |
||||
|
days = date_end - date_start |
||||
|
dates = [] |
||||
|
record = [] |
||||
|
for i in range(days.days + 1): |
||||
|
dates.append(date_start + timedelta(days=i)) |
||||
|
for head in dates: |
||||
|
pass_date = str(head) |
||||
|
accounts_res = self._get_account_move_entry( |
||||
|
accounts, form_data,journals, pass_date) |
||||
|
if accounts_res['lines']: |
||||
|
record.append({ |
||||
|
'date': head, |
||||
|
'debit': accounts_res['debit'], |
||||
|
'credit': accounts_res['credit'], |
||||
|
'balance': accounts_res['balance'], |
||||
|
'child_lines': accounts_res['lines'], |
||||
|
'id': accounts_res['move_id'], |
||||
|
}) |
||||
|
return { |
||||
|
'doc_ids': self.ids, |
||||
|
'time': time, |
||||
|
'Accounts': record, |
||||
|
} |
||||
|
|
||||
|
@api.model |
||||
|
def create(self, vals): |
||||
|
vals['target_move'] = 'all' |
||||
|
res = super(AgeingView, self).create(vals) |
||||
|
return res |
||||
|
|
||||
|
def write(self, vals): |
||||
|
if vals.get('journal_ids'): |
||||
|
vals.update({'journal_ids': [(6, 0, vals.get('journal_ids'))]}) |
||||
|
if vals.get('journal_ids') == []: |
||||
|
vals.update({'journal_ids': [(5,)]}) |
||||
|
if vals.get('account_ids'): |
||||
|
vals.update( |
||||
|
{'account_ids': [(4, j) for j in vals.get('account_ids')]}) |
||||
|
if vals.get('account_ids') == []: |
||||
|
vals.update({'account_ids': [(5,)]}) |
||||
|
res = super(AgeingView, self).write(vals) |
||||
|
return res |
||||
|
|
||||
|
def _get_account_move_entry(self, accounts, form_data,journals, pass_date): |
||||
|
cr = self.env.cr |
||||
|
move_line = self.env['account.move.line'] |
||||
|
tables, where_clause, where_params = move_line._query_get() |
||||
|
wheres = [""] |
||||
|
if where_clause.strip(): |
||||
|
wheres.append(where_clause.strip()) |
||||
|
if form_data['target_move'] == 'posted': |
||||
|
target_move = "AND m.state = 'posted'" |
||||
|
else: |
||||
|
target_move = '' |
||||
|
sql = (''' |
||||
|
SELECT l.id AS lid,m.id AS move_id, acc.name as accname, l.account_id AS account_id, l.date AS ldate, j.code AS lcode, l.currency_id, |
||||
|
l.amount_currency, l.ref AS lref, l.name AS lname, COALESCE(l.debit,0) AS debit, COALESCE(l.credit,0) AS credit, |
||||
|
COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) AS balance, |
||||
|
m.name AS move_name, c.symbol AS currency_code, p.name AS partner_name |
||||
|
FROM account_move_line l |
||||
|
JOIN account_move m ON (l.move_id=m.id) |
||||
|
LEFT JOIN res_currency c ON (l.currency_id=c.id) |
||||
|
LEFT JOIN res_partner p ON (l.partner_id=p.id) |
||||
|
JOIN account_journal j ON (l.journal_id=j.id) |
||||
|
JOIN account_account acc ON (l.account_id = acc.id) |
||||
|
WHERE l.account_id IN %s AND l.journal_id IN %s ''' + target_move + ''' AND l.date = %s |
||||
|
GROUP BY l.id,m.id, l.account_id, l.date, |
||||
|
j.code, l.currency_id, l.amount_currency, l.ref, l.name, m.name, c.symbol, p.name , acc.name |
||||
|
ORDER BY l.date DESC |
||||
|
''') |
||||
|
params = ( |
||||
|
tuple(accounts.ids), tuple(journals.ids), pass_date) |
||||
|
cr.execute(sql, params) |
||||
|
data = cr.dictfetchall() |
||||
|
|
||||
|
res = {} |
||||
|
debit = credit = balance = 0.00 |
||||
|
id = '' |
||||
|
for line in data: |
||||
|
debit += line['debit'] |
||||
|
credit += line['credit'] |
||||
|
balance += line['balance'] |
||||
|
id = line['move_id'] |
||||
|
res['debit'] = debit |
||||
|
res['credit'] = credit |
||||
|
res['balance'] = balance |
||||
|
res['lines'] = data |
||||
|
res['move_id'] = id |
||||
|
return res |
||||
|
|
||||
|
@api.model |
||||
|
def _get_currency(self): |
||||
|
journal = self.env['account.journal'].browse( |
||||
|
self.env.context.get('default_journal_id', False)) |
||||
|
if journal.currency_id: |
||||
|
return journal.currency_id.id |
||||
|
currency_array = [self.env.user.company_id.currency_id.symbol, |
||||
|
self.env.user.company_id.currency_id.position] |
||||
|
|
||||
|
return currency_array |
||||
|
|
||||
|
def get_dynamic_xlsx_report(self, data, response, report_data, dfr_data): |
||||
|
report_data_main = json.loads(report_data) |
||||
|
output = io.BytesIO() |
||||
|
filters = json.loads(data) |
||||
|
workbook = xlsxwriter.Workbook(output, {'in_memory': True}) |
||||
|
sheet = workbook.add_worksheet() |
||||
|
head = workbook.add_format({'align': 'center', 'bold': True, |
||||
|
'font_size': '20px'}) |
||||
|
sub_heading = workbook.add_format( |
||||
|
{'align': 'center', 'bold': True, 'font_size': '10px', |
||||
|
'border': 1, |
||||
|
'border_color': 'black'}) |
||||
|
txt = workbook.add_format({'font_size': '10px', 'border': 1}) |
||||
|
txt_l = workbook.add_format( |
||||
|
{'font_size': '10px', 'border': 1, 'bold': True}) |
||||
|
sheet.merge_range('A2:D3', |
||||
|
self.env.user.company_id.name + ':' + ' Day Book', |
||||
|
head) |
||||
|
date_head = workbook.add_format({'align': 'center', 'bold': True, |
||||
|
'font_size': '10px'}) |
||||
|
date_style = workbook.add_format({'align': 'center', |
||||
|
'font_size': '10px'}) |
||||
|
if filters.get('date_from'): |
||||
|
sheet.merge_range('A4:B4', 'From: ' + filters.get('date_from'), |
||||
|
date_head) |
||||
|
if filters.get('date_to'): |
||||
|
sheet.merge_range('C4:D4', 'To: ' + filters.get('date_to'), |
||||
|
date_head) |
||||
|
sheet.write('A5', 'Journals: ' + ', '.join([lt or '' for lt in |
||||
|
filters[ |
||||
|
'journals']]), |
||||
|
date_head) |
||||
|
|
||||
|
sheet.merge_range('E4:F4', |
||||
|
'Target Moves: ' + filters.get('target_move'), |
||||
|
date_head) |
||||
|
sheet.merge_range('B5:D5', |
||||
|
'Account Type: ' + ', '.join([lt or '' for lt in |
||||
|
filters[ |
||||
|
'accounts']]), |
||||
|
date_head) |
||||
|
|
||||
|
sheet.merge_range('A7:E7', 'Date', sub_heading) |
||||
|
sheet.write('F7', 'Debit', sub_heading) |
||||
|
sheet.write('G7', 'Credit', sub_heading) |
||||
|
sheet.write('H7', 'Balance', sub_heading) |
||||
|
|
||||
|
row = 6 |
||||
|
col = 0 |
||||
|
sheet.set_column(4, 0, 15) |
||||
|
sheet.set_column(5, 0, 15) |
||||
|
sheet.set_column(6, 1, 15) |
||||
|
sheet.set_column(7, 2, 15) |
||||
|
sheet.set_column(8, 3, 15) |
||||
|
sheet.set_column(9, 4, 15) |
||||
|
sheet.set_column(10, 5, 15) |
||||
|
sheet.set_column(11, 6, 15) |
||||
|
for rec_data in report_data_main: |
||||
|
one_lst = [] |
||||
|
two_lst = [] |
||||
|
row += 1 |
||||
|
sheet.merge_range(row, col, row, col + 4, rec_data['date'], txt_l) |
||||
|
sheet.write(row, col + 5, rec_data['debit'], txt_l) |
||||
|
sheet.write(row, col + 6, rec_data['credit'], txt_l) |
||||
|
sheet.write(row, col + 7, rec_data['balance'], txt_l) |
||||
|
for line_data in rec_data['child_lines']: |
||||
|
row += 1 |
||||
|
sheet.write(row, col, line_data.get('ldate'), txt) |
||||
|
sheet.write(row, col + 1, line_data.get('lcode'), txt) |
||||
|
sheet.write(row, col + 2, line_data.get('partner_name'), |
||||
|
txt) |
||||
|
sheet.write(row, col + 3, line_data.get('move_name'), txt) |
||||
|
sheet.write(row, col + 4, line_data.get('lname'), txt) |
||||
|
sheet.write(row, col + 5, line_data.get('debit'), txt) |
||||
|
sheet.write(row, col + 6, line_data.get('credit'), txt) |
||||
|
sheet.write(row, col + 7, line_data.get('balance'), txt) |
||||
|
|
||||
|
workbook.close() |
||||
|
output.seek(0) |
||||
|
response.stream.write(output.read()) |
||||
|
output.close() |