@ -0,0 +1,48 @@ | 
				
			|||
Dynamic Financial Reports | 
				
			|||
========================= | 
				
			|||
* Dynamic financial reports for Odoo 14 community editions | 
				
			|||
 | 
				
			|||
Installation | 
				
			|||
============ | 
				
			|||
	- www.odoo.com/documentation/14.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: | 
				
			|||
(v14) Mehjabin @ Cybrosys | 
				
			|||
(v14) Jibin @ Cybrosys | 
				
			|||
(v14) Sachin @ Cybrosys | 
				
			|||
(v14) Mily @ Cybrosys | 
				
			|||
(v14) Arunima @ Cybrosys | 
				
			|||
(v14) Aneesh @ Cybrosys | 
				
			|||
(v14) Sonu @ Cybrosys | 
				
			|||
(v14) Vaishnavi @ 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,3 @@ | 
				
			|||
from . import wizard | 
				
			|||
from . import report | 
				
			|||
from . import controllers | 
				
			|||
@ -0,0 +1,73 @@ | 
				
			|||
# -*- 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': '14.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/general_ledger_view.xml', | 
				
			|||
        'views/gl_template.xml', | 
				
			|||
        'wizard/dynamic_ledger_view.xml', | 
				
			|||
        'views/templates.xml', | 
				
			|||
        'views/pl_template.xml', | 
				
			|||
        'wizard/partner_ledger_view.xml', | 
				
			|||
        'views/al_template.xml', | 
				
			|||
        'views/kit_menus.xml', | 
				
			|||
        'wizard/dynamic_partner_ageing.xml', | 
				
			|||
        'views/bank_book_pdf_template.xml', | 
				
			|||
        'views/cash_book_pdf_template.xml', | 
				
			|||
        'views/cashfl.xml', | 
				
			|||
        'views/financial_report_qweb_pdf_template.xml', | 
				
			|||
        'views/menu_dynamic_financial_reports.xml', | 
				
			|||
        'views/db_templates.xml', | 
				
			|||
    ], | 
				
			|||
    'qweb': [ | 
				
			|||
        'static/src/xml/views.xml', | 
				
			|||
        'static/src/xml/tb_view.xml', | 
				
			|||
        'static/src/xml/bs_template_views.xml', | 
				
			|||
        'static/src/xml/profit_loss_template_views.xml', | 
				
			|||
        'static/src/xml/partner_ledger_views.xml', | 
				
			|||
        'static/src/xml/al_views.xml', | 
				
			|||
        'static/src/xml/bank_book_view.xml', | 
				
			|||
        'static/src/xml/cash_book_view.xml', | 
				
			|||
        'static/src/xml/cash_flow.xml', | 
				
			|||
        'static/src/xml/db_lines.xml', | 
				
			|||
    ], | 
				
			|||
    'license': 'LGPL-3', | 
				
			|||
    'images': ['static/description/banner.jpg'], | 
				
			|||
    'installable': True, | 
				
			|||
    'auto_install': False, | 
				
			|||
    'application': True, | 
				
			|||
} | 
				
			|||
@ -0,0 +1 @@ | 
				
			|||
from . import main | 
				
			|||
@ -0,0 +1,39 @@ | 
				
			|||
# -*- 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('/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_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,10 @@ | 
				
			|||
## Module <dynamic_financial_report> | 
				
			|||
 | 
				
			|||
#### 29.03.2021 | 
				
			|||
#### Version 14.0.1.0.0 | 
				
			|||
#### ADD | 
				
			|||
- Initial commit for Odoo 14 dynamic financial reports | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
@ -0,0 +1,7 @@ | 
				
			|||
from . import general_ledger | 
				
			|||
from . import financial_reports | 
				
			|||
from . import partner_ledger | 
				
			|||
from . import ageing_partner | 
				
			|||
from . import bank_book | 
				
			|||
from . import cash_flow_report | 
				
			|||
from . import daybook_report | 
				
			|||
@ -0,0 +1,15 @@ | 
				
			|||
from odoo import api, models | 
				
			|||
 | 
				
			|||
 | 
				
			|||
class InsReportAgeingPartner(models.AbstractModel): | 
				
			|||
    _name = 'report.dynamic_financial_report.ageing_partner' | 
				
			|||
 | 
				
			|||
    @api.model | 
				
			|||
    def _get_report_values(self, docids, data=None): | 
				
			|||
        """ fetch values for get pdf report""" | 
				
			|||
        if self.env.context.get('js_report'): | 
				
			|||
            if data.get('report_data'): | 
				
			|||
                data.update({'account_data': data.get('report_data')[1], | 
				
			|||
                             'Filters': data.get('report_data')[0], | 
				
			|||
                             }) | 
				
			|||
        return data | 
				
			|||
@ -0,0 +1,31 @@ | 
				
			|||
# -*- coding: utf-8 -*- | 
				
			|||
 | 
				
			|||
import time | 
				
			|||
from odoo import api, models, _ | 
				
			|||
from odoo.exceptions import UserError | 
				
			|||
 | 
				
			|||
 | 
				
			|||
class InsReportBankBook(models.AbstractModel): | 
				
			|||
    _name = 'report.dynamic_financial_report.bank_book' | 
				
			|||
 | 
				
			|||
    @api.model | 
				
			|||
    def _get_report_values(self, docids, data=None): | 
				
			|||
        if self.env.context.get('js_report'): | 
				
			|||
            if data.get('report_data'): | 
				
			|||
                data.update({'account_data': data.get('report_data')[1], | 
				
			|||
                             'Filters': data.get('report_data')[0], | 
				
			|||
                             }) | 
				
			|||
        return data | 
				
			|||
 | 
				
			|||
 | 
				
			|||
class InsReportCashBook(models.AbstractModel): | 
				
			|||
    _name = 'report.dynamic_financial_report.cash_book' | 
				
			|||
 | 
				
			|||
    @api.model | 
				
			|||
    def _get_report_values(self, docids, data=None): | 
				
			|||
        if self.env.context.get('js_report'): | 
				
			|||
            if data.get('report_data'): | 
				
			|||
                data.update({'account_data': data.get('report_data')[1], | 
				
			|||
                             'Filters': data.get('report_data')[0], | 
				
			|||
                             }) | 
				
			|||
        return data | 
				
			|||
@ -0,0 +1,17 @@ | 
				
			|||
# -*- coding: utf-8 -*- | 
				
			|||
 | 
				
			|||
from odoo import api, models | 
				
			|||
 | 
				
			|||
 | 
				
			|||
class InsReportCashFlow(models.AbstractModel): | 
				
			|||
    _name = 'report.dynamic_financial_report.cash_flow' | 
				
			|||
 | 
				
			|||
    @api.model | 
				
			|||
    def _get_report_values(self, docids, data=None): | 
				
			|||
        if self.env.context.get('js_report'): | 
				
			|||
            if data.get('report_data'): | 
				
			|||
 | 
				
			|||
                data.update({'account_data': data.get('report_data')[1], | 
				
			|||
                             'Filters': data.get('report_data')[0], | 
				
			|||
                             }) | 
				
			|||
        return data | 
				
			|||
@ -0,0 +1,18 @@ | 
				
			|||
# -*- coding: utf-8 -*- | 
				
			|||
from odoo import api, models, _ | 
				
			|||
 | 
				
			|||
 | 
				
			|||
class InsReportDayBook(models.AbstractModel): | 
				
			|||
    _name = 'report.dynamic_financial_report.dynamic_day_book' | 
				
			|||
 | 
				
			|||
    @api.model | 
				
			|||
    def _get_report_values(self, docids, data=None): | 
				
			|||
        """ fetch values for get pdf report""" | 
				
			|||
        if self.env.context.get('js_report'): | 
				
			|||
            if data.get('report_data'): | 
				
			|||
                data.update({'account_data': data.get('report_data')[1], | 
				
			|||
                             'Filters': data.get('report_data')[0], | 
				
			|||
                             'lines': data.get('report_data')[2], | 
				
			|||
                             }) | 
				
			|||
 | 
				
			|||
        return data | 
				
			|||
@ -0,0 +1,21 @@ | 
				
			|||
# -*- coding: utf-8 -*- | 
				
			|||
import time | 
				
			|||
from odoo import api, models, _ | 
				
			|||
from odoo.exceptions import UserError | 
				
			|||
 | 
				
			|||
 | 
				
			|||
class InsReportBalanceSheet(models.AbstractModel): | 
				
			|||
    _name = 'report.dynamic_financial_report.balance_sheet' | 
				
			|||
 | 
				
			|||
    @api.model | 
				
			|||
    def _get_report_values(self, docids, data=None): | 
				
			|||
        if self.env.context.get('js_report'): | 
				
			|||
            if data.get('report_data'): | 
				
			|||
                data.update({ | 
				
			|||
                    'Filters': data.get('report_data')[0], | 
				
			|||
                    'account_data': data.get('report_data')[1], | 
				
			|||
                    'report_lines': data.get('report_data')[2], | 
				
			|||
                    'report_name': data.get('report_name') | 
				
			|||
                }) | 
				
			|||
 | 
				
			|||
        return data | 
				
			|||
@ -0,0 +1,32 @@ | 
				
			|||
# -*- coding: utf-8 -*- | 
				
			|||
 | 
				
			|||
import time | 
				
			|||
from odoo import api, models, _ | 
				
			|||
from odoo.exceptions import UserError | 
				
			|||
 | 
				
			|||
 | 
				
			|||
class InsReportGeneralLedger(models.AbstractModel): | 
				
			|||
    _name = 'report.dynamic_financial_report.general_ledger' | 
				
			|||
    @api.model | 
				
			|||
    def _get_report_values(self, docids, data=None): | 
				
			|||
        if self.env.context.get('js_report'): | 
				
			|||
            if data.get('report_data'): | 
				
			|||
                data.update({'account_data': data.get('report_data')[1], | 
				
			|||
                             'Filters': data.get('report_data')[0], | 
				
			|||
                             }) | 
				
			|||
        return data | 
				
			|||
 | 
				
			|||
 | 
				
			|||
class InsReportTrialBalance(models.AbstractModel): | 
				
			|||
    _name = 'report.dynamic_financial_report.trial_balance' | 
				
			|||
 | 
				
			|||
    @api.model | 
				
			|||
    def _get_report_values(self, docids, data=None): | 
				
			|||
        if self.env.context.get('js_report'): | 
				
			|||
 | 
				
			|||
            if data.get('report_data'): | 
				
			|||
                data.update({'account_data': data.get('report_data')[1], | 
				
			|||
                             'Filters': data.get('report_data')[0], | 
				
			|||
                             'total': data.get('report_data')[2], | 
				
			|||
                             }) | 
				
			|||
        return data | 
				
			|||
@ -0,0 +1,16 @@ | 
				
			|||
# -*- coding: utf-8 -*- | 
				
			|||
 | 
				
			|||
from odoo import api, models | 
				
			|||
 | 
				
			|||
 | 
				
			|||
class InsReportPartnerLedger(models.AbstractModel): | 
				
			|||
    _name = 'report.dynamic_financial_report.partner_ledger' | 
				
			|||
 | 
				
			|||
    @api.model | 
				
			|||
    def _get_report_values(self, docids, data=None): | 
				
			|||
        if self.env.context.get('js_report'): | 
				
			|||
            if data.get('report_data'): | 
				
			|||
                data.update({'account_data': data.get('report_data')[1], | 
				
			|||
                             'Filters': data.get('report_data')[0], | 
				
			|||
                             }) | 
				
			|||
        return data | 
				
			|||
		
		
			
  | 
| 
		 After Width: | Height: | Size: 53 KiB  | 
| 
		 After Width: | Height: | Size: 50 KiB  | 
| 
		 After Width: | Height: | Size: 23 KiB  | 
| 
		 After Width: | Height: | Size: 471 KiB  | 
| 
		 After Width: | Height: | Size: 65 KiB  | 
| 
		 After Width: | Height: | Size: 328 KiB  | 
| 
		 After Width: | Height: | Size: 712 KiB  | 
| 
		 After Width: | Height: | Size: 54 KiB  | 
| 
		 After Width: | Height: | Size: 42 KiB  | 
| 
		 After Width: | Height: | Size: 62 KiB  | 
| 
		 After Width: | Height: | Size: 59 KiB  | 
| 
		 After Width: | Height: | Size: 36 KiB  | 
| 
		 After Width: | Height: | Size: 57 KiB  | 
| 
		 After Width: | Height: | Size: 38 KiB  | 
| 
		 After Width: | Height: | Size: 33 KiB  | 
| 
		 After Width: | Height: | Size: 58 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: 71 KiB  | 
| 
		 After Width: | Height: | Size: 80 KiB  | 
| 
		 After Width: | Height: | Size: 80 KiB  | 
| 
		 After Width: | Height: | Size: 82 KiB  | 
| 
		 After Width: | Height: | Size: 115 KiB  | 
| 
		 After Width: | Height: | Size: 58 KiB  | 
| 
		 After Width: | Height: | Size: 61 KiB  | 
| 
		 After Width: | Height: | Size: 129 KiB  | 
| 
		 After Width: | Height: | Size: 82 KiB  | 
| 
		 After Width: | Height: | Size: 53 KiB  | 
| 
		 After Width: | Height: | Size: 112 KiB  | 
| 
		 After Width: | Height: | Size: 60 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: 96 KiB  | 
| 
		 After Width: | Height: | Size: 44 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: 114 KiB  | 
| 
		 After Width: | Height: | Size: 45 KiB  | 
| 
		 After Width: | Height: | Size: 28 KiB  | 
@ -0,0 +1,52 @@ | 
				
			|||
odoo.define('dynamic_financial_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 | 
				
			|||
     */ | 
				
			|||
    _executexlsxReportDownloadAction: function (action) { | 
				
			|||
        framework.blockUI(); | 
				
			|||
        var def = $.Deferred(); | 
				
			|||
        session.get_file({ | 
				
			|||
            url: '/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_xlsx_download') { | 
				
			|||
            return this._executexlsxReportDownloadAction(action, options); | 
				
			|||
        } | 
				
			|||
        return this._super.apply(this, arguments); | 
				
			|||
    }, | 
				
			|||
 | 
				
			|||
 | 
				
			|||
}); | 
				
			|||
 | 
				
			|||
}); | 
				
			|||
@ -0,0 +1,558 @@ | 
				
			|||
odoo.define('dynamic_financial_report.ageing_partner', 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; | 
				
			|||
 | 
				
			|||
    var AgeingPartner = AbstractAction.extend({ | 
				
			|||
        template: 'AgeingPartner', | 
				
			|||
        events: { | 
				
			|||
            'click .al-line': 'get_move_lines', | 
				
			|||
            'click .view-move': 'view_move', | 
				
			|||
            'click #filter_apply_button': 'apply_filter', | 
				
			|||
            'click #pdf': 'print_pdf', | 
				
			|||
            'click #xlsx': 'print_xlsx', | 
				
			|||
        }, | 
				
			|||
        init: function(view, code) { | 
				
			|||
            this._super(view, code); | 
				
			|||
            this.wizard = code.context.wizard | null; | 
				
			|||
            this.session = session; | 
				
			|||
        }, | 
				
			|||
        start: function() { | 
				
			|||
            var self = this; | 
				
			|||
            self.initial_render = true; | 
				
			|||
            rpc.query({ | 
				
			|||
                model: 'dynamic.ageing.partner', | 
				
			|||
                method: 'create', | 
				
			|||
                args: [{ | 
				
			|||
                    res_model: this.res_model | 
				
			|||
                }] | 
				
			|||
            }).then(function(res) { | 
				
			|||
                self.wizard = res; | 
				
			|||
                self.ledger_view(self.initial_render); | 
				
			|||
            }) | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
        apply_filter: function(event) { | 
				
			|||
            event.preventDefault(); | 
				
			|||
            var self = this; | 
				
			|||
 | 
				
			|||
            self.initial_render = false; | 
				
			|||
            var output = {}; | 
				
			|||
            output.type=false | 
				
			|||
            output.partner_type=false | 
				
			|||
            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=""; } | 
				
			|||
            output.partner_ids = partner_ids | 
				
			|||
            var partner_category_ids = []; | 
				
			|||
            var category_text = []; | 
				
			|||
            var span_res = document.getElementById("category_res") | 
				
			|||
 | 
				
			|||
            var category_list = $(".partner-tag").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(category_text.includes(category_list[i].text) === false) | 
				
			|||
                    {category_text.push(category_list[i].text) | 
				
			|||
 | 
				
			|||
                    } | 
				
			|||
 | 
				
			|||
                    span_res.value = category_text | 
				
			|||
                    span_res.innerHTML=span_res.value; | 
				
			|||
                    } | 
				
			|||
            } | 
				
			|||
            if (category_list.length == 0){ | 
				
			|||
            span_res.value = "" | 
				
			|||
            span_res.innerHTML=""; } | 
				
			|||
            output.partner_category_ids = partner_category_ids | 
				
			|||
 | 
				
			|||
              if ($(".target-moves").length){ | 
				
			|||
              var target_res = document.getElementById("target_res") | 
				
			|||
              output.target_moves = $(".target-moves")[1].value | 
				
			|||
              target_res.value = $(".target-moves")[1].value | 
				
			|||
                 target_res.innerHTML=target_res.value; | 
				
			|||
              if ($(".target-moves").value==""){ | 
				
			|||
              target_res.innerHTML="draft"; | 
				
			|||
              output.target_moves = "draft" | 
				
			|||
                } | 
				
			|||
              } | 
				
			|||
 | 
				
			|||
            if ($(".partner-type").length){ | 
				
			|||
              var partner_type_res = document.getElementById("partner_type_res") | 
				
			|||
              output.partner_type = $(".partner-type")[1].value | 
				
			|||
              partner_type_res.value = $(".partner-type")[1].value | 
				
			|||
                 partner_type_res.innerHTML=partner_type_res.value; | 
				
			|||
              if ($(".partner-type").value==""){ | 
				
			|||
              partner_type_res.innerHTML="customer"; | 
				
			|||
              output.partner_type = "customer" | 
				
			|||
                } | 
				
			|||
              } | 
				
			|||
 | 
				
			|||
            if ($(".account").length){ | 
				
			|||
              var type_res = document.getElementById("type_res") | 
				
			|||
              output.type = $(".account")[1].value | 
				
			|||
              type_res.value = $(".account")[1].value | 
				
			|||
                 type_res.innerHTML=type_res.value; | 
				
			|||
              if ($(".account").value==""){ | 
				
			|||
              type_res.innerHTML="receivable"; | 
				
			|||
              output.type = "receivable" | 
				
			|||
                } | 
				
			|||
              } | 
				
			|||
 | 
				
			|||
            if ($("#as_on_date").val()) { | 
				
			|||
                var dateObject = $("#as_on_date").datepicker("getDate"); | 
				
			|||
                var dateString = $.datepicker.formatDate("yy-mm-dd", dateObject); | 
				
			|||
                output.as_on_date = dateString; | 
				
			|||
            } | 
				
			|||
            output.include_details = true; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
            rpc.query({ | 
				
			|||
                model: 'dynamic.ageing.partner', | 
				
			|||
                method: 'write', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard], output | 
				
			|||
                ], | 
				
			|||
            }).then(function(res) { | 
				
			|||
                self.ledger_view(self.initial_render); | 
				
			|||
 | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
        print_pdf: function(e) { | 
				
			|||
            e.preventDefault(); | 
				
			|||
            var self = this; | 
				
			|||
            self._rpc({ | 
				
			|||
                model: 'dynamic.ageing.partner', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard] | 
				
			|||
                ], | 
				
			|||
            }).then(function(data) { | 
				
			|||
 | 
				
			|||
 | 
				
			|||
                var action = { | 
				
			|||
                    'type': 'ir.actions.report', | 
				
			|||
                    'report_type': 'qweb-pdf', | 
				
			|||
                    'report_name': 'dynamic_financial_report.ageing_partner', | 
				
			|||
                    'report_file': 'dynamic_financial_report.ageing_partner', | 
				
			|||
                    'data': { | 
				
			|||
                        'report_data': data | 
				
			|||
                    }, | 
				
			|||
                    'context': { | 
				
			|||
                        'active_model': 'dynamic.ageing.partner', | 
				
			|||
                        'landscape': 1, | 
				
			|||
                        'js_report': true | 
				
			|||
                    }, | 
				
			|||
                    'display_name': 'Ageing Partner Report', | 
				
			|||
                }; | 
				
			|||
                return self.do_action(action); | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
        print_xlsx: function() { | 
				
			|||
            var self = this; | 
				
			|||
            self._rpc({ | 
				
			|||
                model: 'dynamic.ageing.partner', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard] | 
				
			|||
                ], | 
				
			|||
            }).then(function(data) { | 
				
			|||
 | 
				
			|||
 | 
				
			|||
                var action = { | 
				
			|||
                    'type': 'ir_actions_xlsx_download', | 
				
			|||
                    'data': { | 
				
			|||
                         'model': 'dynamic.ageing.partner', | 
				
			|||
                         'options': JSON.stringify(data[1]), | 
				
			|||
                         'output_format': 'xlsx', | 
				
			|||
                         'report_data': JSON.stringify(data[0]), | 
				
			|||
                         'report_name': 'Partner Ageing', | 
				
			|||
                         'dfr_data': JSON.stringify(data), | 
				
			|||
                    }, | 
				
			|||
                }; | 
				
			|||
 | 
				
			|||
                return self.do_action(action); | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
        ledger_view: function(initial_render = true) { | 
				
			|||
            var self = this; | 
				
			|||
            var node = self.$('.container-al-main'); | 
				
			|||
            var last; | 
				
			|||
            while (last = node.lastChild) node.removeChild(last); | 
				
			|||
            rpc.query({ | 
				
			|||
                model: 'dynamic.ageing.partner', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard] | 
				
			|||
                ], | 
				
			|||
            }).then(function(datas) { | 
				
			|||
                self.filter_data = datas[0] | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
                self.account_data = datas[1] | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
                _.each(self.account_data, function(account) { | 
				
			|||
 | 
				
			|||
                    var currency_format = { | 
				
			|||
                        currency_id: account.company_currency_id, | 
				
			|||
                        position: account.company_currency_position, | 
				
			|||
                        symbol: account.company_currency_symbol, | 
				
			|||
 | 
				
			|||
                        noSymbol: true, | 
				
			|||
                    }; | 
				
			|||
 | 
				
			|||
                      if (currency_format.position == "before") { | 
				
			|||
 | 
				
			|||
                         if (account.total == 0) { | 
				
			|||
                                account.total = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.total = currency_format.symbol + ' ' + account.total.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.Not == 0) { | 
				
			|||
                                account.Not = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account.Not = currency_format.symbol + ' ' + account.Not.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.value_20 == 0) { | 
				
			|||
                                account.value_20 = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account.value_20 = currency_format.symbol + ' ' + account.value_20.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account[2140] == 0) { | 
				
			|||
                                account[2140] = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account[2140] = currency_format.symbol + ' ' + account[2140].toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account[4160] == 0) { | 
				
			|||
                                account[4160] = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account[4160] = currency_format.symbol + ' ' + account[4160].toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account[6180] == 0) { | 
				
			|||
                                account[6180] = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account[6180] = currency_format.symbol + ' ' + account[6180].toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account[81100] == 0) { | 
				
			|||
                                account[81100] = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account[81100] = currency_format.symbol + ' ' + account[81100].toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account[100] == 0) { | 
				
			|||
                                account[100] = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account[100] = currency_format.symbol + ' ' + account[100].toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                        } else { | 
				
			|||
 | 
				
			|||
                            if (account.total == 0) { | 
				
			|||
                                account.total = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.total = account.total.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
//
 | 
				
			|||
                            } | 
				
			|||
                            if (account.Not == 0) { | 
				
			|||
                                account.Not = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account.Not = account.Not.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.value_20 == 0) { | 
				
			|||
                                account.value_20 = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.value_20 = account.value_20.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account[2140] == 0) { | 
				
			|||
                                account[2140] = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account[2140] = account[2140].toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account[4160] == 0) { | 
				
			|||
                                account[4160] = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account[4160] = account[4160].toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account[6180] == 0) { | 
				
			|||
                                account[6180] = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account[6180] = account[6180].toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account[81100] == 0) { | 
				
			|||
                                account[81100] = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account[81100] = account[81100].toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account[100] == 0) { | 
				
			|||
                                account[100] = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account[100] = account[100].toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                        } | 
				
			|||
 | 
				
			|||
                }); | 
				
			|||
                if (initial_render) { | 
				
			|||
                    self.$('.al-filter').html(QWeb.render('FilterSection-al', { | 
				
			|||
                        filter_data: datas[0], | 
				
			|||
                    })); | 
				
			|||
                    self.$el.find('.account').select2({ | 
				
			|||
                        placeholder: 'Select Account Type...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.partner-type').select2({ | 
				
			|||
                        placeholder: 'Select Partner Type...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.partner-tag').select2({ | 
				
			|||
                        placeholder: 'Select Partner Tag...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.partners').select2({ | 
				
			|||
                        placeholder: 'Select Partners...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.target-moves').select2({ | 
				
			|||
                       placeholder: 'Posted or All Entries...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('#as_on_date').datepicker({ | 
				
			|||
                        dateFormat: 'dd-mm-yy' | 
				
			|||
                    }); | 
				
			|||
 | 
				
			|||
                } | 
				
			|||
 | 
				
			|||
                self.$('.container-al-main').html(QWeb.render('AgeingPartnerData', { | 
				
			|||
                    account_data: datas[1] | 
				
			|||
                })); | 
				
			|||
 | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
        al_lines_by_page: function(offset, account_id) { | 
				
			|||
 | 
				
			|||
            var self = this; | 
				
			|||
            return rpc.query({ | 
				
			|||
                model: 'dynamic.ageing.partner', | 
				
			|||
                method: 'al_move_lines', | 
				
			|||
                args: [self.wizard, offset, account_id], | 
				
			|||
            }) | 
				
			|||
        }, | 
				
			|||
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) { | 
				
			|||
                self.al_lines_by_page(offset, account_id).then(function(datas) { | 
				
			|||
 | 
				
			|||
                    _.each(datas[2], function(data) { | 
				
			|||
 | 
				
			|||
                        var currency_format = { | 
				
			|||
                            currency_id: data.company_currency_id, | 
				
			|||
                            position: data.company_currency_position, | 
				
			|||
                            symbol: data.company_currency_symbol, | 
				
			|||
                            noSymbol: true, | 
				
			|||
                        }; | 
				
			|||
 | 
				
			|||
                         if (currency_format.position == "before") { | 
				
			|||
                            if (data.range_0 == 0) { | 
				
			|||
                                data.range_0 = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                data.range_0 = currency_format.symbol  + data.range_0.toFixed(2) ; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.range_1 == 0) { | 
				
			|||
                                data.range_1 = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                data.range_1 = currency_format.symbol  + data.range_1.toFixed(2) ; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.range_2 == 0) { | 
				
			|||
                                data.range_2 = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                data.range_2 = currency_format.symbol  + data.range_2.toFixed(2)  ; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.range_3 == 0) { | 
				
			|||
                                data.range_3 = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                data.range_3 = currency_format.symbol  + data.range_3.toFixed(2)  ; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.range_4 == 0) { | 
				
			|||
                                data.range_4 = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                data.range_4 = currency_format.symbol  + data.range_4.toFixed(2)  ; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.range_5 == 0) { | 
				
			|||
                                data.range_5 = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                data.range_5 = currency_format.symbol  + data.range_5.toFixed(2)  ; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.range_6 == 0) { | 
				
			|||
                                data.range_6 = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                data.range_6 = currency_format.symbol  + data.range_6.toFixed(2)  ; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                        } else { | 
				
			|||
                            if (data.range_0 == 0) { | 
				
			|||
                                data.range_0 = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                data.range_0 = data.range_0.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.range_1 == 0) { | 
				
			|||
                                data.range_1 = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                data.range_1 = data.range_1.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.range_2 == 0) { | 
				
			|||
                                data.range_2 = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                data.range_2 = data.range_2.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.range_3 == 0) { | 
				
			|||
                                data.range_3 = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                data.range_3 = data.range_3.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.range_4 == 0) { | 
				
			|||
                                data.range_4 = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                data.range_4 = data.range_4.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.range_5 == 0) { | 
				
			|||
                                data.range_5 = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                data.range_5 = data.range_5.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.range_6 == 0) { | 
				
			|||
                                data.range_6 = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                data.range_6 = data.range_6.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                        } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
                    }); | 
				
			|||
                    $(event.currentTarget).next('tr').find('td .al-table-div').remove(); | 
				
			|||
                    $(event.currentTarget).next('tr').find('td ul').after( | 
				
			|||
                        QWeb.render('SubSection_al', { | 
				
			|||
                            count: datas[0], | 
				
			|||
                            offset: datas[1], | 
				
			|||
                            account_data: datas[2], | 
				
			|||
                        })) | 
				
			|||
 | 
				
			|||
                    $(event.currentTarget).next('tr').find('td ul li:first a').css({ | 
				
			|||
                        'background-color': '#00ede8', | 
				
			|||
                        'font-weight': 'bold', | 
				
			|||
                    }); | 
				
			|||
 | 
				
			|||
                }) | 
				
			|||
            } | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
 | 
				
			|||
        view_move: function(event) { | 
				
			|||
            event.preventDefault(); | 
				
			|||
            var self = this; | 
				
			|||
            var context = {}; | 
				
			|||
            var redirect_to_document = 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) { | 
				
			|||
                        redirect_to_document('account.move', record[0].id); | 
				
			|||
                    } else { | 
				
			|||
                        redirect_to_document('account.move', $(event.currentTarget).data('move-id')); | 
				
			|||
                    } | 
				
			|||
                }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
    }); | 
				
			|||
    core.action_registry.add('dynamic.al', AgeingPartner); | 
				
			|||
 | 
				
			|||
}); | 
				
			|||
@ -0,0 +1,527 @@ | 
				
			|||
odoo.define('dynamic_financial_report.balance_sheet', 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; | 
				
			|||
 | 
				
			|||
    var BalanceSheet = AbstractAction.extend({ | 
				
			|||
        template: 'BalanceSheet', | 
				
			|||
        events: { | 
				
			|||
            'click .bs-line': 'get_move_lines', | 
				
			|||
            'click .view-move': 'view_move', | 
				
			|||
            'click #filter_apply_button': 'apply_filter', | 
				
			|||
            'click #pdf': 'print_pdf', | 
				
			|||
            'click #xlsx': 'print_xlsx', | 
				
			|||
            'click .open-gl': 'get_gl', | 
				
			|||
        }, | 
				
			|||
        init: function(view, code) { | 
				
			|||
            this._super(view, code); | 
				
			|||
            this.wizard = code.context.wizard | null; | 
				
			|||
            this.session = session; | 
				
			|||
        }, | 
				
			|||
        start: function() { | 
				
			|||
            var self = this; | 
				
			|||
            self.initial_render = true; | 
				
			|||
            rpc.query({ | 
				
			|||
                model: 'dynamic.balance.sheet', | 
				
			|||
                method: 'create', | 
				
			|||
                args: [{ | 
				
			|||
 | 
				
			|||
                }] | 
				
			|||
            }).then(function(res) { | 
				
			|||
                self.wizard = res; | 
				
			|||
                self.sheet_view(self.initial_render); | 
				
			|||
            }) | 
				
			|||
        }, | 
				
			|||
            apply_filter: function(event) { | 
				
			|||
 | 
				
			|||
            event.preventDefault(); | 
				
			|||
            var self = this; | 
				
			|||
 | 
				
			|||
            self.initial_render = false; | 
				
			|||
            var output = {}; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
            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=""; | 
				
			|||
 | 
				
			|||
            } | 
				
			|||
            output.account_ids = account_ids | 
				
			|||
 | 
				
			|||
 | 
				
			|||
             var journal_ids = []; | 
				
			|||
            var journal_text = []; | 
				
			|||
            var journal_res = document.getElementById("journal_res") | 
				
			|||
            var journal_list = $(".journal").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=""; | 
				
			|||
 | 
				
			|||
            } | 
				
			|||
            output.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=""; | 
				
			|||
 | 
				
			|||
            } | 
				
			|||
            output.account_tag_ids = account_tag_ids | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
               var analytic_ids = []; | 
				
			|||
            var analytic_text = []; | 
				
			|||
            var span_res = document.getElementById("analic_res") | 
				
			|||
            var analytic_list = $(".analytic").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) | 
				
			|||
 | 
				
			|||
                    } | 
				
			|||
 | 
				
			|||
                    span_res.value = analytic_text | 
				
			|||
                    span_res.innerHTML=span_res.value; | 
				
			|||
                } | 
				
			|||
            } | 
				
			|||
            if (analytic_list.length == 0){ | 
				
			|||
               span_res.value = "" | 
				
			|||
                    span_res.innerHTML=""; | 
				
			|||
 | 
				
			|||
            } | 
				
			|||
            output.analytic_ids = analytic_ids | 
				
			|||
 | 
				
			|||
            output.analytic_tag_ids = analytic_tag_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=""; | 
				
			|||
 | 
				
			|||
            } | 
				
			|||
            output.analytic_tag_ids = analytic_tag_ids | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
            if ($("#date_from").val()) { | 
				
			|||
                var dateObject = $("#date_from").datepicker("getDate"); | 
				
			|||
                var dateString = $.datepicker.formatDate("yy-mm-dd", dateObject); | 
				
			|||
                output.date_from = dateString; | 
				
			|||
            } | 
				
			|||
            if ($("#date_to").val()) { | 
				
			|||
                var dateObject = $("#date_to").datepicker("getDate"); | 
				
			|||
                var dateString = $.datepicker.formatDate("yy-mm-dd", dateObject); | 
				
			|||
                output.date_to = dateString; | 
				
			|||
            } | 
				
			|||
 | 
				
			|||
            if ($(".entries").length) { | 
				
			|||
            var post_res = document.getElementById("post_res") | 
				
			|||
 | 
				
			|||
            output.entries = $(".entries")[1].value | 
				
			|||
            post_res.value = $(".entries")[1].value | 
				
			|||
                    post_res.innerHTML=post_res.value; | 
				
			|||
              if ($(".entries")[1].value == "") { | 
				
			|||
              post_res.innerHTML="all"; | 
				
			|||
 | 
				
			|||
              } | 
				
			|||
            } | 
				
			|||
 | 
				
			|||
            output.include_details = true; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
            rpc.query({ | 
				
			|||
                model: 'dynamic.balance.sheet', | 
				
			|||
                method: 'write', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard], output | 
				
			|||
                ], | 
				
			|||
            }).then(function(res) { | 
				
			|||
                self.sheet_view(self.initial_render); | 
				
			|||
 | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
        get_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: 'dynamic.gl', | 
				
			|||
                    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', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard], action_title | 
				
			|||
                ], | 
				
			|||
            }).then(function(data) { | 
				
			|||
 | 
				
			|||
                var action = { | 
				
			|||
                    'type': 'ir.actions.report', | 
				
			|||
                    'report_type': 'qweb-pdf', | 
				
			|||
                    'report_name': 'dynamic_financial_report.balance_sheet', | 
				
			|||
                    'report_file': 'dynamic_financial_report.balance_sheet', | 
				
			|||
                    'data': { | 
				
			|||
                        'report_data': data, | 
				
			|||
                        'report_name': 'Balance Sheet' | 
				
			|||
                    }, | 
				
			|||
                    'context': { | 
				
			|||
                        'active_model': 'dynamic.balance.sheet', | 
				
			|||
                        'landscape': 1, | 
				
			|||
                        'js_report': true | 
				
			|||
                    }, | 
				
			|||
                    'display_name': 'Balance Sheet', | 
				
			|||
                }; | 
				
			|||
                return self.do_action(action); | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
        print_xlsx: function() { | 
				
			|||
            var self = this; | 
				
			|||
            var action_title = self._title | 
				
			|||
            self._rpc({ | 
				
			|||
                model: 'dynamic.balance.sheet', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard], action_title | 
				
			|||
                ], | 
				
			|||
            }).then(function(data) { | 
				
			|||
 | 
				
			|||
                var action = { | 
				
			|||
                       'type': 'ir_actions_xlsx_download', | 
				
			|||
                        'data': { | 
				
			|||
                             'model': 'dynamic.balance.sheet', | 
				
			|||
                             'options': 'Balance Sheet', | 
				
			|||
                             'output_format': 'xlsx', | 
				
			|||
                             'report_data': JSON.stringify(data[0]), | 
				
			|||
                             'report_name': 'Balance Sheet', | 
				
			|||
                             'dfr_data':JSON.stringify(data[2]), | 
				
			|||
                        }, | 
				
			|||
                    }; | 
				
			|||
 | 
				
			|||
                    return self.do_action(action); | 
				
			|||
                }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
 | 
				
			|||
        sheet_view: function(initial_render = true) { | 
				
			|||
            var self = this; | 
				
			|||
            var action_title = self._title | 
				
			|||
            var node = self.$('.container-bs-main'); | 
				
			|||
            var last; | 
				
			|||
            while (last = node.lastChild) node.removeChild(last); | 
				
			|||
            rpc.query({ | 
				
			|||
                model: 'dynamic.balance.sheet', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard], action_title | 
				
			|||
                ], | 
				
			|||
            }).then(function(datas) { | 
				
			|||
                self.filter_data = datas[0] | 
				
			|||
 | 
				
			|||
                self.account_data = datas[1] | 
				
			|||
 | 
				
			|||
                _.each(self.account_data, function(account) { | 
				
			|||
                    var currency_format = { | 
				
			|||
                        currency_id: account.company_currency_id, | 
				
			|||
                        position: account.company_currency_position, | 
				
			|||
                        symbol: account.company_currency_symbol, | 
				
			|||
                        noSymbol: true, | 
				
			|||
                    }; | 
				
			|||
                    if (currency_format.position == "before") { | 
				
			|||
 | 
				
			|||
                         if (account.debit == 0) { | 
				
			|||
                                account.debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.debit = currency_format.symbol + ' ' + account.debit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.credit == 0) { | 
				
			|||
                                account.credit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account.credit = currency_format.symbol + ' ' + account.credit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.balance == 0) { | 
				
			|||
                                account.balance = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account.balance = currency_format.symbol + ' ' + account.balance.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                    } else { | 
				
			|||
 | 
				
			|||
                        if (account.debit == 0) { | 
				
			|||
                                account.debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.debit = account.debit.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.credit == 0) { | 
				
			|||
                                account.credit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account.credit = account.credit.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.balance == 0) { | 
				
			|||
                                account.balance = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.balance = account.balance.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                    } | 
				
			|||
                }); | 
				
			|||
 | 
				
			|||
                if (initial_render) { | 
				
			|||
                    self.$('.bs-filter').html(QWeb.render('FilterSectionBS', { | 
				
			|||
                        filter_data: datas[0], | 
				
			|||
                    })); | 
				
			|||
 | 
				
			|||
                    self.$el.find('.journal').select2({ | 
				
			|||
                        placeholder: 'Select Journal...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.account').select2({ | 
				
			|||
                        placeholder: 'Select Account...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.account-tag').select2({ | 
				
			|||
                        placeholder: 'Select Account Tag...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.analytic-tag').select2({ | 
				
			|||
                        placeholder: 'Select Analytic Tag...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.analytic').select2({ | 
				
			|||
                        placeholder: 'Select Analytic...', | 
				
			|||
                    }); | 
				
			|||
 | 
				
			|||
                    self.$el.find('#date_from').datepicker({ | 
				
			|||
                        dateFormat: 'dd-mm-yy' | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('#date_to').datepicker({ | 
				
			|||
                        dateFormat: 'dd-mm-yy' | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.entries').select2({ | 
				
			|||
                        placeholder: 'Select Moves', | 
				
			|||
                    }); | 
				
			|||
                } | 
				
			|||
                self.$('.container-bs-main').html(QWeb.render('BalanceSheetData', { | 
				
			|||
                    account_data: datas[1], | 
				
			|||
                    report_lines: datas[2] | 
				
			|||
                })); | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
        bs_lines_by_page: function(offset, account_id) { | 
				
			|||
            var self = this; | 
				
			|||
            return rpc.query({ | 
				
			|||
                model: 'dynamic.balance.sheet', | 
				
			|||
                method: 'bs_move_lines', | 
				
			|||
                args: [self.wizard, offset, account_id], | 
				
			|||
            }) | 
				
			|||
        }, | 
				
			|||
        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) { | 
				
			|||
                self.bs_lines_by_page(offset, account_id).then(function(datas) { | 
				
			|||
                    _.each(datas[2], function(data) { | 
				
			|||
                        var currency_format = { | 
				
			|||
                            currency_id: data.company_currency_id, | 
				
			|||
                            position: data.company_currency_position, | 
				
			|||
                            symbol: data.company_currency_symbol, | 
				
			|||
                            noSymbol: true, | 
				
			|||
                        }; | 
				
			|||
                        if (currency_format.position == "before") { | 
				
			|||
                            if (data.debit == 0) { | 
				
			|||
                                data.debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                data.debit = currency_format.symbol + ' ' + data.debit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.credit == 0) { | 
				
			|||
                                data.credit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                data.credit = currency_format.symbol + ' ' + data.credit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.balance == 0) { | 
				
			|||
                                data.balance = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                data.balance = currency_format.symbol + ' ' + data.balance.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                        } else { | 
				
			|||
                            if (data.debit == 0) { | 
				
			|||
                                data.debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                data.debit = data.debit.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.credit == 0) { | 
				
			|||
                                data.credit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                data.credit = data.credit.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.balance == 0) { | 
				
			|||
                                data.balance = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                data.balance = data.balance.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
 | 
				
			|||
                        } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
                    }); | 
				
			|||
                    $(event.currentTarget).next('tr').find('td .bs-table-div').remove(); | 
				
			|||
                    $(event.currentTarget).next('tr').find('td ul').after( | 
				
			|||
                        QWeb.render('SubSectionBS', { | 
				
			|||
                            count: datas[0], | 
				
			|||
                            offset: datas[1], | 
				
			|||
                            account_data: datas[2], | 
				
			|||
                        })) | 
				
			|||
                    $(event.currentTarget).next('tr').find('td ul li:first a').css({ | 
				
			|||
                        'background-color': '#00ede8', | 
				
			|||
                        'font-weight': 'bold', | 
				
			|||
                    }); | 
				
			|||
                }) | 
				
			|||
            } | 
				
			|||
        }, | 
				
			|||
        view_move: function(event) { | 
				
			|||
            event.preventDefault(); | 
				
			|||
            var self = this; | 
				
			|||
            var context = {}; | 
				
			|||
            var redirect_to_document = 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) { | 
				
			|||
                        redirect_to_document('account.move', record[0].id); | 
				
			|||
                    } else { | 
				
			|||
                        redirect_to_document('account.move', $(event.currentTarget).data('move-id')); | 
				
			|||
                    } | 
				
			|||
                }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
    }); | 
				
			|||
    core.action_registry.add('dynamic.bs', BalanceSheet); | 
				
			|||
 | 
				
			|||
}); | 
				
			|||
@ -0,0 +1,995 @@ | 
				
			|||
odoo.define('dynamic_financial_report.bank_book', 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; | 
				
			|||
 | 
				
			|||
   var BankBook = AbstractAction.extend({ | 
				
			|||
        template: 'BankBook', | 
				
			|||
        events: { | 
				
			|||
            'click .bb-line': 'get_move_lines', | 
				
			|||
            'click .view-move': 'view_move', | 
				
			|||
            'click #filter_apply_button': 'apply_filter', | 
				
			|||
            'click #pdf': 'print_pdf', | 
				
			|||
            'click #xlsx': 'print_xlsx', | 
				
			|||
        }, | 
				
			|||
        init: function(view, code) { | 
				
			|||
            this._super(view, code); | 
				
			|||
            this.wizard = code.context.wizard | null; | 
				
			|||
            this.session = session; | 
				
			|||
        }, | 
				
			|||
        start: function() { | 
				
			|||
            var self = this; | 
				
			|||
            self.initial_render = true; | 
				
			|||
 | 
				
			|||
                rpc.query({ | 
				
			|||
                model: 'dynamic.bank.book', | 
				
			|||
                method: 'create', | 
				
			|||
                args: [{ | 
				
			|||
 | 
				
			|||
                }] | 
				
			|||
                }).then(function(res) { | 
				
			|||
                    self.wizard = res; | 
				
			|||
                    self.bank_view(self.initial_render); | 
				
			|||
                }) | 
				
			|||
 | 
				
			|||
        }, | 
				
			|||
            apply_filter: function(event) { | 
				
			|||
 | 
				
			|||
            event.preventDefault(); | 
				
			|||
            var self = this; | 
				
			|||
 | 
				
			|||
            self.initial_render = false; | 
				
			|||
            var output = {}; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
            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=""; | 
				
			|||
 | 
				
			|||
            } | 
				
			|||
            output.account_ids = account_ids | 
				
			|||
 | 
				
			|||
 | 
				
			|||
             var journal_ids = []; | 
				
			|||
            var journal_text = []; | 
				
			|||
            var journal_res = document.getElementById("journal_res") | 
				
			|||
            var journal_list = $(".journal").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=""; | 
				
			|||
 | 
				
			|||
            } | 
				
			|||
            output.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=""; | 
				
			|||
 | 
				
			|||
            } | 
				
			|||
            output.account_tag_ids = account_tag_ids | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
               var analytic_ids = []; | 
				
			|||
            var analytic_text = []; | 
				
			|||
            var span_res = document.getElementById("analic_res") | 
				
			|||
            var analytic_list = $(".analytic").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) | 
				
			|||
                    } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
                    span_res.value = analytic_text | 
				
			|||
                    span_res.innerHTML=span_res.value; | 
				
			|||
                } | 
				
			|||
            } | 
				
			|||
            if (analytic_list.length == 0){ | 
				
			|||
               span_res.value = "" | 
				
			|||
                    span_res.innerHTML=""; | 
				
			|||
 | 
				
			|||
            } | 
				
			|||
            output.analytic_ids = analytic_ids | 
				
			|||
 | 
				
			|||
 | 
				
			|||
            output.analytic_tag_ids = analytic_tag_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=""; | 
				
			|||
 | 
				
			|||
            } | 
				
			|||
            output.analytic_tag_ids = analytic_tag_ids | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
            if ($("#date_from").val()) { | 
				
			|||
                var dateObject = $("#date_from").datepicker("getDate"); | 
				
			|||
                var dateString = $.datepicker.formatDate("yy-mm-dd", dateObject); | 
				
			|||
                output.date_from = dateString; | 
				
			|||
            } | 
				
			|||
            if ($("#date_to").val()) { | 
				
			|||
                var dateObject = $("#date_to").datepicker("getDate"); | 
				
			|||
                var dateString = $.datepicker.formatDate("yy-mm-dd", dateObject); | 
				
			|||
                output.date_to = dateString; | 
				
			|||
            } | 
				
			|||
 | 
				
			|||
            if ($(".entries").length) { | 
				
			|||
            var post_res = document.getElementById("post_res") | 
				
			|||
            output.entries = $(".entries")[1].value | 
				
			|||
            post_res.value = $(".entries")[1].value | 
				
			|||
                    post_res.innerHTML=post_res.value; | 
				
			|||
              if ($(".entries")[1].value == "") { | 
				
			|||
              post_res.innerHTML="all"; | 
				
			|||
 | 
				
			|||
              } | 
				
			|||
            } | 
				
			|||
            output.include_details = true; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
            rpc.query({ | 
				
			|||
                model: 'dynamic.bank.book', | 
				
			|||
                method: 'write', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard], output | 
				
			|||
                ], | 
				
			|||
            }).then(function(res) { | 
				
			|||
                self.bank_view(self.initial_render); | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
        print_pdf: function(e) { | 
				
			|||
            e.preventDefault(); | 
				
			|||
            var self = this; | 
				
			|||
            var action_title = self._title | 
				
			|||
 | 
				
			|||
            self._rpc({ | 
				
			|||
                model: 'dynamic.bank.book', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard], action_title | 
				
			|||
                ], | 
				
			|||
            }).then(function(data) { | 
				
			|||
                var action = { | 
				
			|||
                    'type': 'ir.actions.report', | 
				
			|||
                    'report_type': 'qweb-pdf', | 
				
			|||
                    'report_name': 'dynamic_financial_report.bank_book', | 
				
			|||
                    'report_file': 'dynamic_financial_report.bank_book', | 
				
			|||
                    'data': { | 
				
			|||
                        'report_data': data | 
				
			|||
                    }, | 
				
			|||
                    'context': { | 
				
			|||
                        'active_model': 'dynamic.bank.book', | 
				
			|||
                        'landscape': 1, | 
				
			|||
                        'js_report': true | 
				
			|||
                    }, | 
				
			|||
                    'display_name': 'Bank Book', | 
				
			|||
                }; | 
				
			|||
                return self.do_action(action); | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
        print_xlsx: function() { | 
				
			|||
            var self = this; | 
				
			|||
            var action_title = self._title | 
				
			|||
            self._rpc({ | 
				
			|||
                model: 'dynamic.bank.book', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard], action_title | 
				
			|||
                ], | 
				
			|||
            }).then(function(data) { | 
				
			|||
                var action = { | 
				
			|||
                    'type': 'ir_actions_xlsx_download', | 
				
			|||
                    'data': { | 
				
			|||
                         'model': 'dynamic.bank.book', | 
				
			|||
                         'options': JSON.stringify(data[1]), | 
				
			|||
                         'output_format': 'xlsx', | 
				
			|||
                         'report_data': JSON.stringify(data[0]), | 
				
			|||
                         'report_name': 'Bank Book', | 
				
			|||
                         'dfr_data': 'Bank Book', | 
				
			|||
                    }, | 
				
			|||
                }; | 
				
			|||
                return self.do_action(action); | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
        bank_view: function(initial_render = true) { | 
				
			|||
            var self = this; | 
				
			|||
            var node = self.$('.container-bb-main'); | 
				
			|||
            var action_title = self._title | 
				
			|||
            var last; | 
				
			|||
            while (last = node.lastChild) node.removeChild(last); | 
				
			|||
            rpc.query({ | 
				
			|||
                model: 'dynamic.bank.book', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard], action_title | 
				
			|||
                ], | 
				
			|||
            }).then(function(datas) { | 
				
			|||
                self.filter_data = datas[0] | 
				
			|||
 | 
				
			|||
                self.account_data = datas[1] | 
				
			|||
 | 
				
			|||
                _.each(self.account_data, function(account) { | 
				
			|||
                    var currency_format = { | 
				
			|||
                        currency_id: account.company_currency_id, | 
				
			|||
                        position: account.company_currency_position, | 
				
			|||
                        symbol: account.company_currency_symbol, | 
				
			|||
                        noSymbol: true, | 
				
			|||
                    }; | 
				
			|||
                    if (currency_format.position == "before") { | 
				
			|||
 | 
				
			|||
                         if (account.debit == 0) { | 
				
			|||
                                account.debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.debit = currency_format.symbol + ' ' + account.debit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.credit == 0) { | 
				
			|||
                                account.credit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account.credit = currency_format.symbol + ' ' + account.credit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.balance == 0) { | 
				
			|||
                                account.balance = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account.balance = currency_format.symbol + ' ' + account.balance.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                    } else { | 
				
			|||
 | 
				
			|||
                        if (account.debit == 0) { | 
				
			|||
                                account.debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.debit = account.debit.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.credit == 0) { | 
				
			|||
                                account.credit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account.credit = account.credit.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.balance == 0) { | 
				
			|||
                                account.balance = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.balance = account.balance.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                    } | 
				
			|||
                }); | 
				
			|||
                if (initial_render) { | 
				
			|||
                    self.$('.bb-filter').html(QWeb.render('FilterSectionBB', { | 
				
			|||
                        filter_data: datas[0], | 
				
			|||
                    })); | 
				
			|||
 | 
				
			|||
                    self.$el.find('.journal').select2({ | 
				
			|||
                        placeholder: 'Select Journal...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.account').select2({ | 
				
			|||
                        placeholder: 'Select Account...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.account-tag').select2({ | 
				
			|||
                        placeholder: 'Select Account Tag...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.analytic-tag').select2({ | 
				
			|||
                        placeholder: 'Select Analytic Tag...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.analytic').select2({ | 
				
			|||
                        placeholder: 'Select Analytic...', | 
				
			|||
                    }); | 
				
			|||
 | 
				
			|||
                    self.$el.find('#date_from').datepicker({ | 
				
			|||
                        dateFormat: 'dd-mm-yy' | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('#date_to').datepicker({ | 
				
			|||
                        dateFormat: 'dd-mm-yy' | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.entries').select2({ | 
				
			|||
                        placeholder: 'Select Moves', | 
				
			|||
                    }); | 
				
			|||
                } | 
				
			|||
                self.$('.container-bb-main').html(QWeb.render('BankBookData', { | 
				
			|||
                    account_data: datas[1] | 
				
			|||
                })); | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
        bb_lines_by_page: function(offset, account_id) { | 
				
			|||
            var self = this; | 
				
			|||
            return rpc.query({ | 
				
			|||
                model: 'dynamic.bank.book', | 
				
			|||
                method: 'bb_move_lines', | 
				
			|||
                args: [self.wizard, offset, account_id], | 
				
			|||
            }) | 
				
			|||
        }, | 
				
			|||
        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) { | 
				
			|||
                self.bb_lines_by_page(offset, account_id).then(function(datas) { | 
				
			|||
                    _.each(datas[2], function(data) { | 
				
			|||
                        var currency_format = { | 
				
			|||
                            currency_id: data.company_currency_id, | 
				
			|||
                            position: data.company_currency_position, | 
				
			|||
                            symbol: data.company_currency_symbol, | 
				
			|||
                            noSymbol: true, | 
				
			|||
                        }; | 
				
			|||
                        if (currency_format.position == "before") { | 
				
			|||
                            if (data.debit == 0) { | 
				
			|||
                                data.debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                data.debit = currency_format.symbol + ' ' + data.debit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.credit == 0) { | 
				
			|||
                                data.credit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                data.credit = currency_format.symbol + ' ' + data.credit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.balance == 0) { | 
				
			|||
                                data.balance = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                data.balance = currency_format.symbol + ' ' + data.balance.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                        } else { | 
				
			|||
                            if (data.debit == 0) { | 
				
			|||
                                data.debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                data.debit = data.debit.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.credit == 0) { | 
				
			|||
                                data.credit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                data.credit = data.credit.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.balance == 0) { | 
				
			|||
                                data.balance = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                data.balance = data.balance.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
 | 
				
			|||
                        } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
                    }); | 
				
			|||
                    $(event.currentTarget).next('tr').find('td .bb-table-div').remove(); | 
				
			|||
                    $(event.currentTarget).next('tr').find('td ul').after( | 
				
			|||
                        QWeb.render('SubSectionBB', { | 
				
			|||
                            count: datas[0], | 
				
			|||
                            offset: datas[1], | 
				
			|||
                            account_data: datas[2], | 
				
			|||
                        })) | 
				
			|||
                    $(event.currentTarget).next('tr').find('td ul li:first a').css({ | 
				
			|||
                        'background-color': '#00ede8', | 
				
			|||
                        'font-weight': 'bold', | 
				
			|||
                    }); | 
				
			|||
                }) | 
				
			|||
            } | 
				
			|||
        }, | 
				
			|||
        view_move: function(event) { | 
				
			|||
            event.preventDefault(); | 
				
			|||
            var self = this; | 
				
			|||
            var context = {}; | 
				
			|||
            var redirect_to_document = 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) { | 
				
			|||
                        redirect_to_document('account.move', record[0].id); | 
				
			|||
                    } else { | 
				
			|||
                        redirect_to_document('account.move', $(event.currentTarget).data('move-id')); | 
				
			|||
                    } | 
				
			|||
                }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
    }); | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    var CashBook = AbstractAction.extend({ | 
				
			|||
        template: 'CashBook', | 
				
			|||
        events: { | 
				
			|||
            'click .cb-line': 'get_move_lines', | 
				
			|||
            'click .view-move': 'view_move', | 
				
			|||
            'click #filter_apply_button': 'apply_filter', | 
				
			|||
            'click #pdf': 'print_pdf', | 
				
			|||
            'click #xlsx': 'print_xlsx', | 
				
			|||
        }, | 
				
			|||
        init: function(view, code) { | 
				
			|||
            this._super(view, code); | 
				
			|||
            this.wizard = code.context.wizard | null; | 
				
			|||
            this.session = session; | 
				
			|||
        }, | 
				
			|||
        start: function() { | 
				
			|||
            var self = this; | 
				
			|||
            self.initial_render = true; | 
				
			|||
                rpc.query({ | 
				
			|||
                model: 'dynamic.bank.book', | 
				
			|||
                method: 'create', | 
				
			|||
                args: [{ | 
				
			|||
 | 
				
			|||
                }] | 
				
			|||
                }).then(function(res) { | 
				
			|||
                    self.wizard = res; | 
				
			|||
                    self.cash_view(self.initial_render); | 
				
			|||
                }) | 
				
			|||
 | 
				
			|||
        }, | 
				
			|||
            apply_filter: function(event) { | 
				
			|||
 | 
				
			|||
            event.preventDefault(); | 
				
			|||
            var self = this; | 
				
			|||
 | 
				
			|||
            self.initial_render = false; | 
				
			|||
            var output = {}; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
            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=""; | 
				
			|||
 | 
				
			|||
            } | 
				
			|||
            output.account_ids = account_ids | 
				
			|||
 | 
				
			|||
 | 
				
			|||
             var journal_ids = []; | 
				
			|||
            var journal_text = []; | 
				
			|||
            var journal_res = document.getElementById("journal_res") | 
				
			|||
            var journal_list = $(".journal").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=""; | 
				
			|||
 | 
				
			|||
            } | 
				
			|||
            output.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=""; | 
				
			|||
 | 
				
			|||
            } | 
				
			|||
            output.account_tag_ids = account_tag_ids | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
               var analytic_ids = []; | 
				
			|||
            var analytic_text = []; | 
				
			|||
            var span_res = document.getElementById("analic_res") | 
				
			|||
            var analytic_list = $(".analytic").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) | 
				
			|||
 | 
				
			|||
                    } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
                    span_res.value = analytic_text | 
				
			|||
                    span_res.innerHTML=span_res.value; | 
				
			|||
                } | 
				
			|||
            } | 
				
			|||
            if (analytic_list.length == 0){ | 
				
			|||
               span_res.value = "" | 
				
			|||
                    span_res.innerHTML=""; | 
				
			|||
 | 
				
			|||
            } | 
				
			|||
            output.analytic_ids = analytic_ids | 
				
			|||
 | 
				
			|||
            output.analytic_tag_ids = analytic_tag_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=""; | 
				
			|||
 | 
				
			|||
            } | 
				
			|||
            output.analytic_tag_ids = analytic_tag_ids | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
            if ($("#date_from").val()) { | 
				
			|||
                var dateObject = $("#date_from").datepicker("getDate"); | 
				
			|||
                var dateString = $.datepicker.formatDate("yy-mm-dd", dateObject); | 
				
			|||
                output.date_from = dateString; | 
				
			|||
            } | 
				
			|||
            if ($("#date_to").val()) { | 
				
			|||
                var dateObject = $("#date_to").datepicker("getDate"); | 
				
			|||
                var dateString = $.datepicker.formatDate("yy-mm-dd", dateObject); | 
				
			|||
                output.date_to = dateString; | 
				
			|||
            } | 
				
			|||
 | 
				
			|||
            if ($(".entries").length) { | 
				
			|||
            var post_res = document.getElementById("post_res") | 
				
			|||
            output.entries = $(".entries")[1].value | 
				
			|||
            post_res.value = $(".entries")[1].value | 
				
			|||
                    post_res.innerHTML=post_res.value; | 
				
			|||
              if ($(".entries")[1].value == "") { | 
				
			|||
              post_res.innerHTML="all"; | 
				
			|||
 | 
				
			|||
              } | 
				
			|||
            } | 
				
			|||
 | 
				
			|||
            output.include_details = true; | 
				
			|||
 | 
				
			|||
            rpc.query({ | 
				
			|||
                model: 'dynamic.bank.book', | 
				
			|||
                method: 'write', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard], output | 
				
			|||
                ], | 
				
			|||
            }).then(function(res) { | 
				
			|||
                self.cash_view(self.initial_render); | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
        print_pdf: function(e) { | 
				
			|||
            e.preventDefault(); | 
				
			|||
            var self = this; | 
				
			|||
            var action_title = self._title | 
				
			|||
            self._rpc({ | 
				
			|||
                model: 'dynamic.bank.book', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard], action_title | 
				
			|||
                ], | 
				
			|||
            }).then(function(data) { | 
				
			|||
                var action = { | 
				
			|||
                    'type': 'ir.actions.report', | 
				
			|||
                    'report_type': 'qweb-pdf', | 
				
			|||
                    'report_name': 'dynamic_financial_report.cash_book', | 
				
			|||
                    'report_file': 'dynamic_financial_report.cash_book', | 
				
			|||
                    'data': { | 
				
			|||
                        'report_data': data | 
				
			|||
                    }, | 
				
			|||
                    'context': { | 
				
			|||
                        'active_model': 'dynamic.bank.book', | 
				
			|||
                        'landscape': 1, | 
				
			|||
                        'js_report': true | 
				
			|||
                    }, | 
				
			|||
                    'display_name': 'Cash Book', | 
				
			|||
                }; | 
				
			|||
                return self.do_action(action); | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
        print_xlsx: function() { | 
				
			|||
            var self = this; | 
				
			|||
            var action_title = self._title | 
				
			|||
 | 
				
			|||
            self._rpc({ | 
				
			|||
                model: 'dynamic.bank.book', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard], action_title | 
				
			|||
                ], | 
				
			|||
            }).then(function(data) { | 
				
			|||
                var action = { | 
				
			|||
                    'type': 'ir_actions_xlsx_download', | 
				
			|||
                    'data': { | 
				
			|||
                         'model': 'dynamic.bank.book', | 
				
			|||
                         'options': JSON.stringify(data[1]), | 
				
			|||
                         'output_format': 'xlsx', | 
				
			|||
                         'report_data': JSON.stringify(data[0]), | 
				
			|||
                         'report_name': 'Cash Book', | 
				
			|||
                         'dfr_data': 'Cash Book', | 
				
			|||
                    }, | 
				
			|||
                }; | 
				
			|||
                return self.do_action(action); | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
        cash_view: function(initial_render = true) { | 
				
			|||
            var self = this; | 
				
			|||
            var action_title = self._title | 
				
			|||
            console.log("djhhdbkjd", action_title) | 
				
			|||
 | 
				
			|||
            var node = self.$('.container-cb-main'); | 
				
			|||
            var last; | 
				
			|||
            while (last = node.lastChild) node.removeChild(last); | 
				
			|||
            rpc.query({ | 
				
			|||
                model: 'dynamic.bank.book', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard], action_title | 
				
			|||
                ], | 
				
			|||
            }).then(function(datas) { | 
				
			|||
                self.filter_data = datas[0] | 
				
			|||
 | 
				
			|||
                self.account_data = datas[1] | 
				
			|||
 | 
				
			|||
                _.each(self.account_data, function(account) { | 
				
			|||
                    var currency_format = { | 
				
			|||
                        currency_id: account.company_currency_id, | 
				
			|||
                        position: account.company_currency_position, | 
				
			|||
                        symbol: account.company_currency_symbol, | 
				
			|||
                        noSymbol: true, | 
				
			|||
                    }; | 
				
			|||
                    if (currency_format.position == "before") { | 
				
			|||
 | 
				
			|||
                         if (account.debit == 0) { | 
				
			|||
                                account.debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.debit = currency_format.symbol + ' ' + account.debit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.credit == 0) { | 
				
			|||
                                account.credit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account.credit = currency_format.symbol + ' ' + account.credit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.balance == 0) { | 
				
			|||
                                account.balance = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account.balance = currency_format.symbol + ' ' + account.balance.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                    } else { | 
				
			|||
 | 
				
			|||
                        if (account.debit == 0) { | 
				
			|||
                                account.debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.debit = account.debit.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.credit == 0) { | 
				
			|||
                                account.credit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account.credit = account.credit.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.balance == 0) { | 
				
			|||
                                account.balance = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.balance = account.balance.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                    } | 
				
			|||
                }); | 
				
			|||
                if (initial_render) { | 
				
			|||
                    self.$('.cb-filter').html(QWeb.render('FilterSectionCB', { | 
				
			|||
                        filter_data: datas[0], | 
				
			|||
                    })); | 
				
			|||
 | 
				
			|||
                    self.$el.find('.journal').select2({ | 
				
			|||
                        placeholder: 'Select Journal...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.account').select2({ | 
				
			|||
                        placeholder: 'Select Account...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.account-tag').select2({ | 
				
			|||
                        placeholder: 'Select Account Tag...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.analytic-tag').select2({ | 
				
			|||
                        placeholder: 'Select Analytic Tag...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.analytic').select2({ | 
				
			|||
                        placeholder: 'Select Analytic...', | 
				
			|||
                    }); | 
				
			|||
 | 
				
			|||
                    self.$el.find('#date_from').datepicker({ | 
				
			|||
                        dateFormat: 'dd-mm-yy' | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('#date_to').datepicker({ | 
				
			|||
                        dateFormat: 'dd-mm-yy' | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.entries').select2({ | 
				
			|||
                        placeholder: 'Select Moves', | 
				
			|||
                    }); | 
				
			|||
                } | 
				
			|||
                self.$('.container-cb-main').html(QWeb.render('CashBookData', { | 
				
			|||
                    account_data: datas[1] | 
				
			|||
                })); | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
        cb_lines_by_page: function(offset, account_id) { | 
				
			|||
            var self = this; | 
				
			|||
            return rpc.query({ | 
				
			|||
                model: 'dynamic.bank.book', | 
				
			|||
                method: 'bb_move_lines', | 
				
			|||
                args: [self.wizard, offset, account_id], | 
				
			|||
            }) | 
				
			|||
        }, | 
				
			|||
        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) { | 
				
			|||
                self.cb_lines_by_page(offset, account_id).then(function(datas) { | 
				
			|||
                    _.each(datas[2], function(data) { | 
				
			|||
                        var currency_format = { | 
				
			|||
                            currency_id: data.company_currency_id, | 
				
			|||
                            position: data.company_currency_position, | 
				
			|||
                            symbol: data.company_currency_symbol, | 
				
			|||
                            noSymbol: true, | 
				
			|||
                        }; | 
				
			|||
                        if (currency_format.position == "before") { | 
				
			|||
                            if (data.debit == 0) { | 
				
			|||
                                data.debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                data.debit = currency_format.symbol + ' ' + data.debit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.credit == 0) { | 
				
			|||
                                data.credit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                data.credit = currency_format.symbol + ' ' + data.credit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.balance == 0) { | 
				
			|||
                                data.balance = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                data.balance = currency_format.symbol + ' ' + data.balance.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                        } else { | 
				
			|||
                            if (data.debit == 0) { | 
				
			|||
                                data.debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                data.debit = data.debit.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.credit == 0) { | 
				
			|||
                                data.credit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                data.credit = data.credit.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.balance == 0) { | 
				
			|||
                                data.balance = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                data.balance = data.balance.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
 | 
				
			|||
                        } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
                    }); | 
				
			|||
                    $(event.currentTarget).next('tr').find('td .cb-table-div').remove(); | 
				
			|||
                    $(event.currentTarget).next('tr').find('td ul').after( | 
				
			|||
                        QWeb.render('SubSectionCB', { | 
				
			|||
                            count: datas[0], | 
				
			|||
                            offset: datas[1], | 
				
			|||
                            account_data: datas[2], | 
				
			|||
                        })) | 
				
			|||
                    $(event.currentTarget).next('tr').find('td ul li:first a').css({ | 
				
			|||
                        'background-color': '#00ede8', | 
				
			|||
                        'font-weight': 'bold', | 
				
			|||
                    }); | 
				
			|||
                }) | 
				
			|||
            } | 
				
			|||
        }, | 
				
			|||
        view_move: function(event) { | 
				
			|||
            event.preventDefault(); | 
				
			|||
            var self = this; | 
				
			|||
            var context = {}; | 
				
			|||
            var redirect_to_document = 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) { | 
				
			|||
                        redirect_to_document('account.move', record[0].id); | 
				
			|||
                    } else { | 
				
			|||
                        redirect_to_document('account.move', $(event.currentTarget).data('move-id')); | 
				
			|||
                    } | 
				
			|||
                }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
    }); | 
				
			|||
 | 
				
			|||
    core.action_registry.add('dynamic.bb', BankBook); | 
				
			|||
    core.action_registry.add('dynamic.cb', CashBook); | 
				
			|||
 | 
				
			|||
}); | 
				
			|||
@ -0,0 +1,368 @@ | 
				
			|||
odoo.define('dynamic_financial_report.DynamicReports', function(require) { | 
				
			|||
    'use strict'; | 
				
			|||
    var AbstractAction = require('web.AbstractAction'); | 
				
			|||
    var core = require('web.core'); | 
				
			|||
    var Dialog = require('web.Dialog'); | 
				
			|||
    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; | 
				
			|||
    var CashFlow = AbstractAction.extend({ | 
				
			|||
        template: 'CashFlow', | 
				
			|||
        events: { | 
				
			|||
            'click .cf-line': 'get_move_lines', | 
				
			|||
            'click .view-move': 'view_move', | 
				
			|||
            'click #filter_apply_button': 'apply_filter', | 
				
			|||
            'click #pdf': 'print_pdf', | 
				
			|||
            'click #xlsx': 'print_xlsx', | 
				
			|||
        }, | 
				
			|||
        init: function(view, code) { | 
				
			|||
            this._super(view, code); | 
				
			|||
            this.wizard = code.context.wizard | null; | 
				
			|||
            this.session = session; | 
				
			|||
 | 
				
			|||
        }, | 
				
			|||
        start: function() { | 
				
			|||
            var self = this; | 
				
			|||
            self.initial_render = true; | 
				
			|||
            rpc.query({ | 
				
			|||
                model: 'dynamic.cash.flow', | 
				
			|||
                method: 'create', | 
				
			|||
                args: [{ | 
				
			|||
                    res_model: this.res_model | 
				
			|||
                }] | 
				
			|||
            }).then(function(res) { | 
				
			|||
                self.wizard = res; | 
				
			|||
                self.ledger_view(self.initial_render); | 
				
			|||
            }) | 
				
			|||
        }, | 
				
			|||
        apply_filter: function(event) { | 
				
			|||
            event.preventDefault(); | 
				
			|||
            var self = this; | 
				
			|||
 | 
				
			|||
            self.initial_render = false; | 
				
			|||
            var output = {}; | 
				
			|||
            output.reconciled=false; | 
				
			|||
            output.type=false; | 
				
			|||
            output.date_from=false; | 
				
			|||
            output.date_to=false; | 
				
			|||
 | 
				
			|||
            if ($(".level").length){ | 
				
			|||
            var level_res = document.getElementById("level_res") | 
				
			|||
            output.level = $(".level")[1].value | 
				
			|||
            level_res.value = $(".level")[1].value | 
				
			|||
            level_res.innerHTML=level_res.value; | 
				
			|||
            if ($(".level").value==""){ | 
				
			|||
            type_res.innerHTML="summary"; | 
				
			|||
            output.type = "Summary" | 
				
			|||
            } | 
				
			|||
            } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
            var journal_ids = []; | 
				
			|||
            var journal_list = $(".journal").select2('data') | 
				
			|||
            for (var i = 0; i < journal_list.length; i++) { | 
				
			|||
                journal_ids.push(parseInt(journal_list[i].id)) | 
				
			|||
            } | 
				
			|||
            output.journal_ids = journal_ids | 
				
			|||
            var analytic_ids = []; | 
				
			|||
            var analytic_list = $(".analytic").select2('data') | 
				
			|||
            for (var i = 0; i < analytic_list.length; i++) { | 
				
			|||
                analytic_ids.push(parseInt(analytic_list[i].id)) | 
				
			|||
            } | 
				
			|||
            output.analytic_ids = analytic_ids | 
				
			|||
            var analytic_tag_ids = []; | 
				
			|||
            var analytic_tag_list = $(".analytic-tag").select2('data') | 
				
			|||
            for (var i = 0; i < analytic_tag_list.length; i++) { | 
				
			|||
                analytic_tag_ids.push(parseInt(analytic_tag_list[i].id)) | 
				
			|||
            } | 
				
			|||
            output.analytic_tag_ids = analytic_tag_ids | 
				
			|||
            if ($(".target-moves").length){ | 
				
			|||
                var target_res = document.getElementById("target_res") | 
				
			|||
                output.target_moves = $(".target-moves")[1].value | 
				
			|||
                target_res.value = $(".target-moves")[1].value | 
				
			|||
                target_res.innerHTML=target_res.value; | 
				
			|||
                if ($(".target-moves").value==""){ | 
				
			|||
                target_res.innerHTML="all"; | 
				
			|||
                output.target_moves = "all" | 
				
			|||
                } | 
				
			|||
            } | 
				
			|||
 | 
				
			|||
            if ($("#date_from").val()) { | 
				
			|||
                var dateObject = $("#date_from").datepicker("getDate"); | 
				
			|||
                var dateString = $.datepicker.formatDate("yy-mm-dd", dateObject); | 
				
			|||
                output.date_from = dateString; | 
				
			|||
            } | 
				
			|||
 | 
				
			|||
            if ($("#date_to").val()) { | 
				
			|||
                var dateObject = $("#date_to").datepicker("getDate"); | 
				
			|||
                var dateString = $.datepicker.formatDate("yy-mm-dd", dateObject); | 
				
			|||
                output.date_to = dateString; | 
				
			|||
            } | 
				
			|||
            output.include_details = true; | 
				
			|||
 | 
				
			|||
            rpc.query({ | 
				
			|||
                model: 'dynamic.cash.flow', | 
				
			|||
                method: 'write', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard], output | 
				
			|||
                ], | 
				
			|||
            }).then(function(res) { | 
				
			|||
                self.ledger_view(self.initial_render); | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
        print_pdf: function(e) { | 
				
			|||
            e.preventDefault(); | 
				
			|||
            var self = this; | 
				
			|||
            self._rpc({ | 
				
			|||
                model: 'dynamic.cash.flow', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard] | 
				
			|||
                ], | 
				
			|||
            }).then(function(data) { | 
				
			|||
                var action = { | 
				
			|||
                    'type': 'ir.actions.report', | 
				
			|||
                    'report_type': 'qweb-pdf', | 
				
			|||
                    'report_name': 'dynamic_financial_report.cash_flow', | 
				
			|||
                    'report_file': 'dynamic_financial_report.cash_flow', | 
				
			|||
                    'data': { | 
				
			|||
                        'report_data': data | 
				
			|||
                    }, | 
				
			|||
                    'context': { | 
				
			|||
                        'active_model': 'dynamic.cash.flow', | 
				
			|||
                        'landscape': 1, | 
				
			|||
                        'js_report': true | 
				
			|||
                    }, | 
				
			|||
                    'display_name': 'Cash Flow', | 
				
			|||
                }; | 
				
			|||
                return self.do_action(action); | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
        print_xlsx: function() { | 
				
			|||
            var self = this; | 
				
			|||
            self._rpc({ | 
				
			|||
                model: 'dynamic.cash.flow', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard] | 
				
			|||
                ], | 
				
			|||
            }).then(function(data) { | 
				
			|||
                var action = { | 
				
			|||
                    'type': 'ir_actions_xlsx_download', | 
				
			|||
                    'data': { | 
				
			|||
                         'model': 'dynamic.cash.flow', | 
				
			|||
                         'options': JSON.stringify(data[1]), | 
				
			|||
                         'output_format': 'xlsx', | 
				
			|||
                         'report_data': JSON.stringify(data[0]), | 
				
			|||
                         'report_name': 'Cash Flow', | 
				
			|||
                         'dfr_data': JSON.stringify(data), | 
				
			|||
                    }, | 
				
			|||
                }; | 
				
			|||
                return self.do_action(action); | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
        ledger_view: function(initial_render = true) { | 
				
			|||
            var self = this; | 
				
			|||
            var node = self.$('.container-cf-main'); | 
				
			|||
            var last; | 
				
			|||
            while (last = node.lastChild) node.removeChild(last); | 
				
			|||
            rpc.query({ | 
				
			|||
                model: 'dynamic.cash.flow', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard] | 
				
			|||
                ], | 
				
			|||
            }).then(function(datas) { | 
				
			|||
                self.filter_data = datas[0] | 
				
			|||
                self.account_data = datas[1] | 
				
			|||
                _.each(self.account_data.fetched_data, function(account) { | 
				
			|||
                var currency_format = { | 
				
			|||
                        currency_id: datas[1].company_currency_id, | 
				
			|||
                        position: datas[1].company_currency_position, | 
				
			|||
                        symbol: datas[1].company_currency_symbol, | 
				
			|||
 | 
				
			|||
                        noSymbol: true, | 
				
			|||
                    }; | 
				
			|||
                    if (currency_format.position == "before") { | 
				
			|||
 | 
				
			|||
                         if (account.total_credit == 0) { | 
				
			|||
                                account.total_credit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                               account.total_credit = currency_format.symbol + ' ' + account.total_credit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.total_debit == 0) { | 
				
			|||
                                account.total_debit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account.total_debit = currency_format.symbol + ' ' + account.total_debit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.total_balance == 0) { | 
				
			|||
                                account.total_balance = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account.total_balance = currency_format.symbol + ' ' + account.total_balance.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
                        } else {if (account.total_credit == 0) { | 
				
			|||
                                account.total_credit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.total_credit = account.total_credit.toFixed(2) + ' ' + currency_format.symbol; | 
				
			|||
//
 | 
				
			|||
                            } | 
				
			|||
                            if (account.total_debit == 0) { | 
				
			|||
                                account.total_debit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account.total_debit = account.total_debit.toFixed(2) + ' ' + currency_format.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.total_balance == 0) { | 
				
			|||
                                account.total_balance  = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.total_balance  = account.total_balance.toFixed(2) + ' ' + currency_format.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
//
 | 
				
			|||
                        } | 
				
			|||
                }); | 
				
			|||
                if (initial_render) { | 
				
			|||
                    self.$('.cf-filter').html(QWeb.render('FilterSectionCF', { | 
				
			|||
                        filter_data: datas[0], | 
				
			|||
                    })); | 
				
			|||
 | 
				
			|||
                    self.$el.find('.journal').select2({ | 
				
			|||
                        placeholder: 'Select Journal...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.level').select2({ | 
				
			|||
                        placeholder: 'Select Level...', | 
				
			|||
                    }); | 
				
			|||
 | 
				
			|||
                     self.$el.find('.analytic-tag').select2({ | 
				
			|||
                        placeholder: 'Select Analytic Tag...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.analytic').select2({ | 
				
			|||
                        placeholder: 'Select Analytic...', | 
				
			|||
                    }); | 
				
			|||
 | 
				
			|||
                    self.$el.find('#date_from').datepicker({ | 
				
			|||
                        dateFormat: 'dd-mm-yy' | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('#date_to').datepicker({ | 
				
			|||
                        dateFormat: 'dd-mm-yy' | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.target-moves').select2({ | 
				
			|||
                       placeholder: 'Posted or All Entries...', | 
				
			|||
                    }); | 
				
			|||
                } | 
				
			|||
 | 
				
			|||
                self.$('.container-cf-main').html(QWeb.render('CashFlowData', { | 
				
			|||
                    account_data: datas[1].fetched_data, | 
				
			|||
                    level:datas[1].levels, | 
				
			|||
                })); | 
				
			|||
 | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
        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: 'dynamic.cash.flow', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard] | 
				
			|||
                ], | 
				
			|||
            }).then(function(datas) { | 
				
			|||
 | 
				
			|||
                    if(datas[1].levels== 'detailed'){ | 
				
			|||
                        $(event.currentTarget).next('tr').find('td ul').after( | 
				
			|||
                            QWeb.render('SubSectionCF', { | 
				
			|||
                                count: 3, | 
				
			|||
                                offset: 0, | 
				
			|||
                                account_data: datas[1].journal_res, | 
				
			|||
                                level:datas[1].levels, | 
				
			|||
                                data_currency: datas[1], | 
				
			|||
                                line_id:parseInt(event.currentTarget.attributes[3].value), | 
				
			|||
                            })) | 
				
			|||
                    }else if(datas[1].levels== 'very'  || datas[1].levels== false){ | 
				
			|||
                            $(event.currentTarget).next('tr').find('td ul').after( | 
				
			|||
                            QWeb.render('ChildSubSectionCF', { | 
				
			|||
                                count: 3, | 
				
			|||
                                offset: 0, | 
				
			|||
                                account_data: datas[1].account_res, | 
				
			|||
                                level:datas[1].levels, | 
				
			|||
                                data_currency: datas[1], | 
				
			|||
                                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', | 
				
			|||
                    }); | 
				
			|||
                }) | 
				
			|||
            } | 
				
			|||
        }, | 
				
			|||
        view_move: function(event) { | 
				
			|||
            event.preventDefault(); | 
				
			|||
            var self = this; | 
				
			|||
            var context = {}; | 
				
			|||
            var redirect_to_document = 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) { | 
				
			|||
                        redirect_to_document('account.move', record[0].id); | 
				
			|||
                    } else { | 
				
			|||
                        redirect_to_document('account.move', $(event.currentTarget).data('move-id')); | 
				
			|||
                    } | 
				
			|||
                }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
    }); | 
				
			|||
 | 
				
			|||
    core.action_registry.add('dynamic.cf', CashFlow); | 
				
			|||
        return CashFlow; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
}); | 
				
			|||
@ -0,0 +1,414 @@ | 
				
			|||
odoo.define('dynamic_financial_report.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; | 
				
			|||
 | 
				
			|||
    var DayBook = AbstractAction.extend({ | 
				
			|||
        template: 'DayBook', | 
				
			|||
        events: { | 
				
			|||
            'click .db-line': 'get_move_lines', | 
				
			|||
            'click .view-move': 'view_move', | 
				
			|||
            'click #filter_apply_button': 'apply_filter', | 
				
			|||
            'click #pdf': 'print_pdf', | 
				
			|||
            'click #xlsx': 'print_xlsx', | 
				
			|||
        }, | 
				
			|||
        init: function(view, code) { | 
				
			|||
            this._super(view, code); | 
				
			|||
            this.wizard = code.context.wizard | null; | 
				
			|||
            this.session = session; | 
				
			|||
        }, | 
				
			|||
        start: function() { | 
				
			|||
            var self = this; | 
				
			|||
            self.initial_render = true; | 
				
			|||
            rpc.query({ | 
				
			|||
                model: 'dynamic.day.book', | 
				
			|||
                method: 'create', | 
				
			|||
                args: [{ | 
				
			|||
                    res_model: this.res_model | 
				
			|||
                }] | 
				
			|||
            }).then(function(res) { | 
				
			|||
                self.wizard = res; | 
				
			|||
                self.ledger_view(self.initial_render); | 
				
			|||
            }) | 
				
			|||
        }, | 
				
			|||
        apply_filter: function(event) { | 
				
			|||
 | 
				
			|||
            event.preventDefault(); | 
				
			|||
            var self = this; | 
				
			|||
            self.initial_render = false; | 
				
			|||
            var output = {}; | 
				
			|||
            output.date_from=false; | 
				
			|||
            output.date_to=false; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
            var journal_ids = []; | 
				
			|||
            var journal_text = []; | 
				
			|||
            var span_res = document.getElementById("journal_res") | 
				
			|||
 | 
				
			|||
            var journal_list = $(".journal").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) | 
				
			|||
 | 
				
			|||
                    } | 
				
			|||
 | 
				
			|||
                    span_res.value = journal_text | 
				
			|||
                    span_res.innerHTML=span_res.value; | 
				
			|||
                    } | 
				
			|||
            } | 
				
			|||
            if (journal_list.length == 0){ | 
				
			|||
            span_res.value = "" | 
				
			|||
            span_res.innerHTML=""; } | 
				
			|||
            output.journal_ids = journal_ids | 
				
			|||
 | 
				
			|||
 | 
				
			|||
            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=""; } | 
				
			|||
            output.account_ids = account_ids | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
             if ($(".entries").length){ | 
				
			|||
              var target_res = document.getElementById("target_res") | 
				
			|||
              output.entries = $(".entries")[1].value | 
				
			|||
              target_res.value = $(".entries")[1].value | 
				
			|||
                 target_res.innerHTML=target_res.value; | 
				
			|||
              if ($(".entries").value==""){ | 
				
			|||
              target_res.innerHTML="all"; | 
				
			|||
              output.entries = "all" | 
				
			|||
                } | 
				
			|||
              } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
            if ($("#date_from").val()) { | 
				
			|||
                var dateObject = $("#date_from").datepicker("getDate"); | 
				
			|||
                var dateString = $.datepicker.formatDate("yy-mm-dd", dateObject); | 
				
			|||
                output.date_from = dateString; | 
				
			|||
            } | 
				
			|||
            if ($("#date_to").val()) { | 
				
			|||
                var dateObject = $("#date_to").datepicker("getDate"); | 
				
			|||
                var dateString = $.datepicker.formatDate("yy-mm-dd", dateObject); | 
				
			|||
                output.date_to = dateString; | 
				
			|||
            } | 
				
			|||
            output.include_details = true; | 
				
			|||
 | 
				
			|||
            rpc.query({ | 
				
			|||
                model: 'dynamic.day.book', | 
				
			|||
                method: 'write', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard], output | 
				
			|||
                ], | 
				
			|||
            }).then(function(res) { | 
				
			|||
                self.ledger_view(self.initial_render); | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
        print_pdf: function(e) { | 
				
			|||
            e.preventDefault(); | 
				
			|||
            var self = this; | 
				
			|||
            self._rpc({ | 
				
			|||
                model: 'dynamic.day.book', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard] | 
				
			|||
                ], | 
				
			|||
            }).then(function(data) { | 
				
			|||
                var action = { | 
				
			|||
                    'type': 'ir.actions.report', | 
				
			|||
                    'report_type': 'qweb-pdf', | 
				
			|||
                    'report_name': 'dynamic_financial_report.dynamic_day_book', | 
				
			|||
                    'report_file': 'dynamic_financial_report.dynamic_day_book', | 
				
			|||
                    'data': { | 
				
			|||
                        'report_data': data | 
				
			|||
                    }, | 
				
			|||
                    'context': { | 
				
			|||
                        'active_model': 'dynamic.day.book', | 
				
			|||
                        'landscape': 1, | 
				
			|||
                        'js_report': true | 
				
			|||
                    }, | 
				
			|||
                    'display_name': 'Day Book', | 
				
			|||
                }; | 
				
			|||
                return self.do_action(action); | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
        print_xlsx: function() { | 
				
			|||
            var self = this; | 
				
			|||
            self._rpc({ | 
				
			|||
                model: 'dynamic.day.book', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard] | 
				
			|||
                ], | 
				
			|||
            }).then(function(data) { | 
				
			|||
 | 
				
			|||
                var action = { | 
				
			|||
                    'type': 'ir_actions_xlsx_download', | 
				
			|||
                    'data': { | 
				
			|||
                         'model': 'dynamic.day.book', | 
				
			|||
                         'options': JSON.stringify(data[1]), | 
				
			|||
                         'output_format': 'xlsx', | 
				
			|||
                         'report_data': JSON.stringify((data[2][2])), | 
				
			|||
                         'report_name': 'Day Book', | 
				
			|||
                         'dfr_data':JSON.stringify(data[0]), | 
				
			|||
 | 
				
			|||
                    }, | 
				
			|||
 | 
				
			|||
                }; | 
				
			|||
 | 
				
			|||
                return self.do_action(action); | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
        ledger_view: function(initial_render = true) { | 
				
			|||
 | 
				
			|||
            var self = this; | 
				
			|||
            var node = self.$('.container-db-main'); | 
				
			|||
            var last; | 
				
			|||
            while (last = node.lastChild) node.removeChild(last); | 
				
			|||
            rpc.query({ | 
				
			|||
                model: 'dynamic.day.book', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard] | 
				
			|||
                ], | 
				
			|||
            }).then(function(datas) { | 
				
			|||
 | 
				
			|||
                self.filter_data = datas[0] | 
				
			|||
                self.account_data = datas[1] | 
				
			|||
 | 
				
			|||
 | 
				
			|||
                _.each(self.account_data, function(account) { | 
				
			|||
 | 
				
			|||
                    var currency_format = { | 
				
			|||
                        currency_id: account.company_currency_id, | 
				
			|||
                        position: account.company_currency_position, | 
				
			|||
                        symbol: account.company_currency_symbol, | 
				
			|||
                        noSymbol: true, | 
				
			|||
                    }; | 
				
			|||
                    if (currency_format.position == "before") { | 
				
			|||
 | 
				
			|||
                         if (account.debit == 0) { | 
				
			|||
                                account.debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.debit = currency_format.symbol + ' ' + account.debit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.credit == 0) { | 
				
			|||
                                account.credit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account.credit = currency_format.symbol + ' ' + account.credit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.balance == 0) { | 
				
			|||
                                account.balance = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account.balance = currency_format.symbol + ' ' + account.balance.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                    } else { | 
				
			|||
 | 
				
			|||
                        if (account.debit == 0) { | 
				
			|||
                                account.debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.debit = account.debit.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.credit == 0) { | 
				
			|||
                                account.credit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account.credit = account.credit.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.balance == 0) { | 
				
			|||
                                account.balance = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.balance = account.balance.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                    } | 
				
			|||
                }); | 
				
			|||
                if (initial_render) { | 
				
			|||
                    self.$('.db-filter').html(QWeb.render('FilterSectiondb', { | 
				
			|||
                        filter_data: datas[0], | 
				
			|||
                    })); | 
				
			|||
 | 
				
			|||
                    self.$el.find('.journal').select2({ | 
				
			|||
                        placeholder: 'Select Journal...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.account').select2({ | 
				
			|||
                        placeholder: 'Select Account...', | 
				
			|||
                    }); | 
				
			|||
                     self.$el.find('.entries').select2({ | 
				
			|||
                        placeholder: 'Select Moves', | 
				
			|||
                    }); | 
				
			|||
 | 
				
			|||
                    self.$el.find('#date_from').datepicker({ | 
				
			|||
                        dateFormat: 'dd-mm-yy' | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('#date_to').datepicker({ | 
				
			|||
                        dateFormat: 'dd-mm-yy' | 
				
			|||
                    }); | 
				
			|||
                } | 
				
			|||
                self.$('.container-db-main').html(QWeb.render('DayBookData', { | 
				
			|||
                    account_data: datas[1] | 
				
			|||
                })); | 
				
			|||
 | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
        db_lines_by_page: function(offset, account_id) { | 
				
			|||
            var self = this; | 
				
			|||
            return rpc.query({ | 
				
			|||
                model: 'dynamic.day.book', | 
				
			|||
                method: 'db_move_lines', | 
				
			|||
                args: [self.wizard, offset, account_id], | 
				
			|||
            }) | 
				
			|||
        }, | 
				
			|||
        get_move_lines: function(event) { | 
				
			|||
            event.preventDefault(); | 
				
			|||
            var self = this; | 
				
			|||
            var account_id = $(event.currentTarget).data('account-id'); | 
				
			|||
            var date_id = $(event.currentTarget)[0].cells[0].innerText; | 
				
			|||
            var offset = 0; | 
				
			|||
            var td = $(event.currentTarget).next('tr').find('td'); | 
				
			|||
            if (td.length == 1) { | 
				
			|||
                self.db_lines_by_page(offset, account_id).then(function(datas) { | 
				
			|||
                    _.each(datas[2], function(data) { | 
				
			|||
 | 
				
			|||
                        var currency_format = { | 
				
			|||
                            currency_id: data.company_currency_id, | 
				
			|||
                            position: data.company_currency_position, | 
				
			|||
                            symbol: data.company_currency_symbol, | 
				
			|||
                            noSymbol: true, | 
				
			|||
                        }; | 
				
			|||
                        if (currency_format.position == "before") { | 
				
			|||
                            if (data.debit == 0) { | 
				
			|||
                                data.debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                data.debit = currency_format.symbol + ' ' + data.debit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.credit == 0) { | 
				
			|||
                                data.credit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                data.credit = currency_format.symbol + ' ' + data.credit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.balance == 0) { | 
				
			|||
                                data.balance = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                data.balance = currency_format.symbol + ' ' + data.balance.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                        } else { | 
				
			|||
                            if (data.debit == 0) { | 
				
			|||
                                data.debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                data.debit = data.debit.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.credit == 0) { | 
				
			|||
                                data.credit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                data.credit = data.credit.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.balance == 0) { | 
				
			|||
                                data.balance = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                data.balance = data.balance.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
                            } | 
				
			|||
                        } | 
				
			|||
                    }); | 
				
			|||
                    $(event.currentTarget).next('tr').find('td .db-table-div').remove(); | 
				
			|||
                    $(event.currentTarget).next('tr').find('td ul').after( | 
				
			|||
                        QWeb.render('SubSectiondb', { | 
				
			|||
                            count: datas[0], | 
				
			|||
                            offset: datas[1], | 
				
			|||
                            account_data: datas[2], | 
				
			|||
                            date_id: date_id.trim() | 
				
			|||
                        })); | 
				
			|||
 | 
				
			|||
                    $(event.currentTarget).next('tr').find('td ul li:first a').css({ | 
				
			|||
                        'background-color': '#00ede8', | 
				
			|||
                        'font-weight': 'bold', | 
				
			|||
                    }); | 
				
			|||
                }) | 
				
			|||
            } | 
				
			|||
        }, | 
				
			|||
        view_move: function(event) { | 
				
			|||
            event.preventDefault(); | 
				
			|||
            var self = this; | 
				
			|||
            var context = {}; | 
				
			|||
            var redirect_to_document = 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) { | 
				
			|||
                        redirect_to_document('account.move', record[0].id); | 
				
			|||
                    } else { | 
				
			|||
                        redirect_to_document('account.move', $(event.currentTarget).data('move-id')); | 
				
			|||
                    } | 
				
			|||
                }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
    }); | 
				
			|||
 | 
				
			|||
    core.action_registry.add('dynamic.db', DayBook); | 
				
			|||
 | 
				
			|||
}); | 
				
			|||
@ -0,0 +1,875 @@ | 
				
			|||
odoo.define('dynamic_financial_report.DynamicReport', 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; | 
				
			|||
 | 
				
			|||
    var GeneralLedger = AbstractAction.extend({ | 
				
			|||
        template: 'GeneralLedger', | 
				
			|||
        events: { | 
				
			|||
            'click .gl-line': 'get_move_lines', | 
				
			|||
            'click .view-move': 'view_move', | 
				
			|||
            'click #filter_apply_button': 'apply_filter', | 
				
			|||
            'click #pdf': 'print_pdf', | 
				
			|||
            'click #xlsx': 'print_xlsx', | 
				
			|||
        }, | 
				
			|||
        init: function(view, code) { | 
				
			|||
            this._super(view, code); | 
				
			|||
            this.wizard = code.context.wizard | null; | 
				
			|||
            this.session = session; | 
				
			|||
        }, | 
				
			|||
        start: function() { | 
				
			|||
            var self = this; | 
				
			|||
            self.initial_render = true; | 
				
			|||
            if (this.searchModel.config.domain.length != 0) { | 
				
			|||
 | 
				
			|||
                rpc.query({ | 
				
			|||
                    model: 'dynamic.general.ledger', | 
				
			|||
                    method: 'create', | 
				
			|||
                    args: [{ | 
				
			|||
                        account_ids: [this.searchModel.config.domain[0][2]] | 
				
			|||
                    }] | 
				
			|||
                }).then(function(res) { | 
				
			|||
                    self.wizard = res; | 
				
			|||
                    self.ledger_view(self.initial_render); | 
				
			|||
                }) | 
				
			|||
            }else{ | 
				
			|||
 | 
				
			|||
                rpc.query({ | 
				
			|||
                model: 'dynamic.general.ledger', | 
				
			|||
                method: 'create', | 
				
			|||
                args: [{ | 
				
			|||
 | 
				
			|||
                }] | 
				
			|||
                }).then(function(res) { | 
				
			|||
                    self.wizard = res; | 
				
			|||
                    self.ledger_view(self.initial_render); | 
				
			|||
                }) | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
            } | 
				
			|||
        }, | 
				
			|||
            apply_filter: function(event) { | 
				
			|||
 | 
				
			|||
            event.preventDefault(); | 
				
			|||
            var self = this; | 
				
			|||
 | 
				
			|||
            self.initial_render = false; | 
				
			|||
            var output = {}; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
            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=""; | 
				
			|||
 | 
				
			|||
            } | 
				
			|||
            output.account_ids = account_ids | 
				
			|||
 | 
				
			|||
 | 
				
			|||
             var journal_ids = []; | 
				
			|||
            var journal_text = []; | 
				
			|||
            var journal_res = document.getElementById("journal_res") | 
				
			|||
            var journal_list = $(".journal").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=""; | 
				
			|||
 | 
				
			|||
            } | 
				
			|||
            output.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=""; | 
				
			|||
 | 
				
			|||
            } | 
				
			|||
            output.account_tag_ids = account_tag_ids | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
               var analytic_ids = []; | 
				
			|||
            var analytic_text = []; | 
				
			|||
            var span_res = document.getElementById("analic_res") | 
				
			|||
            var analytic_list = $(".analytic").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) | 
				
			|||
                    } | 
				
			|||
                    span_res.value = analytic_text | 
				
			|||
                    span_res.innerHTML=span_res.value; | 
				
			|||
                } | 
				
			|||
            } | 
				
			|||
            if (analytic_list.length == 0){ | 
				
			|||
               span_res.value = "" | 
				
			|||
                    span_res.innerHTML=""; | 
				
			|||
 | 
				
			|||
            } | 
				
			|||
            output.analytic_ids = analytic_ids | 
				
			|||
 | 
				
			|||
            output.analytic_tag_ids = analytic_tag_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=""; | 
				
			|||
 | 
				
			|||
            } | 
				
			|||
            output.analytic_tag_ids = analytic_tag_ids | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
            if ($("#date_from").val()) { | 
				
			|||
                var dateObject = $("#date_from").datepicker("getDate"); | 
				
			|||
                var dateString = $.datepicker.formatDate("yy-mm-dd", dateObject); | 
				
			|||
                output.date_from = dateString; | 
				
			|||
            } | 
				
			|||
            if ($("#date_to").val()) { | 
				
			|||
                var dateObject = $("#date_to").datepicker("getDate"); | 
				
			|||
                var dateString = $.datepicker.formatDate("yy-mm-dd", dateObject); | 
				
			|||
                output.date_to = dateString; | 
				
			|||
            } | 
				
			|||
 | 
				
			|||
            if ($(".entries").length) { | 
				
			|||
            var post_res = document.getElementById("post_res") | 
				
			|||
            output.entries = $(".entries")[1].value | 
				
			|||
            post_res.value = $(".entries")[1].value | 
				
			|||
                    post_res.innerHTML=post_res.value; | 
				
			|||
              if ($(".entries")[1].value == "") { | 
				
			|||
              post_res.innerHTML="all"; | 
				
			|||
 | 
				
			|||
              } | 
				
			|||
            } | 
				
			|||
            output.include_details = true; | 
				
			|||
            rpc.query({ | 
				
			|||
                model: 'dynamic.general.ledger', | 
				
			|||
                method: 'write', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard], output | 
				
			|||
                ], | 
				
			|||
            }).then(function(res) { | 
				
			|||
                self.ledger_view(self.initial_render); | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
        print_pdf: function(e) { | 
				
			|||
            e.preventDefault(); | 
				
			|||
            var self = this; | 
				
			|||
            self._rpc({ | 
				
			|||
                model: 'dynamic.general.ledger', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard] | 
				
			|||
                ], | 
				
			|||
            }).then(function(data) { | 
				
			|||
                var action = { | 
				
			|||
                    'type': 'ir.actions.report', | 
				
			|||
                    'report_type': 'qweb-pdf', | 
				
			|||
                    'report_name': 'dynamic_financial_report.general_ledger', | 
				
			|||
                    'report_file': 'dynamic_financial_report.general_ledger', | 
				
			|||
                    'data': { | 
				
			|||
                        'report_data': data | 
				
			|||
                    }, | 
				
			|||
                    'context': { | 
				
			|||
                        'active_model': 'dynamic.general.ledger', | 
				
			|||
                        'landscape': 1, | 
				
			|||
                        'js_report': true | 
				
			|||
                    }, | 
				
			|||
                    'display_name': 'General Ledger', | 
				
			|||
                }; | 
				
			|||
                return self.do_action(action); | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
        print_xlsx: function() { | 
				
			|||
            var self = this; | 
				
			|||
            self._rpc({ | 
				
			|||
                model: 'dynamic.general.ledger', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard] | 
				
			|||
                ], | 
				
			|||
            }).then(function(data) { | 
				
			|||
                var action = { | 
				
			|||
                    'type': 'ir_actions_xlsx_download', | 
				
			|||
                    'data': { | 
				
			|||
                         'model': 'dynamic.general.ledger', | 
				
			|||
                         'options': JSON.stringify(data[1]), | 
				
			|||
                         'output_format': 'xlsx', | 
				
			|||
                         'report_data': JSON.stringify(data[0]), | 
				
			|||
                         'report_name': 'General Ledger', | 
				
			|||
                         'dfr_data': JSON.stringify(data), | 
				
			|||
                    }, | 
				
			|||
                }; | 
				
			|||
                return self.do_action(action); | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
        ledger_view: function(initial_render = true) { | 
				
			|||
            var self = this; | 
				
			|||
            var node = self.$('.container-gl-main'); | 
				
			|||
            var last; | 
				
			|||
            while (last = node.lastChild) node.removeChild(last); | 
				
			|||
            rpc.query({ | 
				
			|||
                model: 'dynamic.general.ledger', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard] | 
				
			|||
                ], | 
				
			|||
            }).then(function(datas) { | 
				
			|||
                self.filter_data = datas[0] | 
				
			|||
 | 
				
			|||
                self.account_data = datas[1] | 
				
			|||
 | 
				
			|||
                _.each(self.account_data, function(account) { | 
				
			|||
                    var currency_format = { | 
				
			|||
                        currency_id: account.company_currency_id, | 
				
			|||
                        position: account.company_currency_position, | 
				
			|||
                        symbol: account.company_currency_symbol, | 
				
			|||
                        noSymbol: true, | 
				
			|||
                    }; | 
				
			|||
                    if (currency_format.position == "before") { | 
				
			|||
 | 
				
			|||
                         if (account.debit == 0) { | 
				
			|||
                                account.debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.debit = currency_format.symbol + ' ' + account.debit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.credit == 0) { | 
				
			|||
                                account.credit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account.credit = currency_format.symbol + ' ' + account.credit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.balance == 0) { | 
				
			|||
                                account.balance = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account.balance = currency_format.symbol + ' ' + account.balance.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                    } else { | 
				
			|||
 | 
				
			|||
                        if (account.debit == 0) { | 
				
			|||
                                account.debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.debit = account.debit.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.credit == 0) { | 
				
			|||
                                account.credit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account.credit = account.credit.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.balance == 0) { | 
				
			|||
                                account.balance = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.balance = account.balance.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                    } | 
				
			|||
                }); | 
				
			|||
                if (initial_render) { | 
				
			|||
                    self.$('.gl-filter').html(QWeb.render('FilterSection', { | 
				
			|||
                        filter_data: datas[0], | 
				
			|||
                    })); | 
				
			|||
 | 
				
			|||
                    self.$el.find('.journal').select2({ | 
				
			|||
                        placeholder: 'Select Journal...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.account').select2({ | 
				
			|||
                        placeholder: 'Select Account...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.account-tag').select2({ | 
				
			|||
                        placeholder: 'Select Account Tag...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.analytic-tag').select2({ | 
				
			|||
                        placeholder: 'Select Analytic Tag...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.analytic').select2({ | 
				
			|||
                        placeholder: 'Select Analytic...', | 
				
			|||
                    }); | 
				
			|||
 | 
				
			|||
                    self.$el.find('#date_from').datepicker({ | 
				
			|||
                        dateFormat: 'dd-mm-yy' | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('#date_to').datepicker({ | 
				
			|||
                        dateFormat: 'dd-mm-yy' | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.entries').select2({ | 
				
			|||
                        placeholder: 'Select Moves', | 
				
			|||
                    }); | 
				
			|||
                } | 
				
			|||
                self.$('.container-gl-main').html(QWeb.render('GeneralLedgerData', { | 
				
			|||
                    account_data: datas[1] | 
				
			|||
                })); | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
        gl_lines_by_page: function(offset, account_id) { | 
				
			|||
            var self = this; | 
				
			|||
            return rpc.query({ | 
				
			|||
                model: 'dynamic.general.ledger', | 
				
			|||
                method: 'gl_move_lines', | 
				
			|||
                args: [self.wizard, offset, account_id], | 
				
			|||
            }) | 
				
			|||
        }, | 
				
			|||
        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) { | 
				
			|||
                self.gl_lines_by_page(offset, account_id).then(function(datas) { | 
				
			|||
                    _.each(datas[2], function(data) { | 
				
			|||
                        var currency_format = { | 
				
			|||
                            currency_id: data.company_currency_id, | 
				
			|||
                            position: data.company_currency_position, | 
				
			|||
                            symbol: data.company_currency_symbol, | 
				
			|||
                            noSymbol: true, | 
				
			|||
                        }; | 
				
			|||
                        if (currency_format.position == "before") { | 
				
			|||
                            if (data.debit == 0) { | 
				
			|||
                                data.debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                data.debit = currency_format.symbol + ' ' + data.debit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.credit == 0) { | 
				
			|||
                                data.credit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                data.credit = currency_format.symbol + ' ' + data.credit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.balance == 0) { | 
				
			|||
                                data.balance = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                data.balance = currency_format.symbol + ' ' + data.balance.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                        } else { | 
				
			|||
                            if (data.debit == 0) { | 
				
			|||
                                data.debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                data.debit = data.debit.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.credit == 0) { | 
				
			|||
                                data.credit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                data.credit = data.credit.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.balance == 0) { | 
				
			|||
                                data.balance = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                data.balance = data.balance.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
 | 
				
			|||
                        } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
                    }); | 
				
			|||
                    $(event.currentTarget).next('tr').find('td .gl-table-div').remove(); | 
				
			|||
                    $(event.currentTarget).next('tr').find('td ul').after( | 
				
			|||
                        QWeb.render('SubSection', { | 
				
			|||
                            count: datas[0], | 
				
			|||
                            offset: datas[1], | 
				
			|||
                            account_data: datas[2], | 
				
			|||
                        })) | 
				
			|||
                    $(event.currentTarget).next('tr').find('td ul li:first a').css({ | 
				
			|||
                        'background-color': '#00ede8', | 
				
			|||
                        'font-weight': 'bold', | 
				
			|||
                    }); | 
				
			|||
                }) | 
				
			|||
            } | 
				
			|||
        }, | 
				
			|||
        view_move: function(event) { | 
				
			|||
            event.preventDefault(); | 
				
			|||
            var self = this; | 
				
			|||
            var context = {}; | 
				
			|||
            var redirect_to_document = 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) { | 
				
			|||
                        redirect_to_document('account.move', record[0].id); | 
				
			|||
                    } else { | 
				
			|||
                        redirect_to_document('account.move', $(event.currentTarget).data('move-id')); | 
				
			|||
                    } | 
				
			|||
                }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
    }); | 
				
			|||
 | 
				
			|||
     var TrialBalance = AbstractAction.extend({ | 
				
			|||
        template: 'TrialBalance', | 
				
			|||
        events: { | 
				
			|||
            'click #filter_apply_button': 'apply_filter', | 
				
			|||
            'click .open-gl': 'get_gl', | 
				
			|||
            'click #pdf': 'print_pdf', | 
				
			|||
            'click #xlsx': 'print_xlsx', | 
				
			|||
        }, | 
				
			|||
        init: function(view, code) { | 
				
			|||
            this._super(view, code); | 
				
			|||
            this.wizard = code.context.wizard | null; | 
				
			|||
            this.session = session; | 
				
			|||
        }, | 
				
			|||
        start: function() { | 
				
			|||
            var self = this; | 
				
			|||
            self.initial_render = true; | 
				
			|||
            rpc.query({ | 
				
			|||
                model: 'dynamic.trial.balance', | 
				
			|||
                method: 'create', | 
				
			|||
                args: [{ | 
				
			|||
 | 
				
			|||
                }] | 
				
			|||
            }).then(function(res) { | 
				
			|||
                self.wizard = res; | 
				
			|||
                self.ledger_view(self.initial_render); | 
				
			|||
            }) | 
				
			|||
        }, | 
				
			|||
        apply_filter: function(event) { | 
				
			|||
            event.preventDefault(); | 
				
			|||
            var self = this; | 
				
			|||
 | 
				
			|||
            self.initial_render = false; | 
				
			|||
            var output = {}; | 
				
			|||
            var account_ids = []; | 
				
			|||
            var journal_ids = []; | 
				
			|||
            var journal_text = []; | 
				
			|||
            var journal_res = document.getElementById("journal_res") | 
				
			|||
            var journal_list = $(".journal").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=""; | 
				
			|||
 | 
				
			|||
            } | 
				
			|||
            output.journal_ids = journal_ids | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
            var analytic_ids = []; | 
				
			|||
            var analytic_text = []; | 
				
			|||
            var span_res = document.getElementById("analic_res") | 
				
			|||
            var analytic_list = $(".analytic").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) | 
				
			|||
                    } | 
				
			|||
                    span_res.value = analytic_text | 
				
			|||
                    span_res.innerHTML=span_res.value; | 
				
			|||
                } | 
				
			|||
            } | 
				
			|||
            if (analytic_list.length == 0){ | 
				
			|||
               span_res.value = "" | 
				
			|||
                    span_res.innerHTML=""; | 
				
			|||
 | 
				
			|||
            } | 
				
			|||
            output.analytic_ids = analytic_ids | 
				
			|||
 | 
				
			|||
 | 
				
			|||
            if ($("#date_from").val()) { | 
				
			|||
                var dateObject = $("#date_from").datepicker("getDate"); | 
				
			|||
                var dateString = $.datepicker.formatDate("yy-mm-dd", dateObject); | 
				
			|||
                output.date_from = dateString; | 
				
			|||
            } | 
				
			|||
            if ($("#date_to").val()) { | 
				
			|||
                var dateObject = $("#date_to").datepicker("getDate"); | 
				
			|||
                var dateString = $.datepicker.formatDate("yy-mm-dd", dateObject); | 
				
			|||
                output.date_to = dateString; | 
				
			|||
            } | 
				
			|||
 | 
				
			|||
            if ($(".entries").length) { | 
				
			|||
            var post_res = document.getElementById("post_res") | 
				
			|||
            output.entries = $(".entries")[1].value | 
				
			|||
            post_res.value = $(".entries")[1].value | 
				
			|||
                    post_res.innerHTML=post_res.value; | 
				
			|||
              if ($(".entries")[1].value == "") { | 
				
			|||
              post_res.innerHTML="all"; | 
				
			|||
              output.entries = "all" | 
				
			|||
 | 
				
			|||
              } | 
				
			|||
            } | 
				
			|||
            output.include_details = true; | 
				
			|||
 | 
				
			|||
            rpc.query({ | 
				
			|||
                model: 'dynamic.trial.balance', | 
				
			|||
                method: 'write', | 
				
			|||
                args: [ | 
				
			|||
                    self.wizard, output | 
				
			|||
                ], | 
				
			|||
            }).then(function(res) { | 
				
			|||
                self.ledger_view(self.initial_render); | 
				
			|||
            }); | 
				
			|||
 | 
				
			|||
            var dropDown = document.getElementById("entries"); | 
				
			|||
            dropDown.value = ""; | 
				
			|||
 | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
        get_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: 'dynamic.gl', | 
				
			|||
                    target: 'new', | 
				
			|||
 | 
				
			|||
                    domain: [['account_ids','=', account_id]], | 
				
			|||
 | 
				
			|||
 | 
				
			|||
                } | 
				
			|||
                return this.do_action(action); | 
				
			|||
 | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
        print_pdf: function(e) { | 
				
			|||
            e.preventDefault(); | 
				
			|||
            var self = this; | 
				
			|||
            self._rpc({ | 
				
			|||
                model: 'dynamic.trial.balance', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard] | 
				
			|||
                ], | 
				
			|||
            }).then(function(data) { | 
				
			|||
                var action = { | 
				
			|||
                    'type': 'ir.actions.report', | 
				
			|||
                    'report_type': 'qweb-pdf', | 
				
			|||
                    'report_name': 'dynamic_financial_report.trial_balance', | 
				
			|||
                    'report_file': 'dynamic_financial_report.trial_balance', | 
				
			|||
                    'data': { | 
				
			|||
                        'report_data': data | 
				
			|||
                    }, | 
				
			|||
                    'context': { | 
				
			|||
                        'active_model': 'dynamic.trial.balance', | 
				
			|||
                        'landscape': 1, | 
				
			|||
                        'js_report': true | 
				
			|||
                    }, | 
				
			|||
                    'display_name': 'Trial Balance', | 
				
			|||
                }; | 
				
			|||
                return self.do_action(action); | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
        print_xlsx: function() { | 
				
			|||
            var self = this; | 
				
			|||
            self._rpc({ | 
				
			|||
                model: 'dynamic.trial.balance', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard] | 
				
			|||
                ], | 
				
			|||
            }).then(function(data) { | 
				
			|||
                var action = { | 
				
			|||
                    'type': 'ir_actions_xlsx_download', | 
				
			|||
                    'data': { | 
				
			|||
                         'model': 'dynamic.trial.balance', | 
				
			|||
                         'options': JSON.stringify(data[1]), | 
				
			|||
                         'output_format': 'xlsx', | 
				
			|||
                         'report_data': JSON.stringify({"d1":JSON.stringify(data[2]) , "d2":JSON.stringify(data[0])}) , | 
				
			|||
                         'report_name': 'Trial Balance', | 
				
			|||
                         'dfr_data': JSON.stringify(data), | 
				
			|||
                    }, | 
				
			|||
                }; | 
				
			|||
                return self.do_action(action); | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
        ledger_view: function(initial_render = true) { | 
				
			|||
            var self = this; | 
				
			|||
            var node = self.$('.container-tb-main'); | 
				
			|||
            var last; | 
				
			|||
            while (last = node.lastChild) node.removeChild(last); | 
				
			|||
            rpc.query({ | 
				
			|||
                model: 'dynamic.trial.balance', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard] | 
				
			|||
                ], | 
				
			|||
            }).then(function(datas) { | 
				
			|||
                self.filter_data = datas[0] | 
				
			|||
                self.account_data = datas[1] | 
				
			|||
                      if (datas[2].currency_details){ | 
				
			|||
                        var currency_format = { | 
				
			|||
                            currency_id: datas[2].currency_details[0].currency, | 
				
			|||
                            position: datas[2].currency_details[0].position, | 
				
			|||
                            symbol: datas[2].currency_details[0].symbol, | 
				
			|||
                            noSymbol: true, | 
				
			|||
                        }; | 
				
			|||
                        if (currency_format.position == "before") { | 
				
			|||
                            if (datas[2].debit  == 0) { | 
				
			|||
                                datas[2].debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                datas[2].debit  = currency_format.symbol  + datas[2].debit.toFixed(2) ; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (datas[2].credit  == 0) { | 
				
			|||
                                datas[2].credit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                datas[2].credit  = currency_format.symbol + datas[2].credit.toFixed(2) ; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
 | 
				
			|||
                        }else{ | 
				
			|||
 | 
				
			|||
                                if (datas[2].debit == 0) { | 
				
			|||
                                    datas[2].debit = ' - ' | 
				
			|||
                                } else { | 
				
			|||
                                    datas[2].debit = datas[2].debit.toFixed(2) + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                                } | 
				
			|||
                                if (datas[2].credit == 0) { | 
				
			|||
                                    datas[2].credit = ' - ' | 
				
			|||
                                } else { | 
				
			|||
                                    datas[2].credit = datas[2].credit.toFixed(2) + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                                } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
                        } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
                      } | 
				
			|||
 | 
				
			|||
                _.each(self.account_data, function(account) { | 
				
			|||
                    var currency_format = { | 
				
			|||
                        currency_id: account.company_currency_id, | 
				
			|||
                        position: account.company_currency_position, | 
				
			|||
                        symbol: account.company_currency_symbol, | 
				
			|||
                        noSymbol: true, | 
				
			|||
                    }; | 
				
			|||
                    for (var i = 0; i < account.lines.length; i++) { | 
				
			|||
                      if (account.lines[i].initial_bal == true){ | 
				
			|||
                        if (currency_format.position == "before") { | 
				
			|||
                            if (account.lines[i].debit  == 0) { | 
				
			|||
                                account.lines[i].debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.lines[i].debit  = currency_format.symbol + ' ' + account.lines[i].debit .toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.lines[i].credit  == 0) { | 
				
			|||
                                account.lines[i].credit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.lines[i].credit  = currency_format.symbol + ' ' + account.lines[i].credit .toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
 | 
				
			|||
                        }else{ | 
				
			|||
 | 
				
			|||
                                if (account.lines[i].debit == 0) { | 
				
			|||
                                    account.lines[i].debit = ' - ' | 
				
			|||
                                } else { | 
				
			|||
                                    account.lines[i].debit = account.lines[i].debit.toFixed(2) + ' ' + currency_format.symbol; | 
				
			|||
 | 
				
			|||
                                } | 
				
			|||
                                if (account.lines[i].credit == 0) { | 
				
			|||
                                    account.lines[i].credit = ' - ' | 
				
			|||
                                } else { | 
				
			|||
                                    account.lines[i].credit = account.lines[i].credit.toFixed(2) + ' ' + currency_format.symbol; | 
				
			|||
 | 
				
			|||
                                } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
                        } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
                      } | 
				
			|||
                    } | 
				
			|||
                    if (currency_format.position == "before") { | 
				
			|||
 | 
				
			|||
                         if (account.debit == 0) { | 
				
			|||
                                account.debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.debit = currency_format.symbol + ' ' + account.debit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.credit == 0) { | 
				
			|||
                                account.credit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account.credit = currency_format.symbol + ' ' + account.credit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.balance == 0) { | 
				
			|||
                                account.balance = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account.balance = currency_format.symbol + ' ' + account.balance.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                    } else { | 
				
			|||
 | 
				
			|||
                        if (account.debit == 0) { | 
				
			|||
                                account.debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.debit = account.debit.toFixed(2) + ' ' + currency_format.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.credit == 0) { | 
				
			|||
                                account.credit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account.credit = account.credit.toFixed(2) + ' ' + currency_format.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.balance == 0) { | 
				
			|||
                                account.balance = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.balance = account.balance.toFixed(2) + ' ' + currency_format.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                    } | 
				
			|||
                }); | 
				
			|||
                if (initial_render) { | 
				
			|||
                    self.$('.tb-filter').html(QWeb.render('FilterSectionTB', { | 
				
			|||
                        filter_data: datas[0], | 
				
			|||
                    })); | 
				
			|||
 | 
				
			|||
                    self.$el.find('.journal').select2({ | 
				
			|||
                        placeholder: 'Select Journal...', | 
				
			|||
                    }); | 
				
			|||
 | 
				
			|||
                    self.$el.find('.analytic').select2({ | 
				
			|||
                        placeholder: 'Select Analytic...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.entries').select2({ | 
				
			|||
                        placeholder: 'Select Moves', | 
				
			|||
                    }).val('all').trigger('change'); | 
				
			|||
 | 
				
			|||
                    self.$el.find('#date_from').datepicker({ | 
				
			|||
                        dateFormat: 'dd-mm-yy' | 
				
			|||
                    }); | 
				
			|||
 | 
				
			|||
                    self.$el.find('#date_to').datepicker({ | 
				
			|||
                        dateFormat: 'dd-mm-yy' | 
				
			|||
                    }); | 
				
			|||
                } | 
				
			|||
                self.$('.container-tb-main').html(QWeb.render('TrialBalanceData', { | 
				
			|||
 | 
				
			|||
                    account_data: datas[1], | 
				
			|||
                    filter : datas[0], | 
				
			|||
                    total_b : datas[2], | 
				
			|||
                })); | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
    }); | 
				
			|||
 | 
				
			|||
    core.action_registry.add('dynamic.gl', GeneralLedger); | 
				
			|||
    core.action_registry.add('dynamic.tb', TrialBalance); | 
				
			|||
 | 
				
			|||
}); | 
				
			|||
@ -0,0 +1,476 @@ | 
				
			|||
odoo.define('dynamic_financial_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; | 
				
			|||
 | 
				
			|||
    var PartnerLedger = AbstractAction.extend({ | 
				
			|||
        template: 'PartnerLedger', | 
				
			|||
        events: { | 
				
			|||
            'click .pl-line': 'get_move_lines', | 
				
			|||
            'click .view-move': 'view_move', | 
				
			|||
            'click #filter_apply_button': 'apply_filter', | 
				
			|||
            'click #pdf': 'print_pdf', | 
				
			|||
            'click #xlsx': 'print_xlsx', | 
				
			|||
        }, | 
				
			|||
        init: function(view, code) { | 
				
			|||
            this._super(view, code); | 
				
			|||
            this.wizard = code.context.wizard | null; | 
				
			|||
            this.session = session; | 
				
			|||
        }, | 
				
			|||
        start: function() { | 
				
			|||
            var self = this; | 
				
			|||
            self.initial_render = true; | 
				
			|||
            rpc.query({ | 
				
			|||
                model: 'dynamic.partner.ledger', | 
				
			|||
                method: 'create', | 
				
			|||
                args: [{ | 
				
			|||
                    res_model: this.res_model | 
				
			|||
                }] | 
				
			|||
            }).then(function(res) { | 
				
			|||
                self.wizard = res; | 
				
			|||
                self.ledger_view(self.initial_render); | 
				
			|||
            }) | 
				
			|||
        }, | 
				
			|||
        apply_filter: function(event) { | 
				
			|||
            event.preventDefault(); | 
				
			|||
            var self = this; | 
				
			|||
 | 
				
			|||
            self.initial_render = false; | 
				
			|||
            var output = {}; | 
				
			|||
            output.reconciled=false; | 
				
			|||
            output.type=false; | 
				
			|||
            output.date_from=false; | 
				
			|||
            output.date_to=false; | 
				
			|||
            var journal_ids = []; | 
				
			|||
            var journal_text = []; | 
				
			|||
            var span_res = document.getElementById("journal_res") | 
				
			|||
            var journal_list = $(".journal").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) | 
				
			|||
            } | 
				
			|||
            span_res.value = journal_text | 
				
			|||
            span_res.innerHTML=span_res.value; | 
				
			|||
            } | 
				
			|||
            } | 
				
			|||
            if (journal_list.length == 0){ | 
				
			|||
            span_res.value = "" | 
				
			|||
            span_res.innerHTML=""; } | 
				
			|||
            output.journal_ids = journal_ids | 
				
			|||
 | 
				
			|||
 | 
				
			|||
            var partner_ids = []; | 
				
			|||
            var partner_text = []; | 
				
			|||
            var span_res = document.getElementById("partner_res") | 
				
			|||
            var partner_list = $(".partner").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=""; } | 
				
			|||
            output.partner_ids = partner_ids | 
				
			|||
 | 
				
			|||
 | 
				
			|||
            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=""; } | 
				
			|||
            output.account_ids = account_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=""; } | 
				
			|||
            output.partner_category_ids = partner_category_ids | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
            if ($(".reconcile").length){ | 
				
			|||
            var reconciled_res = document.getElementById("reconciled_res") | 
				
			|||
            output.reconciled = $(".reconcile")[1].value | 
				
			|||
            reconciled_res.value = $(".reconcile")[1].value | 
				
			|||
            reconciled_res.innerHTML=reconciled_res.value; | 
				
			|||
            if ($(".reconcile").value==""){ | 
				
			|||
            reconciled_res.innerHTML="unreconciled"; | 
				
			|||
            output.reconciled = "unreconciled" | 
				
			|||
            } | 
				
			|||
            } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
            if ($(".type").length){ | 
				
			|||
            var type_res = document.getElementById("type_res") | 
				
			|||
            output.type = $(".type")[1].value | 
				
			|||
            type_res.value = $(".type")[1].value | 
				
			|||
            type_res.innerHTML=type_res.value; | 
				
			|||
            if ($(".type").value==""){ | 
				
			|||
            type_res.innerHTML="receivable"; | 
				
			|||
            output.type = "Receivable" | 
				
			|||
            } | 
				
			|||
            } | 
				
			|||
 | 
				
			|||
            if ($(".target-moves").length){ | 
				
			|||
                var target_res = document.getElementById("target_res") | 
				
			|||
                output.target_moves = $(".target-moves")[1].value | 
				
			|||
                target_res.value = $(".target-moves")[1].value | 
				
			|||
                target_res.innerHTML=target_res.value; | 
				
			|||
            if ($(".target-moves").value==""){ | 
				
			|||
                target_res.innerHTML="all_entries"; | 
				
			|||
                output.target_moves = "all_entries" | 
				
			|||
                } | 
				
			|||
                } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
            if ($("#date_from").val()) { | 
				
			|||
                var dateObject = $("#date_from").datepicker("getDate"); | 
				
			|||
                var dateString = $.datepicker.formatDate("yy-mm-dd", dateObject); | 
				
			|||
                output.date_from = dateString; | 
				
			|||
            } | 
				
			|||
            if ($("#date_to").val()) { | 
				
			|||
                var dateObject = $("#date_to").datepicker("getDate"); | 
				
			|||
                var dateString = $.datepicker.formatDate("yy-mm-dd", dateObject); | 
				
			|||
                output.date_to = dateString; | 
				
			|||
            } | 
				
			|||
            output.include_details = true; | 
				
			|||
 | 
				
			|||
            rpc.query({ | 
				
			|||
                model: 'dynamic.partner.ledger', | 
				
			|||
                method: 'write', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard], output | 
				
			|||
                ], | 
				
			|||
            }).then(function(res) { | 
				
			|||
                self.ledger_view(self.initial_render); | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
        print_pdf: function(e) { | 
				
			|||
            e.preventDefault(); | 
				
			|||
            var self = this; | 
				
			|||
            self._rpc({ | 
				
			|||
                model: 'dynamic.partner.ledger', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard] | 
				
			|||
                ], | 
				
			|||
            }).then(function(data) { | 
				
			|||
                var action = { | 
				
			|||
                    'type': 'ir.actions.report', | 
				
			|||
                    'report_type': 'qweb-pdf', | 
				
			|||
                    'report_name': 'dynamic_financial_report.partner_ledger', | 
				
			|||
                    'report_file': 'dynamic_financial_report.partner_ledger', | 
				
			|||
                    'data': { | 
				
			|||
                        'report_data': data | 
				
			|||
                    }, | 
				
			|||
                    'context': { | 
				
			|||
                        'active_model': 'dynamic.partner.ledger', | 
				
			|||
                        'landscape': 1, | 
				
			|||
                        'js_report': true | 
				
			|||
                    }, | 
				
			|||
                    'display_name': 'Partner Ledger', | 
				
			|||
                }; | 
				
			|||
                return self.do_action(action); | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
        print_xlsx: function() { | 
				
			|||
            var self = this; | 
				
			|||
            self._rpc({ | 
				
			|||
                model: 'dynamic.partner.ledger', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard] | 
				
			|||
                ], | 
				
			|||
            }).then(function(data) { | 
				
			|||
                var action = { | 
				
			|||
                    'type': 'ir_actions_xlsx_download', | 
				
			|||
                    'data': { | 
				
			|||
                         'model': 'dynamic.partner.ledger', | 
				
			|||
                         'options': JSON.stringify(data[1]), | 
				
			|||
                         'output_format': 'xlsx', | 
				
			|||
                         'report_data': JSON.stringify(data[0]), | 
				
			|||
                         'report_name': 'Partner Ledger', | 
				
			|||
                         'dfr_data': JSON.stringify(data), | 
				
			|||
                    }, | 
				
			|||
 | 
				
			|||
                }; | 
				
			|||
 | 
				
			|||
                return self.do_action(action); | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
        ledger_view: function(initial_render = true) { | 
				
			|||
            var self = this; | 
				
			|||
            var node = self.$('.container-pl-main'); | 
				
			|||
            var last; | 
				
			|||
            while (last = node.lastChild) node.removeChild(last); | 
				
			|||
            rpc.query({ | 
				
			|||
                model: 'dynamic.partner.ledger', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard] | 
				
			|||
                ], | 
				
			|||
            }).then(function(datas) { | 
				
			|||
                self.filter_data = datas[0] | 
				
			|||
                self.account_data = datas[1] | 
				
			|||
 | 
				
			|||
                _.each(self.account_data, function(account) { | 
				
			|||
                    var currency_format = { | 
				
			|||
                        currency_id: account.company_currency_id, | 
				
			|||
                        position: account.company_currency_position, | 
				
			|||
                        symbol: account.company_currency_symbol, | 
				
			|||
                        noSymbol: true, | 
				
			|||
                    }; | 
				
			|||
                    if (currency_format.position == "before") { | 
				
			|||
 | 
				
			|||
                         if (account.debit == 0) { | 
				
			|||
                                account.debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.debit = currency_format.symbol + ' ' + account.debit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.credit == 0) { | 
				
			|||
                                account.credit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account.credit = currency_format.symbol + ' ' + account.credit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.balance == 0) { | 
				
			|||
                                account.balance = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account.balance = currency_format.symbol + ' ' + account.balance.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                    } else { | 
				
			|||
 | 
				
			|||
                        if (account.debit == 0) { | 
				
			|||
                                account.debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.debit = account.debit.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.credit == 0) { | 
				
			|||
                                account.credit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account.credit = account.credit.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.balance == 0) { | 
				
			|||
                                account.balance = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.balance = account.balance.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                    } | 
				
			|||
                }); | 
				
			|||
                if (initial_render) { | 
				
			|||
                    self.$('.pl-filter').html(QWeb.render('FilterSectionPl', { | 
				
			|||
                        filter_data: datas[0], | 
				
			|||
                    })); | 
				
			|||
 | 
				
			|||
                    self.$el.find('.journal').select2({ | 
				
			|||
                        placeholder: 'Select Journal...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.account').select2({ | 
				
			|||
                        placeholder: 'Select Account...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.partner').select2({ | 
				
			|||
                        placeholder: 'Select Partner...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.reconcile').select2({ | 
				
			|||
                        placeholder: 'Select Reconciled status...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.target-moves').select2({ | 
				
			|||
                        placeholder: 'Posted or All Entries...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.type').select2({ | 
				
			|||
                        placeholder: 'Select Account...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.category').select2({ | 
				
			|||
                        placeholder: 'Select Category...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('#date_from').datepicker({ | 
				
			|||
                        dateFormat: 'dd-mm-yy' | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('#date_to').datepicker({ | 
				
			|||
                        dateFormat: 'dd-mm-yy' | 
				
			|||
                    }); | 
				
			|||
                } | 
				
			|||
 | 
				
			|||
                self.$('.container-pl-main').html(QWeb.render('PartnerLedgerData', { | 
				
			|||
                    account_data: datas[1] | 
				
			|||
                })); | 
				
			|||
 | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
        pl_lines_by_page: function(offset, account_id) { | 
				
			|||
            var self = this; | 
				
			|||
            return rpc.query({ | 
				
			|||
                model: 'dynamic.partner.ledger', | 
				
			|||
                method: 'pl_move_lines', | 
				
			|||
                args: [self.wizard, offset, account_id], | 
				
			|||
            }) | 
				
			|||
        }, | 
				
			|||
        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) { | 
				
			|||
                self.pl_lines_by_page(offset, account_id).then(function(datas) { | 
				
			|||
                    _.each(datas[2], function(data) { | 
				
			|||
                        var currency_format = { | 
				
			|||
                            currency_id: data.company_currency_id, | 
				
			|||
                            position: data.company_currency_position, | 
				
			|||
                            symbol: data.company_currency_symbol, | 
				
			|||
                            noSymbol: true, | 
				
			|||
                        }; | 
				
			|||
                        if (currency_format.position == "before") { | 
				
			|||
                            if (data.debit == 0) { | 
				
			|||
                                data.debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                data.debit = currency_format.symbol + ' ' + data.debit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.credit == 0) { | 
				
			|||
                                data.credit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                data.credit = currency_format.symbol + ' ' + data.credit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.balance == 0) { | 
				
			|||
                                data.balance = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                data.balance = currency_format.symbol + ' ' + data.balance.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                        } else { | 
				
			|||
                            if (data.debit == 0) { | 
				
			|||
                                data.debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                data.debit = data.debit.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.credit == 0) { | 
				
			|||
                                data.credit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                data.credit = data.credit.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.balance == 0) { | 
				
			|||
                                data.balance = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                data.balance = data.balance.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
 | 
				
			|||
                        } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
                    }); | 
				
			|||
                    $(event.currentTarget).next('tr').find('td .pl-table-div').remove(); | 
				
			|||
                    $(event.currentTarget).next('tr').find('td ul').after( | 
				
			|||
                        QWeb.render('SubSectionPl', { | 
				
			|||
                            count: datas[0], | 
				
			|||
                            offset: datas[1], | 
				
			|||
                            account_data: datas[2], | 
				
			|||
                        })) | 
				
			|||
                    $(event.currentTarget).next('tr').find('td ul li:first a').css({ | 
				
			|||
                        'background-color': '#00ede8', | 
				
			|||
                        'font-weight': 'bold', | 
				
			|||
                    }); | 
				
			|||
                }) | 
				
			|||
            } | 
				
			|||
        }, | 
				
			|||
        view_move: function(event) { | 
				
			|||
            event.preventDefault(); | 
				
			|||
            var self = this; | 
				
			|||
            var context = {}; | 
				
			|||
            var redirect_to_document = 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) { | 
				
			|||
                        redirect_to_document('account.move', record[0].id); | 
				
			|||
                    } else { | 
				
			|||
                        redirect_to_document('account.move', $(event.currentTarget).data('move-id')); | 
				
			|||
                    } | 
				
			|||
                }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
    }); | 
				
			|||
 | 
				
			|||
    core.action_registry.add('dynamic.pl', PartnerLedger); | 
				
			|||
 | 
				
			|||
}); | 
				
			|||
@ -0,0 +1,526 @@ | 
				
			|||
odoo.define('dynamic_financial_report.profit_loss', 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; | 
				
			|||
 | 
				
			|||
    var ProfitAndLoss = AbstractAction.extend({ | 
				
			|||
        template: 'ProfitAndLoss', | 
				
			|||
        events: { | 
				
			|||
            'click .pal-line': 'get_move_lines', | 
				
			|||
            'click .view-move': 'view_move', | 
				
			|||
            'click #filter_apply_button': 'apply_filter', | 
				
			|||
            'click #pdf': 'print_pdf', | 
				
			|||
            'click #xlsx': 'print_xlsx', | 
				
			|||
            'click .open-gl': 'get_gl', | 
				
			|||
        }, | 
				
			|||
        init: function(view, code) { | 
				
			|||
            this._super(view, code); | 
				
			|||
            this.wizard = code.context.wizard | null; | 
				
			|||
            this.session = session; | 
				
			|||
        }, | 
				
			|||
        start: function() { | 
				
			|||
            var self = this; | 
				
			|||
            self.initial_render = true; | 
				
			|||
            rpc.query({ | 
				
			|||
                model: 'dynamic.balance.sheet', | 
				
			|||
                method: 'create', | 
				
			|||
                args: [{ | 
				
			|||
 | 
				
			|||
                }] | 
				
			|||
            }).then(function(res) { | 
				
			|||
                self.wizard = res; | 
				
			|||
                self.sheet_view(self.initial_render); | 
				
			|||
            }) | 
				
			|||
        }, | 
				
			|||
            apply_filter: function(event) { | 
				
			|||
 | 
				
			|||
            event.preventDefault(); | 
				
			|||
            var self = this; | 
				
			|||
 | 
				
			|||
            self.initial_render = false; | 
				
			|||
            var output = {}; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
            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=""; | 
				
			|||
 | 
				
			|||
            } | 
				
			|||
            output.account_ids = account_ids | 
				
			|||
 | 
				
			|||
 | 
				
			|||
             var journal_ids = []; | 
				
			|||
            var journal_text = []; | 
				
			|||
            var journal_res = document.getElementById("journal_res") | 
				
			|||
            var journal_list = $(".journal").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=""; | 
				
			|||
 | 
				
			|||
            } | 
				
			|||
            output.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=""; | 
				
			|||
 | 
				
			|||
            } | 
				
			|||
            output.account_tag_ids = account_tag_ids | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
               var analytic_ids = []; | 
				
			|||
            var analytic_text = []; | 
				
			|||
            var span_res = document.getElementById("analic_res") | 
				
			|||
            var analytic_list = $(".analytic").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) | 
				
			|||
 | 
				
			|||
                    } | 
				
			|||
 | 
				
			|||
                    span_res.value = analytic_text | 
				
			|||
                    span_res.innerHTML=span_res.value; | 
				
			|||
                } | 
				
			|||
            } | 
				
			|||
            if (analytic_list.length == 0){ | 
				
			|||
               span_res.value = "" | 
				
			|||
                    span_res.innerHTML=""; | 
				
			|||
 | 
				
			|||
            } | 
				
			|||
            output.analytic_ids = analytic_ids | 
				
			|||
 | 
				
			|||
            output.analytic_tag_ids = analytic_tag_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=""; | 
				
			|||
 | 
				
			|||
            } | 
				
			|||
            output.analytic_tag_ids = analytic_tag_ids | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
            if ($("#date_from").val()) { | 
				
			|||
                var dateObject = $("#date_from").datepicker("getDate"); | 
				
			|||
                var dateString = $.datepicker.formatDate("yy-mm-dd", dateObject); | 
				
			|||
                output.date_from = dateString; | 
				
			|||
            } | 
				
			|||
            if ($("#date_to").val()) { | 
				
			|||
                var dateObject = $("#date_to").datepicker("getDate"); | 
				
			|||
                var dateString = $.datepicker.formatDate("yy-mm-dd", dateObject); | 
				
			|||
                output.date_to = dateString; | 
				
			|||
            } | 
				
			|||
 | 
				
			|||
            if ($(".entries").length) { | 
				
			|||
            var post_res = document.getElementById("post_res") | 
				
			|||
 | 
				
			|||
            output.entries = $(".entries")[1].value | 
				
			|||
            post_res.value = $(".entries")[1].value | 
				
			|||
                    post_res.innerHTML=post_res.value; | 
				
			|||
              if ($(".entries")[1].value == "") { | 
				
			|||
              post_res.innerHTML="all"; | 
				
			|||
 | 
				
			|||
              } | 
				
			|||
            } | 
				
			|||
 | 
				
			|||
            output.include_details = true; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
            rpc.query({ | 
				
			|||
                model: 'dynamic.balance.sheet', | 
				
			|||
                method: 'write', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard], output | 
				
			|||
                ], | 
				
			|||
            }).then(function(res) { | 
				
			|||
                self.sheet_view(self.initial_render); | 
				
			|||
 | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
        get_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: 'dynamic.gl', | 
				
			|||
                    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', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard], action_title | 
				
			|||
                ], | 
				
			|||
            }).then(function(data) { | 
				
			|||
 | 
				
			|||
                var action = { | 
				
			|||
                    'type': 'ir.actions.report', | 
				
			|||
                    'report_type': 'qweb-pdf', | 
				
			|||
                    'report_name': 'dynamic_financial_report.balance_sheet', | 
				
			|||
                    'report_file': 'dynamic_financial_report.balance_sheet', | 
				
			|||
                    'data': { | 
				
			|||
                        'report_data': data, | 
				
			|||
                        'report_name': 'Profit and Loss' | 
				
			|||
                    }, | 
				
			|||
                    'context': { | 
				
			|||
                        'active_model': 'dynamic.balance.sheet', | 
				
			|||
                        'landscape': 1, | 
				
			|||
                        'js_report': true | 
				
			|||
                    }, | 
				
			|||
                    'display_name': 'Profit and Loss', | 
				
			|||
                }; | 
				
			|||
                return self.do_action(action); | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
        print_xlsx: function() { | 
				
			|||
            var self = this; | 
				
			|||
            var action_title = self._title | 
				
			|||
            self._rpc({ | 
				
			|||
                model: 'dynamic.balance.sheet', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard],action_title | 
				
			|||
                ], | 
				
			|||
            }).then(function(data) { | 
				
			|||
 | 
				
			|||
                var action = { | 
				
			|||
                       'type': 'ir_actions_xlsx_download', | 
				
			|||
                        'data': { | 
				
			|||
                             'model': 'dynamic.balance.sheet', | 
				
			|||
                             'options': 'Profit and Loss', | 
				
			|||
                             'output_format': 'xlsx', | 
				
			|||
                             'report_data': JSON.stringify(data[0]), | 
				
			|||
                             'report_name': 'Profit and Loss', | 
				
			|||
                             'dfr_data':JSON.stringify(data[2]), | 
				
			|||
                        }, | 
				
			|||
                    }; | 
				
			|||
 | 
				
			|||
                    return self.do_action(action); | 
				
			|||
                }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
 | 
				
			|||
        sheet_view: function(initial_render = true) { | 
				
			|||
            var self = this; | 
				
			|||
            var action_title = self._title | 
				
			|||
            var node = self.$('.container-pal-main'); | 
				
			|||
            var last; | 
				
			|||
            while (last = node.lastChild) node.removeChild(last); | 
				
			|||
            rpc.query({ | 
				
			|||
                model: 'dynamic.balance.sheet', | 
				
			|||
                method: 'get_data', | 
				
			|||
                args: [ | 
				
			|||
                    [self.wizard], action_title | 
				
			|||
                ], | 
				
			|||
            }).then(function(datas) { | 
				
			|||
                self.filter_data = datas[0] | 
				
			|||
 | 
				
			|||
                self.account_data = datas[1] | 
				
			|||
 | 
				
			|||
                _.each(self.account_data, function(account) { | 
				
			|||
                    var currency_format = { | 
				
			|||
                        currency_id: account.company_currency_id, | 
				
			|||
                        position: account.company_currency_position, | 
				
			|||
                        symbol: account.company_currency_symbol, | 
				
			|||
                        noSymbol: true, | 
				
			|||
                    }; | 
				
			|||
                    if (currency_format.position == "before") { | 
				
			|||
 | 
				
			|||
                         if (account.debit == 0) { | 
				
			|||
                                account.debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.debit = currency_format.symbol + ' ' + account.debit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.credit == 0) { | 
				
			|||
                                account.credit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account.credit = currency_format.symbol + ' ' + account.credit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.balance == 0) { | 
				
			|||
                                account.balance = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account.balance = currency_format.symbol + ' ' + account.balance.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                    } else { | 
				
			|||
 | 
				
			|||
                        if (account.debit == 0) { | 
				
			|||
                                account.debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.debit = account.debit.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.credit == 0) { | 
				
			|||
                                account.credit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                account.credit = account.credit.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (account.balance == 0) { | 
				
			|||
                                account.balance = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                account.balance = account.balance.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                    } | 
				
			|||
                }); | 
				
			|||
 | 
				
			|||
                if (initial_render) { | 
				
			|||
                    self.$('.pal-filter').html(QWeb.render('FilterSectionPAL', { | 
				
			|||
                        filter_data: datas[0], | 
				
			|||
                    })); | 
				
			|||
 | 
				
			|||
                    self.$el.find('.journal').select2({ | 
				
			|||
                        placeholder: 'Select Journal...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.account').select2({ | 
				
			|||
                        placeholder: 'Select Account...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.account-tag').select2({ | 
				
			|||
                        placeholder: 'Select Account Tag...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.analytic-tag').select2({ | 
				
			|||
                        placeholder: 'Select Analytic Tag...', | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.analytic').select2({ | 
				
			|||
                        placeholder: 'Select Analytic...', | 
				
			|||
                    }); | 
				
			|||
 | 
				
			|||
                    self.$el.find('#date_from').datepicker({ | 
				
			|||
                        dateFormat: 'dd-mm-yy' | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('#date_to').datepicker({ | 
				
			|||
                        dateFormat: 'dd-mm-yy' | 
				
			|||
                    }); | 
				
			|||
                    self.$el.find('.entries').select2({ | 
				
			|||
                        placeholder: 'Select Moves', | 
				
			|||
                    }); | 
				
			|||
                } | 
				
			|||
                self.$('.container-pal-main').html(QWeb.render('ProfitAndLossData', { | 
				
			|||
                    account_data: datas[1], | 
				
			|||
                    report_lines: datas[2] | 
				
			|||
                })); | 
				
			|||
            }); | 
				
			|||
        }, | 
				
			|||
        pal_lines_by_page: function(offset, account_id) { | 
				
			|||
            var self = this; | 
				
			|||
            return rpc.query({ | 
				
			|||
                model: 'dynamic.balance.sheet', | 
				
			|||
                method: 'bs_move_lines', | 
				
			|||
                args: [self.wizard, offset, account_id], | 
				
			|||
            }) | 
				
			|||
        }, | 
				
			|||
        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) { | 
				
			|||
                self.pal_lines_by_page(offset, account_id).then(function(datas) { | 
				
			|||
                    _.each(datas[2], function(data) { | 
				
			|||
                        var currency_format = { | 
				
			|||
                            currency_id: data.company_currency_id, | 
				
			|||
                            position: data.company_currency_position, | 
				
			|||
                            symbol: data.company_currency_symbol, | 
				
			|||
                            noSymbol: true, | 
				
			|||
                        }; | 
				
			|||
                        if (currency_format.position == "before") { | 
				
			|||
                            if (data.debit == 0) { | 
				
			|||
                                data.debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                data.debit = currency_format.symbol + ' ' + data.debit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.credit == 0) { | 
				
			|||
                                data.credit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                data.credit = currency_format.symbol + ' ' + data.credit.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.balance == 0) { | 
				
			|||
                                data.balance = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                data.balance = currency_format.symbol + ' ' + data.balance.toFixed(2) + ' '; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                        } else { | 
				
			|||
                            if (data.debit == 0) { | 
				
			|||
                                data.debit = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                data.debit = data.debit.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.credit == 0) { | 
				
			|||
                                data.credit = ' - ' | 
				
			|||
 | 
				
			|||
                            } else { | 
				
			|||
                                data.credit = data.credit.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (data.balance == 0) { | 
				
			|||
                                data.balance = ' - ' | 
				
			|||
                            } else { | 
				
			|||
                                data.balance = data.balance.toFixed(2) + ' ' + currency_id.symbol; | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
 | 
				
			|||
                        } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
                    }); | 
				
			|||
                    $(event.currentTarget).next('tr').find('td .pal-table-div').remove(); | 
				
			|||
                    $(event.currentTarget).next('tr').find('td ul').after( | 
				
			|||
                        QWeb.render('SubSectionPAL', { | 
				
			|||
                            count: datas[0], | 
				
			|||
                            offset: datas[1], | 
				
			|||
                            account_data: datas[2], | 
				
			|||
                        })) | 
				
			|||
                    $(event.currentTarget).next('tr').find('td ul li:first a').css({ | 
				
			|||
                        'background-color': '#00ede8', | 
				
			|||
                        'font-weight': 'bold', | 
				
			|||
                    }); | 
				
			|||
                }) | 
				
			|||
            } | 
				
			|||
        }, | 
				
			|||
        view_move: function(event) { | 
				
			|||
            event.preventDefault(); | 
				
			|||
            var self = this; | 
				
			|||
            var context = {}; | 
				
			|||
            var redirect_to_document = 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) { | 
				
			|||
                        redirect_to_document('account.move', record[0].id); | 
				
			|||
                    } else { | 
				
			|||
                        redirect_to_document('account.move', $(event.currentTarget).data('move-id')); | 
				
			|||
                    } | 
				
			|||
                }); | 
				
			|||
        }, | 
				
			|||
 | 
				
			|||
    }); | 
				
			|||
    core.action_registry.add('dynamic.pal', ProfitAndLoss); | 
				
			|||
 | 
				
			|||
}); | 
				
			|||
@ -0,0 +1,377 @@ | 
				
			|||
 | 
				
			|||
.gl-breadcrumb { | 
				
			|||
    font-size: 18px; | 
				
			|||
} | 
				
			|||
.amt{ | 
				
			|||
text-align: right; | 
				
			|||
 | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.amd{ | 
				
			|||
text-align: right; | 
				
			|||
width: 400px !important; | 
				
			|||
 | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.py_cntrl_right{ | 
				
			|||
    max-width: 50%; | 
				
			|||
    max-height: 50px; | 
				
			|||
 | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.gl-breadcrumb li { | 
				
			|||
    display: inline-block; | 
				
			|||
    max-width: 100%; | 
				
			|||
    white-space: nowrap; | 
				
			|||
    overflow: hidden; | 
				
			|||
    text-overflow: ellipsis; | 
				
			|||
    vertical-align: top; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.py-control-div { | 
				
			|||
    display: flex; | 
				
			|||
    justify-content: space-between; | 
				
			|||
    min-height: 30px; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.py-btn-primary{ | 
				
			|||
    color: #FFFFFF; | 
				
			|||
    background-color: #00A09D; | 
				
			|||
    border-color: #00A09D; | 
				
			|||
    border-radius: 0px; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.py-btn-secondary{ | 
				
			|||
    color: #FFFFFF; | 
				
			|||
    background-color: #00A0AD; | 
				
			|||
    border-color: #00A09D; | 
				
			|||
    border-radius: 3px; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.py-search-buttons{ | 
				
			|||
    display: block; | 
				
			|||
    margin: auto 0px; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.py-search-btn-date, | 
				
			|||
.py-search-date-filter, | 
				
			|||
.py-search-journals, | 
				
			|||
.py-search-partners, | 
				
			|||
.py-search-entries, | 
				
			|||
.py-search-accounts, | 
				
			|||
.py-search-accounts-tag, | 
				
			|||
.py-search-analytics, | 
				
			|||
.py-search-analytic-tag, | 
				
			|||
.py-search-extra{ | 
				
			|||
    white-space: nowrap; | 
				
			|||
    display: inline-block; | 
				
			|||
    cursor: pointer; | 
				
			|||
    user-select: none; | 
				
			|||
    position: relative; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.dropdown-item{ | 
				
			|||
    display: block; | 
				
			|||
    width: 100%; | 
				
			|||
    clear: both; | 
				
			|||
    font-weight: 400; | 
				
			|||
    color: rgb(102, 102, 102); | 
				
			|||
    text-align: inherit; | 
				
			|||
    white-space: nowrap; | 
				
			|||
    background-color: transparent; | 
				
			|||
    padding: 0.25rem 1.5rem; | 
				
			|||
    border-width: 0px; | 
				
			|||
    border-style: initial; | 
				
			|||
    border-color: initial; | 
				
			|||
    border-image: initial; | 
				
			|||
    position: relative; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.tl-breadcrumb { | 
				
			|||
    font-size: 18px; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.tl-breadcrumb li { | 
				
			|||
    display: inline-block; | 
				
			|||
    max-width: 100%; | 
				
			|||
    white-space: nowrap; | 
				
			|||
    overflow: hidden; | 
				
			|||
    text-overflow: ellipsis; | 
				
			|||
    vertical-align: top; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.py-search-btn-date, | 
				
			|||
.py-search-date-filter, | 
				
			|||
.py-search-journals, | 
				
			|||
.py-search-partners, | 
				
			|||
.py-search-accounts, | 
				
			|||
.py-search-entries, | 
				
			|||
.py-search-accounts-tag, | 
				
			|||
.py-search-analytics, | 
				
			|||
.py-search-analytic-tag, | 
				
			|||
.py-search-extra{ | 
				
			|||
    white-space: nowrap; | 
				
			|||
    display: inline-block; | 
				
			|||
    cursor: pointer; | 
				
			|||
    user-select: none; | 
				
			|||
    position: relative; | 
				
			|||
} | 
				
			|||
.bs-section-first{ | 
				
			|||
    padding: 5px; | 
				
			|||
    padding-top: 5px; | 
				
			|||
    padding-left: 15px; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.bs-section{ | 
				
			|||
    padding: 5px; | 
				
			|||
    padding-top: 25px; | 
				
			|||
    padding-left: 15px; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.bs-sub-section{ | 
				
			|||
    padding-top: 25px; | 
				
			|||
} | 
				
			|||
.pl-breadcrumb { | 
				
			|||
    font-size: 18px; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.pl-breadcrumb li { | 
				
			|||
    display: inline-block; | 
				
			|||
    max-width: 100%; | 
				
			|||
    white-space: nowrap; | 
				
			|||
    overflow: hidden; | 
				
			|||
    text-overflow: ellipsis; | 
				
			|||
    vertical-align: top; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.py-search-btn-date, | 
				
			|||
.py-search-date-filter, | 
				
			|||
.py-search-journals, | 
				
			|||
.py-search-partners, | 
				
			|||
.py-search-categories, | 
				
			|||
.py-search-reconciled, | 
				
			|||
.py-search-accounts, | 
				
			|||
.py-search-entries, | 
				
			|||
.py-search-accounts-tag, | 
				
			|||
.py-search-analytics, | 
				
			|||
.py-search-analytic-tag, | 
				
			|||
.py-search-extra{ | 
				
			|||
    white-space: nowrap; | 
				
			|||
    display: inline-block; | 
				
			|||
    cursor: pointer; | 
				
			|||
    user-select: none; | 
				
			|||
    position: relative; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.al-breadcrumb { | 
				
			|||
    font-size: 18px; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.al-breadcrumb li { | 
				
			|||
    display: inline-block; | 
				
			|||
    max-width: 100%; | 
				
			|||
    white-space: nowrap; | 
				
			|||
    overflow: hidden; | 
				
			|||
    text-overflow: ellipsis; | 
				
			|||
    vertical-align: top; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.py-search-btn-date, | 
				
			|||
.py-search-date-filter, | 
				
			|||
.py-search-journals, | 
				
			|||
.py-search-partners, | 
				
			|||
.py-search-accounts, | 
				
			|||
.py-search-partner-type, | 
				
			|||
.py-search-analytics, | 
				
			|||
.py-search-partner-tag, | 
				
			|||
.py-search-entries, | 
				
			|||
.py-search-extra{ | 
				
			|||
    white-space: nowrap; | 
				
			|||
    display: inline-block; | 
				
			|||
    cursor: pointer; | 
				
			|||
    user-select: none; | 
				
			|||
    position: relative; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.cf-breadcrumb { | 
				
			|||
    font-size: 18px; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.cf-breadcrumb li { | 
				
			|||
    display: inline-block; | 
				
			|||
    max-width: 100%; | 
				
			|||
    white-space: nowrap; | 
				
			|||
    overflow: hidden; | 
				
			|||
    text-overflow: ellipsis; | 
				
			|||
    vertical-align: top; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.py-search-btn-date, | 
				
			|||
.py-search-date-filter, | 
				
			|||
.py-search-journals, | 
				
			|||
.py-search-partners, | 
				
			|||
.py-search-categories, | 
				
			|||
.py-search-reconciled, | 
				
			|||
.py-search-accounts, | 
				
			|||
.py-search-accounts-tag, | 
				
			|||
.py-search-analytics, | 
				
			|||
.py-search-analytic-tag, | 
				
			|||
.py-search-extra{ | 
				
			|||
    white-space: nowrap; | 
				
			|||
    display: inline-block; | 
				
			|||
    cursor: pointer; | 
				
			|||
    user-select: none; | 
				
			|||
    position: relative; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.main { | 
				
			|||
    border: 1px solid #efefef; | 
				
			|||
    margin: 50px; | 
				
			|||
    border-radius: 17px; | 
				
			|||
    background: #fff; | 
				
			|||
    padding: 2% 0 5%; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.thead { | 
				
			|||
    border-bottom: 2px solid #bfbfbf; | 
				
			|||
    background: #e8e8e8; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.thead tr { | 
				
			|||
    height: 38px; | 
				
			|||
    width: 100%; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.thead tr th { | 
				
			|||
    border-bottom: 1px solid #e6e6e6; | 
				
			|||
    font-weight:bold; | 
				
			|||
    font-size:15px; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.header { | 
				
			|||
    margin-bottom: 50px; | 
				
			|||
    text-align: center; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.child_col1 { | 
				
			|||
    width: 8%; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.parent-highlight { | 
				
			|||
    background: #f5f5f5; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.parent-line { | 
				
			|||
    background-image: linear-gradient(to bottom, #fcfcfc, #dedede); | 
				
			|||
    cursor: pointer; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.parent-line:hover { | 
				
			|||
    background-image: linear-gradient(to bottom, #fcfcfc, #cacaca); | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.child_col2 { | 
				
			|||
    width: 10%; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.child_col3 { | 
				
			|||
    width: 10%; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.child_col4 { | 
				
			|||
    width: 10%; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.categ td { | 
				
			|||
    padding: 7px !important; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.filter_options { | 
				
			|||
    border-bottom: 1px solid; | 
				
			|||
    border-radius: 10px; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.entry_type { | 
				
			|||
    margin: 20px; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.report_header { | 
				
			|||
    text-align: center; | 
				
			|||
    border-bottom: 1px solid #efefef; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.row_color { | 
				
			|||
    background-color: #e4e4e4; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.main_report { | 
				
			|||
    border: 1px solid #efefef; | 
				
			|||
    margin: 50px; | 
				
			|||
    border-radius: 17px; | 
				
			|||
    background: #fff; | 
				
			|||
    padding: 2% 0 5%; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.child-class td { | 
				
			|||
    font-size: 12px !important; | 
				
			|||
    cursor: pointer; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.child-row { | 
				
			|||
    border-bottom: 1px solid #cacaca; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.child-row:hover { | 
				
			|||
    background-color: #f5f5f5; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.bs-breadcrumb { | 
				
			|||
    font-size: 18px; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.bs-breadcrumb li { | 
				
			|||
    display: inline-block; | 
				
			|||
    max-width: 100%; | 
				
			|||
    white-space: nowrap; | 
				
			|||
    overflow: hidden; | 
				
			|||
    text-overflow: ellipsis; | 
				
			|||
    vertical-align: top; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.pal-breadcrumb { | 
				
			|||
    font-size: 18px; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.pal-breadcrumb li { | 
				
			|||
    display: inline-block; | 
				
			|||
    max-width: 100%; | 
				
			|||
    white-space: nowrap; | 
				
			|||
    overflow: hidden; | 
				
			|||
    text-overflow: ellipsis; | 
				
			|||
    vertical-align: top; | 
				
			|||
} | 
				
			|||
.db-breadcrumb { | 
				
			|||
    font-size: 18px; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.db-breadcrumb li { | 
				
			|||
    display: inline-block; | 
				
			|||
    max-width: 100%; | 
				
			|||
    white-space: nowrap; | 
				
			|||
    overflow: hidden; | 
				
			|||
    text-overflow: ellipsis; | 
				
			|||
    vertical-align: top; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.py-search-btn-date, | 
				
			|||
.py-search-date-filter, | 
				
			|||
.py-search-journals, | 
				
			|||
.py-search-entries, | 
				
			|||
.py-search-accounts, | 
				
			|||
.py-search-extra{ | 
				
			|||
    white-space: nowrap; | 
				
			|||
    display: inline-block; | 
				
			|||
    cursor: pointer; | 
				
			|||
    user-select: none; | 
				
			|||
    position: relative; | 
				
			|||
} | 
				
			|||
@ -0,0 +1,292 @@ | 
				
			|||
<templates xml:space="preserve"> | 
				
			|||
	<t t-name="AgeingPartner"> | 
				
			|||
		<div class="container-al"> | 
				
			|||
			<div> | 
				
			|||
				<div class="al-filter"></div> | 
				
			|||
			</div> | 
				
			|||
			<div class="container-al-data"> | 
				
			|||
				<div class="container-al-main"/> | 
				
			|||
			</div> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
	<t t-name="AgeingPartnerData"> | 
				
			|||
		<div> | 
				
			|||
			<table cellspacing="0" width="100%"> | 
				
			|||
				<thead> | 
				
			|||
					<tr> | 
				
			|||
						<th colspan="2">Account</th> | 
				
			|||
						<th class="amt">Not Due</th> | 
				
			|||
						<th class="amt">0-20</th> | 
				
			|||
						<th class="amt">21-40</th> | 
				
			|||
						<th class="amt">41-60</th> | 
				
			|||
						<th class="amt">61-80</th> | 
				
			|||
						<th class="amt">81-100</th> | 
				
			|||
						<th class="amt">100+</th> | 
				
			|||
						<th class="amt">Total</th> | 
				
			|||
					</tr> | 
				
			|||
				</thead> | 
				
			|||
				<tbody> | 
				
			|||
 | 
				
			|||
					<t t-foreach="account_data" t-as="account"> | 
				
			|||
 | 
				
			|||
						<t t-set="common_id" t-value=""/> | 
				
			|||
						<t t-if="account_data[account]['count']"> | 
				
			|||
							<tr style="border: 1.5px solid black;" class="al-line" | 
				
			|||
                                data-toggle="collapse" | 
				
			|||
                                t-att-data-account-id="account_data[account]['id']" | 
				
			|||
                                t-attf-data-target=".a{{account_data[account]['id']}}"> | 
				
			|||
								<td colspan="2" style="border: 0px solid black;"> | 
				
			|||
									<i class="fa fa-caret-down" role="img" aria-label="Unfolded" title="Unfolded"></i> | 
				
			|||
									<span> | 
				
			|||
										<t t-esc="account_data[account]['partner_name']"/> | 
				
			|||
									</span> | 
				
			|||
								</td> | 
				
			|||
								<td class="amt"  > | 
				
			|||
									<t t-raw="account_data[account]['Not']"/> | 
				
			|||
								</td> | 
				
			|||
								<td class="amt" > | 
				
			|||
									<t t-raw="account_data[account]['value_20']"/> | 
				
			|||
								</td> | 
				
			|||
								<td class="amt" > | 
				
			|||
									<t t-raw="account_data[account]['2140']"/> | 
				
			|||
								</td> | 
				
			|||
								<td class="amt" > | 
				
			|||
									<t t-raw="account_data[account]['4160']"/> | 
				
			|||
								</td> | 
				
			|||
								<td class="amt" > | 
				
			|||
									<t t-raw="account_data[account]['6180']"/> | 
				
			|||
								</td> | 
				
			|||
								<td class="amt" > | 
				
			|||
									<t t-raw="account_data[account]['81100']"/> | 
				
			|||
								</td> | 
				
			|||
								<td class="amt" > | 
				
			|||
									<t t-raw="account_data[account]['100']"/> | 
				
			|||
								</td> | 
				
			|||
								<td class="amt" > | 
				
			|||
									<t t-raw="account_data[account]['total']"/> | 
				
			|||
								</td> | 
				
			|||
<!--								<td class="amt"></td>--> | 
				
			|||
								<t t-set="common_id" t-value="'a'+account_data[account]['id']"/> | 
				
			|||
							</tr> | 
				
			|||
						</t> | 
				
			|||
						<tr t-attf-class="collapse a{{account_data[account]['id']}}"> | 
				
			|||
							<td colspan="10"> | 
				
			|||
								<ul> | 
				
			|||
									<t t-if="!account_data[account]['single_page']"> | 
				
			|||
										<t t-foreach="account_data[account]['pages']" t-as="i"> | 
				
			|||
											<t t-esc="i"/> | 
				
			|||
											<li> | 
				
			|||
												<a | 
				
			|||
                                                   t-att-data-page-number="i" | 
				
			|||
                                                   t-att-data-count="account_data[account]['count']" | 
				
			|||
                                                   t-att-data-account-id="account_data[account]['id']"> | 
				
			|||
													<t t-esc="i"/> | 
				
			|||
												</a> | 
				
			|||
											</li> | 
				
			|||
										</t> | 
				
			|||
									</t> | 
				
			|||
								</ul> | 
				
			|||
 | 
				
			|||
							</td> | 
				
			|||
						</tr> | 
				
			|||
					</t> | 
				
			|||
				</tbody> | 
				
			|||
			</table> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
	<t t-name="FilterSection-al"> | 
				
			|||
		<div class="py-control-div"> | 
				
			|||
			<ol class="al-breadcrumb"> | 
				
			|||
				<li>Partner Ageing</li> | 
				
			|||
			</ol> | 
				
			|||
		</div> | 
				
			|||
		<div class="py-control-div"> | 
				
			|||
			<div class="py-cntrl-left"> | 
				
			|||
				<div class="py-ctrl-buttons"> | 
				
			|||
					<button type="button" class="btn py-btn-primary" id="pdf" action="print_pdf" style="position: relative;">Pint (PDF)</button> | 
				
			|||
					<button type="button" class="btn py-btn-primary" id="xlsx" action="print_xlsx" style="position: relative;">Export (XLSX)</button> | 
				
			|||
				</div> | 
				
			|||
			</div> | 
				
			|||
			<div class="py_cntrl_right"> | 
				
			|||
				<div class="py-search-buttons"> | 
				
			|||
					<button type="button" id="filter_apply_button" class="btn py-btn-secondary" action="apply_filter" style="position: relative;">Apply</button> | 
				
			|||
					<div class="py-search-btn-date"> | 
				
			|||
						<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 py-filters-menu" role="menu"> | 
				
			|||
							<div class="o_foldable_menu o_closed_menu o_account_report_search" data-filter="custom_filter_date"> | 
				
			|||
								<label class="custom-date" for="as_on_date">As On Date :</label> | 
				
			|||
								<div class="form-group custom-date"> | 
				
			|||
									<div class="o_datepicker" aria-atomic="true" id="datepicker10" data-target-input="nearest"> | 
				
			|||
										<input type="text" id="as_on_date"></input> | 
				
			|||
										<span class="o_datepicker_button"></span> | 
				
			|||
									</div> | 
				
			|||
								</div> | 
				
			|||
							</div> | 
				
			|||
						</div> | 
				
			|||
					</div> | 
				
			|||
					<div class="py-search-accounts"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Account Type: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-menu account" name="states[]" multiple="multiple"> | 
				
			|||
								<option value="receivable">Receivable Accounts Only</option> | 
				
			|||
								<option value="payable">Payable Accounts Only</option> | 
				
			|||
						</select> | 
				
			|||
						<span id="type_res"></span> | 
				
			|||
					</div> | 
				
			|||
					<div class="py-search-partner-type"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-filter"></span> | 
				
			|||
Partner Type: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-menu partner-type" name="states[]" multiple="multiple"> | 
				
			|||
								<option value="customer">Customer Only</option> | 
				
			|||
								<option value="supplier">Supplier Only</option> | 
				
			|||
						</select> | 
				
			|||
						<span id="partner_type_res"></span> | 
				
			|||
					</div> | 
				
			|||
					<div class="py-search-partners"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-users"></span> | 
				
			|||
Partners: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-menu partners" name="states[]" multiple="multiple"> | 
				
			|||
							<t t-foreach="filter_data.partners_list" t-as="partners"> | 
				
			|||
								<option t-attf-value="{{partners[0]}}"> | 
				
			|||
									<t t-esc="partners[1]"/> | 
				
			|||
								</option> | 
				
			|||
							</t> | 
				
			|||
						</select> | 
				
			|||
						<span id="partner_res"></span> | 
				
			|||
					</div> | 
				
			|||
					<div class="py-search-partner-tag"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-filter"></span> | 
				
			|||
Partner Tag: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-menu partner-tag" name="states[]" multiple="multiple"> | 
				
			|||
							<t t-foreach="filter_data.category_list" t-as="partner_tag"> | 
				
			|||
								<option t-attf-value="{{partner_tag[0]}}"> | 
				
			|||
									<t t-esc="partner_tag[1]"/> | 
				
			|||
								</option> | 
				
			|||
							</t> | 
				
			|||
						</select> | 
				
			|||
						<span id="category_res"></span> | 
				
			|||
					</div> | 
				
			|||
					<div class="py-search-targetmoves"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Target Moves: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-menu target-moves" name="states[]" > | 
				
			|||
							<option value="draft">All Entries</option> | 
				
			|||
							<option value="posted">Posted</option> | 
				
			|||
 | 
				
			|||
						</select> | 
				
			|||
						<span id="target_res"></span> | 
				
			|||
					</div> | 
				
			|||
				</div> | 
				
			|||
			</div> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
	<t t-name="SubSection_al"> | 
				
			|||
		<div class="al-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>Due Date</th> | 
				
			|||
						<th>Journal</th> | 
				
			|||
						<th>Account</th> | 
				
			|||
						<th class="text-right">Not Due</th> | 
				
			|||
						<th class="text-right">0-20</th> | 
				
			|||
						<th class="text-right">21-40</th> | 
				
			|||
						<th class="text-right">41-60</th> | 
				
			|||
						<th class="text-right">61-80</th> | 
				
			|||
						<th class="text-right">81-100</th> | 
				
			|||
						<th class="text-right" >100+</th> | 
				
			|||
 | 
				
			|||
					</tr> | 
				
			|||
				</thead> | 
				
			|||
				<tbody> | 
				
			|||
					<t t-foreach="account_data" t-as="account_line"> | 
				
			|||
							<t t-set="style" t-value="'font-style: italic;'"/> | 
				
			|||
<!--					</t>--> | 
				
			|||
						<tr> | 
				
			|||
							<td> | 
				
			|||
								<t t-if="account_line.move_name"> | 
				
			|||
									<div class="dropdown dropdown-toggle"> | 
				
			|||
										<a data-toggle="dropdown" href="#"> | 
				
			|||
											<span class="caret"></span> | 
				
			|||
											<span data-id="17"> | 
				
			|||
												<t t-esc="account_line.move_name"/> | 
				
			|||
											</span> | 
				
			|||
										</a> | 
				
			|||
										<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu"> | 
				
			|||
											<li> | 
				
			|||
												<a class="view-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.date_maturity"/> | 
				
			|||
							</td> | 
				
			|||
							<td> | 
				
			|||
								<t t-esc="account_line.journal_name"/> | 
				
			|||
							</td> | 
				
			|||
							<td > | 
				
			|||
								<span> | 
				
			|||
										<t t-esc="account_line.account_code"/> | 
				
			|||
                                        - | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
										<t t-esc="account_line.account_name"/> | 
				
			|||
									</span> | 
				
			|||
							</td> | 
				
			|||
							<td class="text-right" | 
				
			|||
> | 
				
			|||
								<t t-esc="account_line.range_0"/> | 
				
			|||
							</td> | 
				
			|||
							<td class="text-right" | 
				
			|||
> | 
				
			|||
								<t t-esc="account_line.range_1"/> | 
				
			|||
							</td> | 
				
			|||
							<td class="text-right" | 
				
			|||
> | 
				
			|||
								<t t-esc="account_line.range_2"/> | 
				
			|||
							</td> | 
				
			|||
							<td class="text-right" | 
				
			|||
> | 
				
			|||
								<t t-esc="account_line.range_3"/> | 
				
			|||
							</td> | 
				
			|||
							<td class="text-right" | 
				
			|||
> | 
				
			|||
								<t t-esc="account_line.range_4"/> | 
				
			|||
							</td> | 
				
			|||
							<td class="text-right" | 
				
			|||
> | 
				
			|||
								<t t-esc="account_line.range_5"/> | 
				
			|||
							</td> | 
				
			|||
							<td class="text-right" | 
				
			|||
> | 
				
			|||
								<t t-esc="account_line.range_6"/> | 
				
			|||
							</td> | 
				
			|||
						</tr> | 
				
			|||
					</t> | 
				
			|||
				</tbody> | 
				
			|||
			</table> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
</templates> | 
				
			|||
@ -0,0 +1,282 @@ | 
				
			|||
<?xml version="1.0" encoding="UTF-8"?> | 
				
			|||
<templates xml:space="preserve"> | 
				
			|||
	<t t-name="BankBook"> | 
				
			|||
		<div class="container-bb"> | 
				
			|||
			<div> | 
				
			|||
				<div class="bb-filter"></div> | 
				
			|||
			</div> | 
				
			|||
			<div class="container-bb-data"> | 
				
			|||
				<div class="container-bb-main"></div> | 
				
			|||
			</div> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
	<t t-name="BankBookData"> | 
				
			|||
		<div> | 
				
			|||
			<table cellspacing="0" width="100%"> | 
				
			|||
				<thead> | 
				
			|||
					<tr> | 
				
			|||
						<th colspan="6">Account</th> | 
				
			|||
						<th class="amt">Debit</th> | 
				
			|||
						<th class="amt">Credit</th> | 
				
			|||
						<th class="amt">Balance</th> | 
				
			|||
						<th></th> | 
				
			|||
					</tr> | 
				
			|||
				</thead> | 
				
			|||
				<tbody> | 
				
			|||
					<t t-foreach="account_data" t-as="account"> | 
				
			|||
						<t t-set="common_id" t-value=""/> | 
				
			|||
						<t t-if="account_data[account]['count']"> | 
				
			|||
							<tr style="border: 1.5px solid black;" class="bb-line" | 
				
			|||
                                data-toggle="collapse" | 
				
			|||
                                t-att-data-account-id="account_data[account]['id']" | 
				
			|||
                                t-attf-data-target=".a{{account_data[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_data[account]['code']"/> | 
				
			|||
                                        - | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
										<t t-esc="account_data[account]['name']"/> | 
				
			|||
									</span> | 
				
			|||
								</td> | 
				
			|||
								<td class="amt"> | 
				
			|||
									<t t-raw="account_data[account]['debit']"/> | 
				
			|||
								</td> | 
				
			|||
								<td class="amt"> | 
				
			|||
									<t t-raw="account_data[account]['credit']"/> | 
				
			|||
								</td> | 
				
			|||
								<td class="amt"> | 
				
			|||
									<t t-raw="account_data[account]['balance']"/> | 
				
			|||
								</td> | 
				
			|||
								<td class="amt"></td> | 
				
			|||
								<t t-set="common_id" t-value="'a'+account_data[account]['id']"/> | 
				
			|||
							</tr> | 
				
			|||
						</t> | 
				
			|||
						<tr t-attf-class="collapse a{{account_data[account]['id']}}"> | 
				
			|||
							<td colspan="10"> | 
				
			|||
								<ul> | 
				
			|||
									<t t-if="!account_data[account]['single_page']"> | 
				
			|||
										<t t-foreach="account_data[account]['pages']" t-as="i"> | 
				
			|||
											<li> | 
				
			|||
												<a | 
				
			|||
                                                   t-att-data-page-number="i" | 
				
			|||
                                                   t-att-data-count="account_data[account]['count']" | 
				
			|||
                                                   t-att-data-account-id="account_data[account]['id']"> | 
				
			|||
													<t t-esc="i"/> | 
				
			|||
												</a> | 
				
			|||
											</li> | 
				
			|||
										</t> | 
				
			|||
									</t> | 
				
			|||
								</ul> | 
				
			|||
							</td> | 
				
			|||
						</tr> | 
				
			|||
					</t> | 
				
			|||
				</tbody> | 
				
			|||
			</table> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
	<t t-name="FilterSectionBB"> | 
				
			|||
		<div class="py-control-div"> | 
				
			|||
			<ol class="gl-breadcrumb"> | 
				
			|||
				<li>Bank Book</li> | 
				
			|||
			</ol> | 
				
			|||
		</div> | 
				
			|||
		<div class="py-control-div"> | 
				
			|||
			<div class="py-cntrl-left"> | 
				
			|||
				<div class="py-ctrl-buttons"> | 
				
			|||
					<button type="button" class="btn py-btn-primary" id="pdf" action="print_pdf" style="position: relative;">Print (PDF)</button> | 
				
			|||
					<button type="button" class="btn py-btn-primary" id="xlsx" action="print_xlsx" style="position: relative;">Export (XLSX)</button> | 
				
			|||
				</div> | 
				
			|||
			</div> | 
				
			|||
			<div class="py_cntrl_right"> | 
				
			|||
				<div class="py-search-buttons"> | 
				
			|||
					<button type="button" id="filter_apply_button" class="btn py-btn-secondary" action="apply_filter" style="position: relative;">Apply</button> | 
				
			|||
					<div class="py-search-btn-date"> | 
				
			|||
						<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> | 
				
			|||
Custom | 
				
			|||
						</a> | 
				
			|||
						<div class="dropdown-menu py-filters-menu" role="menu"> | 
				
			|||
							<div class="o_foldable_menu o_closed_menu o_account_report_search" data-filter="custom_filter_date"> | 
				
			|||
								<label class="custom-date" for="date_from">Start Date :</label> | 
				
			|||
								<div class="form-group custom-date"> | 
				
			|||
									<div class="o_datepicker" aria-atomic="true" id="datepicker10" data-target-input="nearest"> | 
				
			|||
										<input type="text" id="date_from"></input> | 
				
			|||
										<span class="o_datepicker_button"></span> | 
				
			|||
									</div> | 
				
			|||
								</div> | 
				
			|||
								<label class="custom-date" for="date_to">End Date :</label> | 
				
			|||
								<div class="form-group custom-date"> | 
				
			|||
									<div class="o_datepicker" aria-atomic="true" id="datepicker11" data-target-input="nearest"> | 
				
			|||
										<input type="text" id="date_to"></input> | 
				
			|||
										<span class="o_datepicker_button"></span> | 
				
			|||
									</div> | 
				
			|||
								</div> | 
				
			|||
							</div> | 
				
			|||
						</div> | 
				
			|||
					</div> | 
				
			|||
					<div class="py-search-journals"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Journals: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-menu journal" name="states[]" multiple="multiple"> | 
				
			|||
							<b role="menuitem" class="dropdown-item-text"> | 
				
			|||
								<t t-esc="filter_data.company_name"/> | 
				
			|||
							</b> | 
				
			|||
							<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="py-search-accounts"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Accounts: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-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="py-search-accounts-tag"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Account Tags: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-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="py-search-analytics"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Analytic: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-menu analytic" name="states[]" multiple="multiple"> | 
				
			|||
							<t t-foreach="filter_data.analytics_list" t-as="analytic"> | 
				
			|||
								<option t-attf-value="{{analytic[0]}}"> | 
				
			|||
									<t t-esc="analytic[1]"/> | 
				
			|||
								</option> | 
				
			|||
							</t> | 
				
			|||
						</select> | 
				
			|||
						<span id="analic_res"></span> | 
				
			|||
					</div> | 
				
			|||
					<div class="py-search-analytic-tag"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Analytic Tags: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-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="py-search-entries"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-filter"></span> | 
				
			|||
Options: | 
				
			|||
						</a> | 
				
			|||
						<select id="entries" class="dropdown-menu py-filters-menu entries"> | 
				
			|||
								<option value="all">All Entries </option> | 
				
			|||
								<option value="posted">Posted Entries</option> | 
				
			|||
 | 
				
			|||
						</select> | 
				
			|||
						<span id="post_res"></span> | 
				
			|||
					</div> | 
				
			|||
				</div> | 
				
			|||
			</div> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
	<t t-name="SubSectionBB"> | 
				
			|||
		<div class="bb-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="amt">Debit</th> | 
				
			|||
						<th class="amt">Credit</th> | 
				
			|||
						<th class="amt">Balance</th> | 
				
			|||
					</tr> | 
				
			|||
				</thead> | 
				
			|||
				<tbody> | 
				
			|||
					<t t-foreach="account_data" t-as="account_line"> | 
				
			|||
						<t t-set="style" t-value="''"/> | 
				
			|||
						<t t-if="account_line.move_name == 'Initial Balance'"> | 
				
			|||
							<t t-set="style" t-value="'font-style: italic;'"/></t> | 
				
			|||
						<t t-if="account_line.move_name == 'Ending Balance'"> | 
				
			|||
							<t t-set="style" t-value="'font-style: italic;'"/></t> | 
				
			|||
						<tr> | 
				
			|||
							<td> | 
				
			|||
								<t t-if="account_line.ldate"> | 
				
			|||
									<div class="dropdown dropdown-toggle"> | 
				
			|||
										<a data-toggle="dropdown" href="#"> | 
				
			|||
											<span class="caret"></span> | 
				
			|||
											<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-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> | 
				
			|||
							<td t-att-style="style" class="amt"> | 
				
			|||
								<t t-raw="account_line.debit"/> | 
				
			|||
							</td> | 
				
			|||
							<td t-att-style="style" class="amt"> | 
				
			|||
								<t t-raw="account_line.credit"/> | 
				
			|||
							</td> | 
				
			|||
							<td t-att-style="style" class="amt"> | 
				
			|||
								<t t-raw="account_line.balance"/> | 
				
			|||
							</td> | 
				
			|||
						</tr> | 
				
			|||
					</t> | 
				
			|||
				</tbody> | 
				
			|||
			</table> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
</templates> | 
				
			|||
@ -0,0 +1,246 @@ | 
				
			|||
<?xml version="1.0" encoding="UTF-8"?> | 
				
			|||
<templates xml:space="preserve"> | 
				
			|||
	<t t-name="BalanceSheet"> | 
				
			|||
		<div class="container-bs"> | 
				
			|||
			<div> | 
				
			|||
				<div class="bs-filter"></div> | 
				
			|||
			</div> | 
				
			|||
			<div class="container-bs-data"> | 
				
			|||
				<div class="container-bs-main"></div> | 
				
			|||
			</div> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
	<t t-name="BalanceSheetData"> | 
				
			|||
		<div> | 
				
			|||
			<table cellspacing="0" width="100%"> | 
				
			|||
 | 
				
			|||
				<thead> | 
				
			|||
 | 
				
			|||
					<tr> | 
				
			|||
						<th colspan="6" style="padding-top: 5px;"> </th> | 
				
			|||
						<th style="text-align: right;padding-right: 50px; padding-top: 15px;">Debit</th> | 
				
			|||
						<th style="text-align: right;padding-right: 50px; padding-top: 15px;">Credit</th> | 
				
			|||
						<th style="text-align: right;padding-right: 50px; padding-top: 15px;">Balance</th> | 
				
			|||
						<th></th> | 
				
			|||
					</tr> | 
				
			|||
				</thead> | 
				
			|||
				<tbody> | 
				
			|||
					<tr t-foreach="report_lines" t-as="a" style="border-bottom: double;"> | 
				
			|||
						<t t-if="a['level'] != 0"> | 
				
			|||
							<t t-if="a['code']"> | 
				
			|||
								<t t-foreach="account_data" t-as="account"> | 
				
			|||
									<t t-set="common_id" t-value=""/> | 
				
			|||
									<t t-if="account_data[account]['count']"> | 
				
			|||
										<t t-if="account_data[account]['code'] == a['code']"> | 
				
			|||
											<tr style="border-bottom: 1px solid black;" class="bs-line" | 
				
			|||
												data-toggle="collapse" | 
				
			|||
												t-att-data-account-id="account_data[account]['id']" | 
				
			|||
												t-attf-data-target=".a{{account_data[account]['id']}}"> | 
				
			|||
												<td colspan="6" style="border: 0px solid black;  padding-left: 50px;"> | 
				
			|||
													<span> | 
				
			|||
														<t t-esc="account_data[account]['code']"/> | 
				
			|||
														- | 
				
			|||
														<t t-esc="account_data[account]['name']"/> | 
				
			|||
													</span> | 
				
			|||
													<div class="py-search-btn-date"> | 
				
			|||
													<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="" aria-atomic="true" id="" data-target-input=""> | 
				
			|||
																		<li role="presentation"> | 
				
			|||
																			<a role="menuitem" t-att-data-account-id="account_data[account]['id']" class="open-gl" >View General Ledger</a> | 
				
			|||
																		</li> | 
				
			|||
																	</div> | 
				
			|||
																</div> | 
				
			|||
 | 
				
			|||
															</div> | 
				
			|||
														</div> | 
				
			|||
													</div> | 
				
			|||
 | 
				
			|||
												</td> | 
				
			|||
 | 
				
			|||
												<td class="amt" style="text-align: right;padding-right: 50px;"> | 
				
			|||
													<t t-raw="account_data[account]['debit']"/> | 
				
			|||
												</td> | 
				
			|||
												<td class="amt" style="text-align: right;padding-right: 50px;"> | 
				
			|||
													<t t-raw="account_data[account]['credit']"/> | 
				
			|||
												</td> | 
				
			|||
												<td class="amt" style="text-align: right;padding-right: 50px;"> | 
				
			|||
													<t t-raw="account_data[account]['balance']"/> | 
				
			|||
												</td> | 
				
			|||
												<td class="amt"></td> | 
				
			|||
												<t t-set="common_id" t-value="'a'+account_data[account]['id']"/> | 
				
			|||
											</tr> | 
				
			|||
										</t> | 
				
			|||
									</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;'"/> | 
				
			|||
								<t t-if="a['level'] == 1"> | 
				
			|||
									<t t-set="style" t-value="'padding: 5px;padding-left: 15px;'"/> | 
				
			|||
								</t> | 
				
			|||
								<t t-if="a['level'] > 2"> | 
				
			|||
									<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: 15px;padding-top: 25px;'"/> | 
				
			|||
									<t t-set="fr_padding" t-value="'padding-top: 25px; text-align: right;padding-right: 50px;'"/> | 
				
			|||
								</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']" t-att-style="style"/></td> | 
				
			|||
									<td t-att-style="fr_padding"><t t-esc="a['m_balance']" t-att-style="style"/></td> | 
				
			|||
								</tr> | 
				
			|||
 | 
				
			|||
 | 
				
			|||
							</t> | 
				
			|||
						</t> | 
				
			|||
					</tr> | 
				
			|||
				</tbody> | 
				
			|||
			</table> | 
				
			|||
 | 
				
			|||
 | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
	<t t-name="FilterSectionBS"> | 
				
			|||
		<div class="py-control-div"> | 
				
			|||
			<ol class="bs-breadcrumb"> | 
				
			|||
				<li>Balance Sheet</li> | 
				
			|||
			</ol> | 
				
			|||
		</div> | 
				
			|||
		<div class="py-control-div"> | 
				
			|||
			<div class="py-cntrl-left"> | 
				
			|||
				<div class="py-ctrl-buttons"> | 
				
			|||
					<button type="button" class="btn py-btn-primary" id="pdf" action="print_pdf" style="position: relative;">Print (PDF)</button> | 
				
			|||
					<button type="button" class="btn py-btn-primary" id="xlsx" action="print_xlsx" style="position: relative;">Export (XLSX)</button> | 
				
			|||
				</div> | 
				
			|||
			</div> | 
				
			|||
			<div class="py_cntrl_right"> | 
				
			|||
				<div class="py-search-buttons"> | 
				
			|||
					<button type="button" id="filter_apply_button" class="btn py-btn-secondary" action="apply_filter" style="position: relative;">Apply</button> | 
				
			|||
					<div class="py-search-btn-date"> | 
				
			|||
						<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> | 
				
			|||
Custom | 
				
			|||
						</a> | 
				
			|||
						<div class="dropdown-menu py-filters-menu" role="menu"> | 
				
			|||
							<div class="o_foldable_menu o_closed_menu o_account_report_search" data-filter="custom_filter_date"> | 
				
			|||
								<label class="custom-date" for="date_from">Start Date :</label> | 
				
			|||
								<div class="form-group custom-date"> | 
				
			|||
									<div class="o_datepicker" aria-atomic="true" id="datepicker10" data-target-input="nearest"> | 
				
			|||
										<input type="text" id="date_from"></input> | 
				
			|||
										<span class="o_datepicker_button"></span> | 
				
			|||
									</div> | 
				
			|||
								</div> | 
				
			|||
								<label class="custom-date" for="date_to">End Date :</label> | 
				
			|||
								<div class="form-group custom-date"> | 
				
			|||
									<div class="o_datepicker" aria-atomic="true" id="datepicker11" data-target-input="nearest"> | 
				
			|||
										<input type="text" id="date_to"></input> | 
				
			|||
										<span class="o_datepicker_button"></span> | 
				
			|||
									</div> | 
				
			|||
								</div> | 
				
			|||
							</div> | 
				
			|||
						</div> | 
				
			|||
					</div> | 
				
			|||
					<div class="py-search-journals"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Journals: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-menu journal" name="states[]" multiple="multiple"> | 
				
			|||
							<b role="menuitem" class="dropdown-item-text"> | 
				
			|||
								<t t-esc="filter_data.company_name"/> | 
				
			|||
							</b> | 
				
			|||
							<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="py-search-accounts"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Accounts: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-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="py-search-accounts-tag"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Account Tags: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-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="py-search-analytics"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Analytic: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-menu analytic" name="states[]" multiple="multiple"> | 
				
			|||
							<t t-foreach="filter_data.analytics_list" t-as="analytic"> | 
				
			|||
								<option t-attf-value="{{analytic[0]}}"> | 
				
			|||
									<t t-esc="analytic[1]"/> | 
				
			|||
								</option> | 
				
			|||
							</t> | 
				
			|||
						</select> | 
				
			|||
						<span id="analic_res"></span> | 
				
			|||
					</div> | 
				
			|||
					<div class="py-search-analytic-tag"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Analytic Tags: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-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="py-search-entries"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-filter"></span> | 
				
			|||
Options: | 
				
			|||
						</a> | 
				
			|||
						<select id="entries" class="dropdown-menu py-filters-menu entries"> | 
				
			|||
								<option value="all">All Entries </option> | 
				
			|||
								<option value="posted">Posted Entries</option> | 
				
			|||
 | 
				
			|||
						</select> | 
				
			|||
						<span id="post_res"></span> | 
				
			|||
					</div> | 
				
			|||
				</div> | 
				
			|||
			</div> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
</templates> | 
				
			|||
@ -0,0 +1,282 @@ | 
				
			|||
<?xml version="1.0" encoding="UTF-8"?> | 
				
			|||
<templates xml:space="preserve"> | 
				
			|||
	<t t-name="CashBook"> | 
				
			|||
		<div class="container-cb"> | 
				
			|||
			<div> | 
				
			|||
				<div class="cb-filter"></div> | 
				
			|||
			</div> | 
				
			|||
			<div class="container-cb-data"> | 
				
			|||
				<div class="container-cb-main"></div> | 
				
			|||
			</div> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
	<t t-name="CashBookData"> | 
				
			|||
		<div> | 
				
			|||
			<table cellspacing="0" width="100%"> | 
				
			|||
				<thead> | 
				
			|||
					<tr> | 
				
			|||
						<th colspan="6">Account</th> | 
				
			|||
						<th class="amt">Debit</th> | 
				
			|||
						<th class="amt">Credit</th> | 
				
			|||
						<th class="amt">Balance</th> | 
				
			|||
						<th></th> | 
				
			|||
					</tr> | 
				
			|||
				</thead> | 
				
			|||
				<tbody> | 
				
			|||
					<t t-foreach="account_data" t-as="account"> | 
				
			|||
						<t t-set="common_id" t-value=""/> | 
				
			|||
						<t t-if="account_data[account]['count']"> | 
				
			|||
							<tr style="border: 1.5px solid black;" class="cb-line" | 
				
			|||
                                data-toggle="collapse" | 
				
			|||
                                t-att-data-account-id="account_data[account]['id']" | 
				
			|||
                                t-attf-data-target=".a{{account_data[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_data[account]['code']"/> | 
				
			|||
                                        - | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
										<t t-esc="account_data[account]['name']"/> | 
				
			|||
									</span> | 
				
			|||
								</td> | 
				
			|||
								<td class="amt"> | 
				
			|||
									<t t-raw="account_data[account]['debit']"/> | 
				
			|||
								</td> | 
				
			|||
								<td class="amt"> | 
				
			|||
									<t t-raw="account_data[account]['credit']"/> | 
				
			|||
								</td> | 
				
			|||
								<td class="amt"> | 
				
			|||
									<t t-raw="account_data[account]['balance']"/> | 
				
			|||
								</td> | 
				
			|||
								<td class="amt"></td> | 
				
			|||
								<t t-set="common_id" t-value="'a'+account_data[account]['id']"/> | 
				
			|||
							</tr> | 
				
			|||
						</t> | 
				
			|||
						<tr t-attf-class="collapse a{{account_data[account]['id']}}"> | 
				
			|||
							<td colspan="10"> | 
				
			|||
								<ul> | 
				
			|||
									<t t-if="!account_data[account]['single_page']"> | 
				
			|||
										<t t-foreach="account_data[account]['pages']" t-as="i"> | 
				
			|||
											<li> | 
				
			|||
												<a | 
				
			|||
                                                   t-att-data-page-number="i" | 
				
			|||
                                                   t-att-data-count="account_data[account]['count']" | 
				
			|||
                                                   t-att-data-account-id="account_data[account]['id']"> | 
				
			|||
													<t t-esc="i"/> | 
				
			|||
												</a> | 
				
			|||
											</li> | 
				
			|||
										</t> | 
				
			|||
									</t> | 
				
			|||
								</ul> | 
				
			|||
							</td> | 
				
			|||
						</tr> | 
				
			|||
					</t> | 
				
			|||
				</tbody> | 
				
			|||
			</table> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
	<t t-name="FilterSectionCB"> | 
				
			|||
		<div class="py-control-div"> | 
				
			|||
			<ol class="gl-breadcrumb"> | 
				
			|||
				<li>Cash Book</li> | 
				
			|||
			</ol> | 
				
			|||
		</div> | 
				
			|||
		<div class="py-control-div"> | 
				
			|||
			<div class="py-cntrl-left"> | 
				
			|||
				<div class="py-ctrl-buttons"> | 
				
			|||
					<button type="button" class="btn py-btn-primary" id="pdf" action="print_pdf" style="position: relative;">Print (PDF)</button> | 
				
			|||
					<button type="button" class="btn py-btn-primary" id="xlsx" action="print_xlsx" style="position: relative;">Export (XLSX)</button> | 
				
			|||
				</div> | 
				
			|||
			</div> | 
				
			|||
			<div class="py_cntrl_right"> | 
				
			|||
				<div class="py-search-buttons"> | 
				
			|||
					<button type="button" id="filter_apply_button" class="btn py-btn-secondary" action="apply_filter" style="position: relative;">Apply</button> | 
				
			|||
					<div class="py-search-btn-date"> | 
				
			|||
						<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> | 
				
			|||
Custom | 
				
			|||
						</a> | 
				
			|||
						<div class="dropdown-menu py-filters-menu" role="menu"> | 
				
			|||
							<div class="o_foldable_menu o_closed_menu o_account_report_search" data-filter="custom_filter_date"> | 
				
			|||
								<label class="custom-date" for="date_from">Start Date :</label> | 
				
			|||
								<div class="form-group custom-date"> | 
				
			|||
									<div class="o_datepicker" aria-atomic="true" id="datepicker10" data-target-input="nearest"> | 
				
			|||
										<input type="text" id="date_from"></input> | 
				
			|||
										<span class="o_datepicker_button"></span> | 
				
			|||
									</div> | 
				
			|||
								</div> | 
				
			|||
								<label class="custom-date" for="date_to">End Date :</label> | 
				
			|||
								<div class="form-group custom-date"> | 
				
			|||
									<div class="o_datepicker" aria-atomic="true" id="datepicker11" data-target-input="nearest"> | 
				
			|||
										<input type="text" id="date_to"></input> | 
				
			|||
										<span class="o_datepicker_button"></span> | 
				
			|||
									</div> | 
				
			|||
								</div> | 
				
			|||
							</div> | 
				
			|||
						</div> | 
				
			|||
					</div> | 
				
			|||
					<div class="py-search-journals"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Journals: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-menu journal" name="states[]" multiple="multiple"> | 
				
			|||
							<b role="menuitem" class="dropdown-item-text"> | 
				
			|||
								<t t-esc="filter_data.company_name"/> | 
				
			|||
							</b> | 
				
			|||
							<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="py-search-accounts"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Accounts: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-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="py-search-accounts-tag"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Account Tags: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-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="py-search-analytics"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Analytic: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-menu analytic" name="states[]" multiple="multiple"> | 
				
			|||
							<t t-foreach="filter_data.analytics_list" t-as="analytic"> | 
				
			|||
								<option t-attf-value="{{analytic[0]}}"> | 
				
			|||
									<t t-esc="analytic[1]"/> | 
				
			|||
								</option> | 
				
			|||
							</t> | 
				
			|||
						</select> | 
				
			|||
						<span id="analic_res"></span> | 
				
			|||
					</div> | 
				
			|||
					<div class="py-search-analytic-tag"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Analytic Tags: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-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="py-search-entries"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-filter"></span> | 
				
			|||
Options: | 
				
			|||
						</a> | 
				
			|||
						<select id="entries" class="dropdown-menu py-filters-menu entries"> | 
				
			|||
								<option value="all">All Entries </option> | 
				
			|||
								<option value="posted">Posted Entries</option> | 
				
			|||
 | 
				
			|||
						</select> | 
				
			|||
						<span id="post_res"></span> | 
				
			|||
					</div> | 
				
			|||
				</div> | 
				
			|||
			</div> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
	<t t-name="SubSectionCB"> | 
				
			|||
		<div class="cb-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="amt">Debit</th> | 
				
			|||
						<th class="amt">Credit</th> | 
				
			|||
						<th class="amt">Balance</th> | 
				
			|||
					</tr> | 
				
			|||
				</thead> | 
				
			|||
				<tbody> | 
				
			|||
					<t t-foreach="account_data" t-as="account_line"> | 
				
			|||
						<t t-set="style" t-value="''"/> | 
				
			|||
						<t t-if="account_line.move_name == 'Initial Balance'"> | 
				
			|||
							<t t-set="style" t-value="'font-style: italic;'"/></t> | 
				
			|||
						<t t-if="account_line.move_name == 'Ending Balance'"> | 
				
			|||
							<t t-set="style" t-value="'font-style: italic;'"/></t> | 
				
			|||
						<tr> | 
				
			|||
							<td> | 
				
			|||
								<t t-if="account_line.ldate"> | 
				
			|||
									<div class="dropdown dropdown-toggle"> | 
				
			|||
										<a data-toggle="dropdown" href="#"> | 
				
			|||
											<span class="caret"></span> | 
				
			|||
											<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-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> | 
				
			|||
							<td t-att-style="style" class="amt"> | 
				
			|||
								<t t-raw="account_line.debit"/> | 
				
			|||
							</td> | 
				
			|||
							<td t-att-style="style" class="amt"> | 
				
			|||
								<t t-raw="account_line.credit"/> | 
				
			|||
							</td> | 
				
			|||
							<td t-att-style="style" class="amt"> | 
				
			|||
								<t t-raw="account_line.balance"/> | 
				
			|||
							</td> | 
				
			|||
						</tr> | 
				
			|||
					</t> | 
				
			|||
				</tbody> | 
				
			|||
			</table> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
</templates> | 
				
			|||
@ -0,0 +1,306 @@ | 
				
			|||
<?xml version="1.0" encoding="UTF-8"?> | 
				
			|||
<templates xml:space="preserve"> | 
				
			|||
	<t t-name="CashFlow"> | 
				
			|||
		<div class="container-cf"> | 
				
			|||
			<div> | 
				
			|||
				<div class="cf-filter"></div> | 
				
			|||
			</div> | 
				
			|||
			<div class="container-cf-data"> | 
				
			|||
				<div class="container-cf-main"></div> | 
				
			|||
			</div> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
	<t t-name="CashFlowData"> | 
				
			|||
		<div> | 
				
			|||
			<table cellspacing="0" width="100%"> | 
				
			|||
				<thead> | 
				
			|||
					<tr> | 
				
			|||
						<th colspan="6">Name</th> | 
				
			|||
						<th class="amd">Cash In</th> | 
				
			|||
						<th class="amd">Cash Out</th> | 
				
			|||
						<th class="amd">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> | 
				
			|||
								<td class="amd"> | 
				
			|||
									<t t-raw="account['total_debit']"/> | 
				
			|||
								</td> | 
				
			|||
								<td class="amd"> | 
				
			|||
									<t t-raw="account['total_credit']"/> | 
				
			|||
								</td> | 
				
			|||
								<td class="amd"> | 
				
			|||
									<t t-raw="account['total_balance']"/> | 
				
			|||
								</td> | 
				
			|||
							</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> | 
				
			|||
								<td class="amd"> | 
				
			|||
									<t t-raw="account['total_debit']"/> | 
				
			|||
								</td> | 
				
			|||
								<td class="amd"> | 
				
			|||
									<t t-raw="account['total_credit']"/> | 
				
			|||
								</td> | 
				
			|||
								<td class="amd"> | 
				
			|||
									<t t-raw="account['total_balance']"/> | 
				
			|||
								</td> | 
				
			|||
							</tr> | 
				
			|||
						</t> | 
				
			|||
						<tr t-attf-class="collapse a{{account['id']}}"> | 
				
			|||
							<td colspan="10"> | 
				
			|||
								<ul> | 
				
			|||
 | 
				
			|||
								</ul> | 
				
			|||
							</td> | 
				
			|||
						</tr> | 
				
			|||
					</t> | 
				
			|||
				</tbody> | 
				
			|||
 | 
				
			|||
 | 
				
			|||
			</table> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
 | 
				
			|||
	<t t-name="SubSectionCF"> | 
				
			|||
<!--		<div class="cf-table-div">--> | 
				
			|||
 | 
				
			|||
			<table cellspacing="0" width="100%"> | 
				
			|||
				<thead> | 
				
			|||
					<tr> | 
				
			|||
						<th colspan="6">Name</th> | 
				
			|||
						<th class="amd">Cash In</th> | 
				
			|||
						<th class="amd">Cash Out</th> | 
				
			|||
						<th class="amd">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="data_currency.company_currency_position == 'before'"> | 
				
			|||
										<td class="amd"> | 
				
			|||
											<t t-esc="data_currency.company_currency_symbol"/><t t-raw="account_line.total_debit"/> | 
				
			|||
										</td> | 
				
			|||
										<td class="amd"> | 
				
			|||
											<t t-esc="data_currency.company_currency_symbol"/><t t-raw="account_line.total_credit"/> | 
				
			|||
										</td> | 
				
			|||
										<td class="amd"> | 
				
			|||
											<t t-esc="data_currency.company_currency_symbol"/><t t-raw="account_line.balance"/> | 
				
			|||
										</td> | 
				
			|||
										</t> | 
				
			|||
										<t t-if="data_currency.company_currency_position == 'after'"> | 
				
			|||
										<td class="amd"> | 
				
			|||
											<t t-raw="account_line.total_debit"/><t t-esc="data_currency.company_currency_symbol"/> | 
				
			|||
										</td> | 
				
			|||
										<td class="amd"> | 
				
			|||
											<t t-raw="account_line.total_credit"/><t t-esc="data_currency.company_currency_symbol"/> | 
				
			|||
										</td> | 
				
			|||
										<td class="amd"> | 
				
			|||
											<t t-raw="account_line.balance"/><t t-esc="data_currency.company_currency_symbol"/> | 
				
			|||
										</td> | 
				
			|||
										</t> | 
				
			|||
									</tr> | 
				
			|||
								</t> | 
				
			|||
							</t> | 
				
			|||
						</t> | 
				
			|||
				</tbody> | 
				
			|||
 | 
				
			|||
 | 
				
			|||
			</table> | 
				
			|||
 | 
				
			|||
<!--		</div>--> | 
				
			|||
	</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="data_currency.company_currency_position == 'before'"> | 
				
			|||
									<th class="amd" style="left: 100px;"><t t-esc="data_currency.company_currency_symbol"/><t t-esc="data.total_debit"/></th> | 
				
			|||
									<th class="amd"><t t-esc="data_currency.company_currency_symbol"/><t t-esc="data.total_credit"/></th> | 
				
			|||
									<th class="amd"><t t-esc="data_currency.company_currency_symbol"/><t t-esc="data.total_balance"/></th> | 
				
			|||
									</t> | 
				
			|||
									<t t-if="data_currency.company_currency_position == 'after'"> | 
				
			|||
									<th class="amd" style="left: 100px;"><t t-esc="data.total_debit"/><t t-esc="data_currency.company_currency_symbol"/></th> | 
				
			|||
									<th class="amd"><t t-esc="data.total_credit"/><t t-esc="data_currency.company_currency_symbol"/></th> | 
				
			|||
									<th class="amd"><t t-esc="data.total_balance"/><t t-esc="data_currency.company_currency_symbol"/></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="data_currency.company_currency_position == 'before'"> | 
				
			|||
							<td class="amd"> | 
				
			|||
								<t t-esc="data_currency.company_currency_symbol"/> | 
				
			|||
								<t t-raw="account_line.total_debit"/> | 
				
			|||
							</td> | 
				
			|||
							<td class="amd"> | 
				
			|||
								<t t-esc="data_currency.company_currency_symbol"/> | 
				
			|||
								<t t-raw="account_line.total_credit"/> | 
				
			|||
							</td> | 
				
			|||
							<td class="amd"> | 
				
			|||
								<t t-esc="data_currency.company_currency_symbol"/> | 
				
			|||
								<t t-raw="account_line.balance"/> | 
				
			|||
							</td> | 
				
			|||
							</t> | 
				
			|||
							<t t-if="data_currency.company_currency_position == 'after'"> | 
				
			|||
							<td class="amd"> | 
				
			|||
								<t t-if="account_line.total_debit==0"/> | 
				
			|||
								<t t-esc="data_currency.company_currency_symbol"/> | 
				
			|||
							</td> | 
				
			|||
							<td class="amd"> | 
				
			|||
 | 
				
			|||
								<t t-raw="account_line.total_credit"/> | 
				
			|||
								<t t-esc="data_currency.company_currency_symbol"/> | 
				
			|||
							</td> | 
				
			|||
							<td class="amd"> | 
				
			|||
 | 
				
			|||
								<t t-raw="account_line.balance"/> | 
				
			|||
								<t t-esc="data_currency.company_currency_symbol"/> | 
				
			|||
							</td> | 
				
			|||
								</t> | 
				
			|||
								</tr> | 
				
			|||
								</t> | 
				
			|||
							</t> | 
				
			|||
 | 
				
			|||
							<tr t-attf-class="collapse a{{data.id}}"> | 
				
			|||
 | 
				
			|||
								<td colspan=""></td> | 
				
			|||
							</tr> | 
				
			|||
<!--						</t>--> | 
				
			|||
							</t> | 
				
			|||
						</t> | 
				
			|||
					</t> | 
				
			|||
				</thead> | 
				
			|||
			</table> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
		<t t-name="FilterSectionCF"> | 
				
			|||
		<div class="py-control-div"> | 
				
			|||
			<span class="cf-breadcrumb"> | 
				
			|||
				<li>Cash Flow Statement</li> | 
				
			|||
			</span> | 
				
			|||
		</div> | 
				
			|||
		<div class="py-control-div"> | 
				
			|||
			<div class="py-cntrl-left"> | 
				
			|||
				<div class="py-ctrl-buttons"> | 
				
			|||
					<button type="button" class="btn py-btn-primary" id="pdf" action="print_pdf" style="position: relative;">Print (PDF)</button> | 
				
			|||
					<button type="button" class="btn py-btn-primary" id="xlsx" action="print_xlsx" style="position: relative;">Export (XLSX)</button> | 
				
			|||
				</div> | 
				
			|||
			</div> | 
				
			|||
			<div class="py_cntrl_right"> | 
				
			|||
				<div class="py-search-buttons"> | 
				
			|||
					<button type="button" id="filter_apply_button" class="btn py-btn-secondary" action="apply_filter" style="position: relative;">Apply</button> | 
				
			|||
					<div class="py-search-btn-date"> | 
				
			|||
						<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> | 
				
			|||
Custom | 
				
			|||
						</a> | 
				
			|||
						<div class="dropdown-menu py-filters-menu" role="menu"> | 
				
			|||
							<div class="o_foldable_menu o_closed_menu o_account_report_search" data-filter="custom_filter_date"> | 
				
			|||
								<label class="custom-date" for="date_from">Start Date :</label> | 
				
			|||
								<div class="form-group custom-date"> | 
				
			|||
									<div class="o_datepicker" aria-atomic="true" id="datepicker10" data-target-input="nearest"> | 
				
			|||
										<input type="text" id="date_from"></input> | 
				
			|||
										<span class="o_datepicker_button"></span> | 
				
			|||
									</div> | 
				
			|||
								</div> | 
				
			|||
								<label class="custom-date" for="date_to">End Date :</label> | 
				
			|||
								<div class="form-group custom-date"> | 
				
			|||
									<div class="o_datepicker" aria-atomic="true" id="datepicker11" data-target-input="nearest"> | 
				
			|||
										<input type="text" id="date_to"></input> | 
				
			|||
										<span class="o_datepicker_button"></span> | 
				
			|||
									</div> | 
				
			|||
								</div> | 
				
			|||
							</div> | 
				
			|||
						</div> | 
				
			|||
					</div> | 
				
			|||
					<div class="py-search-journals"> | 
				
			|||
 | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Target Moves: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-menu target-moves" name="states[]" > | 
				
			|||
							<option value="all">All Entries</option> | 
				
			|||
							<option value="posted">Posted</option> | 
				
			|||
 | 
				
			|||
						</select> | 
				
			|||
						<span id="target_res"> </span> | 
				
			|||
					</div> | 
				
			|||
					<div class="py-search-reconciled"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Level: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-menu level" id="level" name="states[]" multiple="multiple"> | 
				
			|||
							<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> | 
				
			|||
	</t> | 
				
			|||
</templates> | 
				
			|||
@ -0,0 +1,239 @@ | 
				
			|||
<?xml version="1.0" encoding="UTF-8"?> | 
				
			|||
<templates xml:space="preserve"> | 
				
			|||
	<t t-name="DayBook"> | 
				
			|||
		<div class="container-db"> | 
				
			|||
			<div> | 
				
			|||
				<div class="db-filter"></div> | 
				
			|||
			</div> | 
				
			|||
            <div class="container-db-data"> | 
				
			|||
				<div class="container-db-main"></div> | 
				
			|||
			</div> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
    <t t-name="DayBookData"> | 
				
			|||
		<div> | 
				
			|||
			<table cellspacing="0" width="100%"> | 
				
			|||
				<thead> | 
				
			|||
					<tr> | 
				
			|||
						<th colspan="6">Date</th> | 
				
			|||
                        <th class="text-right" >Debit</th> | 
				
			|||
                        <th class="text-right">Credit</th> | 
				
			|||
                        <th class="text-right">Balance</th> | 
				
			|||
                        <th></th> | 
				
			|||
					</tr> | 
				
			|||
				</thead> | 
				
			|||
                <tbody> | 
				
			|||
					<t t-foreach="account_data" t-as="account"> | 
				
			|||
						<t t-set="common_id" t-value=""/> | 
				
			|||
                        <t t-if="account_data[account]['count']"> | 
				
			|||
							<tr style="border: 1.5px solid black;" class="db-line" | 
				
			|||
                                data-toggle="collapse" | 
				
			|||
                                t-att-data-account-id="account_data[account]['id']" | 
				
			|||
                                t-attf-data-target=".a{{account_data[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_data[account]['date']"/> | 
				
			|||
									</span> | 
				
			|||
								</td> | 
				
			|||
                                <td class="text-right" > | 
				
			|||
									<t t-raw="account_data[account]['debit']"/> | 
				
			|||
								</td> | 
				
			|||
                                <td class="text-right"> | 
				
			|||
									<t t-raw="account_data[account]['credit']"/> | 
				
			|||
								</td> | 
				
			|||
                                <td class="text-right"> | 
				
			|||
									<t t-raw="account_data[account]['balance']"/> | 
				
			|||
								</td> | 
				
			|||
                                <td class="amt"></td> | 
				
			|||
                                <t t-set="common_id" t-value="'a'+account_data[account]['id']"/> | 
				
			|||
							</tr> | 
				
			|||
						</t> | 
				
			|||
                        <tr t-attf-class="collapse a{{account_data[account]['id']}}"> | 
				
			|||
							<td colspan="10"> | 
				
			|||
								<ul> | 
				
			|||
									<t t-if="!account_data[account]['single_page']"> | 
				
			|||
										<t t-foreach="account_data[account]['pages']" t-as="i"> | 
				
			|||
											<li> | 
				
			|||
												<a | 
				
			|||
                                                        t-att-data-page-number="i" | 
				
			|||
                                                        t-att-data-count="account_data[account]['count']" | 
				
			|||
                                                        t-att-data-account-id="account_data[account]['id']"> | 
				
			|||
													<t t-esc="i"/> | 
				
			|||
												</a> | 
				
			|||
											</li> | 
				
			|||
										</t> | 
				
			|||
									</t> | 
				
			|||
								</ul> | 
				
			|||
							</td> | 
				
			|||
						</tr> | 
				
			|||
					</t> | 
				
			|||
				</tbody> | 
				
			|||
			</table> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
    <t t-name="FilterSectiondb"> | 
				
			|||
		<div class="py-control-div"> | 
				
			|||
			<ol class="db-breadcrumb"> | 
				
			|||
				<li>Day Book</li> | 
				
			|||
			</ol> | 
				
			|||
		</div> | 
				
			|||
        <div class="py-control-div"> | 
				
			|||
			<div class="py-cntrl-left"> | 
				
			|||
				<div class="py-ctrl-buttons"> | 
				
			|||
					<button type="button" class="btn py-btn-primary" id="pdf" action="print_pdf" | 
				
			|||
                            style="position: relative;">Print (PDF)</button> | 
				
			|||
                    <button type="button" class="btn py-btn-primary" id="xlsx" action="print_xlsx" | 
				
			|||
                            style="position: relative;">Export (XLSX)</button> | 
				
			|||
				</div> | 
				
			|||
			</div> | 
				
			|||
            <div class="py_cntrl_right"> | 
				
			|||
				<div class="py-search-buttons"> | 
				
			|||
					<button type="button" id="filter_apply_button" class="btn py-btn-secondary" action="apply_filter" | 
				
			|||
                            style="position: relative;">Apply</button> | 
				
			|||
                    <div class="py-search-btn-date"> | 
				
			|||
						<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> | 
				
			|||
                            Custom | 
				
			|||
						</a> | 
				
			|||
                        <div class="dropdown-menu py-filters-menu" role="menu"> | 
				
			|||
							<div class="o_foldable_menu o_closed_menu o_account_report_search" | 
				
			|||
                                 data-filter="custom_filter_date"> | 
				
			|||
								<label class="custom-date" for="date_from">Start Date :</label> | 
				
			|||
                                <div class="form-group custom-date"> | 
				
			|||
									<div class="o_datepicker" aria-atomic="true" id="datepicker10" | 
				
			|||
                                         data-target-input="nearest"> | 
				
			|||
										<input type="text" id="date_from"></input> | 
				
			|||
                                        <span class="o_datepicker_button"></span> | 
				
			|||
									</div> | 
				
			|||
								</div> | 
				
			|||
                                <label class="custom-date" for="date_to">End Date :</label> | 
				
			|||
                                <div class="form-group custom-date"> | 
				
			|||
									<div class="o_datepicker" aria-atomic="true" id="datepicker11" | 
				
			|||
                                         data-target-input="nearest"> | 
				
			|||
										<input type="text" id="date_to"></input> | 
				
			|||
                                        <span class="o_datepicker_button"></span> | 
				
			|||
									</div> | 
				
			|||
								</div> | 
				
			|||
							</div> | 
				
			|||
						</div> | 
				
			|||
					</div> | 
				
			|||
                    <div class="py-search-journals"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
                            Journals: | 
				
			|||
						</a> | 
				
			|||
                        <select class="dropdown-menu py-filters-menu journal" name="states[]" multiple="multiple"> | 
				
			|||
							<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="py-search-accounts"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
                            Accounts: | 
				
			|||
						</a> | 
				
			|||
                        <select class="dropdown-menu py-filters-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="py-search-entries"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-filter"/> | 
				
			|||
                            Target Moves:				</a> | 
				
			|||
                        <select id="entries" | 
				
			|||
                                class="dropdown-menu py-filters-menu entries" | 
				
			|||
                                name="states[]"> | 
				
			|||
							<option value="all">All Entries </option> | 
				
			|||
                            <option value="posted">Posted Entries</option> | 
				
			|||
						</select> | 
				
			|||
                        <span id="target_res"></span> | 
				
			|||
					</div> | 
				
			|||
				</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 class="text-right">Debit</th> | 
				
			|||
                        <th class="text-right">Credit</th> | 
				
			|||
                        <th class="text-right">Balance</th> | 
				
			|||
					</tr> | 
				
			|||
				</thead> | 
				
			|||
                <tbody> | 
				
			|||
					<t t-foreach="account_data" t-as="account_line"> | 
				
			|||
						<t t-set="style" t-value="''"/> | 
				
			|||
                        <t t-if="account_line.move_name == 'Initial Balance'"> | 
				
			|||
							<t t-set="style" t-value="'font-style: italic;'"/></t> | 
				
			|||
                        <t t-if="account_line.move_name == 'Ending Balance'"> | 
				
			|||
							<t t-set="style" t-value="'font-style: italic;'"/></t> | 
				
			|||
                        <t t-if="date_id == account_line.ldate"> | 
				
			|||
						<tr> | 
				
			|||
							<td> | 
				
			|||
								<t t-if="account_line.ldate"> | 
				
			|||
									<div class="dropdown dropdown-toggle"> | 
				
			|||
										<a data-toggle="dropdown" href="#"> | 
				
			|||
											<span class="caret"></span> | 
				
			|||
                                            <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-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> | 
				
			|||
                            <td t-att-style="style" class="text-right"> | 
				
			|||
								<t t-raw="account_line.debit"/> | 
				
			|||
							</td> | 
				
			|||
                            <td t-att-style="style" class="text-right"> | 
				
			|||
								<t t-raw="account_line.credit"/> | 
				
			|||
							</td> | 
				
			|||
                            <td t-att-style="style" class="text-right"> | 
				
			|||
								<t t-raw="account_line.balance"/> | 
				
			|||
							</td> | 
				
			|||
						</tr> | 
				
			|||
						</t> | 
				
			|||
					</t> | 
				
			|||
				</tbody> | 
				
			|||
			</table> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
</templates> | 
				
			|||
@ -0,0 +1,287 @@ | 
				
			|||
<?xml version="1.0" encoding="UTF-8"?> | 
				
			|||
<templates xml:space="preserve"> | 
				
			|||
	<t t-name="PartnerLedger"> | 
				
			|||
		<div class="container-pl"> | 
				
			|||
			<div> | 
				
			|||
				<div class="pl-filter"></div> | 
				
			|||
			</div> | 
				
			|||
			<div class="container-pl-data"> | 
				
			|||
				<div class="container-pl-main"></div> | 
				
			|||
			</div> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
	<t t-name="PartnerLedgerData"> | 
				
			|||
		<div> | 
				
			|||
			<table cellspacing="0" width="100%"> | 
				
			|||
				<thead> | 
				
			|||
					<tr> | 
				
			|||
						<th colspan="6">Partner</th> | 
				
			|||
						<th class = "text-right">Debit</th> | 
				
			|||
						<th class = "text-right">Credit</th> | 
				
			|||
						<th class = "text-right">Balance</th> | 
				
			|||
						<th></th> | 
				
			|||
					</tr> | 
				
			|||
				</thead> | 
				
			|||
				<tbody> | 
				
			|||
					<t t-foreach="account_data" t-as="account"> | 
				
			|||
						<t t-set="common_id" t-value=""/> | 
				
			|||
						<t t-if="account_data[account]['count']"> | 
				
			|||
							<tr style="border: 1.5px solid black;" class="pl-line" | 
				
			|||
                                data-toggle="collapse" | 
				
			|||
                                t-att-data-account-id="account_data[account]['id']" | 
				
			|||
                                t-attf-data-target=".a{{account_data[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_data[account]['name']"/> | 
				
			|||
									</span> | 
				
			|||
								</td> | 
				
			|||
								<td class="amt"> | 
				
			|||
									<t t-raw="account_data[account]['debit']"/> | 
				
			|||
								</td> | 
				
			|||
								<td class="amt"> | 
				
			|||
									<t t-raw="account_data[account]['credit']"/> | 
				
			|||
								</td> | 
				
			|||
								<td class="amt"> | 
				
			|||
									<t t-raw="account_data[account]['balance']"/> | 
				
			|||
								</td> | 
				
			|||
								<td class="amt"></td> | 
				
			|||
								<t t-set="common_id" t-value="'a'+account_data[account]['id']"/> | 
				
			|||
							</tr> | 
				
			|||
						</t> | 
				
			|||
						<tr t-attf-class="collapse a{{account_data[account]['id']}}"> | 
				
			|||
							<td colspan="10"> | 
				
			|||
								<ul> | 
				
			|||
									<t t-if="!account_data[account]['single_page']"> | 
				
			|||
										<t t-foreach="account_data[account]['pages']" t-as="i"> | 
				
			|||
											<li> | 
				
			|||
												<a | 
				
			|||
                                                   t-att-data-page-number="i" | 
				
			|||
                                                   t-att-data-count="account_data[account]['count']" | 
				
			|||
                                                   t-att-data-account-id="account_data[account]['id']"> | 
				
			|||
													<t t-esc="i"/> | 
				
			|||
												</a> | 
				
			|||
											</li> | 
				
			|||
										</t> | 
				
			|||
									</t> | 
				
			|||
								</ul> | 
				
			|||
							</td> | 
				
			|||
						</tr> | 
				
			|||
					</t> | 
				
			|||
				</tbody> | 
				
			|||
			</table> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
	<t t-name="FilterSectionPl"> | 
				
			|||
		<div class="py-control-div"> | 
				
			|||
			<ol class="pl-breadcrumb"> | 
				
			|||
				<li>Partner Ledger</li> | 
				
			|||
			</ol> | 
				
			|||
		</div> | 
				
			|||
		<div class="py-control-div"> | 
				
			|||
			<div class="py-cntrl-left"> | 
				
			|||
				<div class="py-ctrl-buttons"> | 
				
			|||
					<button type="button" class="btn py-btn-primary" id="pdf" action="print_pdf" style="position: relative;">Print (PDF)</button> | 
				
			|||
					<button type="button" class="btn py-btn-primary" id="xlsx" action="print_xlsx" style="position: relative;">Export (XLSX)</button> | 
				
			|||
				</div> | 
				
			|||
			</div> | 
				
			|||
			<div class="py_cntrl_right"> | 
				
			|||
				<div class="py-search-buttons"> | 
				
			|||
					<button type="button" id="filter_apply_button" class="btn py-btn-secondary" action="apply_filter" style="position: relative;">Apply</button> | 
				
			|||
					<div class="py-search-btn-date"> | 
				
			|||
						<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> | 
				
			|||
Custom | 
				
			|||
						</a> | 
				
			|||
						<div class="dropdown-menu py-filters-menu" role="menu"> | 
				
			|||
							<div class="o_foldable_menu o_closed_menu o_account_report_search" data-filter="custom_filter_date"> | 
				
			|||
								<label class="custom-date" for="date_from">Start Date :</label> | 
				
			|||
								<div class="form-group custom-date"> | 
				
			|||
									<div class="o_datepicker" aria-atomic="true" id="datepicker10" data-target-input="nearest"> | 
				
			|||
										<input type="text" id="date_from"></input> | 
				
			|||
										<span class="o_datepicker_button"></span> | 
				
			|||
									</div> | 
				
			|||
								</div> | 
				
			|||
								<label class="custom-date" for="date_to">End Date :</label> | 
				
			|||
								<div class="form-group custom-date"> | 
				
			|||
									<div class="o_datepicker" aria-atomic="true" id="datepicker11" data-target-input="nearest"> | 
				
			|||
										<input type="text" id="date_to"></input> | 
				
			|||
										<span class="o_datepicker_button"></span> | 
				
			|||
									</div> | 
				
			|||
								</div> | 
				
			|||
							</div> | 
				
			|||
						</div> | 
				
			|||
					</div> | 
				
			|||
 | 
				
			|||
					<div class="py-search-journals"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Journals: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-menu journal" name="states[]" multiple="multiple"> | 
				
			|||
							<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="py-search-partners"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-users"></span> | 
				
			|||
Partners: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-menu partner" 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="py-search-reconciled"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Reconciliation Status: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-menu reconcile" name="states[]" multiple="multiple"> | 
				
			|||
							<option value="unreconciled">Unreconciled</option> | 
				
			|||
						</select> | 
				
			|||
																		<span id="reconciled_res"></span> | 
				
			|||
 | 
				
			|||
					</div> | 
				
			|||
					<div class="py-search-reconciled"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Acccount Type | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-menu type" name="states[]" multiple="multiple"> | 
				
			|||
							<option value="receivable">Receivable</option> | 
				
			|||
							<option value="payable">Payable</option> | 
				
			|||
						</select> | 
				
			|||
																		<span id="type_res"></span> | 
				
			|||
 | 
				
			|||
					</div> | 
				
			|||
					<div class="py-search-categories"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-filter"></span> | 
				
			|||
Partner tag: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-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="py-search-accounts"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Accounts: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-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="py-search-targetmoves"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Target Moves: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-menu target-moves" name="states[]"> | 
				
			|||
							<option value="all_entries">All Entries</option> | 
				
			|||
							<option value="posted_only">Posted Entries</option> | 
				
			|||
						</select> | 
				
			|||
						<span id="target_res"></span> | 
				
			|||
					</div> | 
				
			|||
				</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 class="text-right">Debit</th> | 
				
			|||
						<th class="text-right">Credit</th> | 
				
			|||
						<th class="text-right">Balance</th> | 
				
			|||
					</tr> | 
				
			|||
				</thead> | 
				
			|||
				<tbody> | 
				
			|||
					<t t-foreach="account_data" t-as="account_line"> | 
				
			|||
						<t t-set="style" t-value="''"/> | 
				
			|||
						<t t-if="account_line.move_name == 'Initial Balance'"> | 
				
			|||
							<t t-set="style" t-value="'font-style: italic;'"/></t> | 
				
			|||
						<t t-if="account_line.move_name == 'Ending Balance'"> | 
				
			|||
							<t t-set="style" t-value="'font-style: italic;'"/></t> | 
				
			|||
						<tr> | 
				
			|||
							<td> | 
				
			|||
								<t t-if="account_line.ldate"> | 
				
			|||
									<div class="dropdown dropdown-toggle"> | 
				
			|||
										<a data-toggle="dropdown" href="#"> | 
				
			|||
											<span class="caret"></span> | 
				
			|||
											<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-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.account_name"/>(<t t-esc="account_line.account_code"/>) | 
				
			|||
							</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> | 
				
			|||
							<td t-att-style="style" class="text-right" > | 
				
			|||
								<t t-raw="account_line.debit" style="text-align:right"/> | 
				
			|||
							</td> | 
				
			|||
							<td t-att-style="style" class="text-right"> | 
				
			|||
								<t t-raw="account_line.credit"/> | 
				
			|||
							</td> | 
				
			|||
							<td t-att-style="style" class="text-right"> | 
				
			|||
								<t t-raw="account_line.balance"/> | 
				
			|||
							</td> | 
				
			|||
						</tr> | 
				
			|||
					</t> | 
				
			|||
				</tbody> | 
				
			|||
			</table> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
</templates> | 
				
			|||
@ -0,0 +1,246 @@ | 
				
			|||
<?xml version="1.0" encoding="UTF-8"?> | 
				
			|||
<templates xml:space="preserve"> | 
				
			|||
	<t t-name="ProfitAndLoss"> | 
				
			|||
		<div class="container-pal"> | 
				
			|||
			<div> | 
				
			|||
				<div class="pal-filter"></div> | 
				
			|||
			</div> | 
				
			|||
			<div class="container-pal-data"> | 
				
			|||
				<div class="container-pal-main"></div> | 
				
			|||
			</div> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
	<t t-name="ProfitAndLossData"> | 
				
			|||
		<div> | 
				
			|||
			<table cellspacing="0" width="100%"> | 
				
			|||
 | 
				
			|||
				<thead> | 
				
			|||
 | 
				
			|||
					<tr> | 
				
			|||
						<th colspan="6" style="padding-top: 5px;"> </th> | 
				
			|||
						<th style="text-align: right;padding-right: 50px; padding-top: 15px;">Debit</th> | 
				
			|||
						<th style="text-align: right;padding-right: 50px; padding-top: 15px;">Credit</th> | 
				
			|||
						<th style="text-align: right;padding-right: 50px; padding-top: 15px;">Balance</th> | 
				
			|||
						<th></th> | 
				
			|||
					</tr> | 
				
			|||
				</thead> | 
				
			|||
				<tbody> | 
				
			|||
					<tr t-foreach="report_lines" t-as="a" style="border-bottom: double;"> | 
				
			|||
						<t t-if="a['level'] != 0"> | 
				
			|||
							<t t-if="a['code']"> | 
				
			|||
								<t t-foreach="account_data" t-as="account"> | 
				
			|||
									<t t-set="common_id" t-value=""/> | 
				
			|||
									<t t-if="account_data[account]['count']"> | 
				
			|||
										<t t-if="account_data[account]['code'] == a['code']"> | 
				
			|||
											<tr style="border-bottom: 1px solid black;" class="pal-line" | 
				
			|||
												data-toggle="collapse" | 
				
			|||
												t-att-data-account-id="account_data[account]['id']" | 
				
			|||
												t-attf-data-target=".a{{account_data[account]['id']}}"> | 
				
			|||
												<td colspan="6" style="border: 0px solid black;  padding-left: 50px;"> | 
				
			|||
													<span> | 
				
			|||
														<t t-esc="account_data[account]['code']"/> | 
				
			|||
														- | 
				
			|||
														<t t-esc="account_data[account]['name']"/> | 
				
			|||
													</span> | 
				
			|||
													<div class="py-search-btn-date"> | 
				
			|||
													<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="" aria-atomic="true" id="" data-target-input=""> | 
				
			|||
																		<li role="presentation"> | 
				
			|||
																			<a role="menuitem" t-att-data-account-id="account_data[account]['id']" class="open-gl" >View General Ledger</a> | 
				
			|||
																		</li> | 
				
			|||
																	</div> | 
				
			|||
																</div> | 
				
			|||
 | 
				
			|||
															</div> | 
				
			|||
														</div> | 
				
			|||
													</div> | 
				
			|||
 | 
				
			|||
												</td> | 
				
			|||
 | 
				
			|||
												<td class="amt" style="text-align: right;padding-right: 50px;"> | 
				
			|||
													<t t-raw="account_data[account]['debit']"/> | 
				
			|||
												</td> | 
				
			|||
												<td class="amt" style="text-align: right;padding-right: 50px;"> | 
				
			|||
													<t t-raw="account_data[account]['credit']"/> | 
				
			|||
												</td> | 
				
			|||
												<td class="amt" style="text-align: right;padding-right: 50px;"> | 
				
			|||
													<t t-raw="account_data[account]['balance']"/> | 
				
			|||
												</td> | 
				
			|||
												<td class="amt"></td> | 
				
			|||
												<t t-set="common_id" t-value="'a'+account_data[account]['id']"/> | 
				
			|||
											</tr> | 
				
			|||
										</t> | 
				
			|||
									</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;'"/> | 
				
			|||
								<t t-if="a['level'] == 1"> | 
				
			|||
									<t t-set="style" t-value="'padding: 5px;padding-left: 15px;'"/> | 
				
			|||
								</t> | 
				
			|||
								<t t-if="a['level'] > 2"> | 
				
			|||
									<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: 15px;padding-top: 25px;'"/> | 
				
			|||
									<t t-set="fr_padding" t-value="'padding-top: 25px; text-align: right;padding-right: 50px;'"/> | 
				
			|||
								</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']" t-att-style="style"/></td> | 
				
			|||
									<td t-att-style="fr_padding"><t t-esc="a['m_balance']" t-att-style="style"/></td> | 
				
			|||
								</tr> | 
				
			|||
 | 
				
			|||
 | 
				
			|||
							</t> | 
				
			|||
						</t> | 
				
			|||
					</tr> | 
				
			|||
				</tbody> | 
				
			|||
			</table> | 
				
			|||
 | 
				
			|||
 | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
	<t t-name="FilterSectionPAL"> | 
				
			|||
		<div class="py-control-div"> | 
				
			|||
			<ol class="pal-breadcrumb"> | 
				
			|||
				<li>Profit and Loss Report</li> | 
				
			|||
			</ol> | 
				
			|||
		</div> | 
				
			|||
		<div class="py-control-div"> | 
				
			|||
			<div class="py-cntrl-left"> | 
				
			|||
				<div class="py-ctrl-buttons"> | 
				
			|||
					<button type="button" class="btn py-btn-primary" id="pdf" action="print_pdf" style="position: relative;">Print (PDF)</button> | 
				
			|||
					<button type="button" class="btn py-btn-primary" id="xlsx" action="print_xlsx" style="position: relative;">Export (XLSX)</button> | 
				
			|||
				</div> | 
				
			|||
			</div> | 
				
			|||
			<div class="py_cntrl_right"> | 
				
			|||
				<div class="py-search-buttons"> | 
				
			|||
					<button type="button" id="filter_apply_button" class="btn py-btn-secondary" action="apply_filter" style="position: relative;">Apply</button> | 
				
			|||
					<div class="py-search-btn-date"> | 
				
			|||
						<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> | 
				
			|||
Custom | 
				
			|||
						</a> | 
				
			|||
						<div class="dropdown-menu py-filters-menu" role="menu"> | 
				
			|||
							<div class="o_foldable_menu o_closed_menu o_account_report_search" data-filter="custom_filter_date"> | 
				
			|||
								<label class="custom-date" for="date_from">Start Date :</label> | 
				
			|||
								<div class="form-group custom-date"> | 
				
			|||
									<div class="o_datepicker" aria-atomic="true" id="datepicker10" data-target-input="nearest"> | 
				
			|||
										<input type="text" id="date_from"></input> | 
				
			|||
										<span class="o_datepicker_button"></span> | 
				
			|||
									</div> | 
				
			|||
								</div> | 
				
			|||
								<label class="custom-date" for="date_to">End Date :</label> | 
				
			|||
								<div class="form-group custom-date"> | 
				
			|||
									<div class="o_datepicker" aria-atomic="true" id="datepicker11" data-target-input="nearest"> | 
				
			|||
										<input type="text" id="date_to"></input> | 
				
			|||
										<span class="o_datepicker_button"></span> | 
				
			|||
									</div> | 
				
			|||
								</div> | 
				
			|||
							</div> | 
				
			|||
						</div> | 
				
			|||
					</div> | 
				
			|||
					<div class="py-search-journals"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Journals: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-menu journal" name="states[]" multiple="multiple"> | 
				
			|||
							<b role="menuitem" class="dropdown-item-text"> | 
				
			|||
								<t t-esc="filter_data.company_name"/> | 
				
			|||
							</b> | 
				
			|||
							<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="py-search-accounts"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Accounts: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-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="py-search-accounts-tag"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Account Tags: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-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="py-search-analytics"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Analytic: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-menu analytic" name="states[]" multiple="multiple"> | 
				
			|||
							<t t-foreach="filter_data.analytics_list" t-as="analytic"> | 
				
			|||
								<option t-attf-value="{{analytic[0]}}"> | 
				
			|||
									<t t-esc="analytic[1]"/> | 
				
			|||
								</option> | 
				
			|||
							</t> | 
				
			|||
						</select> | 
				
			|||
						<span id="analic_res"></span> | 
				
			|||
					</div> | 
				
			|||
					<div class="py-search-analytic-tag"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Analytic Tags: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-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="py-search-entries"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-filter"></span> | 
				
			|||
Options: | 
				
			|||
						</a> | 
				
			|||
						<select id="entries" class="dropdown-menu py-filters-menu entries"> | 
				
			|||
								<option value="all">All Entries </option> | 
				
			|||
								<option value="posted">Posted Entries</option> | 
				
			|||
 | 
				
			|||
						</select> | 
				
			|||
						<span id="post_res"></span> | 
				
			|||
					</div> | 
				
			|||
				</div> | 
				
			|||
			</div> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
</templates> | 
				
			|||
@ -0,0 +1,190 @@ | 
				
			|||
<?xml version="1.0" encoding="UTF-8"?> | 
				
			|||
<templates xml:space="preserve"> | 
				
			|||
	<t t-name="TrialBalance"> | 
				
			|||
		<div class="container-tb"> | 
				
			|||
			<div> | 
				
			|||
				<div class="tb-filter"></div> | 
				
			|||
			</div> | 
				
			|||
			<div class="container-tb-data"> | 
				
			|||
				<div class="container-tb-main"></div> | 
				
			|||
			</div> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
    <t t-name="TrialBalanceData"> | 
				
			|||
		<div> | 
				
			|||
			<table cellspacing="0" width="100%"> | 
				
			|||
				<thead> | 
				
			|||
					<tr> | 
				
			|||
 | 
				
			|||
						<th colspan="6">Account</th> | 
				
			|||
						<t t-if="filter['date_from']"> | 
				
			|||
							<th class="amt">Initial Debit</th> | 
				
			|||
							<th class="amt">Initial Credit</th> | 
				
			|||
 | 
				
			|||
						</t> | 
				
			|||
						<th class="amt">Debit</th> | 
				
			|||
						<th class="amt">Credit</th> | 
				
			|||
						<th></th> | 
				
			|||
					</tr> | 
				
			|||
				</thead> | 
				
			|||
				<tbody> | 
				
			|||
					<t t-foreach="account_data" t-as="account"> | 
				
			|||
						<t t-set="common_id" t-value=""/> | 
				
			|||
						<t t-if="account_data[account]['count']"> | 
				
			|||
							<tr style="border: 1.5px solid black;" class="gl-line" | 
				
			|||
                                data-toggle="collapse" | 
				
			|||
                                t-att-data-account-id="account_data[account]['id']" | 
				
			|||
                                t-attf-data-target=".a{{account_data[account]['id']}}"> | 
				
			|||
								<td colspan="6" style="border: 0px solid black;"> | 
				
			|||
									<span> | 
				
			|||
										<t t-esc="account_data[account]['code']"/> | 
				
			|||
                                        - | 
				
			|||
										<t t-esc="account_data[account]['name']"/> | 
				
			|||
									</span> | 
				
			|||
									<div class="py-search-btn-date"> | 
				
			|||
									<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="" aria-atomic="true" id="" data-target-input=""> | 
				
			|||
														<li role="presentation"> | 
				
			|||
															<a role="menuitem" t-att-data-account-id="account_data[account]['id']" class="open-gl" >View General Ledger</a> | 
				
			|||
														</li> | 
				
			|||
													</div> | 
				
			|||
												</div> | 
				
			|||
 | 
				
			|||
											</div> | 
				
			|||
										</div> | 
				
			|||
									</div> | 
				
			|||
								</td> | 
				
			|||
								<t t-if="filter['date_from']"> | 
				
			|||
									<t t-foreach="account_data[account]['lines']" t-as="line"> | 
				
			|||
										<t t-if="(line['initial_bal'] == true and line['move_name'] == 'Initial Balance')"> | 
				
			|||
											<td class="amt"> | 
				
			|||
												<t t-raw="line['debit']"/> | 
				
			|||
											</td> | 
				
			|||
											<td class="amt"> | 
				
			|||
												<t t-raw="line['credit']"/> | 
				
			|||
											</td> | 
				
			|||
										</t> | 
				
			|||
									</t> | 
				
			|||
								</t> | 
				
			|||
								<td class="amt"> | 
				
			|||
									<t t-raw="account_data[account]['debit']"/> | 
				
			|||
								</td> | 
				
			|||
								<td class="amt"> | 
				
			|||
									<t t-raw="account_data[account]['credit']"/> | 
				
			|||
								</td> | 
				
			|||
 | 
				
			|||
								<t t-set="common_id" t-value="'a'+account_data[account]['id']"/> | 
				
			|||
							</tr> | 
				
			|||
						</t> | 
				
			|||
					</t> | 
				
			|||
							<td colspan="6" style="" class=""><strong>Total</strong></td> | 
				
			|||
							<t t-if="filter['date_from']"> | 
				
			|||
 | 
				
			|||
							<td class="amt" style=""><strong></strong></td> | 
				
			|||
							<td class="amt" style=""><strong></strong></td> | 
				
			|||
							</t> | 
				
			|||
							<td class="amt" style=""><strong><t t-esc="total_b['debit']"/></strong></td> | 
				
			|||
							<td class="amt" style=""><strong><t t-esc="total_b['credit']"/></strong></td> | 
				
			|||
 | 
				
			|||
				</tbody> | 
				
			|||
			</table> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
	<t t-name="FilterSectionTB"> | 
				
			|||
		<div class="py-control-div"> | 
				
			|||
			<ol class="tl-breadcrumb"> | 
				
			|||
				<li>Trial Balance</li> | 
				
			|||
			</ol> | 
				
			|||
		</div> | 
				
			|||
		<div class="py-control-div"> | 
				
			|||
			<div class="py-cntrl-left"> | 
				
			|||
				<div class="py-ctrl-buttons"> | 
				
			|||
					<button type="button" class="btn py-btn-primary" id="pdf" style="position: relative;">Print (PDF)</button> | 
				
			|||
					<button type="button" class="btn py-btn-primary" id="xlsx" style="position: relative;">Export (XLSX)</button> | 
				
			|||
				</div> | 
				
			|||
			</div> | 
				
			|||
			<div class="py_cntrl_right"> | 
				
			|||
				<div class="py-search-buttons"> | 
				
			|||
					<button type="button" id="filter_apply_button" class="btn py-btn-secondary" style="position: relative;">Apply</button> | 
				
			|||
					<div class="py-search-btn-date"> | 
				
			|||
						<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 py-filters-menu" role="menu"> | 
				
			|||
							<div class="o_foldable_menu o_closed_menu o_account_report_search" data-filter="custom_filter_date"> | 
				
			|||
								<label class="custom-date" for="date_from">Start Date :</label> | 
				
			|||
								<div class="form-group custom-date"> | 
				
			|||
									<div class="o_datepicker" aria-atomic="true" id="datepicker10" data-target-input="nearest"> | 
				
			|||
										<input type="text" id="date_from"></input> | 
				
			|||
										<span class="o_datepicker_button"></span> | 
				
			|||
									</div> | 
				
			|||
								</div> | 
				
			|||
								<label class="custom-date" for="date_to">End Date :</label> | 
				
			|||
								<div class="form-group custom-date"> | 
				
			|||
									<div class="o_datepicker" aria-atomic="true" id="datepicker11" data-target-input="nearest"> | 
				
			|||
										<input type="text" id="date_to"></input> | 
				
			|||
										<span class="o_datepicker_button"></span> | 
				
			|||
									</div> | 
				
			|||
								</div> | 
				
			|||
							</div> | 
				
			|||
						</div> | 
				
			|||
					</div> | 
				
			|||
					<div class="py-search-journals"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Journals: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-menu journal" name="states[]" multiple="multiple"> | 
				
			|||
							<b role="menuitem" class="dropdown-item-text"> | 
				
			|||
								<t t-esc="filter_data.company_name"/> | 
				
			|||
							</b> | 
				
			|||
							<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="py-search-analytics"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Analytic: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-menu analytic" name="states[]" multiple="multiple"> | 
				
			|||
							<t t-foreach="filter_data.analytics_list" t-as="analytic"> | 
				
			|||
								<option t-attf-value="{{analytic[0]}}"> | 
				
			|||
									<t t-esc="analytic[1]"/> | 
				
			|||
								</option> | 
				
			|||
							</t> | 
				
			|||
						</select> | 
				
			|||
						<span id="analic_res"></span> | 
				
			|||
					</div> | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
					<div class="py-search-entries"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-filter"></span> | 
				
			|||
Options: | 
				
			|||
						</a> | 
				
			|||
						<select id="entries" class="dropdown-menu py-filters-menu entries" name="states[]"> | 
				
			|||
								<option value="all">All Entries </option> | 
				
			|||
								<option value="posted">Posted Entries</option> | 
				
			|||
						</select> | 
				
			|||
						<span id="post_res"></span> | 
				
			|||
					</div> | 
				
			|||
 | 
				
			|||
				</div> | 
				
			|||
			</div> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
</templates> | 
				
			|||
@ -0,0 +1,282 @@ | 
				
			|||
<?xml version="1.0" encoding="UTF-8"?> | 
				
			|||
<templates xml:space="preserve"> | 
				
			|||
	<t t-name="GeneralLedger"> | 
				
			|||
		<div class="container-gl"> | 
				
			|||
			<div> | 
				
			|||
				<div class="gl-filter"></div> | 
				
			|||
			</div> | 
				
			|||
			<div class="container-gl-data"> | 
				
			|||
				<div class="container-gl-main"></div> | 
				
			|||
			</div> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
	<t t-name="GeneralLedgerData"> | 
				
			|||
		<div> | 
				
			|||
			<table cellspacing="0" width="100%"> | 
				
			|||
				<thead> | 
				
			|||
					<tr> | 
				
			|||
						<th colspan="6">Account</th> | 
				
			|||
						<th class="amt">Debit</th> | 
				
			|||
						<th class="amt">Credit</th> | 
				
			|||
						<th class="amt">Balance</th> | 
				
			|||
						<th></th> | 
				
			|||
					</tr> | 
				
			|||
				</thead> | 
				
			|||
				<tbody> | 
				
			|||
					<t t-foreach="account_data" t-as="account"> | 
				
			|||
						<t t-set="common_id" t-value=""/> | 
				
			|||
						<t t-if="account_data[account]['count']"> | 
				
			|||
							<tr style="border: 1.5px solid black;" class="gl-line" | 
				
			|||
                                data-toggle="collapse" | 
				
			|||
                                t-att-data-account-id="account_data[account]['id']" | 
				
			|||
                                t-attf-data-target=".a{{account_data[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_data[account]['code']"/> | 
				
			|||
                                        - | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
										<t t-esc="account_data[account]['name']"/> | 
				
			|||
									</span> | 
				
			|||
								</td> | 
				
			|||
								<td class="amt"> | 
				
			|||
									<t t-raw="account_data[account]['debit']"/> | 
				
			|||
								</td> | 
				
			|||
								<td class="amt"> | 
				
			|||
									<t t-raw="account_data[account]['credit']"/> | 
				
			|||
								</td> | 
				
			|||
								<td class="amt"> | 
				
			|||
									<t t-raw="account_data[account]['balance']"/> | 
				
			|||
								</td> | 
				
			|||
								<td class="amt"></td> | 
				
			|||
								<t t-set="common_id" t-value="'a'+account_data[account]['id']"/> | 
				
			|||
							</tr> | 
				
			|||
						</t> | 
				
			|||
						<tr t-attf-class="collapse a{{account_data[account]['id']}}"> | 
				
			|||
							<td colspan="10"> | 
				
			|||
								<ul> | 
				
			|||
									<t t-if="!account_data[account]['single_page']"> | 
				
			|||
										<t t-foreach="account_data[account]['pages']" t-as="i"> | 
				
			|||
											<li> | 
				
			|||
												<a | 
				
			|||
                                                   t-att-data-page-number="i" | 
				
			|||
                                                   t-att-data-count="account_data[account]['count']" | 
				
			|||
                                                   t-att-data-account-id="account_data[account]['id']"> | 
				
			|||
													<t t-esc="i"/> | 
				
			|||
												</a> | 
				
			|||
											</li> | 
				
			|||
										</t> | 
				
			|||
									</t> | 
				
			|||
								</ul> | 
				
			|||
							</td> | 
				
			|||
						</tr> | 
				
			|||
					</t> | 
				
			|||
				</tbody> | 
				
			|||
			</table> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
	<t t-name="FilterSection"> | 
				
			|||
		<div class="py-control-div"> | 
				
			|||
			<ol class="gl-breadcrumb"> | 
				
			|||
				<li>General Ledger</li> | 
				
			|||
			</ol> | 
				
			|||
		</div> | 
				
			|||
		<div class="py-control-div"> | 
				
			|||
			<div class="py-cntrl-left"> | 
				
			|||
				<div class="py-ctrl-buttons"> | 
				
			|||
					<button type="button" class="btn py-btn-primary" id="pdf" action="print_pdf" style="position: relative;">Print (PDF)</button> | 
				
			|||
					<button type="button" class="btn py-btn-primary" id="xlsx" action="print_xlsx" style="position: relative;">Export (XLSX)</button> | 
				
			|||
				</div> | 
				
			|||
			</div> | 
				
			|||
			<div class="py_cntrl_right"> | 
				
			|||
				<div class="py-search-buttons"> | 
				
			|||
					<button type="button" id="filter_apply_button" class="btn py-btn-secondary" action="apply_filter" style="position: relative;">Apply</button> | 
				
			|||
					<div class="py-search-btn-date"> | 
				
			|||
						<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> | 
				
			|||
Custom | 
				
			|||
						</a> | 
				
			|||
						<div class="dropdown-menu py-filters-menu" role="menu"> | 
				
			|||
							<div class="o_foldable_menu o_closed_menu o_account_report_search" data-filter="custom_filter_date"> | 
				
			|||
								<label class="custom-date" for="date_from">Start Date :</label> | 
				
			|||
								<div class="form-group custom-date"> | 
				
			|||
									<div class="o_datepicker" aria-atomic="true" id="datepicker10" data-target-input="nearest"> | 
				
			|||
										<input type="text" id="date_from"></input> | 
				
			|||
										<span class="o_datepicker_button"></span> | 
				
			|||
									</div> | 
				
			|||
								</div> | 
				
			|||
								<label class="custom-date" for="date_to">End Date :</label> | 
				
			|||
								<div class="form-group custom-date"> | 
				
			|||
									<div class="o_datepicker" aria-atomic="true" id="datepicker11" data-target-input="nearest"> | 
				
			|||
										<input type="text" id="date_to"></input> | 
				
			|||
										<span class="o_datepicker_button"></span> | 
				
			|||
									</div> | 
				
			|||
								</div> | 
				
			|||
							</div> | 
				
			|||
						</div> | 
				
			|||
					</div> | 
				
			|||
					<div class="py-search-journals"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Journals: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-menu journal" name="states[]" multiple="multiple"> | 
				
			|||
							<b role="menuitem" class="dropdown-item-text"> | 
				
			|||
								<t t-esc="filter_data.company_name"/> | 
				
			|||
							</b> | 
				
			|||
							<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="py-search-accounts"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Accounts: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-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="py-search-accounts-tag"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Account Tags: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-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="py-search-analytics"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Analytic: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-menu analytic" name="states[]" multiple="multiple"> | 
				
			|||
							<t t-foreach="filter_data.analytics_list" t-as="analytic"> | 
				
			|||
								<option t-attf-value="{{analytic[0]}}"> | 
				
			|||
									<t t-esc="analytic[1]"/> | 
				
			|||
								</option> | 
				
			|||
							</t> | 
				
			|||
						</select> | 
				
			|||
						<span id="analic_res"></span> | 
				
			|||
					</div> | 
				
			|||
					<div class="py-search-analytic-tag"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-book"></span> | 
				
			|||
Analytic Tags: | 
				
			|||
						</a> | 
				
			|||
						<select class="dropdown-menu py-filters-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="py-search-entries"> | 
				
			|||
						<a type="button" class="dropdown-toggle" data-toggle="dropdown"> | 
				
			|||
							<span class="fa fa-filter"></span> | 
				
			|||
Options: | 
				
			|||
						</a> | 
				
			|||
						<select id="entries" class="dropdown-menu py-filters-menu entries"> | 
				
			|||
								<option value="all">All Entries </option> | 
				
			|||
								<option value="posted">Posted Entries</option> | 
				
			|||
 | 
				
			|||
						</select> | 
				
			|||
						<span id="post_res"></span> | 
				
			|||
					</div> | 
				
			|||
				</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="amt">Debit</th> | 
				
			|||
						<th class="amt">Credit</th> | 
				
			|||
						<th class="amt">Balance</th> | 
				
			|||
					</tr> | 
				
			|||
				</thead> | 
				
			|||
				<tbody> | 
				
			|||
					<t t-foreach="account_data" t-as="account_line"> | 
				
			|||
						<t t-set="style" t-value="''"/> | 
				
			|||
						<t t-if="account_line.move_name == 'Initial Balance'"> | 
				
			|||
							<t t-set="style" t-value="'font-style: italic;'"/></t> | 
				
			|||
						<t t-if="account_line.move_name == 'Ending Balance'"> | 
				
			|||
							<t t-set="style" t-value="'font-style: italic;'"/></t> | 
				
			|||
						<tr> | 
				
			|||
							<td> | 
				
			|||
								<t t-if="account_line.ldate"> | 
				
			|||
									<div class="dropdown dropdown-toggle"> | 
				
			|||
										<a data-toggle="dropdown" href="#"> | 
				
			|||
											<span class="caret"></span> | 
				
			|||
											<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-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> | 
				
			|||
							<td t-att-style="style" class="amt"> | 
				
			|||
								<t t-raw="account_line.debit"/> | 
				
			|||
							</td> | 
				
			|||
							<td t-att-style="style" class="amt"> | 
				
			|||
								<t t-raw="account_line.credit"/> | 
				
			|||
							</td> | 
				
			|||
							<td t-att-style="style" class="amt"> | 
				
			|||
								<t t-raw="account_line.balance"/> | 
				
			|||
							</td> | 
				
			|||
						</tr> | 
				
			|||
					</t> | 
				
			|||
				</tbody> | 
				
			|||
			</table> | 
				
			|||
		</div> | 
				
			|||
	</t> | 
				
			|||
</templates> | 
				
			|||
@ -0,0 +1,211 @@ | 
				
			|||
<?xml version="1.0" encoding="utf-8"?> | 
				
			|||
<odoo> | 
				
			|||
    <template id="ageing_partner"> | 
				
			|||
       <t t-call="web.html_container"> | 
				
			|||
            <t t-call="web.internal_layout"> | 
				
			|||
                <div class="page"> | 
				
			|||
                    <div class="oe_structure"/> | 
				
			|||
                    <h3><span t-esc="res_company.name"/>: Partner Ageing | 
				
			|||
                    </h3> | 
				
			|||
                    <br></br> | 
				
			|||
                    <div> | 
				
			|||
                        <div class="row mt32"> | 
				
			|||
                        <div class="col-3"> | 
				
			|||
                            <strong>As On Date:</strong> | 
				
			|||
                            <p t-esc="report_data[0]['as_on_date']"/> | 
				
			|||
                        </div> | 
				
			|||
                            <div class="col-3"> | 
				
			|||
                                <strong>Partners: </strong> | 
				
			|||
                                <t t-foreach="report_data[0]['partners']" | 
				
			|||
                                   t-as="data"> | 
				
			|||
                                    <t t-esc="data"/> | 
				
			|||
 | 
				
			|||
                                </t> | 
				
			|||
 | 
				
			|||
                            </div> | 
				
			|||
                            <div class="col-3"> | 
				
			|||
                                <strong>Partner Tag: </strong> | 
				
			|||
                                <t t-foreach="report_data[0]['categories']" | 
				
			|||
                                   t-as="data"> | 
				
			|||
                                    <t t-esc="data"/> | 
				
			|||
 | 
				
			|||
                                </t> | 
				
			|||
 | 
				
			|||
                            </div> | 
				
			|||
 | 
				
			|||
                    </div> | 
				
			|||
                        <br></br> | 
				
			|||
                     <div class="row mb32"> | 
				
			|||
                         <div class="col-3"> | 
				
			|||
                            <strong>Account Type:</strong> | 
				
			|||
                            <p t-esc="report_data[0]['type']"/> | 
				
			|||
                        </div> | 
				
			|||
                         <div class="col-3"> | 
				
			|||
                            <strong>Partner Type:</strong> | 
				
			|||
                            <p t-esc="report_data[0]['partner_type']"/> | 
				
			|||
                        </div> | 
				
			|||
                        <div class="col-3"> | 
				
			|||
                            <strong>Target Moves:</strong> | 
				
			|||
                            <p t-esc="report_data[0]['target_moves']"/> | 
				
			|||
                        </div> | 
				
			|||
                    </div> | 
				
			|||
 | 
				
			|||
                        <table  class="table table-sm table-reports"> | 
				
			|||
                            <thead> | 
				
			|||
                                <tr class="text-center"> | 
				
			|||
                                    <th style="text-align:left;" >Entry Label</th> | 
				
			|||
                                    <th style="text-align:left;"  >Due Date</th> | 
				
			|||
                                    <th style="text-align:left;" >Journal</th> | 
				
			|||
                                    <th style="text-align:left;" >Account</th> | 
				
			|||
                                    <th style="text-align:right;" colspan="1">Not Due</th> | 
				
			|||
                                    <th style="text-align:right;" colspan="1">0 - 20</th> | 
				
			|||
                                    <th style="text-align:right;" colspan="1">21 - 40</th> | 
				
			|||
                                    <th style="text-align:right;" colspan="1">41 - 60</th> | 
				
			|||
                                    <th style="text-align:right;" colspan="1">61 - 80</th> | 
				
			|||
                                    <th style="text-align:right;" colspan="2">81 - 100</th> | 
				
			|||
                                    <th style="text-align:right;" colspan="2">100 +</th> | 
				
			|||
                                </tr> | 
				
			|||
                            </thead> | 
				
			|||
                            <tbody> | 
				
			|||
                            <t t-foreach="account_data" t-as="line"> | 
				
			|||
                                <t t-if="account_data[line]['count']"> | 
				
			|||
 | 
				
			|||
                                    <tr style="border-bottom: 2px solid black;"> | 
				
			|||
 | 
				
			|||
                                        <td colspan="4"> | 
				
			|||
                                            <span style="color: white;" t-esc="'..'"/> | 
				
			|||
                                            <strong> | 
				
			|||
                                                <span t-esc="account_data[line]['partner_name']"/> | 
				
			|||
 | 
				
			|||
                                            </strong> | 
				
			|||
 | 
				
			|||
                                        </td> | 
				
			|||
                                         <td class="text-right"> | 
				
			|||
                                            <strong> | 
				
			|||
                                                 <span t-esc="account_data[line]['Not']" | 
				
			|||
                                                  t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
 | 
				
			|||
                                            </strong> | 
				
			|||
 | 
				
			|||
                                        </td> | 
				
			|||
                                        <td class="text-right"> | 
				
			|||
                                            <strong> | 
				
			|||
                                                 <span t-esc="account_data[line]['value_20']" | 
				
			|||
                                                  t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
 | 
				
			|||
                                            </strong> | 
				
			|||
 | 
				
			|||
                                        </td> | 
				
			|||
                                        <td class="text-right"> | 
				
			|||
                                            <strong> | 
				
			|||
                                                <span t-esc="account_data[line]['2140']" | 
				
			|||
                                                  t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
 | 
				
			|||
                                            </strong> | 
				
			|||
 | 
				
			|||
                                        </td> | 
				
			|||
                                        <td class="text-right"> | 
				
			|||
                                            <strong> | 
				
			|||
                                                <span t-esc="account_data[line]['4160']" | 
				
			|||
                                                  t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
 | 
				
			|||
                                            </strong> | 
				
			|||
 | 
				
			|||
                                        </td> | 
				
			|||
                                        <td class="text-right"> | 
				
			|||
                                            <strong> | 
				
			|||
                                                <span t-esc="account_data[line]['6180']" | 
				
			|||
                                                  t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
 | 
				
			|||
                                            </strong> | 
				
			|||
 | 
				
			|||
                                        </td> | 
				
			|||
                                        <td class="text-right" colspan="2"> | 
				
			|||
                                            <strong> | 
				
			|||
                                                <span t-esc="account_data[line]['81100']" | 
				
			|||
                                                  t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
 | 
				
			|||
                                            </strong> | 
				
			|||
 | 
				
			|||
                                        </td> | 
				
			|||
                                        <td class="text-right"> | 
				
			|||
                                            <strong> | 
				
			|||
                                                <span t-esc="account_data[line]['100']" | 
				
			|||
                                                  t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
 | 
				
			|||
                                            </strong> | 
				
			|||
 | 
				
			|||
                                        </td> | 
				
			|||
                                    </tr> | 
				
			|||
 | 
				
			|||
 | 
				
			|||
                                    <t t-foreach="account_data[line]['partner_move_lines'][2]" t-as="sub_line"> | 
				
			|||
 | 
				
			|||
                                            <tr> | 
				
			|||
                                                <td style="text-align:left;"> | 
				
			|||
                                                    <t t-esc="sub_line.get('move_name')"/> | 
				
			|||
                                                </td > | 
				
			|||
                                                 <td style="text-align:left;"> | 
				
			|||
                                                    <t t-esc="sub_line.get('date_maturity')"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                 <td style="text-align:left;"> | 
				
			|||
                                                    <t t-esc="sub_line.get('journal_name')"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                 <td colspan="1" style="text-align:left;"> | 
				
			|||
                                                    <t t-esc="sub_line.get('account_code')"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td colspan="1" style="text-align:right;"> | 
				
			|||
                                                    <t t-esc="sub_line.get('range_0')" | 
				
			|||
                                                       t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td colspan="1" style="text-align:right;"> | 
				
			|||
                                                    <t t-esc="sub_line.get('range_1')" | 
				
			|||
                                                    t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td colspan="1" style="text-align:right;"> | 
				
			|||
                                                    <t t-esc="sub_line.get('range_2')" | 
				
			|||
                                                    t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td colspan="1" style="text-align:right;"> | 
				
			|||
                                                    <t t-esc="sub_line.get('range_3')" | 
				
			|||
                                                    t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                </td> | 
				
			|||
 | 
				
			|||
                                                <td colspan="1" style="text-align:right;"> | 
				
			|||
                                                    <t t-esc="sub_line.get('range_4')" | 
				
			|||
                                                    t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                 <td colspan="2" style="text-align:right;"> | 
				
			|||
                                                    <t t-esc="sub_line.get('range_5')" | 
				
			|||
                                                    t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td colspan="2" style="text-align:right;"> | 
				
			|||
                                                    <t t-esc="sub_line.get('range_5')" | 
				
			|||
                                                    t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                </td> | 
				
			|||
                                            </tr> | 
				
			|||
 | 
				
			|||
 | 
				
			|||
                                    </t> | 
				
			|||
                                </t> | 
				
			|||
 | 
				
			|||
                            </t> | 
				
			|||
                            </tbody> | 
				
			|||
                        </table> | 
				
			|||
                    </div> | 
				
			|||
                    <br></br> | 
				
			|||
                </div> | 
				
			|||
            </t> | 
				
			|||
        </t> | 
				
			|||
    </template> | 
				
			|||
 | 
				
			|||
    <report id="action_print_ageing_partner" | 
				
			|||
            model="dynamic.ageing.partner" | 
				
			|||
            report_type="qweb-pdf" | 
				
			|||
            menu="False" | 
				
			|||
            string="Partner Ageing" | 
				
			|||
            name="dynamic_financial_report.ageing_partner" | 
				
			|||
            file="dynamic_financial_report.ageing_partner" | 
				
			|||
    /> | 
				
			|||
 | 
				
			|||
</odoo> | 
				
			|||
@ -0,0 +1,194 @@ | 
				
			|||
<?xml version="1.0" encoding="utf-8"?> | 
				
			|||
<odoo> | 
				
			|||
        <template id="dynamic_financial_report.bank_book"> | 
				
			|||
            <t t-call="web.html_container"> | 
				
			|||
                <t t-call="web.internal_layout"> | 
				
			|||
                    <div class="page"> | 
				
			|||
                        <div class="oe_structure"/> | 
				
			|||
                        <h3> | 
				
			|||
                            <span t-esc="res_company.name"/> | 
				
			|||
                            : Bank Book | 
				
			|||
                        </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>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-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>Entries:</strong> | 
				
			|||
                                        <!--                             <t t-foreach="Filters['journals']" t-as="ps"> --> | 
				
			|||
                                        <li> | 
				
			|||
                                            <t t-esc="Filters['entries']"/> | 
				
			|||
                                        </li> | 
				
			|||
                                        <!--                             </t> --> | 
				
			|||
                                    </div> | 
				
			|||
                                </div> | 
				
			|||
                            </div> | 
				
			|||
                            <br/> | 
				
			|||
                            <table> | 
				
			|||
                                <thead> | 
				
			|||
                                    <tr class="text-center"> | 
				
			|||
                                        <th style="text-align:left;">Date</th> | 
				
			|||
                                        <th style="text-align:left;">Journal | 
				
			|||
                                        </th> | 
				
			|||
                                        <th style="text-align:left;">Partner | 
				
			|||
                                        </th> | 
				
			|||
                                        <th style="text-align:left;">Move</th> | 
				
			|||
                                        <th style="text-align:left;">Reference | 
				
			|||
                                        </th> | 
				
			|||
                                        <th style="text-align:right;padding-bottom:10px;"> | 
				
			|||
                                            Debit | 
				
			|||
                                        </th> | 
				
			|||
                                        <th style="text-align:right">Credit</th> | 
				
			|||
                                        <th style="text-align:right">Balance | 
				
			|||
                                        </th> | 
				
			|||
                                    </tr> | 
				
			|||
                                </thead> | 
				
			|||
                                <t t-foreach="account_data" t-as="line"> | 
				
			|||
                                    <t t-if="account_data[line]['count']"> | 
				
			|||
                                        <tr> | 
				
			|||
                                            <td colspan="5"> | 
				
			|||
                                                <span style="color: white;" | 
				
			|||
                                                      t-esc="'..'"/> | 
				
			|||
                                                <span t-esc="account_data[line]['name']"/> | 
				
			|||
                                            </td> | 
				
			|||
                                            <td class="text-right"> | 
				
			|||
                                                <span t-esc="account_data[line]['debit']" | 
				
			|||
                                                      t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                            </td> | 
				
			|||
                                            <td class="text-right"> | 
				
			|||
                                                <span t-esc="account_data[line]['credit']" | 
				
			|||
                                                      t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                            </td> | 
				
			|||
                                            <td class="text-right"> | 
				
			|||
                                                <span t-esc="account_data[line]['balance']" | 
				
			|||
                                                      t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                            </td> | 
				
			|||
                                        </tr> | 
				
			|||
                                        <t t-foreach="account_data[line]['lines']" | 
				
			|||
                                           t-as="sub_line"> | 
				
			|||
                                            <t t-if="sub_line['initial_bal']"> | 
				
			|||
                                                <tr> | 
				
			|||
                                                    <td colspan="5" | 
				
			|||
                                                        class="text-right"> | 
				
			|||
                                                        <span>Initial Balance | 
				
			|||
                                                        </span> | 
				
			|||
                                                    </td> | 
				
			|||
                                                    <td class="text-right"> | 
				
			|||
                                                        <span t-esc="sub_line['debit']" | 
				
			|||
                                                              t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                    </td> | 
				
			|||
                                                    <td class="text-right"> | 
				
			|||
                                                        <span t-esc="sub_line['credit']" | 
				
			|||
                                                              t-options="{'widgetaccount_data': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                    </td> | 
				
			|||
                                                    <td class="text-right"> | 
				
			|||
                                                        <span t-esc="sub_line['balance']" | 
				
			|||
                                                              t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                    </td> | 
				
			|||
                                                </tr> | 
				
			|||
                                            </t> | 
				
			|||
                                            <t t-if="not sub_line['initial_bal'] and not sub_line['ending_bal']"> | 
				
			|||
                                                <tr> | 
				
			|||
                                                    <td> | 
				
			|||
                                                        <t t-esc="sub_line.get('ldate')" | 
				
			|||
                                                           t-options="{'widget': 'date'}"/> | 
				
			|||
                                                    </td> | 
				
			|||
                                                    <td> | 
				
			|||
                                                        <t t-esc="sub_line.get('lcode')"/> | 
				
			|||
                                                    </td> | 
				
			|||
                                                    <td> | 
				
			|||
                                                        <t t-esc="sub_line.get('partner_name')"/> | 
				
			|||
                                                    </td> | 
				
			|||
                                                    <td> | 
				
			|||
                                                        <t t-esc="sub_line.get('move_name')"/> | 
				
			|||
                                                    </td> | 
				
			|||
                                                    <td style="width:30%;"> | 
				
			|||
                                                        <t t-esc="sub_line.get('lname')"/> | 
				
			|||
                                                    </td> | 
				
			|||
                                                    <td class="text-right"> | 
				
			|||
                                                        <t t-esc="sub_line.get('debit')" | 
				
			|||
                                                           t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                    </td> | 
				
			|||
                                                    <td class="text-right"> | 
				
			|||
                                                        <t t-esc="sub_line.get('credit')" | 
				
			|||
                                                           t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                    </td> | 
				
			|||
                                                    <td class="text-right"> | 
				
			|||
                                                        <t t-esc="sub_line.get('balance')" | 
				
			|||
                                                           t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                    </td> | 
				
			|||
                                                </tr> | 
				
			|||
                                            </t> | 
				
			|||
 | 
				
			|||
                                        </t> | 
				
			|||
                                    </t> | 
				
			|||
                                </t> | 
				
			|||
                            </table> | 
				
			|||
                        </div> | 
				
			|||
                        <br/> | 
				
			|||
                    </div> | 
				
			|||
                </t> | 
				
			|||
            </t> | 
				
			|||
        </template> | 
				
			|||
    <report id="action_print_bank_book" | 
				
			|||
            model="dynamic.bank.book" | 
				
			|||
            report_type="qweb-pdf" | 
				
			|||
            menu="False" | 
				
			|||
            string="Bank Book" | 
				
			|||
            name="dynamic_financial_report.bank_book" | 
				
			|||
            file="dynamic_financial_report.bank_book" | 
				
			|||
    /> | 
				
			|||
 | 
				
			|||
</odoo> | 
				
			|||
@ -0,0 +1,194 @@ | 
				
			|||
<?xml version="1.0" encoding="utf-8"?> | 
				
			|||
<odoo> | 
				
			|||
        <template id="dynamic_financial_report.cash_book"> | 
				
			|||
            <t t-call="web.html_container"> | 
				
			|||
                <t t-call="web.internal_layout"> | 
				
			|||
                    <div class="page"> | 
				
			|||
                        <div class="oe_structure"/> | 
				
			|||
                        <h3> | 
				
			|||
                            <span t-esc="res_company.name"/> | 
				
			|||
                            : Cash Book | 
				
			|||
                        </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>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-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>Entries:</strong> | 
				
			|||
                                        <!--                             <t t-foreach="Filters['journals']" t-as="ps"> --> | 
				
			|||
                                        <li> | 
				
			|||
                                            <t t-esc="Filters['entries']"/> | 
				
			|||
                                        </li> | 
				
			|||
                                        <!--                             </t> --> | 
				
			|||
                                    </div> | 
				
			|||
                                </div> | 
				
			|||
                            </div> | 
				
			|||
                            <br/> | 
				
			|||
                            <table> | 
				
			|||
                                <thead> | 
				
			|||
                                    <tr class="text-center"> | 
				
			|||
                                        <th style="text-align:left;">Date</th> | 
				
			|||
                                        <th style="text-align:left;">Journal | 
				
			|||
                                        </th> | 
				
			|||
                                        <th style="text-align:left;">Partner | 
				
			|||
                                        </th> | 
				
			|||
                                        <th style="text-align:left;">Move</th> | 
				
			|||
                                        <th style="text-align:left;">Reference | 
				
			|||
                                        </th> | 
				
			|||
                                        <th style="text-align:right;padding-bottom:10px;"> | 
				
			|||
                                            Debit | 
				
			|||
                                        </th> | 
				
			|||
                                        <th style="text-align:right">Credit</th> | 
				
			|||
                                        <th style="text-align:right">Balance | 
				
			|||
                                        </th> | 
				
			|||
                                    </tr> | 
				
			|||
                                </thead> | 
				
			|||
                                <t t-foreach="account_data" t-as="line"> | 
				
			|||
                                    <t t-if="account_data[line]['count']"> | 
				
			|||
                                        <tr> | 
				
			|||
                                            <td colspan="5"> | 
				
			|||
                                                <span style="color: white;" | 
				
			|||
                                                      t-esc="'..'"/> | 
				
			|||
                                                <span t-esc="account_data[line]['name']"/> | 
				
			|||
                                            </td> | 
				
			|||
                                            <td class="text-right"> | 
				
			|||
                                                <span t-esc="account_data[line]['debit']" | 
				
			|||
                                                      t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                            </td> | 
				
			|||
                                            <td class="text-right"> | 
				
			|||
                                                <span t-esc="account_data[line]['credit']" | 
				
			|||
                                                      t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                            </td> | 
				
			|||
                                            <td class="text-right"> | 
				
			|||
                                                <span t-esc="account_data[line]['balance']" | 
				
			|||
                                                      t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                            </td> | 
				
			|||
                                        </tr> | 
				
			|||
                                        <t t-foreach="account_data[line]['lines']" | 
				
			|||
                                           t-as="sub_line"> | 
				
			|||
                                            <t t-if="sub_line['initial_bal']"> | 
				
			|||
                                                <tr> | 
				
			|||
                                                    <td colspan="5" | 
				
			|||
                                                        class="text-right"> | 
				
			|||
                                                        <span>Initial Balance | 
				
			|||
                                                        </span> | 
				
			|||
                                                    </td> | 
				
			|||
                                                    <td class="text-right"> | 
				
			|||
                                                        <span t-esc="sub_line['debit']" | 
				
			|||
                                                              t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                    </td> | 
				
			|||
                                                    <td class="text-right"> | 
				
			|||
                                                        <span t-esc="sub_line['credit']" | 
				
			|||
                                                              t-options="{'widgetaccount_data': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                    </td> | 
				
			|||
                                                    <td class="text-right"> | 
				
			|||
                                                        <span t-esc="sub_line['balance']" | 
				
			|||
                                                              t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                    </td> | 
				
			|||
                                                </tr> | 
				
			|||
                                            </t> | 
				
			|||
                                            <t t-if="not sub_line['initial_bal'] and not sub_line['ending_bal']"> | 
				
			|||
                                                <tr> | 
				
			|||
                                                    <td> | 
				
			|||
                                                        <t t-esc="sub_line.get('ldate')" | 
				
			|||
                                                           t-options="{'widget': 'date'}"/> | 
				
			|||
                                                    </td> | 
				
			|||
                                                    <td> | 
				
			|||
                                                        <t t-esc="sub_line.get('lcode')"/> | 
				
			|||
                                                    </td> | 
				
			|||
                                                    <td> | 
				
			|||
                                                        <t t-esc="sub_line.get('partner_name')"/> | 
				
			|||
                                                    </td> | 
				
			|||
                                                    <td> | 
				
			|||
                                                        <t t-esc="sub_line.get('move_name')"/> | 
				
			|||
                                                    </td> | 
				
			|||
                                                    <td style="width:30%;"> | 
				
			|||
                                                        <t t-esc="sub_line.get('lname')"/> | 
				
			|||
                                                    </td> | 
				
			|||
                                                    <td class="text-right"> | 
				
			|||
                                                        <t t-esc="sub_line.get('debit')" | 
				
			|||
                                                           t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                    </td> | 
				
			|||
                                                    <td class="text-right"> | 
				
			|||
                                                        <t t-esc="sub_line.get('credit')" | 
				
			|||
                                                           t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                    </td> | 
				
			|||
                                                    <td class="text-right"> | 
				
			|||
                                                        <t t-esc="sub_line.get('balance')" | 
				
			|||
                                                           t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                    </td> | 
				
			|||
                                                </tr> | 
				
			|||
                                            </t> | 
				
			|||
                                        </t> | 
				
			|||
                                    </t> | 
				
			|||
                                </t> | 
				
			|||
                            </table> | 
				
			|||
                        </div> | 
				
			|||
                        <br/> | 
				
			|||
                    </div> | 
				
			|||
                </t> | 
				
			|||
            </t> | 
				
			|||
        </template> | 
				
			|||
 | 
				
			|||
        <report id="action_print_cash_book" | 
				
			|||
                model="dynamic.bank.book" | 
				
			|||
                report_type="qweb-pdf" | 
				
			|||
                menu="False" | 
				
			|||
                string="Cash Book" | 
				
			|||
                name="dynamic_financial_report.cash_book" | 
				
			|||
                file="dynamic_financial_report.cash_book" | 
				
			|||
        /> | 
				
			|||
 | 
				
			|||
    </odoo> | 
				
			|||
@ -0,0 +1,254 @@ | 
				
			|||
<?xml version="1.0" encoding="utf-8"?> | 
				
			|||
<odoo> | 
				
			|||
    <template id="dynamic_financial_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="report_data[0].get('target_moves')"> | 
				
			|||
                                    <p> | 
				
			|||
                                    <strong>Target Moves:</strong> | 
				
			|||
 | 
				
			|||
                                 <span t-esc="report_data[0]['target_moves']"/> | 
				
			|||
                                        <br/> | 
				
			|||
                                 <t t-if="report_data[1].get('levels')"> | 
				
			|||
                                        <strong>Level :</strong> | 
				
			|||
                                <span t-esc="report_data[1]['levels']"/> | 
				
			|||
                                 </t> | 
				
			|||
 | 
				
			|||
                            </p> | 
				
			|||
                                </t> | 
				
			|||
                        </div> | 
				
			|||
 | 
				
			|||
                        <div class="col-4"> | 
				
			|||
 | 
				
			|||
                            <p> | 
				
			|||
                                 <t t-if="report_data[0].get('date_from')"> | 
				
			|||
                                <strong>Date from :</strong> | 
				
			|||
                                <span t-esc="report_data[0].get('date_from')"/> | 
				
			|||
                                 </t> | 
				
			|||
                                <br/> | 
				
			|||
                                <t t-if="report_data[0].get('date_to')"> | 
				
			|||
                                <strong>Date to :</strong> | 
				
			|||
                                <span t-esc="report_data[0].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="account_data['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="account_data['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="account_data['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="account_data['levels' ] == 'very' or account_data['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> | 
				
			|||
 | 
				
			|||
    <report id="action_print_cash_flow" | 
				
			|||
            model="dynamic.cash.flow" | 
				
			|||
            report_type="qweb-pdf" | 
				
			|||
            menu="False" | 
				
			|||
            string="Cash Flow" | 
				
			|||
            name="dynamic_financial_report.cash_flow" | 
				
			|||
            file="dynamic_financial_report.cash_flow" | 
				
			|||
    > </report> | 
				
			|||
</odoo> | 
				
			|||
@ -0,0 +1,169 @@ | 
				
			|||
<?xml version="1.0" encoding="utf-8"?> | 
				
			|||
<odoo> | 
				
			|||
    <template id="dynamic_financial_report.dynamic_day_book"> | 
				
			|||
       <t t-call="web.html_container"> | 
				
			|||
            <t t-call="web.internal_layout"> | 
				
			|||
                <div class="page"> | 
				
			|||
                    <div class="oe_structure"/> | 
				
			|||
                    <h3><span t-esc="res_company.name"/>: Day Book | 
				
			|||
                    </h3> | 
				
			|||
                    <br></br> | 
				
			|||
                    <div> | 
				
			|||
                        <div class="row mt32"> | 
				
			|||
                             <div class="col-3"> | 
				
			|||
                            <span t-if="Filters.get('date_from')"> | 
				
			|||
                                <strong>From:</strong> | 
				
			|||
                                <t t-esc="report_data[0]['date_from']"/> | 
				
			|||
                            </span> | 
				
			|||
                             </div> | 
				
			|||
                             <div class="col-3"> | 
				
			|||
                            <span t-if="Filters.get('date_to')"> | 
				
			|||
                                <strong>To:</strong> | 
				
			|||
                                <t t-esc="report_data[0]['date_to']"/> | 
				
			|||
                            </span> | 
				
			|||
                             </div> | 
				
			|||
                        </div> | 
				
			|||
                        <br></br> | 
				
			|||
                        <div class="row mb32"> | 
				
			|||
                            <div class="col-3"> | 
				
			|||
                                <strong>Journals: </strong> | 
				
			|||
                                <t t-foreach="report_data[0]['journals']" | 
				
			|||
                                   t-as="data"> | 
				
			|||
                                    <t t-esc="data"/> | 
				
			|||
 | 
				
			|||
                                </t> | 
				
			|||
                            </div> | 
				
			|||
                             <div class="col-3"> | 
				
			|||
                                <strong>Account: </strong> | 
				
			|||
                                <t t-foreach="report_data[0]['accounts']" | 
				
			|||
                                   t-as="data"> | 
				
			|||
                                    <t t-esc="data"/> | 
				
			|||
                                </t> | 
				
			|||
                            </div> | 
				
			|||
                         <div class="col-3"> | 
				
			|||
                            <strong>Target Moves:</strong> | 
				
			|||
                            <p t-esc="report_data[0]['entries']"/> | 
				
			|||
                        </div> | 
				
			|||
 | 
				
			|||
 | 
				
			|||
                    </div> | 
				
			|||
 | 
				
			|||
                        <table  class="table table-sm table-reports"> | 
				
			|||
                            <thead> | 
				
			|||
                                <tr class="text-center"> | 
				
			|||
                                    <th style="text-align:left;" >Date</th> | 
				
			|||
                                    <th style="text-align:left;"  >JRNL</th> | 
				
			|||
                                    <th style="text-align:left;" >Partner</th> | 
				
			|||
 | 
				
			|||
                                    <th style="text-align:left;" >Move</th> | 
				
			|||
                                     <th style="text-align:left;" >Entry Label</th> | 
				
			|||
 | 
				
			|||
                                    <th style="text-align:right;" colspan="1">Debit</th> | 
				
			|||
                                    <th style="text-align:right;" colspan="2">Credit</th> | 
				
			|||
                                    <th style="text-align:right;" colspan="2">Balance</th> | 
				
			|||
                                </tr> | 
				
			|||
                            </thead> | 
				
			|||
                            <tbody> | 
				
			|||
                            <t t-foreach="account_data" t-as="line"> | 
				
			|||
                                <t t-if="account_data[line]['count']"> | 
				
			|||
 | 
				
			|||
                                    <tr style="border-bottom: 2px solid black;"> | 
				
			|||
 | 
				
			|||
                                        <td colspan="4"> | 
				
			|||
                                            <span style="color: white;" t-esc="'..'"/> | 
				
			|||
                                            <strong> | 
				
			|||
                                                <span t-esc="account_data[line]['date']"/> | 
				
			|||
 | 
				
			|||
                                            </strong> | 
				
			|||
 | 
				
			|||
                                        </td> | 
				
			|||
                                         <td class="text-right" colspan="2"> | 
				
			|||
                                            <strong> | 
				
			|||
                                                 <span t-esc="account_data[line]['debit']" | 
				
			|||
                                                  t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
 | 
				
			|||
                                            </strong> | 
				
			|||
 | 
				
			|||
                                        </td> | 
				
			|||
                                        <td class="text-right" colspan="2"> | 
				
			|||
                                            <strong> | 
				
			|||
                                                 <span t-esc="account_data[line]['credit']" | 
				
			|||
                                                  t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
 | 
				
			|||
                                            </strong> | 
				
			|||
 | 
				
			|||
                                        </td> | 
				
			|||
                                        <td class="text-right" colspan="2"> | 
				
			|||
                                            <strong> | 
				
			|||
                                                <span t-esc="account_data[line]['balance']" | 
				
			|||
                                                  t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
 | 
				
			|||
                                            </strong> | 
				
			|||
 | 
				
			|||
                                        </td> | 
				
			|||
 | 
				
			|||
                                    </tr> | 
				
			|||
                                    <br></br> | 
				
			|||
<!--                                </t>--> | 
				
			|||
                                    <t t-foreach="lines[2]" t-as="sub_line"> | 
				
			|||
                                        <t t-if="sub_line['ldate'] == account_data[line]['date']"> | 
				
			|||
 | 
				
			|||
                                            <tr> | 
				
			|||
                                                <td style="text-align:left;"> | 
				
			|||
                                                    <t t-esc="sub_line.get('ldate')"/> | 
				
			|||
                                                </td > | 
				
			|||
                                                <td  style="text-align:left;"> | 
				
			|||
                                                    <t t-esc="sub_line.get('lcode')"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                 <td style="text-align:left;"> | 
				
			|||
                                                    <t t-esc="sub_line.get('partner_name')"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                 <td style="text-align:left;"> | 
				
			|||
                                                    <t t-esc="sub_line.get('move_name')"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                 <td colspan="1" style="text-align:left;"> | 
				
			|||
                                                    <t t-esc="sub_line.get('lname')"/> | 
				
			|||
                                                </td> | 
				
			|||
<!-- | 
				
			|||
                                               ">–>--> | 
				
			|||
 | 
				
			|||
                                                <td colspan="1" style="text-align:right;"> | 
				
			|||
                                                    <t t-esc="sub_line.get('debit')" | 
				
			|||
                                                    t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                 <td colspan="2" style="text-align:right;"> | 
				
			|||
                                                    <t t-esc="sub_line.get('credit')" | 
				
			|||
                                                    t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td colspan="2" style="text-align:right;"> | 
				
			|||
                                                    <t t-esc="sub_line.get('balance')" | 
				
			|||
                                                    t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                </td> | 
				
			|||
                                            </tr> | 
				
			|||
 | 
				
			|||
                                        </t> | 
				
			|||
                                    </t> | 
				
			|||
                                </t> | 
				
			|||
                            </t> | 
				
			|||
                            </tbody> | 
				
			|||
                        </table> | 
				
			|||
                    </div> | 
				
			|||
                    <br></br> | 
				
			|||
                </div> | 
				
			|||
            </t> | 
				
			|||
        </t> | 
				
			|||
    </template> | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    <report id="action_print_day_book" | 
				
			|||
            model="dynamic.day.book" | 
				
			|||
            report_type="qweb-pdf" | 
				
			|||
            menu="False" | 
				
			|||
            string="Day Book" | 
				
			|||
            name="dynamic_financial_report.dynamic_day_book" | 
				
			|||
            file="dynamic_financial_report.dynamic_day_book" | 
				
			|||
    /> | 
				
			|||
 | 
				
			|||
</odoo> | 
				
			|||
@ -0,0 +1,179 @@ | 
				
			|||
<?xml version="1.0" encoding="utf-8"?> | 
				
			|||
<odoo> | 
				
			|||
    <template id="dynamic_financial_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>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-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>Entries:</strong> | 
				
			|||
                                        <li> | 
				
			|||
                                            <t t-esc="Filters['entries']"/> | 
				
			|||
                                        </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="account_data[line]['count']"> | 
				
			|||
                                                <t t-if="account_data[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="account_data[line]['name']"/> | 
				
			|||
                                                        </td> | 
				
			|||
                                                        <td class="text-right"> | 
				
			|||
                                                            <span t-esc="account_data[line]['debit']" | 
				
			|||
                                                                  t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                        </td> | 
				
			|||
                                                        <td class="text-right"> | 
				
			|||
                                                            <span t-esc="account_data[line]['credit']" | 
				
			|||
                                                                  t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                        </td> | 
				
			|||
                                                        <td class="text-right"> | 
				
			|||
                                                            <span t-esc="account_data[line]['balance']" | 
				
			|||
                                                                  t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                        </td> | 
				
			|||
                                                    </tr> | 
				
			|||
                                                </t> | 
				
			|||
 | 
				
			|||
                                            </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</field> | 
				
			|||
            <field name="report_type">qweb-pdf</field> | 
				
			|||
            <field name="report_name">dynamic_financial_report.balance_sheet</field> | 
				
			|||
            <field name="report_file">dynamic_financial_report.balance_sheet</field> | 
				
			|||
    </record> | 
				
			|||
 | 
				
			|||
</odoo> | 
				
			|||
@ -0,0 +1,60 @@ | 
				
			|||
<?xml version="1.0" encoding="utf-8"?> | 
				
			|||
<odoo> | 
				
			|||
    <menuitem id="account_dynamic_report" sequence="15" | 
				
			|||
              name="Dynamic Reports" parent="account.menu_finance_reports"/> | 
				
			|||
 | 
				
			|||
    <record id="ins_general_ledger_wizard_view" model="ir.ui.view"> | 
				
			|||
        <field name="name">dynamic.general.ledger.view</field> | 
				
			|||
        <field name="model">dynamic.general.ledger</field> | 
				
			|||
        <field name="arch" type="xml"> | 
				
			|||
            <form> | 
				
			|||
                <group col="4"> | 
				
			|||
                    <field name="company_id" groups="base.group_multi_company"/> | 
				
			|||
                    <field name="date_from"/> | 
				
			|||
                    <field name="date_to"/> | 
				
			|||
                    <field name="include_details"/> | 
				
			|||
                </group> | 
				
			|||
 | 
				
			|||
                <group col="2"> | 
				
			|||
                    <field name="account_ids" widget="many2many_tags" | 
				
			|||
                           domain="[('company_id','=',company_id)]" | 
				
			|||
                           options="{'no_create_edit': True,'no_create': True, 'no_quick_create': True}"/> | 
				
			|||
                    <field name="account_tag_ids" widget="many2many_tags" | 
				
			|||
                           options="{'no_create_edit': True,'no_create': True, 'no_quick_create': True}"/> | 
				
			|||
                    <field name="journal_ids" widget="many2many_tags" | 
				
			|||
                           domain="[('company_id','=',company_id)]" | 
				
			|||
                           options="{'no_create_edit': True,'no_create': True, 'no_quick_create': True}"/> | 
				
			|||
                    <field name="analytic_ids" widget="many2many_tags" | 
				
			|||
                           domain="[('company_id','=',company_id)]" | 
				
			|||
                           options="{'no_create_edit': True,'no_create': True, 'no_quick_create': True}"/> | 
				
			|||
                    <field name="analytic_tag_ids" widget="many2many_tags" | 
				
			|||
                           domain="['|',('company_id','=',company_id),('company_id','=',False)]" | 
				
			|||
                           options="{'no_create_edit': True,'no_create': True, 'no_quick_create': True}"/> | 
				
			|||
                </group> | 
				
			|||
            </form> | 
				
			|||
        </field> | 
				
			|||
    </record> | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    <record id="ins_trial_balance_wizard_view" model="ir.ui.view"> | 
				
			|||
        <field name="name">dynamic.trial.balance.view</field> | 
				
			|||
        <field name="model">dynamic.trial.balance</field> | 
				
			|||
        <field name="arch" type="xml"> | 
				
			|||
            <form> | 
				
			|||
                <group col="4"> | 
				
			|||
                    <field name="company_id" groups="base.group_multi_company"/> | 
				
			|||
                    <field name="date_from"/> | 
				
			|||
                    <field name="date_to"/> | 
				
			|||
                </group> | 
				
			|||
 | 
				
			|||
                <group col="2"> | 
				
			|||
                    <field name="analytic_ids" widget="many2many_tags" | 
				
			|||
                           domain="[('company_id','=',company_id)]" | 
				
			|||
                           options="{'no_create_edit': True,'no_create': True, 'no_quick_create': True}"/> | 
				
			|||
                </group> | 
				
			|||
            </form> | 
				
			|||
        </field> | 
				
			|||
    </record> | 
				
			|||
 | 
				
			|||
 | 
				
			|||
</odoo> | 
				
			|||
@ -0,0 +1,354 @@ | 
				
			|||
<?xml version="1.0" encoding="utf-8"?> | 
				
			|||
<odoo> | 
				
			|||
    <template id="dynamic_financial_report.general_ledger"> | 
				
			|||
        <t t-call="web.html_container"> | 
				
			|||
            <t t-call="web.internal_layout"> | 
				
			|||
                <div class="page"> | 
				
			|||
                    <div class="oe_structure"/> | 
				
			|||
                    <h3><span t-esc="res_company.name"/>: General ledger | 
				
			|||
                    </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>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-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>Entries:</strong> | 
				
			|||
        <!--                            <t t-foreach="Filters['journals']" t-as="ps">--> | 
				
			|||
                                        <li> | 
				
			|||
                                            <t t-esc="Filters['entries']"/> | 
				
			|||
                                        </li> | 
				
			|||
        <!--                            </t>--> | 
				
			|||
                                </div> | 
				
			|||
                        </div> | 
				
			|||
                    </div> | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
                        <br></br> | 
				
			|||
                        <table> | 
				
			|||
                            <thead> | 
				
			|||
                                <tr class="text-center"> | 
				
			|||
                                    <th style="text-align:left;">Date</th> | 
				
			|||
                                    <th style="text-align:left;">Journal</th> | 
				
			|||
                                    <th style="text-align:left;">Partner</th> | 
				
			|||
                                    <th style="text-align:left;">Move</th> | 
				
			|||
                                    <th style="text-align:left;">Reference</th> | 
				
			|||
                                    <th style="text-align:right;padding-bottom:10px;">Debit</th> | 
				
			|||
                                    <th style="text-align:right">Credit</th> | 
				
			|||
                                    <th style="text-align:right">Balance</th> | 
				
			|||
                                </tr> | 
				
			|||
                            </thead> | 
				
			|||
                            <t t-foreach="account_data" t-as="line"> | 
				
			|||
                                <t t-if="account_data[line]['count']"> | 
				
			|||
 | 
				
			|||
                                    <tr> | 
				
			|||
 | 
				
			|||
                                        <td colspan="5"> | 
				
			|||
                                            <span style="color: white;" t-esc="'..'"/> | 
				
			|||
                                            <span t-esc="account_data[line]['name']"/> | 
				
			|||
                                        </td> | 
				
			|||
                                        <td class="text-right"> | 
				
			|||
                                            <span t-esc="account_data[line]['debit']" | 
				
			|||
                                                  t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                        </td> | 
				
			|||
                                        <td class="text-right"> | 
				
			|||
                                            <span t-esc="account_data[line]['credit']" | 
				
			|||
                                                  t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                        </td> | 
				
			|||
                                        <td class="text-right"> | 
				
			|||
                                            <span t-esc="account_data[line]['balance']" | 
				
			|||
                                                  t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                        </td> | 
				
			|||
                                    </tr> | 
				
			|||
 | 
				
			|||
                                    <t t-foreach="account_data[line]['lines']" t-as="sub_line"> | 
				
			|||
                                        <t t-if="sub_line['initial_bal']"> | 
				
			|||
                                            <tr> | 
				
			|||
                                                <td colspan="5" class="text-right"> | 
				
			|||
                                                    <span>Initial Balance</span> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td class="text-right"> | 
				
			|||
                                                    <span t-esc="sub_line['debit']" | 
				
			|||
                                                          t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td class="text-right"> | 
				
			|||
                                                    <span t-esc="sub_line['credit']" | 
				
			|||
                                                          t-options="{'widgetaccount_data': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td class="text-right"> | 
				
			|||
                                                    <span t-esc="sub_line['balance']" | 
				
			|||
                                                          t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                </td> | 
				
			|||
                                            </tr> | 
				
			|||
                                        </t> | 
				
			|||
                                        <t t-if="not sub_line['initial_bal'] and not sub_line['ending_bal']"> | 
				
			|||
                                            <tr> | 
				
			|||
                                                <td> | 
				
			|||
                                                    <t t-esc="sub_line.get('ldate')" t-options='{"widget": "date"}'/> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td> | 
				
			|||
                                                    <t t-esc="sub_line.get('lcode')"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td> | 
				
			|||
                                                    <t t-esc="sub_line.get('partner_name')"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td> | 
				
			|||
                                                    <t t-esc="sub_line.get('move_name')"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td style="width:30%;"> | 
				
			|||
                                                    <t t-esc="sub_line.get('lname')"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td class="text-right"> | 
				
			|||
                                                    <t t-esc="sub_line.get('debit')" | 
				
			|||
                                                       t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td class="text-right"> | 
				
			|||
                                                    <t t-esc="sub_line.get('credit')" | 
				
			|||
                                                       t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td class="text-right"> | 
				
			|||
                                                    <t t-esc="sub_line.get('balance')" | 
				
			|||
                                                       t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                </td> | 
				
			|||
                                            </tr> | 
				
			|||
                                        </t> | 
				
			|||
                                        <t t-if="sub_line['ending_bal']"> | 
				
			|||
                                            <tr> | 
				
			|||
                                                <td colspan="5" class="text-right"> | 
				
			|||
                                                    <span>Ending Balance</span> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td class="text-right"> | 
				
			|||
                                                    <span t-esc="sub_line['debit']" | 
				
			|||
                                                          t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td class="text-right"> | 
				
			|||
                                                    <span t-esc="sub_line['credit']" | 
				
			|||
                                                          t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td class="text-right"> | 
				
			|||
                                                    <span t-esc="sub_line['balance']" | 
				
			|||
                                                          t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                </td> | 
				
			|||
                                            </tr> | 
				
			|||
                                        </t> | 
				
			|||
                                    </t> | 
				
			|||
                                </t> | 
				
			|||
                            </t> | 
				
			|||
                        </table> | 
				
			|||
                    </div> | 
				
			|||
                    <br></br> | 
				
			|||
                </div> | 
				
			|||
            </t> | 
				
			|||
        </t> | 
				
			|||
    </template> | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    <record id="action_print_general_ledger" model="ir.actions.report"> | 
				
			|||
        <field name="name">General Ledger</field> | 
				
			|||
        <field name="model">dynamic.general.ledger</field> | 
				
			|||
        <field name="report_type">qweb-pdf</field> | 
				
			|||
        <field name="report_name">dynamic_financial_report.general_ledger</field> | 
				
			|||
        <field name="report_file">dynamic_financial_report.general_ledger</field> | 
				
			|||
    </record> | 
				
			|||
 | 
				
			|||
    <template id="dynamic_financial_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"> | 
				
			|||
                                    <strong>Journals:</strong> | 
				
			|||
                                    <t t-foreach="Filters['journals']" t-as="ps"> | 
				
			|||
                                        <li> | 
				
			|||
                                            <t t-esc="ps"/> | 
				
			|||
                                        </li> | 
				
			|||
                                    </t> | 
				
			|||
                                </div> | 
				
			|||
                                <div class="col-3"> | 
				
			|||
                                    <strong>Analytic:</strong> | 
				
			|||
                                    <t t-foreach="Filters['analytics']" t-as="ps"> | 
				
			|||
                                        <li> | 
				
			|||
                                            <t t-esc="ps"/> | 
				
			|||
                                        </li> | 
				
			|||
                                    </t> | 
				
			|||
                                </div> | 
				
			|||
                                <div class="col-3"> | 
				
			|||
                                    <strong>Entries:</strong> | 
				
			|||
        <!--                            <t t-foreach="Filters['journals']" t-as="ps">--> | 
				
			|||
                                        <li> | 
				
			|||
                                            <t t-esc="Filters['entries']"/> | 
				
			|||
                                        </li> | 
				
			|||
        <!--                            </t>--> | 
				
			|||
                                </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="amt">Initial Debit</th> | 
				
			|||
                                        <th class="amt">Initial Credit</th> | 
				
			|||
 | 
				
			|||
                                    </t> | 
				
			|||
                                    <th class="text-right">Debit</th> | 
				
			|||
                                    <th class="text-right">Credit</th> | 
				
			|||
<!--                                    <th class="text-right">Balance</th>--> | 
				
			|||
                                </tr> | 
				
			|||
                            </thead> | 
				
			|||
                            <t t-foreach="account_data" t-as="line"> | 
				
			|||
                                <t t-if="account_data[line]['count']"> | 
				
			|||
 | 
				
			|||
                                    <tr> | 
				
			|||
 | 
				
			|||
                                        <td style="text-align:left;"> | 
				
			|||
                                            <span style="color: white;" t-esc="'..'"/> | 
				
			|||
                                            <span t-esc="account_data[line]['code']"/> | 
				
			|||
                                        </td> | 
				
			|||
                                        <td colspan="5"> | 
				
			|||
                                            <span style="color: white;" t-esc="'..'"/> | 
				
			|||
                                            <span t-esc="account_data[line]['name']"/> | 
				
			|||
                                        </td> | 
				
			|||
                                        <t t-if="Filters.get('date_from')"> | 
				
			|||
                                            <t t-foreach="account_data[line]['lines']" t-as="iline"> | 
				
			|||
                                                <t t-if="(iline['initial_bal'] == true and iline['move_name'] == 'Initial Balance')"> | 
				
			|||
                                                    <td class="amt"> | 
				
			|||
                                                        <t t-raw="iline['debit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                    </td> | 
				
			|||
                                                    <td class="amt"> | 
				
			|||
                                                        <t t-raw="iline['credit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                    </td> | 
				
			|||
 | 
				
			|||
                                                </t> | 
				
			|||
 | 
				
			|||
                                            </t> | 
				
			|||
 | 
				
			|||
 | 
				
			|||
                                        </t> | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
                                        <td class="text-right"> | 
				
			|||
                                            <span t-esc="account_data[line]['debit']" | 
				
			|||
                                                  t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                        </td> | 
				
			|||
                                        <td class="text-right"> | 
				
			|||
                                            <span t-esc="account_data[line]['credit']" | 
				
			|||
                                                  t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                        </td> | 
				
			|||
<!--                                        <td class="text-right">--> | 
				
			|||
<!--                                            <span t-esc="account_data[line]['balance']"--> | 
				
			|||
<!--                                                  t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>--> | 
				
			|||
<!--                                        </td>--> | 
				
			|||
                                    </tr> | 
				
			|||
                                </t> | 
				
			|||
                            </t> | 
				
			|||
                            <td colspan="6" style="border-bottom: 1px solid ;" class="amt"><strong>Total</strong></td> | 
				
			|||
                            <t t-if="Filters.get('date_from')"> | 
				
			|||
                                <td class="amt" style="border-bottom: 1px solid ;"><strong></strong></td> | 
				
			|||
                                <td class="amt" style="border-bottom: 1px solid ;"><strong></strong></td> | 
				
			|||
                            </t> | 
				
			|||
 | 
				
			|||
<!--						<t t-if="(credit > 0 || debit > 0 )">--> | 
				
			|||
							<td class="text-right" style="border-bottom: 1px solid ;"><strong><t t-esc="total['debit']" 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="total['credit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></strong></td> | 
				
			|||
<!--						</t>--> | 
				
			|||
 | 
				
			|||
                        </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">dynamic.trial.balance</field> | 
				
			|||
            <field name="report_type">qweb-pdf</field> | 
				
			|||
            <field name="report_name">dynamic_financial_report.trial_balance</field> | 
				
			|||
            <field name="report_file">dynamic_financial_report.trial_balance</field> | 
				
			|||
    </record> | 
				
			|||
 | 
				
			|||
</odoo> | 
				
			|||
@ -0,0 +1,70 @@ | 
				
			|||
 | 
				
			|||
<odoo> | 
				
			|||
    <record id="action_dynamic_day_book" model="ir.actions.client"> | 
				
			|||
            <field name="name">Day Book</field> | 
				
			|||
            <field name="tag">dynamic.db</field> | 
				
			|||
        </record> | 
				
			|||
          <menuitem id="menu_day_book_report" sequence="60" action="action_dynamic_day_book" | 
				
			|||
              name="Day Book" parent="dynamic_financial_report.account_dynamic_report"/> | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
     <record id="action_dynamic_cash_flow" model="ir.actions.client"> | 
				
			|||
            <field name="name">Cash Flow Statement Reports</field> | 
				
			|||
            <field name="tag">dynamic.cf</field> | 
				
			|||
 | 
				
			|||
        </record> | 
				
			|||
        <menuitem id="menu_cash_flow_report" sequence="60" action="action_dynamic_cash_flow" | 
				
			|||
              name="Cash Flow Satement" parent="dynamic_financial_report.account_dynamic_report"/> | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    <record id="action_dynamic_bank_book" model="ir.actions.client"> | 
				
			|||
            <field name="name">Bank Book</field> | 
				
			|||
            <field name="tag">dynamic.bb</field> | 
				
			|||
        </record> | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
        <menuitem id="menu_bank_book_report" sequence="60" action="action_dynamic_bank_book" | 
				
			|||
                  name="Bank Book" parent="account_dynamic_report" groups="account.group_account_user"/> | 
				
			|||
 | 
				
			|||
            <record id="action_dynamic_cash_book" model="ir.actions.client"> | 
				
			|||
            <field name="name">Cash Book</field> | 
				
			|||
            <field name="tag">dynamic.cb</field> | 
				
			|||
        </record> | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
        <menuitem id="menu_cash_book_report" sequence="60" action="action_dynamic_cash_book" | 
				
			|||
                  name="Cash Book" parent="account_dynamic_report" groups="account.group_account_user"/> | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    <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,24 @@ | 
				
			|||
<?xml version="1.0" encoding="utf-8"?> | 
				
			|||
<odoo> | 
				
			|||
    <data> | 
				
			|||
        <record id="action_dynamic_balance_sheet" model="ir.actions.client"> | 
				
			|||
            <field name="name">Balance Sheet Report</field> | 
				
			|||
            <field name="tag">dynamic.bs</field> | 
				
			|||
        </record> | 
				
			|||
 | 
				
			|||
        <record id="action_dynamic_profit_and_loss" model="ir.actions.client"> | 
				
			|||
            <field name="name">Profit and Loss Report</field> | 
				
			|||
            <field name="tag">dynamic.pal</field> | 
				
			|||
        </record> | 
				
			|||
 | 
				
			|||
        <menuitem id="account_dynamic_report" sequence="15" | 
				
			|||
              name="Dynamic Reports" parent="account.menu_finance_reports"/> | 
				
			|||
 | 
				
			|||
        <menuitem id="menu__balance_sheet_report" sequence="60" action="action_dynamic_balance_sheet" | 
				
			|||
                  name="Balance Sheet" parent="account_dynamic_report" groups="account.group_account_user"/> | 
				
			|||
 | 
				
			|||
        <menuitem id="menu_profit_and_loss_report" sequence="61" action="action_dynamic_profit_and_loss" | 
				
			|||
                name="Profit and Loss" parent="account_dynamic_report" groups="account.group_account_user"/> | 
				
			|||
 | 
				
			|||
    </data> | 
				
			|||
</odoo> | 
				
			|||
@ -0,0 +1,203 @@ | 
				
			|||
<?xml version="1.0" encoding="utf-8"?> | 
				
			|||
<odoo> | 
				
			|||
    <template id="partner_ledger"> | 
				
			|||
        <t t-call="web.html_container"> | 
				
			|||
            <t t-call="web.internal_layout"> | 
				
			|||
                <div class="page"> | 
				
			|||
                    <h3><span t-esc="res_company.name"/>: Partner Ledger</h3> | 
				
			|||
                    <br></br> | 
				
			|||
                        <div class="row mt32"> | 
				
			|||
                            <div class="col-2"> | 
				
			|||
                                <strong>Partners:</strong> | 
				
			|||
                                <t t-foreach="report_data[0]['partners']" | 
				
			|||
                                   t-as="data"> | 
				
			|||
                                    <t t-esc="data"/> | 
				
			|||
                                </t> | 
				
			|||
                            </div> | 
				
			|||
                            <div class="col-2"> | 
				
			|||
                                <strong>Journals:</strong> | 
				
			|||
                                <t t-foreach="report_data[0]['journals']" | 
				
			|||
                                   t-as="data"> | 
				
			|||
                                    <t t-esc="data"/> | 
				
			|||
                                </t> | 
				
			|||
                            </div> | 
				
			|||
                            <div class="col-2"> | 
				
			|||
                                <strong>Partners Tag:</strong> | 
				
			|||
                                <t t-foreach="report_data[0]['categories']" | 
				
			|||
                                   t-as="data"> | 
				
			|||
                                    <t t-esc="data"/> | 
				
			|||
                                </t> | 
				
			|||
                            </div> | 
				
			|||
                            <div class="col-2"> | 
				
			|||
                                <strong>Account Type :</strong> | 
				
			|||
                                <p t-esc="report_data[0]['type']"/> | 
				
			|||
                            </div> | 
				
			|||
                            <div class="col-2"> | 
				
			|||
                                <strong>Accounts:</strong> | 
				
			|||
                                <t t-foreach="report_data[0]['accounts']" | 
				
			|||
                                   t-as="data"> | 
				
			|||
                                    <t t-esc="data"/> | 
				
			|||
                                </t> | 
				
			|||
                            </div> | 
				
			|||
                            <div class="col-2"> | 
				
			|||
                                <strong>Target Moves:</strong> | 
				
			|||
                                <p t-esc="report_data[0]['target_moves']"/> | 
				
			|||
                            </div> | 
				
			|||
                        </div> | 
				
			|||
                    <div class="row mt32"> | 
				
			|||
                        <t t-if="report_data[0].get('date_from')"> | 
				
			|||
                                <div class="col-2"> | 
				
			|||
                                    <strong>From Date :</strong> | 
				
			|||
                                    <p t-esc="report_data[0]['date_from']"/> | 
				
			|||
                                </div> | 
				
			|||
                            </t> | 
				
			|||
                            <t t-if="report_data[0].get('date_to')"> | 
				
			|||
                                <div class="col-2"> | 
				
			|||
                                    <strong>To Date :</strong> | 
				
			|||
                                    <p t-esc="report_data[0]['date_to']"/> | 
				
			|||
                                </div> | 
				
			|||
                            </t> | 
				
			|||
                        <t t-if="report_data[0].get('reconciled')"> | 
				
			|||
                                <div class="col-2"> | 
				
			|||
                                    <strong>Reconciliation status :</strong> | 
				
			|||
                                    <p t-esc="report_data[0]['reconciled']"/> | 
				
			|||
                                </div> | 
				
			|||
                            </t> | 
				
			|||
                    </div> | 
				
			|||
10:27 | 
				
			|||
<t t-set="data_report_margin_top" t-value="0"/> | 
				
			|||
                        <table class="table table-sm table-reports" style="top:0px;"> | 
				
			|||
                            <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;">Reference</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="line"> | 
				
			|||
                                <t t-if="account_data[line]['count']"> | 
				
			|||
                                    <tr style="border-bottom: 2px solid black;"> | 
				
			|||
                                        <td colspan="5"> | 
				
			|||
                                            <span style="color: white;" | 
				
			|||
                                                  t-esc="'..'"/> | 
				
			|||
                                            <strong> | 
				
			|||
                                                <span t-esc="account_data[line]['name']"/> | 
				
			|||
                                            </strong> | 
				
			|||
                                        </td> | 
				
			|||
                                        <td class="text-right"> | 
				
			|||
                                            <strong> | 
				
			|||
                                                <span t-esc="account_data[line]['debit']" | 
				
			|||
                                                      t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                            </strong> | 
				
			|||
                                        </td> | 
				
			|||
                                        <td class="text-right"> | 
				
			|||
                                            <strong> | 
				
			|||
                                                <span t-esc="account_data[line]['credit']" | 
				
			|||
                                                      t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                            </strong> | 
				
			|||
                                        </td> | 
				
			|||
                                        <td class="text-right"> | 
				
			|||
                                            <strong> | 
				
			|||
                                                <span t-esc="account_data[line]['balance']" | 
				
			|||
                                                      t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                            </strong> | 
				
			|||
                                        </td> | 
				
			|||
                                    </tr> | 
				
			|||
                                    <t t-foreach="account_data[line]['lines']" | 
				
			|||
                                       t-as="sub_line"> | 
				
			|||
                                        <t t-if="sub_line['initial_bal']"> | 
				
			|||
                                            <tr> | 
				
			|||
                                                <td colspan="5" | 
				
			|||
                                                    class="text-right"> | 
				
			|||
                                                    <span>Initial Balance</span> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td class="text-right"> | 
				
			|||
                                                    <span t-esc="sub_line['debit']" | 
				
			|||
                                                          t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td class="text-right"> | 
				
			|||
                                                    <span t-esc="sub_line['credit']" | 
				
			|||
                                                          t-options="{'widgetaccount_data': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td class="text-right"> | 
				
			|||
                                                    <span t-esc="sub_line['balance']" | 
				
			|||
                                                          t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                </td> | 
				
			|||
                                            </tr> | 
				
			|||
                                        </t> | 
				
			|||
                                        <t t-if="not sub_line['initial_bal'] and not sub_line['ending_bal']"> | 
				
			|||
                                            <tr> | 
				
			|||
                                                <td> | 
				
			|||
                                                    <t t-esc="sub_line.get('ldate')" | 
				
			|||
                                                       t-options='{"widget": "date"}'/> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td> | 
				
			|||
                                                    <t t-esc="sub_line.get('lcode')"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td> | 
				
			|||
                                                    <t t-esc="sub_line.get('account_code')"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td> | 
				
			|||
                                                    <t t-esc="sub_line.get('move_name')"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td style="width:30%;"> | 
				
			|||
                                                    <t t-esc="sub_line.get('lname')"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td class="text-right"> | 
				
			|||
                                                    <t t-esc="sub_line.get('debit')" | 
				
			|||
                                                       t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td class="text-right"> | 
				
			|||
                                                    <t t-esc="sub_line.get('credit')" | 
				
			|||
                                                       t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td class="text-right"> | 
				
			|||
                                                    <t t-esc="sub_line.get('balance')" | 
				
			|||
                                                       t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                </td> | 
				
			|||
                                            </tr> | 
				
			|||
                                        </t> | 
				
			|||
                                        <t t-if="sub_line['ending_bal']"> | 
				
			|||
                                            <tr> | 
				
			|||
                                                <td colspan="5" | 
				
			|||
                                                    class="text-right"> | 
				
			|||
                                                    <span>Ending Balance</span> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td class="text-right"> | 
				
			|||
                                                    <span t-esc="sub_line['debit']" | 
				
			|||
                                                          t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td class="text-right"> | 
				
			|||
                                                    <span t-esc="sub_line['credit']" | 
				
			|||
                                                          t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                </td> | 
				
			|||
                                                <td class="text-right"> | 
				
			|||
                                                    <span t-esc="sub_line['balance']" | 
				
			|||
                                                          t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/> | 
				
			|||
                                                </td> | 
				
			|||
                                            </tr> | 
				
			|||
                                        </t> | 
				
			|||
                                    </t> | 
				
			|||
                                </t> | 
				
			|||
                            </t> | 
				
			|||
                            </tbody> | 
				
			|||
                        </table> | 
				
			|||
                </div> | 
				
			|||
            </t> | 
				
			|||
        </t> | 
				
			|||
    </template> | 
				
			|||
    <report id="action_print_partner_ledger" | 
				
			|||
            model="dynamic.partner.ledger" | 
				
			|||
            report_type="qweb-pdf" | 
				
			|||
            menu="False" | 
				
			|||
            string="Partner Ledger" | 
				
			|||
            name="dynamic_financial_report.partner_ledger" | 
				
			|||
            file="dynamic_financial_report.partner_ledger" | 
				
			|||
    /> | 
				
			|||
</odoo> | 
				
			|||
@ -0,0 +1,18 @@ | 
				
			|||
<?xml version="1.0" encoding="utf-8"?> | 
				
			|||
<odoo> | 
				
			|||
    <template id="assets_backend" name="account_dynamic_reports assets" inherit_id="web.assets_backend"> | 
				
			|||
        <xpath expr="." position="inside"> | 
				
			|||
                        <link rel="stylesheet" type="text/scss" href="/dynamic_financial_report/static/src/scss/dynamic_common_style.scss"/> | 
				
			|||
            <script type="text/javascript" src="/dynamic_financial_report/static/src/js/balance_sheet.js"></script> | 
				
			|||
            <script type="text/javascript" src="/dynamic_financial_report/static/src/js/gl_tb.js"></script> | 
				
			|||
            <script type="text/javascript" src="/dynamic_financial_report/static/src/js/ageing_partner.js"></script> | 
				
			|||
            <script type="text/javascript" src="/dynamic_financial_report/static/src/js/partner_ledger.js"></script> | 
				
			|||
            <script type="text/javascript" src="/dynamic_financial_report/static/src/js/profit_loss.js"></script> | 
				
			|||
            <script type="text/javascript" src="/dynamic_financial_report/static/src/js/bank_book.js"></script> | 
				
			|||
            <script type="text/javascript" src="/dynamic_financial_report/static/src/js/action_manager.js"></script> | 
				
			|||
            <script type="text/javascript" src="/dynamic_financial_report/static/src/js/cash_flow.js"></script> | 
				
			|||
            <script type="text/javascript" src="/dynamic_financial_report/static/src/js/daybook.js"></script> | 
				
			|||
 | 
				
			|||
        </xpath> | 
				
			|||
    </template> | 
				
			|||
</odoo> | 
				
			|||
@ -0,0 +1,9 @@ | 
				
			|||
from . import general_ledger | 
				
			|||
from . import trial_balance | 
				
			|||
from . import balance_sheet | 
				
			|||
from . import partner_ledger | 
				
			|||
from . import ageing_partner | 
				
			|||
from . import balance_sheet_config | 
				
			|||
from . import bankbook | 
				
			|||
from . import cash_flow_report | 
				
			|||
from . import day_book | 
				
			|||
@ -0,0 +1,705 @@ | 
				
			|||
"""Partner Ageing""" | 
				
			|||
import io | 
				
			|||
import json | 
				
			|||
import xlsxwriter | 
				
			|||
from odoo import api, fields, models, _ | 
				
			|||
from odoo.exceptions import ValidationError, UserError | 
				
			|||
from dateutil.relativedelta import relativedelta | 
				
			|||
 | 
				
			|||
FETCH_RANGE = 2500 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
class PartnerAgeing(models.TransientModel): | 
				
			|||
    """ Transient class For Ageing partner""" | 
				
			|||
    _name = "dynamic.ageing.partner" | 
				
			|||
 | 
				
			|||
    @api.onchange('partner_type') | 
				
			|||
    def onchange_partner_type(self): | 
				
			|||
        self.partner_ids = [(5,)] | 
				
			|||
        if self.partner_type: | 
				
			|||
            company_id = self.env.user.company_id | 
				
			|||
            if self.partner_type == 'customer': | 
				
			|||
                partner_company_domain = [('parent_id', '=', False), | 
				
			|||
                                          ('customer', '=', True), | 
				
			|||
                                          '|', | 
				
			|||
                                          ('company_id', '=', company_id.id), | 
				
			|||
                                          ('company_id', '=', False)] | 
				
			|||
 | 
				
			|||
                self.partner_ids |= self.env['res.partner'].search \ | 
				
			|||
                    (partner_company_domain) | 
				
			|||
            if self.partner_type == 'supplier': | 
				
			|||
                partner_company_domain = [('parent_id', '=', False), | 
				
			|||
                                          ('supplier', '=', True), | 
				
			|||
                                          '|', | 
				
			|||
                                          ('company_id', '=', company_id.id), | 
				
			|||
                                          ('company_id', '=', False)] | 
				
			|||
 | 
				
			|||
                self.partner_ids |= self.env['res.partner'].search \ | 
				
			|||
                    (partner_company_domain) | 
				
			|||
 | 
				
			|||
    def name_get(self): | 
				
			|||
        res = [] | 
				
			|||
        for record in self: | 
				
			|||
            res.append((record.id, 'Ageing')) | 
				
			|||
        return res | 
				
			|||
 | 
				
			|||
    as_on_date = fields.Date(string='As on date', required=True, | 
				
			|||
                             default=fields.Date.today()) | 
				
			|||
    bucket_1 = fields.Integer(string='Bucket 1', required=True, default=20) | 
				
			|||
    bucket_2 = fields.Integer(string='Bucket 2', required=True, default=40) | 
				
			|||
    bucket_3 = fields.Integer(string='Bucket 3', required=True, default=60) | 
				
			|||
    bucket_4 = fields.Integer(string='Bucket 4', required=True, default=80) | 
				
			|||
    bucket_5 = fields.Integer(string='Bucket 5', required=True, default=100) | 
				
			|||
    include_details = fields.Boolean(string='Include Details', default=True) | 
				
			|||
    type = fields.Selection([('receivable', 'Receivable Accounts Only'), | 
				
			|||
                             ('payable', 'Payable Accounts Only')], | 
				
			|||
                            string='Type') | 
				
			|||
    partner_type = fields.Selection([('customer', 'Customer Only'), | 
				
			|||
                                     ('supplier', 'Supplier Only')], | 
				
			|||
                                    string='Partner Type') | 
				
			|||
 | 
				
			|||
    partner_ids = fields.Many2many( | 
				
			|||
        'res.partner', required=False | 
				
			|||
    ) | 
				
			|||
    partner_category_ids = fields.Many2many( | 
				
			|||
        'res.partner.category', string='Partner Tag', | 
				
			|||
    ) | 
				
			|||
    target_moves = fields.Selection( | 
				
			|||
        [('draft', 'Draft'), | 
				
			|||
         ('posted', 'Posted')], default='draft', string='Target Moves' | 
				
			|||
 | 
				
			|||
    ) | 
				
			|||
    company_id = fields.Many2one( | 
				
			|||
        'res.company', string='Company', | 
				
			|||
 | 
				
			|||
    ) | 
				
			|||
 | 
				
			|||
    def write(self, vals): | 
				
			|||
 | 
				
			|||
        if not vals.get('partner_ids'): | 
				
			|||
            vals.update({ | 
				
			|||
                'partner_ids': [(5, 0, 0)] | 
				
			|||
            }) | 
				
			|||
 | 
				
			|||
        if vals.get('partner_category_ids'): | 
				
			|||
            vals.update({'partner_category_ids': [(4, j) for j in vals.get( | 
				
			|||
                'partner_category_ids')]}) | 
				
			|||
        if vals.get('partner_category_ids') == []: | 
				
			|||
            vals.update({'partner_category_ids': [(5,)]}) | 
				
			|||
        ret = super(PartnerAgeing, self).write(vals) | 
				
			|||
 | 
				
			|||
        return ret | 
				
			|||
 | 
				
			|||
    def validate_data(self): | 
				
			|||
        if not (self.bucket_1 < self.bucket_2 and | 
				
			|||
                self.bucket_2 < self.bucket_3 and | 
				
			|||
                self.bucket_3 < self.bucket_4 and | 
				
			|||
                self.bucket_4 < self.bucket_5): | 
				
			|||
            raise ValidationError(_('"Bucket order must be ascending"')) | 
				
			|||
        return True | 
				
			|||
 | 
				
			|||
    def get_filters(self, default_filters={}): | 
				
			|||
        """ shows filters """ | 
				
			|||
        company_id = self.env.user.company_id | 
				
			|||
        partner_company_domain = [('parent_id', '=', False), | 
				
			|||
                                  # '|', | 
				
			|||
                                  # ('customer_rank', '=', True), | 
				
			|||
                                  # ('supplier_rank', '=', True), | 
				
			|||
                                  '|', | 
				
			|||
                                  ('company_id', '=', company_id.id), | 
				
			|||
                                  ('company_id', '=', False)] | 
				
			|||
 | 
				
			|||
        partners = self.partner_ids if self.partner_ids else self.env[ | 
				
			|||
            'res.partner'].search(partner_company_domain) | 
				
			|||
        categories = self.partner_category_ids if self.partner_category_ids else \ | 
				
			|||
            self.env['res.partner.category'].search([]) | 
				
			|||
 | 
				
			|||
        filter_dict = { | 
				
			|||
            'partner_ids': self.partner_ids.ids, | 
				
			|||
            'partner_category_ids': self.partner_category_ids.ids, | 
				
			|||
            'company_id': self.company_id and self.company_id.id or False, | 
				
			|||
            'as_on_date': self.as_on_date, | 
				
			|||
            'type': self.type, | 
				
			|||
            'target_moves': self.target_moves, | 
				
			|||
            'partner_type': self.partner_type, | 
				
			|||
            'bucket_1': self.bucket_1, | 
				
			|||
            'bucket_2': self.bucket_2, | 
				
			|||
            'bucket_3': self.bucket_3, | 
				
			|||
            'bucket_4': self.bucket_4, | 
				
			|||
            'bucket_5': self.bucket_5, | 
				
			|||
            'include_details': self.include_details, | 
				
			|||
 | 
				
			|||
            'partners_list': [(p.id, p.name) for p in partners], | 
				
			|||
            'category_list': [(c.id, c.name) for c in categories], | 
				
			|||
            'company_name': self.company_id and self.company_id.name, | 
				
			|||
        } | 
				
			|||
        filter_dict.update(default_filters) | 
				
			|||
        return filter_dict | 
				
			|||
 | 
				
			|||
    def process_filters(self): | 
				
			|||
        ''' To show on report headers''' | 
				
			|||
 | 
				
			|||
        data = self.get_filters(default_filters={}) | 
				
			|||
        filters = {} | 
				
			|||
        filters['bucket_1'] = data.get('bucket_1') | 
				
			|||
        filters['bucket_2'] = data.get('bucket_2') | 
				
			|||
        filters['bucket_3'] = data.get('bucket_3') | 
				
			|||
        filters['bucket_4'] = data.get('bucket_4') | 
				
			|||
        filters['bucket_5'] = data.get('bucket_5') | 
				
			|||
 | 
				
			|||
        if data.get('partner_ids', []): | 
				
			|||
            filters['partners'] = self.env['res.partner'].browse( | 
				
			|||
                data.get('partner_ids', [])).mapped('name') | 
				
			|||
        else: | 
				
			|||
            filters['partners'] = ['All'] | 
				
			|||
 | 
				
			|||
        if data.get('as_on_date', False): | 
				
			|||
            filters['as_on_date'] = data.get('as_on_date') | 
				
			|||
 | 
				
			|||
        if data.get('company_id'): | 
				
			|||
            filters['company_id'] = data.get('company_id') | 
				
			|||
        else: | 
				
			|||
            filters['company_id'] = '' | 
				
			|||
 | 
				
			|||
        if data.get('target_moves') == 'draft': | 
				
			|||
 | 
				
			|||
            filters['target_moves'] = 'All Entries' | 
				
			|||
        else: | 
				
			|||
            filters['target_moves'] = 'Posted Only' | 
				
			|||
 | 
				
			|||
        if data.get('type') == 'receivable': | 
				
			|||
            filters['type'] = 'Receivable' | 
				
			|||
        elif data.get('type') == 'payable': | 
				
			|||
            filters['type'] = 'Payable' | 
				
			|||
        else: | 
				
			|||
            filters['type'] = 'Receivable and Payable' | 
				
			|||
 | 
				
			|||
        if data.get('partner_type') == 'customer': | 
				
			|||
            filters['partner_type'] = 'Customer Only' | 
				
			|||
        elif data.get('partner_type') == 'supplier': | 
				
			|||
            filters['partner_type'] = 'Supplier Only' | 
				
			|||
        else: | 
				
			|||
            filters['partner_type'] = 'Customer And Supplier ' | 
				
			|||
 | 
				
			|||
        if data.get('partner_category_ids', []): | 
				
			|||
            filters['categories'] = self.env['res.partner.category'].browse( | 
				
			|||
                data.get('partner_category_ids', [])).mapped('name') | 
				
			|||
        else: | 
				
			|||
            filters['categories'] = ['All'] | 
				
			|||
 | 
				
			|||
        if data.get('include_details'): | 
				
			|||
            filters['include_details'] = True | 
				
			|||
        else: | 
				
			|||
            filters['include_details'] = False | 
				
			|||
 | 
				
			|||
        filters['partners_list'] = data.get('partners_list') | 
				
			|||
        filters['category_list'] = data.get('category_list') | 
				
			|||
        filters['company_name'] = data.get('company_name') | 
				
			|||
 | 
				
			|||
        return filters | 
				
			|||
 | 
				
			|||
    def prepare_bucket_list(self): | 
				
			|||
        """ prepare bucket values for partner ageing report""" | 
				
			|||
        periods = {} | 
				
			|||
        date_from = self.as_on_date | 
				
			|||
        date_from = fields.Date.from_string(date_from) | 
				
			|||
        bucket_list = [self.bucket_1, self.bucket_2, self.bucket_3, | 
				
			|||
                       self.bucket_4, self.bucket_5] | 
				
			|||
        start = False | 
				
			|||
        stop = date_from | 
				
			|||
        name = 'Not' | 
				
			|||
        periods[0] = { | 
				
			|||
            'bucket': 'As on', | 
				
			|||
            'name': name, | 
				
			|||
            'start': '', | 
				
			|||
            'stop': stop.strftime('%Y-%m-%d'), | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        stop = date_from | 
				
			|||
        final_date = False | 
				
			|||
        for i in range(5): | 
				
			|||
            start = stop - relativedelta(days=1) | 
				
			|||
            stop = start - relativedelta(days=bucket_list[i]) | 
				
			|||
            name = 'value_' + str(bucket_list[0]) if i == 0 else str( | 
				
			|||
                str(bucket_list[i - 1] + 1)) + str(bucket_list[i]) | 
				
			|||
 | 
				
			|||
            final_date = stop | 
				
			|||
            periods[i + 1] = { | 
				
			|||
                'bucket': bucket_list[i], | 
				
			|||
                'name': name, | 
				
			|||
                'start': start.strftime('%Y-%m-%d'), | 
				
			|||
                'stop': stop.strftime('%Y-%m-%d'), | 
				
			|||
            } | 
				
			|||
 | 
				
			|||
        start = final_date - relativedelta(days=1) | 
				
			|||
        stop = '' | 
				
			|||
        name = str(self.bucket_5) | 
				
			|||
 | 
				
			|||
        periods[6] = { | 
				
			|||
            'bucket': 'Above', | 
				
			|||
            'name': name, | 
				
			|||
            'start': start.strftime('%Y-%m-%d'), | 
				
			|||
            'stop': '', | 
				
			|||
        } | 
				
			|||
        return periods | 
				
			|||
 | 
				
			|||
    def al_move_lines(self, offset=0, partner=0, fetch_range=FETCH_RANGE): | 
				
			|||
        """ shows detailed move lines""" | 
				
			|||
 | 
				
			|||
        as_on_date = self.as_on_date | 
				
			|||
        period_dict = self.prepare_bucket_list() | 
				
			|||
        period_list = [period_dict[a]['name'] for a in period_dict] | 
				
			|||
        company_id = self.env.user.company_id | 
				
			|||
        type = ('receivable', 'payable') | 
				
			|||
        if self.type: | 
				
			|||
            type = tuple([self.type, 'none']) | 
				
			|||
        arg_list = ('draft', 'posted') | 
				
			|||
        if self.target_moves == 'posted': | 
				
			|||
            arg_list = tuple([self.target_moves, 'none']) | 
				
			|||
        offset = offset * fetch_range | 
				
			|||
        count = 0 | 
				
			|||
        move_lines = [] | 
				
			|||
        if partner: | 
				
			|||
            sql = """ | 
				
			|||
                    SELECT COUNT(*) | 
				
			|||
                    FROM | 
				
			|||
                        account_move_line AS l | 
				
			|||
                    LEFT JOIN | 
				
			|||
                        account_move AS m ON m.id = l.move_id | 
				
			|||
                    LEFT JOIN | 
				
			|||
                        account_account AS a ON a.id = l.account_id | 
				
			|||
                    LEFT JOIN | 
				
			|||
                        account_account_type AS ty ON a.user_type_id = ty.id | 
				
			|||
                    LEFT JOIN | 
				
			|||
                        account_journal AS j ON l.journal_id = j.id | 
				
			|||
                    WHERE | 
				
			|||
                        l.balance <> 0 | 
				
			|||
                        AND m.state IN %s | 
				
			|||
                        AND ty.type IN %s | 
				
			|||
                        AND l.partner_id = %s | 
				
			|||
                        AND l.date <= '%s' | 
				
			|||
                        AND l.company_id = %s | 
				
			|||
                """ % (arg_list, type, partner, as_on_date, company_id.id) | 
				
			|||
            self.env.cr.execute(sql) | 
				
			|||
            count = self.env.cr.fetchone()[0] | 
				
			|||
 | 
				
			|||
            SELECT = """SELECT m.name AS move_name, | 
				
			|||
                                m.id AS move_id, | 
				
			|||
                                l.date AS date, | 
				
			|||
                                l.date_maturity AS date_maturity,  | 
				
			|||
                                j.name AS journal_name, | 
				
			|||
                                cc.id AS company_currency_id, | 
				
			|||
                                a.name AS account_name, | 
				
			|||
                                a.code AS account_code, | 
				
			|||
                                c.symbol AS currency_symbol, | 
				
			|||
                                c.position AS currency_position, | 
				
			|||
                                c.rounding AS currency_precision, | 
				
			|||
                                cc.id AS company_currency_id, | 
				
			|||
                                cc.symbol AS company_currency_symbol, | 
				
			|||
                                cc.rounding AS company_currency_precision, | 
				
			|||
                                cc.position AS company_currency_position,""" | 
				
			|||
 | 
				
			|||
            for period in period_dict: | 
				
			|||
                if period_dict[period].get('start') and period_dict[period].get( | 
				
			|||
                        'stop'): | 
				
			|||
                    SELECT += """ CASE | 
				
			|||
                                    WHEN  | 
				
			|||
                                        COALESCE(l.date_maturity,l.date) >= '%s' AND  | 
				
			|||
                                        COALESCE(l.date_maturity,l.date) <= '%s' | 
				
			|||
                                    THEN | 
				
			|||
                                        sum(l.balance) + | 
				
			|||
                                        sum( | 
				
			|||
                                            COALESCE( | 
				
			|||
                                                (SELECT  | 
				
			|||
                                                    SUM(amount) | 
				
			|||
                                                FROM account_partial_reconcile | 
				
			|||
                                                WHERE credit_move_id = l.id AND max_date <= '%s'), 0 | 
				
			|||
                                                ) | 
				
			|||
                                            ) - | 
				
			|||
                                        sum( | 
				
			|||
                                            COALESCE( | 
				
			|||
                                                (SELECT  | 
				
			|||
                                                    SUM(amount)  | 
				
			|||
                                                FROM account_partial_reconcile  | 
				
			|||
                                                WHERE debit_move_id = l.id AND max_date <= '%s'), 0 | 
				
			|||
                                                ) | 
				
			|||
                                            ) | 
				
			|||
                                    ELSE | 
				
			|||
                                        0 | 
				
			|||
                                    END AS %s,""" % ( | 
				
			|||
                        period_dict[period].get('stop'), | 
				
			|||
                        period_dict[period].get('start'), | 
				
			|||
                        as_on_date, | 
				
			|||
                        as_on_date, | 
				
			|||
                        'range_' + str(period), | 
				
			|||
                    ) | 
				
			|||
                elif not period_dict[period].get('start'): | 
				
			|||
                    SELECT += """ CASE | 
				
			|||
                                    WHEN  | 
				
			|||
                                        COALESCE(l.date_maturity,l.date) >= '%s'  | 
				
			|||
                                    THEN | 
				
			|||
                                        sum( | 
				
			|||
                                            l.balance | 
				
			|||
                                            ) + | 
				
			|||
                                        sum( | 
				
			|||
                                            COALESCE( | 
				
			|||
                                                (SELECT  | 
				
			|||
                                                    SUM(amount) | 
				
			|||
                                                FROM account_partial_reconcile | 
				
			|||
                                                WHERE credit_move_id = l.id AND max_date <= '%s'), 0 | 
				
			|||
                                                ) | 
				
			|||
                                            ) - | 
				
			|||
                                        sum( | 
				
			|||
                                            COALESCE( | 
				
			|||
                                                (SELECT  | 
				
			|||
                                                    SUM(amount)  | 
				
			|||
                                                FROM account_partial_reconcile  | 
				
			|||
                                                WHERE debit_move_id = l.id AND max_date <= '%s'), 0 | 
				
			|||
                                                ) | 
				
			|||
                                            ) | 
				
			|||
                                    ELSE | 
				
			|||
                                        0 | 
				
			|||
                                    END AS %s,""" % ( | 
				
			|||
                        period_dict[period].get('stop'), as_on_date, as_on_date, | 
				
			|||
                        'range_' + str(period)) | 
				
			|||
                else: | 
				
			|||
                    SELECT += """ CASE | 
				
			|||
                                    WHEN | 
				
			|||
                                        COALESCE(l.date_maturity,l.date) <= '%s'  | 
				
			|||
                                    THEN | 
				
			|||
                                        sum( | 
				
			|||
                                            l.balance | 
				
			|||
                                            ) + | 
				
			|||
                                        sum( | 
				
			|||
                                            COALESCE( | 
				
			|||
                                                (SELECT  | 
				
			|||
                                                    SUM(amount) | 
				
			|||
                                                FROM account_partial_reconcile | 
				
			|||
                                                WHERE credit_move_id = l.id AND max_date <= '%s'), 0 | 
				
			|||
                                                ) | 
				
			|||
                                            ) - | 
				
			|||
                                        sum( | 
				
			|||
                                            COALESCE( | 
				
			|||
                                                (SELECT  | 
				
			|||
                                                    SUM(amount)  | 
				
			|||
                                                FROM account_partial_reconcile  | 
				
			|||
                                                WHERE debit_move_id = l.id AND max_date <= '%s'), 0 | 
				
			|||
                                                ) | 
				
			|||
                                            ) | 
				
			|||
                                    ELSE | 
				
			|||
                                        0 | 
				
			|||
                                    END AS %s """ % ( | 
				
			|||
                        period_dict[period].get('start'), as_on_date, | 
				
			|||
                        as_on_date, | 
				
			|||
                        'range_' + str(period)) | 
				
			|||
 | 
				
			|||
            sql = """ | 
				
			|||
 | 
				
			|||
                    FROM | 
				
			|||
                        account_move_line AS l | 
				
			|||
                    LEFT JOIN | 
				
			|||
                        account_move AS m ON m.id = l.move_id | 
				
			|||
                    LEFT JOIN | 
				
			|||
                        account_account AS a ON a.id = l.account_id | 
				
			|||
                    LEFT JOIN | 
				
			|||
                        account_account_type AS ty ON a.user_type_id = ty.id | 
				
			|||
                    LEFT JOIN | 
				
			|||
                        account_journal AS j ON l.journal_id = j.id | 
				
			|||
                    LEFT JOIN  | 
				
			|||
                        res_currency AS c ON l.currency_id = c.id     | 
				
			|||
                    LEFT JOIN  | 
				
			|||
                        res_currency AS cc ON l.company_currency_id = cc.id | 
				
			|||
                    WHERE | 
				
			|||
                        l.balance <> 0 | 
				
			|||
                        AND m.state IN %s | 
				
			|||
                        AND ty.type IN %s | 
				
			|||
                        AND l.partner_id = %s | 
				
			|||
                        AND l.date <= '%s' | 
				
			|||
                        AND l.company_id = %s | 
				
			|||
                    GROUP BY | 
				
			|||
                        l.date, l.date_maturity,l.currency_id, m.id, m.name, j.name, a.name,a.code, c.rounding, cc.id, cc.rounding, cc.position, c.position, c.symbol, cc.symbol | 
				
			|||
                    OFFSET %s ROWS | 
				
			|||
                    FETCH FIRST %s ROWS ONLY | 
				
			|||
                """ % ( | 
				
			|||
                arg_list, type, partner, as_on_date, company_id.id, offset, fetch_range) | 
				
			|||
            self.env.cr.execute(SELECT + sql) | 
				
			|||
            final_list = self.env.cr.dictfetchall() or 0.0 | 
				
			|||
 | 
				
			|||
            for m_list in final_list: | 
				
			|||
                if (m_list['range_0'] or m_list['range_1'] or m_list['range_2'] or | 
				
			|||
                        m_list['range_3'] or m_list['range_4'] or m_list['range_5']): | 
				
			|||
                    move_lines.append(m_list) | 
				
			|||
        return count, offset, move_lines, period_list | 
				
			|||
 | 
				
			|||
    def report_data(self): | 
				
			|||
        """ fetch values from query to get report, prepare bucket values """ | 
				
			|||
        data = self.get_filters(default_filters={}) | 
				
			|||
 | 
				
			|||
        period_dict = self.prepare_bucket_list() | 
				
			|||
        company_id = self.env.user.company_id | 
				
			|||
        domain = ['|', ('company_id', '=', company_id.id), | 
				
			|||
                  ('company_id', '=', False)] | 
				
			|||
        if self.partner_type == 'customer': | 
				
			|||
            domain.append(('customer_rank', '=', True)) | 
				
			|||
        if self.partner_type == 'supplier': | 
				
			|||
            domain.append(('supplier_rank', '=', True)) | 
				
			|||
 | 
				
			|||
        if self.partner_category_ids: | 
				
			|||
            domain.append(('category_id', 'in', self.partner_category_ids.ids)) | 
				
			|||
 | 
				
			|||
        partner_ids = self.partner_ids or self.env['res.partner'].search(domain) | 
				
			|||
        as_on_date = self.as_on_date | 
				
			|||
        company_currency_id = company_id.currency_id.id | 
				
			|||
        company_currency_symbol = company_id.currency_id.symbol | 
				
			|||
        company_currency_position = company_id.currency_id.position | 
				
			|||
        company_currency_precision = company_id.currency_id.rounding | 
				
			|||
 | 
				
			|||
        type = ('receivable', 'payable') | 
				
			|||
        if self.type: | 
				
			|||
            type = tuple([self.type, 'none']) | 
				
			|||
        arg_list = ('draft', 'posted') | 
				
			|||
        if self.target_moves == 'posted': | 
				
			|||
            arg_list = tuple([self.target_moves, 'none']) | 
				
			|||
 | 
				
			|||
        partner_dict = {} | 
				
			|||
        for partner in partner_ids: | 
				
			|||
            partner_dict.update({partner.id: {}}) | 
				
			|||
 | 
				
			|||
        for partner in partner_ids: | 
				
			|||
            partner_dict[partner.id].update( | 
				
			|||
                {'id': partner.id, 'partner_name': partner.name}) | 
				
			|||
 | 
				
			|||
            total_balance = 0.0 | 
				
			|||
            sql = """ | 
				
			|||
                SELECT | 
				
			|||
 | 
				
			|||
                    COUNT(*) AS count | 
				
			|||
                FROM | 
				
			|||
                    account_move_line AS l | 
				
			|||
                LEFT JOIN | 
				
			|||
                    account_move AS m ON m.id = l.move_id | 
				
			|||
                LEFT JOIN | 
				
			|||
                    account_account AS a ON a.id = l.account_id | 
				
			|||
                LEFT JOIN | 
				
			|||
                    account_account_type AS ty ON a.user_type_id = ty.id | 
				
			|||
                WHERE  | 
				
			|||
                    l.balance <> 0 | 
				
			|||
                    AND m.state IN %s | 
				
			|||
                    AND ty.type IN %s | 
				
			|||
                    AND l.partner_id = %s | 
				
			|||
                    AND l.date <= '%s' | 
				
			|||
                    AND l.company_id = %s | 
				
			|||
            """ % (arg_list, type, partner.id, as_on_date, company_id.id) | 
				
			|||
            self.env.cr.execute(sql) | 
				
			|||
 | 
				
			|||
            fetch_dict = self.env.cr.dictfetchone() or 0.0 | 
				
			|||
 | 
				
			|||
            count = fetch_dict.get('count') or 0.0 | 
				
			|||
 | 
				
			|||
            if count: | 
				
			|||
                for period in period_dict: | 
				
			|||
 | 
				
			|||
                    where = " AND l.date <= '%s' AND l.partner_id = %s " \ | 
				
			|||
                            "AND COALESCE(l.date_maturity,l.date) " % ( | 
				
			|||
                                as_on_date, partner.id) | 
				
			|||
                    if period_dict[period].get('start') and period_dict[ | 
				
			|||
                        period].get('stop'): | 
				
			|||
                        where += " BETWEEN '%s' AND '%s'" % ( | 
				
			|||
                            period_dict[period].get('stop'), | 
				
			|||
                            period_dict[period].get('start')) | 
				
			|||
                    elif not period_dict[period].get('start'):  # ie just | 
				
			|||
                        where += " >= '%s'" % (period_dict[period].get('stop')) | 
				
			|||
                    else: | 
				
			|||
                        where += " <= '%s'" % (period_dict[period].get('start')) | 
				
			|||
 | 
				
			|||
                    sql = """ | 
				
			|||
                        SELECT | 
				
			|||
                            sum(l.balance) AS balance, | 
				
			|||
                            sum(COALESCE((SELECT SUM(amount)FROM account_partial_reconcile | 
				
			|||
                                WHERE credit_move_id = l.id AND max_date <= '%s'), 0)) AS sum_debit, | 
				
			|||
                            sum(COALESCE((SELECT SUM(amount) FROM account_partial_reconcile  | 
				
			|||
                                WHERE debit_move_id = l.id AND max_date <= '%s'), 0)) AS sum_credit | 
				
			|||
                        FROM | 
				
			|||
                            account_move_line AS l | 
				
			|||
                        LEFT JOIN | 
				
			|||
                            account_move AS m ON m.id = l.move_id | 
				
			|||
                        LEFT JOIN | 
				
			|||
                            account_account AS a ON a.id = l.account_id | 
				
			|||
                        LEFT JOIN | 
				
			|||
                            account_account_type AS ty ON a.user_type_id = ty.id | 
				
			|||
                        WHERE  | 
				
			|||
                            l.balance <> 0 | 
				
			|||
 | 
				
			|||
                            AND ty.type IN %s | 
				
			|||
                            AND m.state IN %s | 
				
			|||
                            AND l.company_id = %s | 
				
			|||
                    """ % (as_on_date, as_on_date, type, arg_list, company_id.id) | 
				
			|||
                    amount = 0.0 | 
				
			|||
                    self.env.cr.execute(sql + where) | 
				
			|||
 | 
				
			|||
                    fetch_dict = self.env.cr.dictfetchall() or 0.0 | 
				
			|||
 | 
				
			|||
                    if not fetch_dict[0].get('balance'): | 
				
			|||
                        amount = 0.0 | 
				
			|||
                    else: | 
				
			|||
                        amount = fetch_dict[0]['balance'] + fetch_dict[0][ | 
				
			|||
                            'sum_debit'] - fetch_dict[0]['sum_credit'] | 
				
			|||
                        total_balance += amount | 
				
			|||
 | 
				
			|||
                    partner_dict[partner.id].update( | 
				
			|||
                        {period_dict[period]['name']: amount}) | 
				
			|||
 | 
				
			|||
                partner_dict[partner.id].update({'count': count}) | 
				
			|||
 | 
				
			|||
                partner_dict[partner.id].update( | 
				
			|||
                    {'pages': self.get_page_list(count)}) | 
				
			|||
                partner_dict[partner.id].update( | 
				
			|||
                    {'single_page': True if count <= FETCH_RANGE else False}) | 
				
			|||
                partner_dict[partner.id].update({'total': total_balance}) | 
				
			|||
                partner_dict[partner.id].update( | 
				
			|||
                    {'company_currency_id': company_currency_id}) | 
				
			|||
                partner_dict[partner.id].update( | 
				
			|||
                    {'company_currency_symbol': company_currency_symbol}) | 
				
			|||
                partner_dict[partner.id].update( | 
				
			|||
                    {'company_currency_position': company_currency_position}) | 
				
			|||
                partner_dict[partner.id].update( | 
				
			|||
                    {'company_currency_precision': company_currency_precision}) | 
				
			|||
                partner_dict[partner.id].update( | 
				
			|||
                    {'partner_move_lines': self.al_move_lines(0, partner.id, | 
				
			|||
                                                              2500)}) | 
				
			|||
 | 
				
			|||
            else: | 
				
			|||
                partner_dict.pop(partner.id, None) | 
				
			|||
 | 
				
			|||
        return period_dict, partner_dict | 
				
			|||
 | 
				
			|||
    def get_page_list(self, total_count): | 
				
			|||
        ''' | 
				
			|||
        Helper function to get list of pages from total_count | 
				
			|||
        :param total_count: integer | 
				
			|||
        :return: list(pages) eg. [1,2,3,4,5,6,7 ....] | 
				
			|||
        ''' | 
				
			|||
        page_count = int(total_count / FETCH_RANGE) | 
				
			|||
        if total_count % FETCH_RANGE: | 
				
			|||
            page_count += 1 | 
				
			|||
        return [i + 1 for i in range(0, int(page_count))] or [] | 
				
			|||
 | 
				
			|||
    def get_data(self, default_filters={}, data=None): | 
				
			|||
        """ return period list and filters""" | 
				
			|||
        filters = self.process_filters() | 
				
			|||
        period_dict, partner_lines = self.report_data() | 
				
			|||
        period_list = [period_dict[a]['name'] for a in period_dict] | 
				
			|||
        return filters, partner_lines, period_dict, period_list | 
				
			|||
 | 
				
			|||
    def get_xlsx_report(self, data, response, report_data, dfr_data): | 
				
			|||
        """ xlsx report of Partner Ageing""" | 
				
			|||
 | 
				
			|||
        i_data = str(data) | 
				
			|||
        n_data = json.loads(i_data) | 
				
			|||
        filters = json.loads(report_data) | 
				
			|||
        output = io.BytesIO() | 
				
			|||
        workbook = xlsxwriter.Workbook(output, {'in_memory': True}) | 
				
			|||
        cell_format = workbook.add_format( | 
				
			|||
            {'align': 'center', 'bold': True, 'bg_color': '#d3d3d3;', | 
				
			|||
             'border': 1}) | 
				
			|||
        sheet = workbook.add_worksheet() | 
				
			|||
        head = workbook.add_format({'align': 'center', 'bold': True, | 
				
			|||
                                    'font_size': '20px'}) | 
				
			|||
        txt = workbook.add_format({'font_size': '10px', 'border': 1}) | 
				
			|||
        sub_heading_sub = workbook.add_format( | 
				
			|||
            {'align': 'center', 'bold': True, 'font_size': '10px', | 
				
			|||
             'border': 2, | 
				
			|||
             'border_color': 'black'}) | 
				
			|||
        sheet.merge_range('E1:I2', | 
				
			|||
                          self.env.user.company_id.name + ':' + ' Partner Ageing', | 
				
			|||
                          head) | 
				
			|||
        date_head = workbook.add_format({'align': 'center', 'bold': True, | 
				
			|||
                                         'font_size': '10px'}) | 
				
			|||
        sheet.merge_range('A3:C3', 'As On Date: ' + filters.get('as_on_date'), | 
				
			|||
                          date_head) | 
				
			|||
        sheet.merge_range('D3:F3', 'Account Type: ' + filters.get('type'), date_head) | 
				
			|||
        sheet.merge_range('G3:H3', 'Target Moves: ' + filters.get('target_moves'), | 
				
			|||
                          date_head) | 
				
			|||
        sheet.merge_range('I3:J3', | 
				
			|||
                          'Partner Type: ' + filters.get('partner_type'), | 
				
			|||
                          date_head) | 
				
			|||
        sheet.merge_range('D4:F4', '  Partners: ' + ', '.join( | 
				
			|||
            [lt or '' for lt in | 
				
			|||
             filters['partners']]), date_head) | 
				
			|||
        sheet.merge_range('G4:H4', ' Partner Type: ' + ', '.join( | 
				
			|||
            [lt or '' for lt in | 
				
			|||
             filters['categories']]), | 
				
			|||
                          date_head) | 
				
			|||
        sheet.merge_range('A5:C5', 'Partner', cell_format) | 
				
			|||
        sheet.write('D5', 'Total', cell_format) | 
				
			|||
        sheet.write('E5', 'Not Due', cell_format) | 
				
			|||
        sheet.write('F5', '0-20', cell_format) | 
				
			|||
        sheet.write('G5', '21-40', cell_format) | 
				
			|||
        sheet.write('H5', '41-60', cell_format) | 
				
			|||
        sheet.write('I5', '61-80', cell_format) | 
				
			|||
        sheet.write('J5', '81-100', cell_format) | 
				
			|||
        sheet.write('K5', '100+', cell_format) | 
				
			|||
 | 
				
			|||
        lst = [] | 
				
			|||
        for rec in n_data: | 
				
			|||
            lst.append(rec) | 
				
			|||
        row = 4 | 
				
			|||
        col = 0 | 
				
			|||
        sheet.set_column(5, 5, 15) | 
				
			|||
        sheet.set_column(6, 6, 15) | 
				
			|||
        sheet.set_column(7, 7, 26) | 
				
			|||
        sheet.set_column(8, 8, 15) | 
				
			|||
        sheet.set_column(9, 9, 15) | 
				
			|||
        sheet.set_column(6, 6, 15) | 
				
			|||
        sheet.set_column(7, 7, 26) | 
				
			|||
        sheet.set_column(8, 8, 15) | 
				
			|||
        sheet.set_column(9, 9, 15) | 
				
			|||
 | 
				
			|||
        for l_rec in lst: | 
				
			|||
            one_lst = [] | 
				
			|||
            two_lst = [] | 
				
			|||
 | 
				
			|||
            if n_data[l_rec]['count']: | 
				
			|||
                one_lst.append(n_data[l_rec]) | 
				
			|||
                two_lst = (n_data[l_rec]['partner_move_lines'][2]) | 
				
			|||
                sheet.merge_range(row + 1, col, row + 1, col + 2, | 
				
			|||
                                  n_data[l_rec]['partner_name'], sub_heading_sub) | 
				
			|||
                sheet.write(row + 1, col + 3, n_data[l_rec]['total'], sub_heading_sub) | 
				
			|||
                sheet.write(row + 1, col + 4, n_data[l_rec]['Not'], sub_heading_sub) | 
				
			|||
                sheet.write(row + 1, col + 5, n_data[l_rec]['value_20'], sub_heading_sub) | 
				
			|||
                sheet.write(row + 1, col + 6, n_data[l_rec]['2140'], sub_heading_sub) | 
				
			|||
                sheet.write(row + 1, col + 7, n_data[l_rec]['4160'], sub_heading_sub) | 
				
			|||
                sheet.write(row + 1, col + 8, n_data[l_rec]['6180'], sub_heading_sub) | 
				
			|||
                sheet.write(row + 1, col + 9, n_data[l_rec]['81100'], sub_heading_sub) | 
				
			|||
                sheet.write(row + 1, col + 10, n_data[l_rec]['100'], sub_heading_sub) | 
				
			|||
 | 
				
			|||
                row += 2 | 
				
			|||
                sheet.write(row, col, 'Entry Label', cell_format) | 
				
			|||
                sheet.write(row, col + 1, 'Due Date', cell_format) | 
				
			|||
                sheet.write(row, col + 2, 'Journal', cell_format) | 
				
			|||
                sheet.write(row, col + 3, 'Account', cell_format) | 
				
			|||
                sheet.write(row, col + 4, 'Not Due', cell_format) | 
				
			|||
                sheet.write(row, col + 5, '0 - 20', cell_format) | 
				
			|||
                sheet.write(row, col + 6, '21 - 40', cell_format) | 
				
			|||
                sheet.write(row, col + 7, '41 - 60', cell_format) | 
				
			|||
                sheet.write(row, col + 8, '61 - 80', cell_format) | 
				
			|||
                sheet.write(row, col + 9, '81 - 100', cell_format) | 
				
			|||
                sheet.write(row, col + 10, '100 +', cell_format) | 
				
			|||
                for r_rec in two_lst: | 
				
			|||
                    row += 1 | 
				
			|||
                    sheet.write(row, col, r_rec['move_name'], txt) | 
				
			|||
                    sheet.write(row, col + 1, r_rec['date_maturity'], txt) | 
				
			|||
                    sheet.write(row, col + 2, r_rec['journal_name'], txt) | 
				
			|||
                    sheet.write(row, col + 3, r_rec['account_code'], txt) | 
				
			|||
                    sheet.write(row, col + 4, r_rec['range_0'], txt) | 
				
			|||
                    sheet.write(row, col + 5, r_rec['range_1'], txt) | 
				
			|||
                    sheet.write(row, col + 6, r_rec['range_2'], txt) | 
				
			|||
                    sheet.write(row, col + 7, r_rec['range_3'], txt) | 
				
			|||
                    sheet.write(row, col + 8, r_rec['range_4'], txt) | 
				
			|||
                    sheet.write(row, col + 9, r_rec['range_5'], txt) | 
				
			|||
                    sheet.write(row, col + 10, r_rec['range_6'], txt) | 
				
			|||
 | 
				
			|||
        workbook.close() | 
				
			|||
        output.seek(0) | 
				
			|||
        response.stream.write(output.read()) | 
				
			|||
        output.close() | 
				
			|||
@ -0,0 +1,670 @@ | 
				
			|||
from odoo import models, fields, api | 
				
			|||
import io | 
				
			|||
import json | 
				
			|||
try: | 
				
			|||
    from odoo.tools.misc import xlsxwriter | 
				
			|||
except ImportError: | 
				
			|||
    import xlsxwriter | 
				
			|||
FETCH_RANGE = 2000 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
class BalanceSheetModel(models.TransientModel): | 
				
			|||
    _name = "dynamic.balance.sheet" | 
				
			|||
 | 
				
			|||
    journal_ids = fields.Many2many( | 
				
			|||
        "account.journal", | 
				
			|||
        string="Journals", | 
				
			|||
    ) | 
				
			|||
    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") | 
				
			|||
    company_id = fields.Many2one( | 
				
			|||
        "res.company", | 
				
			|||
        string="Company", | 
				
			|||
    ) | 
				
			|||
    date_from = fields.Date( | 
				
			|||
        string="Start date", | 
				
			|||
    ) | 
				
			|||
    date_to = fields.Date( | 
				
			|||
        string="End date", | 
				
			|||
    ) | 
				
			|||
    include_details = fields.Boolean(string="Include Details", default=True) | 
				
			|||
 | 
				
			|||
    entries = fields.Selection([('posted', 'All Posted Entries'), | 
				
			|||
                                ('all', 'All Entries')], string='Target Moves', | 
				
			|||
                               default='all') | 
				
			|||
 | 
				
			|||
    def report_data(self, tag): | 
				
			|||
        cr = self.env.cr | 
				
			|||
 | 
				
			|||
        data = self.get_filters(default_filters={}) | 
				
			|||
        WHERE = '(1=1)' | 
				
			|||
        company_id = self.env.user.company_id | 
				
			|||
        company_domain = [('company_id', '=', company_id.id)] | 
				
			|||
        if data.get('account_tag_ids', []): | 
				
			|||
            company_domain.append( | 
				
			|||
                ('tag_ids', 'in', data.get('account_tag_ids', []))) | 
				
			|||
        if data.get('account_ids', []): | 
				
			|||
            company_domain.append(('id', 'in', data.get('account_ids', []))) | 
				
			|||
        account_ids = self.env['account.account'].search(company_domain) | 
				
			|||
 | 
				
			|||
        if data.get('journal_ids'): | 
				
			|||
            WHERE += ' AND j.id IN %s' % str( | 
				
			|||
                tuple(data.get('journal_ids')) + tuple([0])) | 
				
			|||
 | 
				
			|||
        if data.get('analytic_ids'): | 
				
			|||
            WHERE += ' AND anl.id IN %s' % str( | 
				
			|||
                tuple(data.get('analytic_ids')) + tuple([0])) | 
				
			|||
 | 
				
			|||
        if data.get('entries') == 'posted': | 
				
			|||
            WHERE += " AND m.state = 'posted'" | 
				
			|||
 | 
				
			|||
        if data.get('analytic_tag_ids'): | 
				
			|||
            WHERE += ' AND analtag.account_analytic_tag_id IN %s' % str( | 
				
			|||
                tuple(data.get('analytic_tag_ids')) + tuple([0])) | 
				
			|||
 | 
				
			|||
        move_lines = { | 
				
			|||
            x.code: { | 
				
			|||
                'name': x.name, | 
				
			|||
                'code': x.code, | 
				
			|||
                'id': x.id, | 
				
			|||
                'lines': [], | 
				
			|||
                'type': x.user_type_id.internal_group, | 
				
			|||
                'type_id': x.user_type_id | 
				
			|||
            } for x in sorted(account_ids, key=lambda a: a.code) | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        for account in account_ids: | 
				
			|||
            company_id = self.env.user.company_id | 
				
			|||
            currency = account.company_id.currency_id or company_id.currency_id | 
				
			|||
            symbol = currency.symbol | 
				
			|||
            rounding = currency.rounding | 
				
			|||
            position = currency.position | 
				
			|||
 | 
				
			|||
            opening_balance = 0 | 
				
			|||
            if data.get('date_from') and data.get('date_to'): | 
				
			|||
                WHERE_CURRENT = WHERE + " AND l.date >= '%s'" % data.get( | 
				
			|||
                    'date_from') + " AND l.date <= '%s'" % data.get( | 
				
			|||
                    'date_to') | 
				
			|||
                WHERE_CURRENT += " AND a.id = %s" % account.id | 
				
			|||
            elif data.get('date_from'): | 
				
			|||
                WHERE_CURRENT = WHERE + " AND l.date >= '%s'" % data.get( | 
				
			|||
                    'date_from') | 
				
			|||
                WHERE_CURRENT += " AND a.id = %s" % account.id | 
				
			|||
            elif data.get('date_to'): | 
				
			|||
                WHERE_CURRENT = WHERE + " AND l.date <= '%s'" % data.get( | 
				
			|||
                    'date_to') | 
				
			|||
                WHERE_CURRENT += " AND a.id = %s" % account.id | 
				
			|||
            else: | 
				
			|||
                WHERE_CURRENT = WHERE + " AND a.id = %s" % account.id | 
				
			|||
            ORDER_BY_CURRENT = 'l.date' | 
				
			|||
            sql = (''' | 
				
			|||
                    SELECT | 
				
			|||
                     l.date AS ldate, | 
				
			|||
                     l.id AS lid, | 
				
			|||
                    j.code AS lcode, | 
				
			|||
                 p.name AS partner_name, | 
				
			|||
                    m.name AS move_name, | 
				
			|||
                    l.name AS lname, | 
				
			|||
                    COALESCE(l.debit,0) AS debit, | 
				
			|||
                 COALESCE(l.credit,0) AS credit, | 
				
			|||
                     COALESCE(l.debit - l.credit,0) AS balance, | 
				
			|||
                    COALESCE(l.amount_currency,0) AS amount_currency | 
				
			|||
                FROM account_move_line l | 
				
			|||
                JOIN account_account a ON (l.account_id=a.id) | 
				
			|||
                LEFT JOIN account_analytic_account anl ON (l.analytic_account_id=anl.id) | 
				
			|||
                LEFT JOIN account_analytic_tag_account_move_line_rel analtag ON (analtag.account_move_line_id=l.id) | 
				
			|||
                LEFT 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_move i ON (m.id =i.id) | 
				
			|||
                JOIN account_journal j ON (l.journal_id=j.id) | 
				
			|||
                WHERE %s | 
				
			|||
                --GROUP BY l.id, l.account_id,  j.code, l.currency_id, l.date,l.debit_currency, l.credit_currency, l.ref, l.name, m.id, m.name, c.rounding, cc.rounding, cc.position, c.position, c.symbol, cc.symbol, p.name | 
				
			|||
                ORDER BY %s | 
				
			|||
            ''') % (WHERE_CURRENT, ORDER_BY_CURRENT) | 
				
			|||
            cr.execute(sql) | 
				
			|||
            current_lines = cr.dictfetchall() | 
				
			|||
            for row in current_lines: | 
				
			|||
                row['initial_bal'] = False | 
				
			|||
                row['ending_bal'] = False | 
				
			|||
 | 
				
			|||
                current_balance = row['balance'] | 
				
			|||
                row['balance'] = opening_balance + current_balance | 
				
			|||
                opening_balance += current_balance | 
				
			|||
                row['initial_bal'] = False | 
				
			|||
 | 
				
			|||
                move_lines[account.code]['lines'].append(row) | 
				
			|||
            WHERE_FULL = WHERE + " AND a.id = %s" % account.id | 
				
			|||
            sql = (''' | 
				
			|||
                SELECT  | 
				
			|||
                    COALESCE(SUM(l.debit),0) AS debit,  | 
				
			|||
                    COALESCE(SUM(l.credit),0) AS credit,  | 
				
			|||
                    COALESCE(SUM(l.debit - l.credit),0) AS balance | 
				
			|||
                FROM account_move_line l | 
				
			|||
                JOIN account_move m ON (l.move_id=m.id) | 
				
			|||
                JOIN account_account a ON (l.account_id=a.id) | 
				
			|||
                LEFT JOIN account_analytic_account anl ON (l.analytic_account_id=anl.id) | 
				
			|||
                LEFT JOIN account_analytic_tag_account_move_line_rel analtag ON analtag.account_move_line_id = l.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) | 
				
			|||
                WHERE %s | 
				
			|||
            ''') % WHERE_FULL | 
				
			|||
            cr.execute(sql) | 
				
			|||
            for row in cr.dictfetchall(): | 
				
			|||
                row['ending_bal'] = True | 
				
			|||
                row['initial_bal'] = False | 
				
			|||
                move_lines[account.code]['lines'].append(row) | 
				
			|||
                move_lines[account.code]['debit'] = row['debit'] | 
				
			|||
                move_lines[account.code]['credit'] = row['credit'] | 
				
			|||
                move_lines[account.code]['balance'] = row['balance'] | 
				
			|||
                move_lines[account.code]['company_currency_id'] = currency.id | 
				
			|||
                move_lines[account.code]['company_currency_symbol'] = symbol | 
				
			|||
                move_lines[account.code][ | 
				
			|||
                    'company_currency_precision'] = rounding | 
				
			|||
                move_lines[account.code]['company_currency_position'] = position | 
				
			|||
                move_lines[account.code]['count'] = len(current_lines) | 
				
			|||
                move_lines[account.code]['pages'] = self.get_page_list( | 
				
			|||
                    len(current_lines)) | 
				
			|||
                move_lines[account.code]['single_page'] = True if len( | 
				
			|||
                    current_lines) <= FETCH_RANGE else False | 
				
			|||
        if tag == 'Balance Sheet Report': | 
				
			|||
            account_report_id = self.env['account.financial.report'].search([ | 
				
			|||
                ('name', 'ilike', 'Balance Sheet')]) | 
				
			|||
        if tag == 'Profit and Loss Report': | 
				
			|||
            account_report_id = self.env['account.financial.report'].search([ | 
				
			|||
                ('name', 'ilike', 'Profit and Loss')]) | 
				
			|||
 | 
				
			|||
        new_data = {'id': self.id, 'date_from': self.date_from, | 
				
			|||
                    'enable_filter': True, | 
				
			|||
                    'debit_credit': True, 'date_to': self.date_to, | 
				
			|||
                    'account_report_id': account_report_id, | 
				
			|||
                    'target_move': self.entries, | 
				
			|||
                    'view_format': 'vertical', | 
				
			|||
                    'company_id': self.company_id, | 
				
			|||
                    'used_context': {'journal_ids': False, | 
				
			|||
                                     'state': self.entries, | 
				
			|||
                                     'date_from': self.date_from, | 
				
			|||
                                     'date_to': self.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_line_counts = [] | 
				
			|||
 | 
				
			|||
        for rec in move_lines: | 
				
			|||
 | 
				
			|||
            if move_lines[rec]['count'] != 0: | 
				
			|||
                move_line_accounts.append(move_lines[rec]['code']) | 
				
			|||
            move_line_counts.append(move_lines[rec]['count']) | 
				
			|||
 | 
				
			|||
        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) | 
				
			|||
 | 
				
			|||
        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 move_lines, final_report_lines | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    def get_filters(self, default_filters={}): | 
				
			|||
        company_id = self.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) | 
				
			|||
        account_tags = self.account_tag_ids if self.account_tag_ids else \ | 
				
			|||
            self.env['account.account.tag'].search([]) | 
				
			|||
        analytics = self.analytic_ids if self.analytic_ids else self.env[ | 
				
			|||
            'account.analytic.account'].search( | 
				
			|||
            company_domain) | 
				
			|||
        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)]) | 
				
			|||
        filter_dict = { | 
				
			|||
            'journal_ids': self.journal_ids.ids, | 
				
			|||
            'account_ids': self.account_ids.ids, | 
				
			|||
            'account_tag_ids': self.account_tag_ids.ids, | 
				
			|||
            'analytic_ids': self.analytic_ids.ids, | 
				
			|||
            'analytic_tag_ids': self.analytic_tag_ids.ids, | 
				
			|||
            'company_id': self.company_id.id, | 
				
			|||
            'date_from': self.date_from, | 
				
			|||
            'date_to': self.date_to, | 
				
			|||
            'entries': self.entries, | 
				
			|||
            'journals_list': [(j.id, j.name) for j in journals], | 
				
			|||
            'accounts_list': [(a.id, a.name) for a in accounts], | 
				
			|||
            'account_tag_list': [(a.id, a.name) for a in account_tags], | 
				
			|||
            'analytics_list': [(anl.id, anl.name) for anl in analytics], | 
				
			|||
            'analytic_tag_list': [(anltag.id, anltag.name) for anltag in | 
				
			|||
                                  analytic_tags], | 
				
			|||
            'company_name': company_id and company_id.name, | 
				
			|||
        } | 
				
			|||
        filter_dict.update(default_filters) | 
				
			|||
        return filter_dict | 
				
			|||
 | 
				
			|||
    def process_filters(self): | 
				
			|||
        ''' To show on report headers''' | 
				
			|||
 | 
				
			|||
        data = self.get_filters(default_filters={}) | 
				
			|||
        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('include_details'): | 
				
			|||
            filters['include_details'] = True | 
				
			|||
        else: | 
				
			|||
            filters['include_details'] = False | 
				
			|||
 | 
				
			|||
        if data.get('entries'): | 
				
			|||
            filters['entries'] = data.get('entries') | 
				
			|||
        if data.get('date_from', False): | 
				
			|||
            filters['date_from'] = data.get('date_from') | 
				
			|||
        if data.get('date_to', False): | 
				
			|||
            filters['date_to'] = data.get('date_to') | 
				
			|||
        if data.get('company_id'): | 
				
			|||
            filters['company_id'] = data.get('company_id') | 
				
			|||
        else: | 
				
			|||
            filters['company_id'] = '' | 
				
			|||
        filters['account_tags'] = ['All'] | 
				
			|||
        filters['analytics'] = ['All'] | 
				
			|||
        filters['analytic_tags'] = ['All'] | 
				
			|||
        filters['journals_list'] = data.get('journals_list') | 
				
			|||
        filters['accounts_list'] = data.get('accounts_list') | 
				
			|||
        filters['account_tag_list'] = data.get('account_tag_list') | 
				
			|||
        filters['analytics_list'] = data.get('analytics_list') | 
				
			|||
        filters['analytic_tag_list'] = data.get('analytic_tag_list') | 
				
			|||
        filters['company_name'] = data.get('company_name') | 
				
			|||
 | 
				
			|||
        return filters | 
				
			|||
 | 
				
			|||
    def bs_move_lines(self, offset=0, account=0, fetch_range=FETCH_RANGE): | 
				
			|||
        cr = self.env.cr | 
				
			|||
        offset_count = offset * fetch_range | 
				
			|||
        opening_balance = 0 | 
				
			|||
        data = self.get_filters(default_filters={}) | 
				
			|||
 | 
				
			|||
        company_id = self.env.user.company_id | 
				
			|||
 | 
				
			|||
        WHERE = '(1=1)' | 
				
			|||
 | 
				
			|||
        WHERE_CURRENT = WHERE | 
				
			|||
        WHERE_CURRENT += " AND a.id = %s" % account | 
				
			|||
        if data.get('entries') == 'posted': | 
				
			|||
            WHERE += " AND m.state = 'posted'" | 
				
			|||
 | 
				
			|||
        if data.get('date_from') and data.get('date_to'): | 
				
			|||
            WHERE_CURRENT = WHERE + " AND l.date >= '%s'" % data.get( | 
				
			|||
                'date_from') + " AND l.date <= '%s'" % data.get( | 
				
			|||
                'date_to') | 
				
			|||
            WHERE_CURRENT += " AND a.id = %s" % account | 
				
			|||
        elif data.get('date_from'): | 
				
			|||
            WHERE_CURRENT = WHERE + " AND l.date >= '%s'" % data.get( | 
				
			|||
                'date_from') | 
				
			|||
            WHERE_CURRENT += " AND a.id = %s" % account | 
				
			|||
        elif data.get('date_to'): | 
				
			|||
            WHERE_CURRENT = WHERE + " AND l.date <= '%s'" % data.get( | 
				
			|||
                'date_to') | 
				
			|||
            WHERE_CURRENT += " AND a.id = %s" % account | 
				
			|||
 | 
				
			|||
 | 
				
			|||
        else: | 
				
			|||
            WHERE_CURRENT = WHERE + " AND a.id = %s" % account | 
				
			|||
 | 
				
			|||
        ORDER_BY_CURRENT = 'j.code, p.name, l.move_id, l.date' | 
				
			|||
        move_lines = [] | 
				
			|||
        sql = (''' | 
				
			|||
            SELECT  | 
				
			|||
                COALESCE(SUM(l.debit - l.credit),0) AS balance | 
				
			|||
            FROM account_move_line l | 
				
			|||
            JOIN account_move m ON (l.move_id=m.id) | 
				
			|||
            JOIN account_account a ON (l.account_id=a.id) | 
				
			|||
            LEFT JOIN account_analytic_account anl ON (l.analytic_account_id=anl.id) | 
				
			|||
            LEFT JOIN account_analytic_tag_account_move_line_rel analtag ON analtag.account_move_line_id = l.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) | 
				
			|||
            WHERE %s | 
				
			|||
            GROUP BY j.code, p.name, l.move_id, l.date | 
				
			|||
            ORDER BY %s | 
				
			|||
            OFFSET %s ROWS | 
				
			|||
            FETCH FIRST %s ROWS ONLY | 
				
			|||
        ''') % (WHERE_CURRENT, ORDER_BY_CURRENT, 0, offset_count) | 
				
			|||
        cr.execute(sql) | 
				
			|||
        running_balance_list = cr.fetchall() | 
				
			|||
        for running_balance in running_balance_list: | 
				
			|||
            opening_balance += running_balance[0] | 
				
			|||
 | 
				
			|||
        sql = (''' | 
				
			|||
            SELECT COUNT(*) | 
				
			|||
            FROM account_move_line l | 
				
			|||
                JOIN account_move m ON (l.move_id=m.id) | 
				
			|||
                JOIN account_account a ON (l.account_id=a.id) | 
				
			|||
                LEFT JOIN account_analytic_account anl ON (l.analytic_account_id=anl.id) | 
				
			|||
                LEFT JOIN account_analytic_tag_account_move_line_rel analtag ON analtag.account_move_line_id = l.id | 
				
			|||
                LEFT JOIN res_currency c ON (l.currency_id=c.id) | 
				
			|||
                LEFT JOIN res_currency cc ON (l.company_currency_id=cc.id) | 
				
			|||
                LEFT JOIN res_partner p ON (l.partner_id=p.id) | 
				
			|||
                JOIN account_journal j ON (l.journal_id=j.id) | 
				
			|||
            WHERE %s | 
				
			|||
        ''') % (WHERE_CURRENT) | 
				
			|||
        cr.execute(sql) | 
				
			|||
        count = cr.fetchone()[0] | 
				
			|||
 | 
				
			|||
        sql = (''' | 
				
			|||
                SELECT | 
				
			|||
                    l.date AS ldate, | 
				
			|||
                    l.id AS lid, | 
				
			|||
                    l.account_id AS account_id, | 
				
			|||
                    j.code AS lcode, | 
				
			|||
                    l.currency_id, | 
				
			|||
                    --l.ref AS lref, | 
				
			|||
                    l.name AS lname, | 
				
			|||
                    m.id AS move_id, | 
				
			|||
                    m.name AS move_name, | 
				
			|||
                    c.symbol AS currency_symbol, | 
				
			|||
                    c.position AS currency_position, | 
				
			|||
                    c.rounding AS currency_precision, | 
				
			|||
                    cc.id AS company_currency_id, | 
				
			|||
                    cc.symbol AS company_currency_symbol, | 
				
			|||
                    cc.rounding AS company_currency_precision, | 
				
			|||
                    cc.position AS company_currency_position, | 
				
			|||
                    p.name AS partner_name, | 
				
			|||
                    COALESCE(l.debit,0) AS debit, | 
				
			|||
                    COALESCE(l.credit,0) AS credit, | 
				
			|||
                    COALESCE(l.debit - l.credit,0) AS balance, | 
				
			|||
                    COALESCE(l.amount_currency,0) AS amount_currency | 
				
			|||
                FROM account_move_line l | 
				
			|||
                JOIN account_move m ON (l.move_id=m.id) | 
				
			|||
                JOIN account_account a ON (l.account_id=a.id) | 
				
			|||
                LEFT JOIN account_analytic_account anl ON (l.analytic_account_id=anl.id) | 
				
			|||
                LEFT JOIN account_analytic_tag_account_move_line_rel analtag ON analtag.account_move_line_id = l.id | 
				
			|||
                LEFT JOIN res_currency c ON (l.currency_id=c.id) | 
				
			|||
                LEFT JOIN res_currency cc ON (l.company_currency_id=cc.id) | 
				
			|||
                LEFT JOIN res_partner p ON (l.partner_id=p.id) | 
				
			|||
                JOIN account_journal j ON (l.journal_id=j.id) | 
				
			|||
                WHERE %s | 
				
			|||
                GROUP BY l.id, l.account_id, j.code, l.currency_id, l.amount_currency, l.name, m.id, m.name, c.rounding, cc.id, cc.rounding, cc.position, c.position, c.symbol, cc.symbol, p.name | 
				
			|||
                ORDER BY %s | 
				
			|||
                OFFSET %s ROWS | 
				
			|||
                FETCH FIRST %s ROWS ONLY | 
				
			|||
            ''') % (WHERE_CURRENT, ORDER_BY_CURRENT, offset_count, fetch_range) | 
				
			|||
 | 
				
			|||
        cr.execute(sql) | 
				
			|||
        for row in cr.dictfetchall(): | 
				
			|||
            current_balance = row['balance'] | 
				
			|||
            row['balance'] = opening_balance + current_balance | 
				
			|||
            opening_balance += current_balance | 
				
			|||
            row['initial_bal'] = False | 
				
			|||
            move_lines.append(row) | 
				
			|||
 | 
				
			|||
        return count, offset_count, move_lines | 
				
			|||
 | 
				
			|||
    def get_data(self, tag): | 
				
			|||
        filters = self.process_filters() | 
				
			|||
        account_lines = self.report_data(tag)[0] | 
				
			|||
        report_lines = self.report_data(tag)[1] | 
				
			|||
 | 
				
			|||
        return filters, account_lines, report_lines | 
				
			|||
 | 
				
			|||
    def get_page_list(self, total_count): | 
				
			|||
 | 
				
			|||
        page_count = int(total_count / FETCH_RANGE) | 
				
			|||
        if total_count % FETCH_RANGE: | 
				
			|||
            page_count += 1 | 
				
			|||
        return [i + 1 for i in range(0, int(page_count))] or [] | 
				
			|||
 | 
				
			|||
    def write(self, vals): | 
				
			|||
 | 
				
			|||
        if vals.get('journal_ids'): | 
				
			|||
            vals.update( | 
				
			|||
                {'journal_ids': [(4, j) for j in 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('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_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_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,)]}) | 
				
			|||
 | 
				
			|||
        return super(BalanceSheetModel, self).write(vals) | 
				
			|||
 | 
				
			|||
    @api.model | 
				
			|||
    def create(self, vals): | 
				
			|||
        res = super(BalanceSheetModel, self).create(vals) | 
				
			|||
        return res | 
				
			|||
 | 
				
			|||
    def get_xlsx_report(self, data, response, report_data, dfr_data): | 
				
			|||
 | 
				
			|||
        i_data = str(data) | 
				
			|||
        filters = json.loads(report_data) | 
				
			|||
        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_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']]) + '  Entries: ' + filters.get( | 
				
			|||
            'entries'), 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,306 @@ | 
				
			|||
import re | 
				
			|||
from odoo import models, fields, api | 
				
			|||
 | 
				
			|||
 | 
				
			|||
class BalanceSheet(models.TransientModel): | 
				
			|||
    _inherit = "dynamic.balance.sheet" | 
				
			|||
 | 
				
			|||
    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""" | 
				
			|||
 | 
				
			|||
        self.ensure_one() | 
				
			|||
        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 = r_name.replace(" ", "-") + "-" | 
				
			|||
            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) | 
				
			|||
                    # new_r_name = str(report.name) | 
				
			|||
                    # new_r_name = new_r_name.replace(" ", "-") + "-" | 
				
			|||
                    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,527 @@ | 
				
			|||
from odoo import models, fields, api | 
				
			|||
import io | 
				
			|||
import json | 
				
			|||
try: | 
				
			|||
    from odoo.tools.misc import xlsxwriter | 
				
			|||
except ImportError: | 
				
			|||
    import xlsxwriter | 
				
			|||
FETCH_RANGE = 2000 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
class BankBook(models.TransientModel): | 
				
			|||
    _name = "dynamic.bank.book" | 
				
			|||
 | 
				
			|||
    journal_ids = fields.Many2many( | 
				
			|||
        "account.journal", | 
				
			|||
        string="Journals", | 
				
			|||
    ) | 
				
			|||
    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") | 
				
			|||
    company_id = fields.Many2one( | 
				
			|||
        "res.company", | 
				
			|||
        string="Company", | 
				
			|||
    ) | 
				
			|||
    date_from = fields.Date( | 
				
			|||
        string="Start date", | 
				
			|||
    ) | 
				
			|||
    date_to = fields.Date( | 
				
			|||
        string="End date", | 
				
			|||
    ) | 
				
			|||
    include_details = fields.Boolean(string="Include Details", default=True) | 
				
			|||
 | 
				
			|||
    entries = fields.Selection([('posted', 'All Posted Entries'), | 
				
			|||
                                ('all', 'All Entries')], string='Target Moves', default='all') | 
				
			|||
 | 
				
			|||
    def report_data(self, title): | 
				
			|||
        cr = self.env.cr | 
				
			|||
 | 
				
			|||
        data = self.get_filters(default_filters={}) | 
				
			|||
        WHERE = '(1=1)' | 
				
			|||
        company_id = self.env.user.company_id | 
				
			|||
        company_domain = [('company_id', '=', company_id.id)] | 
				
			|||
        if data.get('account_tag_ids', []): | 
				
			|||
            company_domain.append(('tag_ids','in', data.get('account_tag_ids', []))) | 
				
			|||
        if data.get('account_ids', []): | 
				
			|||
            company_domain.append(('id','in', data.get('account_ids', []))) | 
				
			|||
        account_ids = self.env['account.account'].search(company_domain) | 
				
			|||
 | 
				
			|||
        if title == "Bank Book": | 
				
			|||
            journals = self.env['account.journal'].search([('type', '=', 'bank')], | 
				
			|||
                                                      limit=1) | 
				
			|||
        if title == "Cash Book": | 
				
			|||
            journals = self.env['account.journal'].search([('type', '=', 'cash')], | 
				
			|||
                                                          limit=1) | 
				
			|||
        journals_type = journals.id | 
				
			|||
        WHERE += 'AND j.id = %s' % str(journals_type) | 
				
			|||
 | 
				
			|||
        if data.get('analytic_ids'): | 
				
			|||
            WHERE += ' AND anl.id IN %s' % str(tuple(data.get('analytic_ids')) + tuple([0])) | 
				
			|||
 | 
				
			|||
        if data.get('entries') == 'posted': | 
				
			|||
            WHERE += " AND m.state = 'posted'" | 
				
			|||
 | 
				
			|||
        if data.get('analytic_tag_ids'): | 
				
			|||
            WHERE += ' AND analtag.account_analytic_tag_id IN %s' % str( | 
				
			|||
                tuple(data.get('analytic_tag_ids')) + tuple([0])) | 
				
			|||
 | 
				
			|||
        move_lines = { | 
				
			|||
            x.code: { | 
				
			|||
                'name': x.name, | 
				
			|||
                'code': x.code, | 
				
			|||
                'id': x.id, | 
				
			|||
                'lines': [] | 
				
			|||
            } for x in sorted(account_ids, key=lambda a: a.code) | 
				
			|||
        } | 
				
			|||
        for account in account_ids: | 
				
			|||
            company_id = self.env.user.company_id | 
				
			|||
            currency = account.company_id.currency_id or company_id.currency_id | 
				
			|||
            symbol = currency.symbol | 
				
			|||
            rounding = currency.rounding | 
				
			|||
            position = currency.position | 
				
			|||
 | 
				
			|||
            opening_balance = 0 | 
				
			|||
            if data.get('date_from') and data.get('date_to'): | 
				
			|||
                WHERE_CURRENT = WHERE + " AND l.date >= '%s'" % data.get('date_from') + " AND l.date <= '%s'" % data.get( | 
				
			|||
                    'date_to') | 
				
			|||
                WHERE_CURRENT += " AND a.id = %s" % account.id | 
				
			|||
            elif data.get('date_from'): | 
				
			|||
                WHERE_CURRENT = WHERE + " AND l.date >= '%s'" % data.get( | 
				
			|||
                    'date_from') | 
				
			|||
                WHERE_CURRENT += " AND a.id = %s" % account.id | 
				
			|||
            elif data.get('date_to'): | 
				
			|||
                WHERE_CURRENT = WHERE + " AND l.date <= '%s'" % data.get( | 
				
			|||
                    'date_to') | 
				
			|||
                WHERE_CURRENT += " AND a.id = %s" % account.id | 
				
			|||
            else: | 
				
			|||
                WHERE_CURRENT = WHERE + " AND a.id = %s" % account.id | 
				
			|||
            ORDER_BY_CURRENT = 'l.date' | 
				
			|||
            sql = (''' | 
				
			|||
                    SELECT | 
				
			|||
                     l.date AS ldate, | 
				
			|||
                     l.id AS lid, | 
				
			|||
                    j.code AS lcode, | 
				
			|||
                 p.name AS partner_name, | 
				
			|||
                    m.name AS move_name, | 
				
			|||
                    l.name AS lname, | 
				
			|||
                    COALESCE(l.debit,0) AS debit, | 
				
			|||
                 COALESCE(l.credit,0) AS credit, | 
				
			|||
                     COALESCE(l.debit - l.credit,0) AS balance, | 
				
			|||
                    COALESCE(l.amount_currency,0) AS amount_currency | 
				
			|||
                FROM account_move_line l | 
				
			|||
                JOIN account_account a ON (l.account_id=a.id) | 
				
			|||
                LEFT JOIN account_analytic_account anl ON (l.analytic_account_id=anl.id) | 
				
			|||
                LEFT JOIN account_analytic_tag_account_move_line_rel analtag ON (analtag.account_move_line_id=l.id) | 
				
			|||
                LEFT 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_move i ON (m.id =i.id) | 
				
			|||
                JOIN account_journal j ON (l.journal_id=j.id) | 
				
			|||
                WHERE %s | 
				
			|||
                --GROUP BY l.id, l.account_id,  j.code, l.currency_id, l.date,l.debit_currency, l.credit_currency, l.ref, l.name, m.id, m.name, c.rounding, cc.rounding, cc.position, c.position, c.symbol, cc.symbol, p.name | 
				
			|||
                ORDER BY %s | 
				
			|||
            ''') % (WHERE_CURRENT, ORDER_BY_CURRENT) | 
				
			|||
            cr.execute(sql) | 
				
			|||
            current_lines = cr.dictfetchall() | 
				
			|||
            for row in current_lines: | 
				
			|||
                row['initial_bal'] = False | 
				
			|||
                row['ending_bal'] = False | 
				
			|||
 | 
				
			|||
                current_balance = row['balance'] | 
				
			|||
                row['balance'] = opening_balance + current_balance | 
				
			|||
                opening_balance += current_balance | 
				
			|||
                row['initial_bal'] = False | 
				
			|||
 | 
				
			|||
                move_lines[account.code]['lines'].append(row) | 
				
			|||
            WHERE_FULL = WHERE + " AND a.id = %s" % account.id | 
				
			|||
            sql = (''' | 
				
			|||
                SELECT  | 
				
			|||
                    COALESCE(SUM(l.debit),0) AS debit,  | 
				
			|||
                    COALESCE(SUM(l.credit),0) AS credit,  | 
				
			|||
                    COALESCE(SUM(l.debit - l.credit),0) AS balance | 
				
			|||
                FROM account_move_line l | 
				
			|||
                JOIN account_move m ON (l.move_id=m.id) | 
				
			|||
                JOIN account_account a ON (l.account_id=a.id) | 
				
			|||
                LEFT JOIN account_analytic_account anl ON (l.analytic_account_id=anl.id) | 
				
			|||
                LEFT JOIN account_analytic_tag_account_move_line_rel analtag ON analtag.account_move_line_id = l.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) | 
				
			|||
                WHERE %s | 
				
			|||
            ''') % WHERE_FULL | 
				
			|||
            cr.execute(sql) | 
				
			|||
            for row in cr.dictfetchall(): | 
				
			|||
                row['ending_bal'] = True | 
				
			|||
                row['initial_bal'] = False | 
				
			|||
                move_lines[account.code]['lines'].append(row) | 
				
			|||
                move_lines[account.code]['debit'] = row['debit'] | 
				
			|||
                move_lines[account.code]['credit'] = row['credit'] | 
				
			|||
                move_lines[account.code]['balance'] = row['balance'] | 
				
			|||
                move_lines[account.code]['company_currency_id'] = currency.id | 
				
			|||
                move_lines[account.code]['company_currency_symbol'] = symbol | 
				
			|||
                move_lines[account.code]['company_currency_precision'] = rounding | 
				
			|||
                move_lines[account.code]['company_currency_position'] = position | 
				
			|||
                move_lines[account.code]['count'] = len(current_lines) | 
				
			|||
                move_lines[account.code]['pages'] = self.get_page_list(len(current_lines)) | 
				
			|||
                move_lines[account.code]['single_page'] = True if len(current_lines) <= FETCH_RANGE else False | 
				
			|||
        return move_lines | 
				
			|||
    def get_filters(self, default_filters={}): | 
				
			|||
        company_id = self.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) | 
				
			|||
        account_tags = self.account_tag_ids if self.account_tag_ids else self.env['account.account.tag'].search([]) | 
				
			|||
        analytics = self.analytic_ids if self.analytic_ids else self.env['account.analytic.account'].search( | 
				
			|||
            company_domain) | 
				
			|||
        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)]) | 
				
			|||
        filter_dict = { | 
				
			|||
            'journal_ids': self.journal_ids.ids, | 
				
			|||
            'account_ids': self.account_ids.ids, | 
				
			|||
            'account_tag_ids': self.account_tag_ids.ids, | 
				
			|||
            'analytic_ids': self.analytic_ids.ids, | 
				
			|||
            'analytic_tag_ids': self.analytic_tag_ids.ids, | 
				
			|||
            'company_id': self.company_id.id, | 
				
			|||
            'date_from': self.date_from, | 
				
			|||
            'date_to': self.date_to, | 
				
			|||
            'entries': self.entries, | 
				
			|||
            'journals_list': [(j.id, j.name) for j in journals], | 
				
			|||
            'accounts_list': [(a.id, a.name) for a in accounts], | 
				
			|||
            'account_tag_list': [(a.id, a.name) for a in account_tags], | 
				
			|||
            'analytics_list': [(anl.id, anl.name) for anl in analytics], | 
				
			|||
            'analytic_tag_list': [(anltag.id, anltag.name) for anltag in analytic_tags], | 
				
			|||
            'company_name': company_id and company_id.name, | 
				
			|||
        } | 
				
			|||
        filter_dict.update(default_filters) | 
				
			|||
        return filter_dict | 
				
			|||
 | 
				
			|||
    def process_filters(self): | 
				
			|||
        ''' To show on report headers''' | 
				
			|||
 | 
				
			|||
        data = self.get_filters(default_filters={}) | 
				
			|||
        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('include_details'): | 
				
			|||
            filters['include_details'] = True | 
				
			|||
        else: | 
				
			|||
            filters['include_details'] = False | 
				
			|||
 | 
				
			|||
        if data.get('entries'): | 
				
			|||
            filters['entries'] = data.get('entries') | 
				
			|||
        if data.get('date_from', False): | 
				
			|||
            filters['date_from'] = data.get('date_from') | 
				
			|||
        if data.get('date_to', False): | 
				
			|||
            filters['date_to'] = data.get('date_to') | 
				
			|||
        if data.get('company_id'): | 
				
			|||
            filters['company_id'] = data.get('company_id') | 
				
			|||
        else: | 
				
			|||
            filters['company_id'] = '' | 
				
			|||
        filters['account_tags'] = ['All'] | 
				
			|||
        filters['analytics'] = ['All'] | 
				
			|||
        filters['analytic_tags'] = ['All'] | 
				
			|||
        filters['journals_list'] = data.get('journals_list') | 
				
			|||
        filters['accounts_list'] = data.get('accounts_list') | 
				
			|||
        filters['account_tag_list'] = data.get('account_tag_list') | 
				
			|||
        filters['analytics_list'] = data.get('analytics_list') | 
				
			|||
        filters['analytic_tag_list'] = data.get('analytic_tag_list') | 
				
			|||
        filters['company_name'] = data.get('company_name') | 
				
			|||
 | 
				
			|||
        return filters | 
				
			|||
 | 
				
			|||
    def bb_move_lines(self, offset=0, account=0, fetch_range=FETCH_RANGE): | 
				
			|||
        cr = self.env.cr | 
				
			|||
        offset_count = offset * fetch_range | 
				
			|||
        opening_balance = 0 | 
				
			|||
        data = self.get_filters(default_filters={}) | 
				
			|||
 | 
				
			|||
        company_id = self.env.user.company_id | 
				
			|||
 | 
				
			|||
        WHERE = '(1=1)' | 
				
			|||
 | 
				
			|||
        WHERE_CURRENT = WHERE | 
				
			|||
        WHERE_CURRENT += " AND a.id = %s" % account | 
				
			|||
        if data.get('entries') == 'posted': | 
				
			|||
            WHERE += " AND m.state = 'posted'" | 
				
			|||
 | 
				
			|||
        if data.get('date_from') and data.get('date_to'): | 
				
			|||
            WHERE_CURRENT = WHERE + " AND l.date >= '%s'" % data.get( | 
				
			|||
                'date_from') + " AND l.date <= '%s'" % data.get( | 
				
			|||
                'date_to') | 
				
			|||
            WHERE_CURRENT += " AND a.id = %s" % account | 
				
			|||
        elif data.get('date_from'): | 
				
			|||
            WHERE_CURRENT = WHERE + " AND l.date >= '%s'" % data.get( | 
				
			|||
                'date_from') | 
				
			|||
            WHERE_CURRENT += " AND a.id = %s" % account | 
				
			|||
        elif data.get('date_to'): | 
				
			|||
            WHERE_CURRENT = WHERE + " AND l.date <= '%s'" % data.get( | 
				
			|||
                'date_to') | 
				
			|||
            WHERE_CURRENT += " AND a.id = %s" % account | 
				
			|||
 | 
				
			|||
 | 
				
			|||
        else: | 
				
			|||
            WHERE_CURRENT = WHERE + " AND a.id = %s" % account | 
				
			|||
 | 
				
			|||
        ORDER_BY_CURRENT = 'j.code, p.name, l.move_id, l.date' | 
				
			|||
        move_lines = [] | 
				
			|||
        sql = (''' | 
				
			|||
            SELECT  | 
				
			|||
                COALESCE(SUM(l.debit - l.credit),0) AS balance | 
				
			|||
            FROM account_move_line l | 
				
			|||
            JOIN account_move m ON (l.move_id=m.id) | 
				
			|||
            JOIN account_account a ON (l.account_id=a.id) | 
				
			|||
            LEFT JOIN account_analytic_account anl ON (l.analytic_account_id=anl.id) | 
				
			|||
            LEFT JOIN account_analytic_tag_account_move_line_rel analtag ON analtag.account_move_line_id = l.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) | 
				
			|||
            WHERE %s | 
				
			|||
            GROUP BY j.code, p.name, l.move_id, l.date | 
				
			|||
            ORDER BY %s | 
				
			|||
            OFFSET %s ROWS | 
				
			|||
            FETCH FIRST %s ROWS ONLY | 
				
			|||
        ''') % (WHERE_CURRENT, ORDER_BY_CURRENT, 0, offset_count) | 
				
			|||
        cr.execute(sql) | 
				
			|||
        running_balance_list = cr.fetchall() | 
				
			|||
        for running_balance in running_balance_list: | 
				
			|||
            opening_balance += running_balance[0] | 
				
			|||
 | 
				
			|||
        sql = (''' | 
				
			|||
            SELECT COUNT(*) | 
				
			|||
            FROM account_move_line l | 
				
			|||
                JOIN account_move m ON (l.move_id=m.id) | 
				
			|||
                JOIN account_account a ON (l.account_id=a.id) | 
				
			|||
                LEFT JOIN account_analytic_account anl ON (l.analytic_account_id=anl.id) | 
				
			|||
                LEFT JOIN account_analytic_tag_account_move_line_rel analtag ON analtag.account_move_line_id = l.id | 
				
			|||
                LEFT JOIN res_currency c ON (l.currency_id=c.id) | 
				
			|||
                LEFT JOIN res_currency cc ON (l.company_currency_id=cc.id) | 
				
			|||
                LEFT JOIN res_partner p ON (l.partner_id=p.id) | 
				
			|||
                JOIN account_journal j ON (l.journal_id=j.id) | 
				
			|||
            WHERE %s | 
				
			|||
        ''') % (WHERE_CURRENT) | 
				
			|||
        cr.execute(sql) | 
				
			|||
        count = cr.fetchone()[0] | 
				
			|||
 | 
				
			|||
        sql = (''' | 
				
			|||
                SELECT | 
				
			|||
                    l.date AS ldate, | 
				
			|||
                    l.id AS lid, | 
				
			|||
                    l.account_id AS account_id, | 
				
			|||
                    j.code AS lcode, | 
				
			|||
                    l.currency_id, | 
				
			|||
                    --l.ref AS lref, | 
				
			|||
                    l.name AS lname, | 
				
			|||
                    m.id AS move_id, | 
				
			|||
                    m.name AS move_name, | 
				
			|||
                    c.symbol AS currency_symbol, | 
				
			|||
                    c.position AS currency_position, | 
				
			|||
                    c.rounding AS currency_precision, | 
				
			|||
                    cc.id AS company_currency_id, | 
				
			|||
                    cc.symbol AS company_currency_symbol, | 
				
			|||
                    cc.rounding AS company_currency_precision, | 
				
			|||
                    cc.position AS company_currency_position, | 
				
			|||
                    p.name AS partner_name, | 
				
			|||
                    COALESCE(l.debit,0) AS debit, | 
				
			|||
                    COALESCE(l.credit,0) AS credit, | 
				
			|||
                    COALESCE(l.debit - l.credit,0) AS balance, | 
				
			|||
                    COALESCE(l.amount_currency,0) AS amount_currency | 
				
			|||
                FROM account_move_line l | 
				
			|||
                JOIN account_move m ON (l.move_id=m.id) | 
				
			|||
                JOIN account_account a ON (l.account_id=a.id) | 
				
			|||
                LEFT JOIN account_analytic_account anl ON (l.analytic_account_id=anl.id) | 
				
			|||
                LEFT JOIN account_analytic_tag_account_move_line_rel analtag ON analtag.account_move_line_id = l.id | 
				
			|||
                LEFT JOIN res_currency c ON (l.currency_id=c.id) | 
				
			|||
                LEFT JOIN res_currency cc ON (l.company_currency_id=cc.id) | 
				
			|||
                LEFT JOIN res_partner p ON (l.partner_id=p.id) | 
				
			|||
                JOIN account_journal j ON (l.journal_id=j.id) | 
				
			|||
                WHERE %s | 
				
			|||
                GROUP BY l.id, l.account_id, j.code, l.currency_id, l.amount_currency, l.name, m.id, m.name, c.rounding, cc.id, cc.rounding, cc.position, c.position, c.symbol, cc.symbol, p.name | 
				
			|||
                ORDER BY %s | 
				
			|||
                OFFSET %s ROWS | 
				
			|||
                FETCH FIRST %s ROWS ONLY | 
				
			|||
            ''') % (WHERE_CURRENT, ORDER_BY_CURRENT, offset_count, fetch_range) | 
				
			|||
        cr.execute(sql) | 
				
			|||
        for row in cr.dictfetchall(): | 
				
			|||
            current_balance = row['balance'] | 
				
			|||
            row['balance'] = opening_balance + current_balance | 
				
			|||
            opening_balance += current_balance | 
				
			|||
            row['initial_bal'] = False | 
				
			|||
            move_lines.append(row) | 
				
			|||
 | 
				
			|||
        return count, offset_count, move_lines | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    def get_data(self, title): | 
				
			|||
        filters = self.process_filters() | 
				
			|||
        account_lines = self.report_data(title) | 
				
			|||
        return filters, account_lines | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    def get_page_list(self, total_count): | 
				
			|||
 | 
				
			|||
        page_count = int(total_count / FETCH_RANGE) | 
				
			|||
        if total_count % FETCH_RANGE: | 
				
			|||
            page_count += 1 | 
				
			|||
        return [i + 1 for i in range(0, int(page_count))] or [] | 
				
			|||
 | 
				
			|||
    def write(self, vals): | 
				
			|||
 | 
				
			|||
        if vals.get('journal_ids'): | 
				
			|||
            vals.update({'journal_ids': [(4, j) for j in 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('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_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_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,)]}) | 
				
			|||
        return super(BankBook, self).write(vals) | 
				
			|||
 | 
				
			|||
    @api.model | 
				
			|||
    def create(self, vals): | 
				
			|||
        res = super(BankBook, self).create(vals) | 
				
			|||
        return res | 
				
			|||
 | 
				
			|||
    def get_xlsx_report(self, data, response, report_data, dfr_data): | 
				
			|||
        i = str(data) | 
				
			|||
        n = json.loads(i) | 
				
			|||
        filters = json.loads(report_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': '12px', | 
				
			|||
             'border': 1, | 
				
			|||
             'border_color': 'black'}) | 
				
			|||
        sub_heading_sub = workbook.add_format( | 
				
			|||
            {'align': 'center', 'bold': True, 'font_size': '10px', | 
				
			|||
             'border': 2, | 
				
			|||
             'border_color': 'black'}) | 
				
			|||
        sub_heading_total = workbook.add_format( | 
				
			|||
            {'align': 'right', 'bold': True, 'font_size': '10px', | 
				
			|||
             'border': 2, | 
				
			|||
             'border_color': 'black'}) | 
				
			|||
        sub_heading_main = workbook.add_format( | 
				
			|||
            {'align': 'center', 'bold': True, 'font_size': '10px', | 
				
			|||
             'border': 1, | 
				
			|||
             'border_color': 'black'}) | 
				
			|||
        txt = workbook.add_format({'font_size': '10px', 'border': 1}) | 
				
			|||
        sheet.merge_range('A2:J3', self.env.user.company_id.name + ':' + dfr_data, 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('B4:C4', 'From: '+filters.get('date_from') , date_head) | 
				
			|||
        if filters.get('date_to'): | 
				
			|||
            sheet.merge_range('H4:I4', 'To: '+ filters.get('date_to'), date_head) | 
				
			|||
        sheet.merge_range('A5:J6', '  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'] ]) + '  Entries: '+ filters.get('entries'), date_head) | 
				
			|||
 | 
				
			|||
        sheet.write('A8', 'Code', sub_heading) | 
				
			|||
        sheet.write('B8', 'Account', sub_heading) | 
				
			|||
        sheet.write('C8', 'Date', sub_heading) | 
				
			|||
        sheet.write('D8', 'JRNL', sub_heading) | 
				
			|||
        sheet.write('E8', 'Partner', sub_heading) | 
				
			|||
        sheet.write('F8', 'Move', sub_heading) | 
				
			|||
        sheet.write('G8', 'Entry Label', sub_heading) | 
				
			|||
        sheet.write('H8', 'Debit', sub_heading) | 
				
			|||
        sheet.write('I8', 'Credit', sub_heading) | 
				
			|||
        sheet.write('J8', 'Balance', sub_heading) | 
				
			|||
        lst = [] | 
				
			|||
        for rec in n: | 
				
			|||
            lst.append(rec) | 
				
			|||
        row = 6 | 
				
			|||
        col = 0 | 
				
			|||
        row_1 = 5 | 
				
			|||
        sheet.set_column(8, 0, 15) | 
				
			|||
        sheet.set_column('B:B', 40) | 
				
			|||
        sheet.set_column(8, 2, 15) | 
				
			|||
        sheet.set_column(8, 3, 15) | 
				
			|||
        sheet.set_column(8, 4, 15) | 
				
			|||
        sheet.set_column(8, 5, 15) | 
				
			|||
        sheet.set_column(8, 6, 50) | 
				
			|||
        sheet.set_column(8, 7, 26) | 
				
			|||
        sheet.set_column(8, 8, 15) | 
				
			|||
        sheet.set_column(8, 9, 15) | 
				
			|||
        for l in lst: | 
				
			|||
            one_lst = [] | 
				
			|||
            two_lst = [] | 
				
			|||
 | 
				
			|||
            if n[l]['count']: | 
				
			|||
 | 
				
			|||
                one_lst.append(n[l]) | 
				
			|||
                row += 1 | 
				
			|||
                row_1 += 1 | 
				
			|||
                sheet.write(row +1, col, n[l]['code'], sub_heading_sub) | 
				
			|||
                sheet.write(row +1, col + 1, n[l]['name'], sub_heading_sub) | 
				
			|||
                sheet.write(row + 1, col + 2, '', sub_heading_sub) | 
				
			|||
                sheet.write(row + 1, col + 3, '', sub_heading_sub) | 
				
			|||
                sheet.write(row + 1, col + 4, '', sub_heading_sub) | 
				
			|||
                sheet.write(row + 1, col + 5, '', sub_heading_sub) | 
				
			|||
                sheet.write(row + 1, col + 6, '', sub_heading_sub) | 
				
			|||
 | 
				
			|||
                sheet.write(row +1, col + 7, n[l]['debit'], sub_heading_total) | 
				
			|||
                sheet.write(row +1, col + 8, n[l]['credit'], sub_heading_total) | 
				
			|||
                sheet.write(row +1, col + 9, n[l]['balance'], sub_heading_total) | 
				
			|||
 | 
				
			|||
                for rec_1 in n[l]['lines']: | 
				
			|||
                    row_1 += 1 | 
				
			|||
                    row += 1 | 
				
			|||
                    if rec_1['initial_bal']: | 
				
			|||
                        sheet.write(row +1, col, 'Initial Balance', sub_heading_main) | 
				
			|||
                        sheet.write(row + 1, col + 1, '', txt) | 
				
			|||
                        sheet.write(row + 1, col + 2, '', txt) | 
				
			|||
                        sheet.write(row + 1, col + 3, '', txt) | 
				
			|||
                        sheet.write(row + 1, col + 4, '', txt) | 
				
			|||
                        sheet.write(row + 1, col + 5, '', txt) | 
				
			|||
                        sheet.write(row + 1, col + 6, '', txt) | 
				
			|||
                        sheet.write(row +1, col + 7, n[l]['debit'], txt) | 
				
			|||
                        sheet.write(row +1, col + 8, n[l]['credit'], txt) | 
				
			|||
                        sheet.write(row +1, col + 9, n[l]['balance'], txt) | 
				
			|||
                    if not rec_1['initial_bal'] and not rec_1['ending_bal']: | 
				
			|||
                        sheet.write(row + 1, col , '', txt) | 
				
			|||
                        sheet.write(row + 1, col + 1, '', txt) | 
				
			|||
                        sheet.write(row +1, col + 2, rec_1.get('ldate'), txt) | 
				
			|||
                        sheet.write(row +1, col + 3, rec_1.get('lcode'), txt) | 
				
			|||
                        sheet.write(row +1, col + 4, rec_1.get('partner_name'), txt) | 
				
			|||
                        sheet.write(row +1, col + 5, rec_1.get('move_name'), txt) | 
				
			|||
                        sheet.write(row +1, col + 6, rec_1.get('lname'), txt) | 
				
			|||
                        sheet.write(row +1, col + 7, rec_1.get('debit'), txt) | 
				
			|||
                        sheet.write(row +1, col + 8, rec_1.get('credit'), txt) | 
				
			|||
                        sheet.write(row +1, col + 9, rec_1.get('balance'), txt) | 
				
			|||
 | 
				
			|||
        workbook.close() | 
				
			|||
        output.seek(0) | 
				
			|||
        response.stream.write(output.read()) | 
				
			|||
        output.close() | 
				
			|||
@ -0,0 +1,653 @@ | 
				
			|||
from odoo import models, fields, api | 
				
			|||
import io | 
				
			|||
import json | 
				
			|||
from odoo.exceptions import UserError, ValidationError | 
				
			|||
try: | 
				
			|||
    from odoo.tools.misc import xlsxwriter | 
				
			|||
except ImportError: | 
				
			|||
    import xlsxwriter | 
				
			|||
FETCH_RANGE = 2000 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
class CashFlow(models.TransientModel): | 
				
			|||
    _name = "dynamic.cash.flow" | 
				
			|||
    journal_ids = fields.Many2many( | 
				
			|||
        "account.journal", | 
				
			|||
        string="Journals", | 
				
			|||
    ) | 
				
			|||
    target_moves = fields.Selection( | 
				
			|||
        [('all', 'All entries'), | 
				
			|||
         ('posted', 'Posted Only')], string='Target Moves', default='all' | 
				
			|||
    ) | 
				
			|||
    analytic_ids = fields.Many2many( | 
				
			|||
        "account.analytic.account", string="Analytic Accounts" | 
				
			|||
    ) | 
				
			|||
    analytic_tag_ids = fields.Many2many("account.analytic.tag", | 
				
			|||
                                        string="Analytic Tags") | 
				
			|||
    account_ids = fields.Many2many( | 
				
			|||
        "account.account", | 
				
			|||
        string="Accounts", | 
				
			|||
    ) | 
				
			|||
    company_id = fields.Many2one( | 
				
			|||
        "res.company", | 
				
			|||
        string="Company", | 
				
			|||
    ) | 
				
			|||
    date_from = fields.Date( | 
				
			|||
        default='2021-01-01', | 
				
			|||
        string="Start date", | 
				
			|||
    ) | 
				
			|||
    date_to = fields.Date( | 
				
			|||
        default=fields.Date.today(), | 
				
			|||
        string="End date", | 
				
			|||
    ) | 
				
			|||
    partner_ids = fields.Many2many('res.partner', string='Partner') | 
				
			|||
    partner_category_ids = fields.Many2many('res.partner.category', | 
				
			|||
                                            string='Partner_tags') | 
				
			|||
    include_details = fields.Boolean(string="Include Details", default=True) | 
				
			|||
    level = fields.Selection([('summary', 'Summary'), | 
				
			|||
                              ('consolidated', 'Consolidated'), | 
				
			|||
                              ('detailed', 'Detailed'), | 
				
			|||
                              ('very', 'Very Detailedy')], | 
				
			|||
                                  string='Levels') | 
				
			|||
 | 
				
			|||
    reconciled = fields.Selection([('reconciled', 'Reconciled Only'), | 
				
			|||
                                   ('unreconciled', 'Unreconciled Only')], | 
				
			|||
                                  string='Reconcile Type') | 
				
			|||
 | 
				
			|||
    type = fields.Selection( | 
				
			|||
        [('receivable', 'Receivable Only'), | 
				
			|||
         ('payable', 'Payable only')], | 
				
			|||
        string='Account Type', required=False | 
				
			|||
    ) | 
				
			|||
 | 
				
			|||
    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_moves') == '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, | 
				
			|||
            } | 
				
			|||
 | 
				
			|||
    def process_filters(self): | 
				
			|||
        # To show on report headers | 
				
			|||
        data = self.get_filters(default_filters={}) | 
				
			|||
        filters = {} | 
				
			|||
        if data.get('date_from', False): | 
				
			|||
            filters['date_from'] = data.get('date_from') | 
				
			|||
        if data.get('date_to', False): | 
				
			|||
            filters['date_to'] = data.get('date_to') | 
				
			|||
        if data.get('company_id'): | 
				
			|||
            filters['company_id'] = data.get('company_id') | 
				
			|||
        else: | 
				
			|||
            filters['company_id'] = '' | 
				
			|||
 | 
				
			|||
        if data.get('include_details'): | 
				
			|||
            filters['include_details'] = True | 
				
			|||
        else: | 
				
			|||
            filters['include_details'] = False | 
				
			|||
        if data.get('target_moves') == 'all': | 
				
			|||
            filters['target_moves'] = 'All Entries' | 
				
			|||
        else: | 
				
			|||
            filters['target_moves'] = 'Posted Only' | 
				
			|||
        return filters | 
				
			|||
 | 
				
			|||
    def get_filters(self, default_filters={}): | 
				
			|||
        company_id = self.env.user.company_id | 
				
			|||
        company_domain = [('company_id', '=', company_id.id)] | 
				
			|||
        partner_company_domain = [('parent_id', '=', False), | 
				
			|||
                                  '|', | 
				
			|||
                                  ('company_id', '=', company_id.id), | 
				
			|||
                                  ('company_id', '=', False)] | 
				
			|||
 | 
				
			|||
        filter_dict = { | 
				
			|||
            'account_ids': self.account_ids.ids, | 
				
			|||
            'company_id': self.company_id and self.company_id.id or False, | 
				
			|||
            'date_from': self.date_from, | 
				
			|||
            'date_to': self.date_to, | 
				
			|||
            'reconciled': self.reconciled, | 
				
			|||
            'type': self.type, | 
				
			|||
            'level': self.level, | 
				
			|||
            'target_moves' : self.target_moves, | 
				
			|||
            'company_name': self.company_id and self.company_id.name, | 
				
			|||
        } | 
				
			|||
        filter_dict.update(default_filters) | 
				
			|||
        return filter_dict | 
				
			|||
 | 
				
			|||
    def get_data(self): | 
				
			|||
        filters = self.process_filters() | 
				
			|||
        account_lines = self.report_data() | 
				
			|||
        if account_lines['date_from'] is False: | 
				
			|||
            raise ValidationError("Please attach your document") | 
				
			|||
        return filters, account_lines | 
				
			|||
 | 
				
			|||
    def get_page_list(self, total_count): | 
				
			|||
        page_count = int(total_count / FETCH_RANGE) | 
				
			|||
        if total_count % FETCH_RANGE: | 
				
			|||
            page_count += 1 | 
				
			|||
        return [i + 1 for i in range(0, int(page_count))] or [] | 
				
			|||
 | 
				
			|||
    @api.model | 
				
			|||
    def create(self, vals): | 
				
			|||
        ret = super(CashFlow, self).create(vals) | 
				
			|||
        return ret | 
				
			|||
 | 
				
			|||
    def write(self, vals): | 
				
			|||
        if vals['date_from'] is False: | 
				
			|||
            raise ValidationError("Please enter start date") | 
				
			|||
        if vals['date_to'] is False: | 
				
			|||
            raise ValidationError("Please enter  date") | 
				
			|||
        if vals.get('journal_ids'): | 
				
			|||
            vals.update( | 
				
			|||
                {'journal_ids': [(4, j) for j in vals.get('journal_ids')]}) | 
				
			|||
        if vals.get('journal_ids') == []: | 
				
			|||
            vals.update({'journal_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_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,)]}) | 
				
			|||
        ret = super(CashFlow, self).write(vals) | 
				
			|||
        return ret | 
				
			|||
 | 
				
			|||
    def report_data(self): | 
				
			|||
        cr = self.env.cr | 
				
			|||
        data = self.get_filters(default_filters={}) | 
				
			|||
        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('level') == 'summary': | 
				
			|||
            state = """ WHERE am.state = 'posted' """ if data.get('target_moves') == '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( | 
				
			|||
                'level') == '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( | 
				
			|||
                'level') == '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( | 
				
			|||
                'level') == '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( | 
				
			|||
                'level') == '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('level') == 'consolidated': | 
				
			|||
            state = """ WHERE am.state = 'posted' """ if data.get('level') == '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('level') == 'detailed': | 
				
			|||
            state = """ WHERE am.state = 'posted' """ if data.get('level') == '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('level') == '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_moves') == '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_xlsx_report(self, data, response, report_data, dfr_data): | 
				
			|||
        report_data = json.loads(report_data) | 
				
			|||
        data = json.loads(data) | 
				
			|||
        output = io.BytesIO() | 
				
			|||
        workbook = xlsxwriter.Workbook(output, {'in_memory': True}) | 
				
			|||
        fetched_data = [] | 
				
			|||
        account_res = [] | 
				
			|||
        journal_res = [] | 
				
			|||
        fetched = [] | 
				
			|||
        account_type_id = self.env.ref('account.data_account_type_liquidity').id | 
				
			|||
        currency_symbol = self.env.user.company_id.currency_id.symbol | 
				
			|||
 | 
				
			|||
        if data['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['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['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['levels'] == 'detailed': | 
				
			|||
            state = """ WHERE am.state = 'posted' """ if data.get('target_move') == 'posted' else '' | 
				
			|||
            query1 = """SELECT 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['date_from']) + """' and '""" + str( | 
				
			|||
                data['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""" | 
				
			|||
            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.name,aa.code, sum(aml.debit) AS total_debit, | 
				
			|||
                                                 sum(aml.credit) AS total_credit 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['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""" | 
				
			|||
 | 
				
			|||
            cr = self._cr | 
				
			|||
            cr.execute(sql) | 
				
			|||
            fetched = 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) | 
				
			|||
        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('D6', "Date From", cell_format) | 
				
			|||
        sheet.write('E6', str(data['date_from']), date) | 
				
			|||
        sheet.write('D7', "Date To", cell_format) | 
				
			|||
        sheet.write('E7', str(data['date_to']), date) | 
				
			|||
        if data['levels']: | 
				
			|||
            sheet.write('D9', "Level", cell_format) | 
				
			|||
            sheet.write('E9', data.get("levels"), date) | 
				
			|||
        sheet.write('D8', "Target Moves", cell_format) | 
				
			|||
        sheet.write('E8', report_data.get("target_moves"), date) | 
				
			|||
        sheet.write('C11', 'NAME', bold) | 
				
			|||
        sheet.write('D11', 'CASH IN', bold) | 
				
			|||
        sheet.write('E11', 'CASH OUT', bold) | 
				
			|||
        sheet.write('F11', 'BALANCE', bold) | 
				
			|||
 | 
				
			|||
        row_num = 8 | 
				
			|||
        col_num = 2 | 
				
			|||
        fetched_data_list = fetched_data.copy() | 
				
			|||
        account_res_list = account_res.copy() | 
				
			|||
        journal_res_list = journal_res.copy() | 
				
			|||
        fetched_list = fetched.copy() | 
				
			|||
 | 
				
			|||
        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: | 
				
			|||
            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: | 
				
			|||
            for k in fetched_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() | 
				
			|||