summaryrefslogtreecommitdiff
path: root/dynamic_accounts_report/static/src
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 17:14:58 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 17:14:58 +0700
commit1ca3b3df3421961caec3b747a364071c80f5c7da (patch)
tree6778a1f0f3f9b4c6e26d6d87ccde16e24da6c9d6 /dynamic_accounts_report/static/src
parentb57188be371d36d96caac4b8d65a40745c0e972c (diff)
initial commit
Diffstat (limited to 'dynamic_accounts_report/static/src')
-rw-r--r--dynamic_accounts_report/static/src/css/report.css9
-rw-r--r--dynamic_accounts_report/static/src/js/action_manager.js52
-rw-r--r--dynamic_accounts_report/static/src/js/ageing.js405
-rw-r--r--dynamic_accounts_report/static/src/js/cash_flow.js335
-rw-r--r--dynamic_accounts_report/static/src/js/daybook.js387
-rw-r--r--dynamic_accounts_report/static/src/js/financial_reports.js357
-rw-r--r--dynamic_accounts_report/static/src/js/general_ledger.js453
-rw-r--r--dynamic_accounts_report/static/src/js/partner_ledger.js431
-rw-r--r--dynamic_accounts_report/static/src/js/trial_balance.js263
-rw-r--r--dynamic_accounts_report/static/src/xml/ageing.xml580
-rw-r--r--dynamic_accounts_report/static/src/xml/cash_flow_view.xml351
-rw-r--r--dynamic_accounts_report/static/src/xml/daybook.xml341
-rw-r--r--dynamic_accounts_report/static/src/xml/financial_reports_view.xml266
-rw-r--r--dynamic_accounts_report/static/src/xml/general_ledger_view.xml395
-rw-r--r--dynamic_accounts_report/static/src/xml/partner_ledger_view.xml340
-rw-r--r--dynamic_accounts_report/static/src/xml/trial_balance_view.xml283
16 files changed, 5248 insertions, 0 deletions
diff --git a/dynamic_accounts_report/static/src/css/report.css b/dynamic_accounts_report/static/src/css/report.css
new file mode 100644
index 0000000..a1f6e98
--- /dev/null
+++ b/dynamic_accounts_report/static/src/css/report.css
@@ -0,0 +1,9 @@
+.mon_fld{
+text-align: right;
+
+}
+
+.cf_fld{
+text-align: right;
+width: 300px !important;
+} \ No newline at end of file
diff --git a/dynamic_accounts_report/static/src/js/action_manager.js b/dynamic_accounts_report/static/src/js/action_manager.js
new file mode 100644
index 0000000..9eda3ec
--- /dev/null
+++ b/dynamic_accounts_report/static/src/js/action_manager.js
@@ -0,0 +1,52 @@
+odoo.define('dynamic_accounts_report.action_manager', function (require) {
+"use strict";
+/**
+ * The purpose of this file is to add the actions of type
+ * 'xlsx' to the ActionManager.
+ */
+var ActionManager = require('web.ActionManager');
+var framework = require('web.framework');
+var session = require('web.session');
+
+
+ActionManager.include({
+
+ /**
+ * Executes actions of type 'ir.actions.report'.
+ *
+ * @private
+ * @param {Object} action the description of the action to execute
+ * @param {Object} options @see doAction for details
+ * @returns {Promise} resolved when the action has been executed
+ */
+ _executedynamicxlsxReportDownloadAction: function (action) {
+ framework.blockUI();
+ var def = $.Deferred();
+ session.get_file({
+ url: '/dynamic_xlsx_reports',
+ data: action.data,
+ success: def.resolve.bind(def),
+ error: (error) => this.call('crash_manager', 'rpc_error', error),
+ complete: framework.unblockUI,
+ });
+ return def;
+ },
+ /**
+ * Overrides to handle the 'ir.actions.report' actions.
+ *
+ * @override
+ * @private
+ */
+
+ _handleAction: function (action, options) {
+
+ if (action.type === 'ir_actions_dynamic_xlsx_download') {
+ return this._executedynamicxlsxReportDownloadAction(action, options);
+ }
+ return this._super.apply(this, arguments);
+ },
+
+
+});
+
+});
diff --git a/dynamic_accounts_report/static/src/js/ageing.js b/dynamic_accounts_report/static/src/js/ageing.js
new file mode 100644
index 0000000..c5c2a41
--- /dev/null
+++ b/dynamic_accounts_report/static/src/js/ageing.js
@@ -0,0 +1,405 @@
+odoo.define('dynamic_accounts_report.ageing', function (require) {
+ 'use strict';
+ var AbstractAction = require('web.AbstractAction');
+ var core = require('web.core');
+ var field_utils = require('web.field_utils');
+ var rpc = require('web.rpc');
+ var session = require('web.session');
+ var utils = require('web.utils');
+ var QWeb = core.qweb;
+ var _t = core._t;
+
+ window.click_num = 0;
+ var PartnerAgeing = AbstractAction.extend({
+ template: 'AgeingTemp',
+ events: {
+ 'click .parent-line': 'journal_line_click',
+ 'click .child_col1': 'journal_line_click',
+ 'click #apply_filter': 'apply_filter',
+ 'click #pdf': 'print_pdf',
+ 'click #xlsx': 'print_xlsx',
+ 'click .gl-line': 'show_drop_down',
+ 'click .view-account-move': 'view_acc_move',
+ },
+
+ init: function(parent, action) {
+ this._super(parent, action);
+ this.currency=action.currency;
+ this.report_lines = action.report_lines;
+
+ this.wizard_id = action.context.wizard | null;
+
+ },
+
+
+ start: function() {
+ var self = this;
+ self.initial_render = true;
+ rpc.query({
+ model: 'account.partner.ageing',
+ method: 'create',
+ args: [{
+
+ }]
+ }).then(function(t_res) {
+ self.wizard_id = t_res;
+
+ self.load_data(self.initial_render);
+ })
+ },
+
+
+ load_data: function (initial_render = true) {
+
+ var self = this;
+
+ self.$(".categ").empty();
+ try{
+ var self = this;
+ self._rpc({
+ model: 'account.partner.ageing',
+ method: 'view_report',
+ args: [[this.wizard_id]],
+ }).then(function(datas) {
+ _.each(datas['report_lines'][0], function(rep_lines) {
+ rep_lines.total = self.format_currency(datas['currency'],rep_lines.total);
+ rep_lines[4] = self.format_currency(datas['currency'],rep_lines[4]);
+ rep_lines[3] = self.format_currency(datas['currency'],rep_lines[3]);
+ rep_lines[2] = self.format_currency(datas['currency'],rep_lines[2]);
+ rep_lines[1] = self.format_currency(datas['currency'],rep_lines[1]);
+ rep_lines[0] = self.format_currency(datas['currency'],rep_lines[0]);
+
+ rep_lines['direction'] = self.format_currency(datas['currency'],rep_lines['direction']);
+
+ });
+
+ if (initial_render) {
+ self.$('.filter_view_tb').html(QWeb.render('AgeingFilterView', {
+ filter_data: datas['filters'],
+ }));
+ self.$el.find('.partners').select2({
+ placeholder: ' Partners...',
+ });
+ self.$el.find('.category').select2({
+ placeholder: ' Partner Category...',
+ });
+ self.$el.find('.target_move').select2({
+ placeholder: ' Target Move...',
+ });
+ self.$el.find('.result_selection').select2({
+ placeholder: ' Account Type...',
+ });
+
+ }
+ var child=[];
+
+ self.$('.table_view_tb').html(QWeb.render('Ageingtable', {
+
+ report_lines : datas['report_lines'],
+ move_lines :datas['report_lines'][2],
+ filter : datas['filters'],
+ currency : datas['currency'],
+ }));
+
+ });
+
+ }
+ catch (el) {
+ window.location.href
+ }
+ },
+ format_currency: function(currency, amount) {
+ if (typeof(amount) != 'number') {
+ amount = parseFloat(amount);
+ }
+ var formatted_value = (parseInt(amount)).toLocaleString(currency[2],{
+ minimumFractionDigits: 2
+ })
+ return formatted_value
+ },
+
+ print_pdf: function(e) {
+ e.preventDefault();
+
+ var self = this;
+ self._rpc({
+ model: 'account.partner.ageing',
+ method: 'view_report',
+ args: [
+ [self.wizard_id]
+ ],
+ }).then(function(data) {
+ var action = {
+ 'type': 'ir.actions.report',
+ 'report_type': 'qweb-pdf',
+ 'report_name': 'dynamic_accounts_report.partner_ageing',
+ 'report_file': 'dynamic_accounts_report.partner_ageing',
+ 'data': {
+ 'report_data': data
+ },
+ 'context': {
+ 'active_model': 'account.partner.ageing',
+ 'landscape': 1,
+ 'ageing_pdf_report': true
+
+ },
+ 'display_name': 'Partner Ageing',
+ };
+
+ return self.do_action(action);
+ });
+ },
+
+
+
+ print_xlsx: function() {
+ var self = this;
+ self._rpc({
+ model: 'account.partner.ageing',
+ method: 'view_report',
+ args: [
+ [self.wizard_id]
+ ],
+ }).then(function(data) {
+
+ var action = {
+ 'type': 'ir_actions_dynamic_xlsx_download',
+ 'data': {
+ 'model': 'account.partner.ageing',
+ 'options': JSON.stringify(data['filters']),
+ 'output_format': 'xlsx',
+ 'report_data': JSON.stringify(data['report_lines']),
+ 'report_name': 'Partner Ageing',
+ 'dfr_data': JSON.stringify(data),
+ },
+ };
+ return self.do_action(action);
+ });
+ },
+
+
+
+
+
+ create_lines_with_style: function(rec, attr, datas) {
+ var temp_str = "";
+ var style_name = "border-bottom: 1px solid #e6e6e6;";
+ var attr_name = attr + " style="+style_name;
+
+
+
+ temp_str += "<td class='child_col1' "+attr_name+" >"+rec['code'] +rec['name'] +"</td>";
+ if(datas.currency[1]=='after'){
+ temp_str += "<td class='child_col2' "+attr_name+" >"+rec['debit'].toFixed(2)+datas.currency[0]+"</td>";
+ temp_str += "<td class='child_col3' "+attr_name+" >"+rec['credit'].toFixed(2) +datas.currency[0]+ "</td>";
+
+ }
+ else{
+ temp_str += "<td class='child_col2' "+attr_name+" >"+datas.currency[0]+rec['debit'].toFixed(2) + "</td>";
+ temp_str += "<td class='child_col3' "+attr_name+">"+datas.currency[0]+rec['credit'].toFixed(2) + "</td>";
+
+ }
+ return temp_str;
+ },
+
+
+ journal_line_click: function (el){
+
+ click_num++;
+ var self = this;
+ var line = $(el.target).parent().data('id');
+
+ return self.do_action({
+ type: 'ir.actions.act_window',
+ view_type: 'form',
+ view_mode: 'form',
+ res_model: 'account.move',
+ views: [
+ [false, 'form']
+ ],
+ res_id: line,
+ target: 'current',
+ });
+
+ },
+
+ show_drop_down: function(event) {
+ event.preventDefault();
+ var self = this;
+ var account_id = $(event.currentTarget).data('account-id');
+
+ var partner_id = $(event.currentTarget)[0].cells[0].innerText;
+
+ var offset = 0;
+ var td = $(event.currentTarget).next('tr').find('td');
+ if (td.length == 1) {
+
+ self._rpc({
+ model: 'account.partner.ageing',
+ method: 'view_report',
+ args: [
+ [self.wizard_id]
+ ],
+ }).then(function(data) {
+
+
+ _.each(data['report_lines'][0], function(rep_lines) {
+ _.each(rep_lines['child_lines'], function(child_line) {
+ child_line.amount = self.format_currency(data['currency'],child_line.amount);
+
+ });
+ });
+
+
+ for (var i = 0; i < data['report_lines'][0].length; i++) {
+ if (account_id == data['report_lines'][0][i]['partner_id'] ){
+ $(event.currentTarget).next('tr').find('td .gl-table-div').remove();
+ $(event.currentTarget).next('tr').find('td ul').after(
+ QWeb.render('SubSectional', {
+ account_data: data['report_lines'][0][i]['child_lines'],
+ }))
+ $(event.currentTarget).next('tr').find('td ul li:first a').css({
+ 'background-color': '#00ede8',
+ 'font-weight': 'bold',
+ });
+ }
+ }
+
+ });
+ }
+ },
+
+ view_acc_move: function(event) {
+ event.preventDefault();
+ var self = this;
+ var context = {};
+ var show_acc_move = function(res_model, res_id, view_id) {
+ var action = {
+ type: 'ir.actions.act_window',
+ view_type: 'form',
+ view_mode: 'form',
+ res_model: res_model,
+ views: [
+ [view_id || false, 'form']
+ ],
+ res_id: res_id,
+ target: 'current',
+ context: context,
+ };
+ return self.do_action(action);
+ };
+ rpc.query({
+ model: 'account.move',
+ method: 'search_read',
+ domain: [
+ ['id', '=', $(event.currentTarget).data('move-id')]
+ ],
+ fields: ['id'],
+ limit: 1,
+ })
+ .then(function(record) {
+ if (record.length > 0) {
+ show_acc_move('account.move', record[0].id);
+ } else {
+ show_acc_move('account.move', $(event.currentTarget).data('move-id'));
+ }
+ });
+ },
+
+
+ apply_filter: function(event) {
+
+ event.preventDefault();
+ var self = this;
+ self.initial_render = false;
+
+ var filter_data_selected = {};
+
+ if ($("#date_from").val()) {
+ var dateString = $("#date_from").val();
+
+ filter_data_selected.date_from= dateString;
+ }
+ var partner_ids = [];
+ var partner_text = [];
+ var span_res = document.getElementById("partner_res")
+ var partner_list = $(".partners").select2('data')
+ for (var i = 0; i < partner_list.length; i++) {
+ if(partner_list[i].element[0].selected === true)
+ {partner_ids.push(parseInt(partner_list[i].id))
+ if(partner_text.includes(partner_list[i].text) === false)
+ {partner_text.push(partner_list[i].text)
+ }
+ span_res.value = partner_text
+ span_res.innerHTML=span_res.value;
+ }
+ }
+ if (partner_list.length == 0){
+ span_res.value = ""
+ span_res.innerHTML="";
+ }
+ filter_data_selected.partner_ids = partner_ids
+
+ var partner_category_ids = [];
+ var partner_category_text = [];
+ var span_res = document.getElementById("category_res")
+ var category_list = $(".category").select2('data')
+
+ for (var i = 0; i < category_list.length; i++) {
+ if(category_list[i].element[0].selected === true)
+ {partner_category_ids.push(parseInt(category_list[i].id))
+ if(partner_category_text.includes(category_list[i].text) === false)
+ {partner_category_text.push(category_list[i].text)
+ }
+ span_res.value = partner_category_text
+ span_res.innerHTML=span_res.value;
+ }
+ }
+ if (category_list.length == 0){
+ span_res.value = ""
+ span_res.innerHTML="";
+ }
+ filter_data_selected.partner_category_ids = partner_category_ids
+
+
+ if ($(".target_move").length) {
+
+ var post_res = document.getElementById("post_res")
+ filter_data_selected.target_move = $(".target_move")[1].value
+
+ post_res.value = $(".target_move")[1].value
+ post_res.innerHTML=post_res.value;
+ if ($(".target_move")[1].value == "") {
+ post_res.innerHTML="posted";
+
+ }
+ }
+
+ if ($(".result_selection").length) {
+ var account_res = document.getElementById("account_res")
+ filter_data_selected.result_selection = $(".result_selection")[1].value
+ account_res.value = $(".result_selection")[1].value
+ account_res.innerHTML=account_res.value;
+ if ($(".result_selection")[1].value == "") {
+ account_res.innerHTML="customer";
+
+ }
+ }
+
+
+ rpc.query({
+ model: 'account.partner.ageing',
+ method: 'write',
+ args: [
+ self.wizard_id, filter_data_selected
+ ],
+ }).then(function(res) {
+ self.initial_render = false;
+ self.load_data(self.initial_render);
+ });
+ },
+
+ });
+ core.action_registry.add("p_a", PartnerAgeing);
+ return PartnerAgeing;
+}); \ No newline at end of file
diff --git a/dynamic_accounts_report/static/src/js/cash_flow.js b/dynamic_accounts_report/static/src/js/cash_flow.js
new file mode 100644
index 0000000..66219aa
--- /dev/null
+++ b/dynamic_accounts_report/static/src/js/cash_flow.js
@@ -0,0 +1,335 @@
+odoo.define('dynamic_cash_flow_statements.cash_flow', function (require) {
+ 'use strict';
+ var AbstractAction = require('web.AbstractAction');
+ var core = require('web.core');
+ var field_utils = require('web.field_utils');
+ var rpc = require('web.rpc');
+ var session = require('web.session');
+ var utils = require('web.utils');
+ var QWeb = core.qweb;
+ var _t = core._t;
+
+ window.click_num = 0;
+ var CashFlow = AbstractAction.extend({
+ template: 'CFTemp',
+ events: {
+ 'click .parent-line': 'journal_line_click',
+ 'click .child_col1': 'journal_line_click',
+ 'click #apply_filter': 'apply_filter',
+ 'click #pdf': 'print_pdf',
+ 'click #xlsx': 'print_xlsx',
+ 'click .cf-line': 'get_move_lines',
+ },
+
+ init: function(parent, action) {
+ this._super(parent, action);
+ this.currency=action.currency;
+ this.report_lines = action.report_lines;
+ this.wizard_id = action.context.wizard | null;
+ },
+
+
+ start: function() {
+ var self = this;
+ self.initial_render = true;
+ rpc.query({
+ model: 'account.cash.flow',
+ method: 'create',
+ args: [{
+
+ }]
+ }).then(function(t_res) {
+ self.wizard_id = t_res;
+ self.load_data(self.initial_render);
+ })
+ },
+
+ get_move_lines: function(event) {
+ event.preventDefault();
+ var self = this;
+ var account_id = $(event.currentTarget).data('account-id');
+ var offset = 0;
+ var td = $(event.currentTarget).next('tr').find('td');
+ if (td.length == 1) {
+ self._rpc({
+ model: 'account.cash.flow',
+ method: 'view_report',
+ args: [
+ [self.wizard_id]
+ ],
+ }).then(function(datas) {
+ _.each(datas['journal_res'], function(journal_lines) {
+ _.each(journal_lines['journal_lines'], function(rep_lines) {
+ rep_lines.total_debit = self.format_currency(datas['currency'],rep_lines.total_debit);
+ rep_lines.total_credit = self.format_currency(datas['currency'],rep_lines.total_credit);
+ rep_lines.balance = self.format_currency(datas['currency'],rep_lines.balance);
+
+
+
+
+ });
+
+ });
+ _.each(datas['account_res'], function(journal_lines) {
+ _.each(journal_lines['journal_lines'], function(rep_lines) {
+ rep_lines.total_debit = self.format_currency(datas['currency'],rep_lines.total_debit);
+ rep_lines.total_credit = self.format_currency(datas['currency'],rep_lines.total_credit);
+ rep_lines.total_balance = self.format_currency(datas['currency'],rep_lines.total_balance);
+
+
+ });
+ _.each(journal_lines['move_lines'], function(move_lines) {
+ move_lines.total_debit = self.format_currency(datas['currency'],move_lines.total_debit);
+ move_lines.total_credit = self.format_currency(datas['currency'],move_lines.total_credit);
+ move_lines.balance = self.format_currency(datas['currency'],move_lines.balance);
+
+
+
+
+ });
+ });
+
+
+ if(datas['levels']== 'detailed'){
+ $(event.currentTarget).next('tr').find('td ul').after(
+ QWeb.render('SubSectionCF', {
+ count: 3,
+ offset: 0,
+ account_data: datas['journal_res'],
+ level:datas['levels'],
+ currency : datas['currency'],
+ line_id:parseInt(event.currentTarget.attributes[3].value),
+ }))
+ }else if(datas['levels']== 'very' || datas['levels']== false){
+ $(event.currentTarget).next('tr').find('td ul').after(
+ QWeb.render('ChildSubSectionCF', {
+ count: 3,
+ offset: 0,
+ account_data: datas['account_res'],
+ level:datas['levels'],
+ currency : datas['currency'],
+ line_id:parseInt(event.currentTarget.attributes[3].value),
+ }))
+ }
+
+ $(event.currentTarget).next('tr').find('td ul li:first a').css({
+ 'background-color': '#00ede8',
+ 'font-weight': 'bold',
+ });
+ })
+ }
+ },
+
+
+ load_data: function (initial_render = true) {
+ var self = this;
+ self.$(".categ").empty();
+ try{
+ var self = this;
+ self._rpc({
+ model: 'account.cash.flow',
+ method: 'view_report',
+ args: [[this.wizard_id]],
+ }).then(function(datas) {
+
+
+ _.each(datas['fetched_data'], function(rep_lines) {
+ rep_lines.total_debit = self.format_currency(datas['currency'],rep_lines.total_debit);
+ rep_lines.total_credit = self.format_currency(datas['currency'],rep_lines.total_credit);
+ rep_lines.total_balance = self.format_currency(datas['currency'],rep_lines.total_balance);
+
+
+
+
+ });
+ if (initial_render) {
+ self.$('.filter_view_tb').html(QWeb.render('CashFilterView', {
+ filter_data: datas['filters'],
+ }));
+ self.$el.find('.journals').select2({
+ placeholder: 'Select Journals...',
+ });
+ self.$el.find('.target_move').select2({
+ placeholder: 'Target Move...',
+ });
+ self.$el.find('.levels').select2({
+ placeholder: 'Levels...',
+ });
+ }
+ var child=[];
+
+ self.$('.table_view_tb').html(QWeb.render('CashTable', {
+
+ account_data: datas['fetched_data'],
+ level:datas['levels'],
+ currency : datas['currency'],
+ }));
+
+ });
+
+ }
+ catch (el) {
+ window.location.href
+ }
+ },
+
+ format_currency: function(currency, amount) {
+ if (typeof(amount) != 'number') {
+ amount = parseFloat(amount);
+ }
+ var formatted_value = (parseInt(amount)).toLocaleString(currency[2],{
+ minimumFractionDigits: 2
+ })
+ return formatted_value
+ },
+
+ show_gl: function(e) {
+ var self = this;
+ var account_id = $(e.target).attr('data-account-id');
+ var options = {
+ account_ids: [account_id],
+ }
+
+ var action = {
+ type: 'ir.actions.client',
+ name: 'GL View',
+ tag: 'g_l',
+ target: 'new',
+
+ domain: [['account_ids','=', account_id]],
+
+
+ }
+ return this.do_action(action);
+
+ },
+ print_pdf: function(e) {
+ e.preventDefault();
+ var self = this;
+ self._rpc({
+ model: 'account.cash.flow',
+ method: 'view_report',
+ args: [
+ [self.wizard_id]
+ ],
+ }).then(function(data) {
+ var action = {
+ 'type': 'ir.actions.report',
+ 'report_type': 'qweb-pdf',
+ 'report_name': 'dynamic_accounts_report.cash_flow',
+ 'report_file': 'dynamic_accounts_report.cash_flow',
+ 'data': {
+ 'report_data': data
+ },
+ 'context': {
+ 'active_model': 'account.cash.flow',
+ 'landscape': 1,
+ 'trial_pdf_report': true
+ },
+ 'display_name': 'Cash Flow Statements',
+ };
+ return self.do_action(action);
+ });
+ },
+
+
+
+ print_xlsx: function() {
+ var self = this;
+ self._rpc({
+ model: 'account.cash.flow',
+ method: 'view_report',
+ args: [
+ [self.wizard_id]
+ ],
+ }).then(function(data) {
+ var action = {
+ 'type': 'ir_actions_dynamic_xlsx_download',
+ 'data': {
+ 'model': 'account.cash.flow',
+ 'options': JSON.stringify(data['filters']),
+ 'output_format': 'xlsx',
+ 'report_data': JSON.stringify(data['report_lines']),
+ 'report_name': 'Cash Flow Statements',
+ 'dfr_data': JSON.stringify(data),
+ },
+ };
+ return self.do_action(action);
+ });
+ },
+
+ journal_line_click: function (el){
+ click_num++;
+ var self = this;
+ var line = $(el.target).parent().data('id');
+ return self.do_action({
+ type: 'ir.actions.act_window',
+ view_type: 'form',
+ view_mode: 'form',
+ res_model: 'account.move',
+ views: [
+ [false, 'form']
+ ],
+ res_id: line,
+ target: 'current',
+ });
+
+ },
+
+
+ apply_filter: function(event) {
+
+ event.preventDefault();
+ var self = this;
+ self.initial_render = false;
+
+ var filter_data_selected = {};
+
+
+
+ if ($(".levels").length){
+ var level_res = document.getElementById("level_res")
+ filter_data_selected.levels = $(".levels")[1].value
+ level_res.value = $(".levels")[1].value
+ level_res.innerHTML=level_res.value;
+ if ($(".levels").value==""){
+ type_res.innerHTML="summary";
+ filter_data_selected.type = "Summary"
+ }
+ }
+
+ if ($("#date_from").val()) {
+ var dateString = $("#date_from").val();
+ filter_data_selected.date_from = dateString;
+ }
+ if ($("#date_to").val()) {
+ var dateString = $("#date_to").val();
+ filter_data_selected.date_to = dateString;
+ }
+
+ if ($(".target_move").length) {
+ var post_res = document.getElementById("post_res")
+ filter_data_selected.target_move = $(".target_move")[1].value
+ post_res.value = $(".target_move")[1].value
+ post_res.innerHTML=post_res.value;
+ if ($(".target_move")[1].value == "") {
+ post_res.innerHTML="posted";
+
+ }
+ }
+ rpc.query({
+ model: 'account.cash.flow',
+ method: 'write',
+ args: [
+ self.wizard_id, filter_data_selected
+ ],
+ }).then(function(res) {
+ self.initial_render = false;
+ self.load_data(self.initial_render);
+ });
+ },
+
+ });
+ core.action_registry.add("c_f", CashFlow);
+ return CashFlow;
+}); \ No newline at end of file
diff --git a/dynamic_accounts_report/static/src/js/daybook.js b/dynamic_accounts_report/static/src/js/daybook.js
new file mode 100644
index 0000000..47d98c1
--- /dev/null
+++ b/dynamic_accounts_report/static/src/js/daybook.js
@@ -0,0 +1,387 @@
+odoo.define('dynamic_partner_daybook.daybook', function (require) {
+ 'use strict';
+ var AbstractAction = require('web.AbstractAction');
+ var core = require('web.core');
+ var field_utils = require('web.field_utils');
+ var rpc = require('web.rpc');
+ var session = require('web.session');
+ var utils = require('web.utils');
+ var QWeb = core.qweb;
+ var _t = core._t;
+
+ window.click_num = 0;
+ var DayBook = AbstractAction.extend({
+ template: 'DaybookTemp',
+ events: {
+ 'click .parent-line': 'journal_line_click',
+ 'click .child_col1': 'journal_line_click',
+ 'click #apply_filter': 'apply_filter',
+ 'click #pdf': 'print_pdf',
+ 'click #xlsx': 'print_xlsx',
+ 'click .db-line': 'show_drop_down',
+ 'click .view-account-move': 'view_acc_move',
+ },
+
+ init: function(parent, action) {
+ this._super(parent, action);
+ this.currency=action.currency;
+ this.report_lines = action.report_lines;
+ this.wizard_id = action.context.wizard | null;
+ },
+
+
+ start: function() {
+ var self = this;
+ self.initial_render = true;
+ rpc.query({
+ model: 'account.day.book',
+ method: 'create',
+ args: [{
+
+ }]
+ }).then(function(t_res) {
+ self.wizard_id = t_res;
+ self.load_data(self.initial_render);
+ })
+ },
+
+
+ load_data: function (initial_render = true) {
+ var self = this;
+ self.$(".categ").empty();
+ try{
+ var self = this;
+ self._rpc({
+ model: 'account.day.book',
+ method: 'view_report',
+ args: [[this.wizard_id]],
+ }).then(function(datas) {
+ _.each(datas['report_lines'], function(rep_lines) {
+ rep_lines.debit = self.format_currency(datas['currency'],rep_lines.debit);
+ rep_lines.credit = self.format_currency(datas['currency'],rep_lines.credit);
+ rep_lines.balance = self.format_currency(datas['currency'],rep_lines.balance);
+
+ });
+
+ if (initial_render) {
+
+ self.$('.filter_view_db').html(QWeb.render('DayFilterView', {
+ filter_data: datas['filters'],
+ }));
+ self.$el.find('.journals').select2({
+ placeholder: ' Journals...',
+ });
+ self.$el.find('.account').select2({
+ placeholder: ' Accounts...',
+ });
+ self.$el.find('.target_move').select2({
+ placeholder: 'Target Move...',
+ });
+
+
+ }
+ var child=[];
+
+ self.$('.table_view_db').html(QWeb.render('Daytable', {
+
+ report_lines : datas['report_lines'],
+ filter : datas['filters'],
+ currency : datas['currency'],
+ }));
+
+ });
+
+ }
+ catch (el) {
+ window.location.href
+ }
+ },
+
+
+ format_currency: function(currency, amount) {
+ if (typeof(amount) != 'number') {
+ amount = parseFloat(amount);
+ }
+ var formatted_value = (parseInt(amount)).toLocaleString(currency[2],{
+ minimumFractionDigits: 2
+ })
+ return formatted_value
+ },
+
+ print_pdf: function(e) {
+ e.preventDefault();
+
+ var self = this;
+ self._rpc({
+ model: 'account.day.book',
+ method: 'view_report',
+ args: [
+ [self.wizard_id]
+ ],
+ }).then(function(data) {
+
+ var action = {
+ 'type': 'ir.actions.report',
+ 'report_type': 'qweb-pdf',
+ 'report_name': 'dynamic_accounts_report.day_book',
+ 'report_file': 'dynamic_accounts_report.day_book',
+ 'data': {
+ 'report_data': data
+ },
+ 'context': {
+ 'active_model': 'account.day.book',
+ 'landscape': 1,
+ 'daybook_pdf_report': true
+ },
+ 'display_name': 'Day Book',
+ };
+
+ return self.do_action(action);
+ });
+ },
+
+ print_xlsx: function() {
+ var self = this;
+ self._rpc({
+ model: 'account.day.book',
+ method: 'view_report',
+ args: [
+ [self.wizard_id]
+ ],
+ }).then(function(data) {
+
+ var action = {
+ 'type': 'ir_actions_dynamic_xlsx_download',
+ 'data': {
+ 'model': 'account.day.book',
+ 'options': JSON.stringify(data['filters']),
+ 'output_format': 'xlsx',
+ 'report_data': JSON.stringify(data['report_lines']),
+ 'report_name': 'Day Book',
+ 'dfr_data': JSON.stringify(data),
+ },
+ };
+ return self.do_action(action);
+ });
+ },
+
+ create_lines_with_style: function(rec, attr, datas) {
+
+ var temp_str = "";
+ var style_name = "border-bottom: 1px solid #e6e6e6;";
+ var attr_name = attr + " style="+style_name;
+ temp_str += "<td class='child_col1' "+attr_name+" >"+rec['code'] +rec['name'] +"</td>";
+ if(datas.currency[1]=='after'){
+ temp_str += "<td class='child_col2' "+attr_name+" >"+rec['debit'].toFixed(2)+datas.currency[0]+"</td>";
+ temp_str += "<td class='child_col3' "+attr_name+" >"+rec['credit'].toFixed(2) +datas.currency[0]+ "</td>";
+ }
+ else{
+ temp_str += "<td class='child_col2' "+attr_name+" >"+datas.currency[0]+rec['debit'].toFixed(2) + "</td>";
+ temp_str += "<td class='child_col3' "+attr_name+">"+datas.currency[0]+rec['credit'].toFixed(2) + "</td>";
+ }
+ return temp_str;
+ },
+
+
+ journal_line_click: function (el){
+ click_num++;
+ var self = this;
+ var line = $(el.target).parent().data('id');
+ return self.do_action({
+ type: 'ir.actions.act_window',
+ view_type: 'form',
+ view_mode: 'form',
+ res_model: 'account.move',
+ views: [
+ [false, 'form']
+ ],
+ res_id: line,
+ target: 'current',
+ });
+
+ },
+
+ show_drop_down: function(event) {
+ event.preventDefault();
+ var self = this;
+ var account_id = $(event.currentTarget).data('account-id');
+ var offset = 0;
+ var td = $(event.currentTarget).next('tr').find('td');
+ if (td.length == 1) {
+
+ self._rpc({
+ model: 'account.day.book',
+ method: 'view_report',
+ args: [
+ [self.wizard_id]
+ ],
+ }).then(function(data) {
+ _.each(data['report_lines'], function(rep_lines) {
+ _.each(rep_lines['child_lines'], function(move_line) {
+
+ move_line.debit = self.format_currency(data['currency'],move_line.debit);
+ move_line.credit = self.format_currency(data['currency'],move_line.credit);
+ move_line.balance = self.format_currency(data['currency'],move_line.balance);
+
+
+ });
+ });
+ for (var i = 0; i < data['report_lines'].length; i++) {
+
+ if (account_id == data['report_lines'][i]['id'] ){
+ $(event.currentTarget).next('tr').find('td .db-table-div').remove();
+ $(event.currentTarget).next('tr').find('td ul').after(
+ QWeb.render('SubSectiondb', {
+
+ account_data: data['report_lines'][i]['child_lines'],
+ currency_symbol : data.currency[0],
+ currency_position : data.currency[1],
+ }))
+
+ $(event.currentTarget).next('tr').find('td ul li:first a').css({
+ 'background-color': '#00ede8',
+ 'font-weight': 'bold',
+ });
+ }
+ }
+
+ });
+ }
+ },
+
+ view_acc_move: function(event) {
+
+ event.preventDefault();
+ var self = this;
+ var context = {};
+ var show_acc_move = function(res_model, res_id, view_id) {
+ var action = {
+ type: 'ir.actions.act_window',
+ view_type: 'form',
+ view_mode: 'form',
+ res_model: res_model,
+ views: [
+ [view_id || false, 'form']
+ ],
+ res_id: res_id,
+ target: 'current',
+ context: context,
+ };
+ return self.do_action(action);
+ };
+ rpc.query({
+ model: 'account.move',
+ method: 'search_read',
+ domain: [
+ ['id', '=', $(event.currentTarget).data('move-id')]
+ ],
+ fields: ['id'],
+ limit: 1,
+ })
+ .then(function(record) {
+
+ if (record.length > 0) {
+ show_acc_move('account.move', record[0].id);
+ } else {
+ show_acc_move('account.move', $(event.currentTarget).data('move-id'));
+ }
+ });
+ },
+
+
+ apply_filter: function(event) {
+
+ event.preventDefault();
+ var self = this;
+ self.initial_render = false;
+
+ var filter_data_selected = {};
+
+
+ var account_ids = [];
+ var account_text = [];
+
+ var account_res = document.getElementById("acc_res")
+
+ var account_list = $(".account").select2('data')
+ for (var i = 0; i < account_list.length; i++) {
+ if(account_list[i].element[0].selected === true){
+
+ account_ids.push(parseInt(account_list[i].id))
+ if(account_text.includes(account_list[i].text) === false){
+ account_text.push(account_list[i].text)
+ }
+ account_res.value = account_text
+ account_res.innerHTML=account_res.value;
+ }
+ }
+ if (account_list.length == 0){
+ account_res.value = ""
+ account_res.innerHTML="";
+
+ }
+
+ filter_data_selected.account_ids = account_ids
+
+
+
+ var journal_ids = [];
+ var journal_text = [];
+ var journal_res = document.getElementById("journal_res")
+ var journal_list = $(".journals").select2('data')
+ for (var i = 0; i < journal_list.length; i++) {
+ if(journal_list[i].element[0].selected === true){
+
+ journal_ids.push(parseInt(journal_list[i].id))
+ if(journal_text.includes(journal_list[i].text) === false){
+ journal_text.push(journal_list[i].text)
+ }
+ journal_res.value = journal_text
+ journal_res.innerHTML=journal_res.value;
+ }
+ }
+ if (journal_list.length == 0){
+ journal_res.value = ""
+ journal_res.innerHTML="";
+
+ }
+ filter_data_selected.journal_ids = journal_ids
+
+ if ($("#date_from").val()) {
+ var dateString = $("#date_from").val();
+
+ filter_data_selected.date_from = dateString;
+ }
+ if ($("#date_to").val()) {
+ var dateString = $("#date_to").val();
+ filter_data_selected.date_to = dateString;
+ }
+
+ if ($(".target_move").length) {
+
+ var post_res = document.getElementById("post_res")
+ filter_data_selected.target_move = $(".target_move")[1].value
+ post_res.value = $(".target_move")[1].value
+ post_res.innerHTML=post_res.value;
+ if ($(".target_move")[1].value == "") {
+ post_res.innerHTML="posted";
+
+ }
+ }
+
+ rpc.query({
+ model: 'account.day.book',
+ method: 'write',
+ args: [
+ self.wizard_id, filter_data_selected
+ ],
+ }).then(function(res) {
+ self.initial_render = false;
+ self.load_data(self.initial_render);
+ });
+ },
+
+ });
+ core.action_registry.add("d_b", DayBook);
+ return DayBook;
+});
diff --git a/dynamic_accounts_report/static/src/js/financial_reports.js b/dynamic_accounts_report/static/src/js/financial_reports.js
new file mode 100644
index 0000000..5d79f25
--- /dev/null
+++ b/dynamic_accounts_report/static/src/js/financial_reports.js
@@ -0,0 +1,357 @@
+odoo.define('dynamic_accounts_report.financial_reports', function (require) {
+ 'use strict';
+ var AbstractAction = require('web.AbstractAction');
+ var core = require('web.core');
+ var field_utils = require('web.field_utils');
+ var rpc = require('web.rpc');
+ var session = require('web.session');
+ var utils = require('web.utils');
+ var QWeb = core.qweb;
+ var _t = core._t;
+
+ window.click_num = 0;
+ var ProfitAndLoss = AbstractAction.extend({
+ template: 'dfr_template_new',
+ events: {
+ 'click .parent-line': 'journal_line_click',
+ 'click .child_col1': 'journal_line_click',
+ 'click #apply_filter': 'apply_filter',
+ 'click #pdf': 'print_pdf',
+ 'click #xlsx': 'print_xlsx',
+ 'click .show-gl': 'show_gl',
+ },
+
+ init: function(parent, action) {
+ this._super(parent, action);
+ this.currency=action.currency;
+ this.report_lines = action.report_lines;
+ this.wizard_id = action.context.wizard | null;
+ },
+ start: function() {
+ var self = this;
+ self.initial_render = true;
+ rpc.query({
+ model: 'dynamic.balance.sheet.report',
+ method: 'create',
+ args: [{
+ }]
+ }).then(function(t_res) {
+ self.wizard_id = t_res;
+ self.load_data(self.initial_render);
+ })
+ },
+
+ load_data: function (initial_render = true) {
+ var self = this;
+ var action_title = self._title;
+ self.$(".categ").empty();
+ try{
+ var self = this;
+ self._rpc({
+ model: 'dynamic.balance.sheet.report',
+ method: 'view_report',
+ args: [[this.wizard_id], action_title],
+ }).then(function(datas) {
+
+ if (initial_render) {
+ self.$('.filter_view_dfr').html(QWeb.render('DfrFilterView', {
+ filter_data: datas['filters'],
+ title : datas['name'],
+ }));
+ self.$el.find('.journals').select2({
+ placeholder: ' Journals...',
+ });
+ self.$el.find('.account').select2({
+ placeholder: ' Accounts...',
+ });
+ self.$el.find('.account-tag').select2({
+ placeholder: 'Account Tag...',
+ });
+ self.$el.find('.analytics').select2({
+ placeholder: 'Analytic Accounts...',
+ });
+ self.$el.find('.analytic-tag').select2({
+ placeholder: 'Analytic Tag...',
+ });
+ self.$el.find('.target_move').select2({
+ placeholder: 'Target Move...',
+ });
+
+ }
+ var child=[];
+ self.$('.table_view_dfr').html(QWeb.render('dfr_table', {
+
+ report_lines : datas['report_lines'],
+ filter : datas['filters'],
+ currency : datas['currency'],
+ credit_total : datas['credit_total'],
+ debit_total : datas['debit_total'],
+ debit_balance : datas['debit_balance'],
+ bs_lines : datas['bs_lines'],
+ }));
+ });
+ }
+ catch (el) {
+ window.location.href
+ }
+ },
+
+ format_currency: function(currency, amount) {
+ if (typeof(amount) != 'number') {
+ amount = parseFloat(amount);
+ }
+ var formatted_value = (parseInt(amount)).toLocaleString(currency[2],{
+ minimumFractionDigits: 2
+ })
+ return formatted_value
+ },
+
+ show_gl: function(e) {
+ var self = this;
+ var account_id = $(e.target).attr('data-account-id');
+ var options = {
+ account_ids: [account_id],
+ }
+ var action = {
+ type: 'ir.actions.client',
+ name: 'GL View',
+ tag: 'g_l',
+ target: 'new',
+ domain: [['account_ids','=', account_id]],
+
+ }
+ return this.do_action(action);
+ },
+
+ print_pdf: function(e) {
+ e.preventDefault();
+ var self = this;
+ var action_title = self._title;
+ self._rpc({
+ model: 'dynamic.balance.sheet.report',
+ method: 'view_report',
+ args: [
+ [self.wizard_id], action_title
+ ],
+ }).then(function(data) {
+ var action = {
+ 'type': 'ir.actions.report',
+ 'report_type': 'qweb-pdf',
+ 'report_name': 'dynamic_accounts_report.balance_sheet',
+ 'report_file': 'dynamic_accounts_report.balance_sheet',
+ 'data': {
+ 'report_data': data,
+ 'report_name': action_title
+ },
+ 'context': {
+ 'active_model': 'dynamic.balance.sheet.report',
+ 'landscape': 1,
+ 'bs_report': true
+ },
+ 'display_name': action_title,
+ };
+ return self.do_action(action);
+ });
+ },
+
+ print_xlsx: function() {
+ var self = this;
+ var action_title = self._title;
+ self._rpc({
+ model: 'dynamic.balance.sheet.report',
+ method: 'view_report',
+ args: [
+ [self.wizard_id], action_title
+ ],
+ }).then(function(data) {
+ var action = {
+ 'type': 'ir_actions_dynamic_xlsx_download',
+ 'data': {
+ 'model': 'dynamic.balance.sheet.report',
+ 'options': JSON.stringify(data['filters']),
+ 'output_format': 'xlsx',
+ 'report_data': action_title,
+ 'report_name': action_title,
+ 'dfr_data': JSON.stringify(data['bs_lines']),
+ },
+ };
+ return self.do_action(action);
+ });
+ },
+
+ journal_line_click: function (el){
+ click_num++;
+ var self = this;
+ var line = $(el.target).parent().data('id');
+ return self.do_action({
+ type: 'ir.actions.act_window',
+ view_type: 'form',
+ view_mode: 'form',
+ res_model: 'account.move',
+ views: [
+ [false, 'form']
+ ],
+ res_id: line,
+ target: 'current',
+ });
+
+ },
+
+ apply_filter: function(event) {
+
+ event.preventDefault();
+ var self = this;
+ self.initial_render = false;
+ var filter_data_selected = {};
+ var account_ids = [];
+ var account_text = [];
+ var account_res = document.getElementById("acc_res")
+ var account_list = $(".account").select2('data')
+ for (var i = 0; i < account_list.length; i++) {
+ if(account_list[i].element[0].selected === true){
+
+ account_ids.push(parseInt(account_list[i].id))
+ if(account_text.includes(account_list[i].text) === false){
+ account_text.push(account_list[i].text)
+ }
+ account_res.value = account_text
+ account_res.innerHTML=account_res.value;
+ }
+ }
+ if (account_list.length == 0){
+ account_res.value = ""
+ account_res.innerHTML="";
+
+ }
+ filter_data_selected.account_ids = account_ids
+
+
+ var journal_ids = [];
+ var journal_text = [];
+ var journal_res = document.getElementById("journal_res")
+ var journal_list = $(".journals").select2('data')
+ for (var i = 0; i < journal_list.length; i++) {
+ if(journal_list[i].element[0].selected === true){
+
+ journal_ids.push(parseInt(journal_list[i].id))
+ if(journal_text.includes(journal_list[i].text) === false){
+ journal_text.push(journal_list[i].text)
+ }
+ journal_res.value = journal_text
+ journal_res.innerHTML=journal_res.value;
+ }
+ }
+ if (journal_list.length == 0){
+ journal_res.value = ""
+ journal_res.innerHTML="";
+
+ }
+ filter_data_selected.journal_ids = journal_ids
+
+ var account_tag_ids = [];
+ var account_tag_text = [];
+ var account_tag_res = document.getElementById("acc_tag_res")
+
+ var account_tag_list = $(".account-tag").select2('data')
+ for (var i = 0; i < account_tag_list.length; i++) {
+ if(account_tag_list[i].element[0].selected === true){
+
+ account_tag_ids.push(parseInt(account_tag_list[i].id))
+ if(account_tag_text.includes(account_tag_list[i].text) === false){
+ account_tag_text.push(account_tag_list[i].text)
+ }
+
+ account_tag_res.value = account_tag_text
+ account_tag_res.innerHTML=account_tag_res.value;
+ }
+ }
+ if (account_tag_list.length == 0){
+ account_tag_res.value = ""
+ account_tag_res.innerHTML="";
+
+ }
+ filter_data_selected.account_tag_ids = account_tag_ids
+
+ var analytic_ids = []
+ var analytic_text = [];
+ var analytic_res = document.getElementById("analytic_res")
+ var analytic_list = $(".analytics").select2('data')
+
+ for (var i = 0; i < analytic_list.length; i++) {
+ if(analytic_list[i].element[0].selected === true){
+
+ analytic_ids.push(parseInt(analytic_list[i].id))
+ if(analytic_text.includes(analytic_list[i].text) === false){
+ analytic_text.push(analytic_list[i].text)
+ }
+ analytic_res.value = analytic_text
+ analytic_res.innerHTML=analytic_res.value;
+ }
+ }
+ if (analytic_list.length == 0){
+ analytic_res.value = ""
+ analytic_res.innerHTML="";
+
+ }
+ filter_data_selected.analytic_ids = analytic_ids
+
+ var analytic_tag_ids = [];
+ var analytic_tag_text = [];
+ var analytic_tag_res = document.getElementById("analic_tag_res")
+ var analytic_tag_list = $(".analytic-tag").select2('data')
+ for (var i = 0; i < analytic_tag_list.length; i++) {
+ if(analytic_tag_list[i].element[0].selected === true){
+
+ analytic_tag_ids.push(parseInt(analytic_tag_list[i].id))
+ if(analytic_tag_text.includes(analytic_tag_list[i].text) === false){
+ analytic_tag_text.push(analytic_tag_list[i].text)
+
+ }
+
+ analytic_tag_res.value = analytic_tag_text
+ analytic_tag_res.innerHTML=analytic_tag_res.value;
+ }
+ }
+ if (analytic_tag_list.length == 0){
+ analytic_tag_res.value = ""
+ analytic_tag_res.innerHTML="";
+
+ }
+ filter_data_selected.analytic_tag_ids = analytic_tag_ids
+
+
+ if ($("#date_from").val()) {
+ var dateString = $("#date_from").val();
+ filter_data_selected.date_from = dateString;
+ }
+ if ($("#date_to").val()) {
+ var dateString = $("#date_to").val();
+ filter_data_selected.date_to = dateString;
+ }
+
+ if ($(".target_move").length) {
+ var post_res = document.getElementById("post_res")
+ filter_data_selected.target_move = $(".target_move")[1].value
+ post_res.value = $(".target_move")[1].value
+ post_res.innerHTML=post_res.value;
+ if ($(".target_move")[1].value == "") {
+ post_res.innerHTML="posted";
+
+ }
+ }
+ rpc.query({
+ model: 'dynamic.balance.sheet.report',
+ method: 'write',
+ args: [
+ self.wizard_id, filter_data_selected
+ ],
+ }).then(function(res) {
+ self.initial_render = false;
+ self.load_data(self.initial_render);
+ });
+ },
+
+ });
+ core.action_registry.add("dfr_n", ProfitAndLoss);
+ return ProfitAndLoss;
+});
diff --git a/dynamic_accounts_report/static/src/js/general_ledger.js b/dynamic_accounts_report/static/src/js/general_ledger.js
new file mode 100644
index 0000000..b719a3e
--- /dev/null
+++ b/dynamic_accounts_report/static/src/js/general_ledger.js
@@ -0,0 +1,453 @@
+odoo.define('dynamic_cash_flow_statements.general_ledger', function (require) {
+ 'use strict';
+ var AbstractAction = require('web.AbstractAction');
+ var core = require('web.core');
+ var field_utils = require('web.field_utils');
+ var rpc = require('web.rpc');
+ var session = require('web.session');
+ var utils = require('web.utils');
+ var QWeb = core.qweb;
+ var _t = core._t;
+
+ window.click_num = 0;
+ var GeneralLedger = AbstractAction.extend({
+ template: 'GeneralTemp',
+ events: {
+ 'click .parent-line': 'journal_line_click',
+ 'click .child_col1': 'journal_line_click',
+ 'click #apply_filter': 'apply_filter',
+ 'click #pdf': 'print_pdf',
+ 'click #xlsx': 'print_xlsx',
+ 'click .gl-line': 'show_drop_down',
+ 'click .view-account-move': 'view_acc_move',
+ },
+
+ init: function(parent, action) {
+ this._super(parent, action);
+ this.currency=action.currency;
+ this.report_lines = action.report_lines;
+ this.wizard_id = action.context.wizard | null;
+ },
+
+
+ start: function() {
+ var self = this;
+ self.initial_render = true;
+ if (this.searchModel.config.domain.length != 0) {
+ rpc.query({
+ model: 'account.general.ledger',
+ method: 'create',
+ args: [{
+ account_ids : [this.searchModel.config.domain[0][2]]
+ }]
+ }).then(function(t_res) {
+ self.wizard_id = t_res;
+ self.load_data(self.initial_render);
+ })
+ }else{
+ rpc.query({
+ model: 'account.general.ledger',
+ method: 'create',
+ args: [{
+
+ }]
+ }).then(function(t_res) {
+ self.wizard_id = t_res;
+ self.load_data(self.initial_render);
+ })
+ }
+ },
+
+
+ load_data: function (initial_render = true) {
+ var self = this;
+ self.$(".categ").empty();
+ try{
+ var self = this;
+ var action_title = self._title
+ self._rpc({
+ model: 'account.general.ledger',
+ method: 'view_report',
+ args: [[this.wizard_id], action_title],
+ }).then(function(datas) {
+ _.each(datas['report_lines'], function(rep_lines) {
+ rep_lines.debit = self.format_currency(datas['currency'],rep_lines.debit);
+ rep_lines.credit = self.format_currency(datas['currency'],rep_lines.credit);
+ rep_lines.balance = self.format_currency(datas['currency'],rep_lines.balance);
+
+
+
+
+ });
+
+ if (initial_render) {
+ self.$('.filter_view_tb').html(QWeb.render('GLFilterView', {
+ filter_data: datas['filters'],
+ title : datas['name'],
+ }));
+ self.$el.find('.journals').select2({
+ placeholder: ' Journals...',
+ });
+ self.$el.find('.account').select2({
+ placeholder: ' Accounts...',
+ });
+ self.$el.find('.analytics').select2({
+ placeholder: 'Analytic Accounts...',
+ });
+ self.$el.find('.analytic_tags').select2({
+ placeholder: 'Analytic Tags...',
+ });
+ self.$el.find('.target_move').select2({
+ placeholder: 'Target Move...',
+ });
+
+ }
+ var child=[];
+
+ self.$('.table_view_tb').html(QWeb.render('GLTable', {
+
+ report_lines : datas['report_lines'],
+ filter : datas['filters'],
+ currency : datas['currency'],
+ credit_total : datas['credit_total'],
+ debit_total : datas['debit_total'],
+ debit_balance : datas['debit_balance']
+ }));
+
+ });
+
+ }
+ catch (el) {
+ window.location.href
+ }
+ },
+
+ print_pdf: function(e) {
+ e.preventDefault();
+ var self = this;
+ var action_title = self._title
+ self._rpc({
+ model: 'account.general.ledger',
+ method: 'view_report',
+ args: [
+ [self.wizard_id], action_title
+ ],
+ }).then(function(data) {
+ var action = {
+ 'type': 'ir.actions.report',
+ 'report_type': 'qweb-pdf',
+ 'report_name': 'dynamic_accounts_report.general_ledger',
+ 'report_file': 'dynamic_accounts_report.general_ledger',
+ 'data': {
+ 'report_data': data
+ },
+ 'context': {
+ 'active_model': 'account.general.ledger',
+ 'landscape': 1,
+ 'trial_pdf_report': true
+ },
+ 'display_name': action_title,
+ };
+ return self.do_action(action);
+ });
+ },
+
+ print_xlsx: function() {
+ var self = this;
+ var action_title = self._title
+ self._rpc({
+ model: 'account.general.ledger',
+ method: 'view_report',
+ args: [
+ [self.wizard_id], action_title
+ ],
+ }).then(function(data) {
+ var action = {
+ 'type': 'ir_actions_dynamic_xlsx_download',
+ 'data': {
+ 'model': 'account.general.ledger',
+ 'options': JSON.stringify(data['filters']),
+ 'output_format': 'xlsx',
+ 'report_data': JSON.stringify(data['report_lines']),
+ 'report_name': action_title,
+ 'dfr_data': JSON.stringify(data),
+ },
+ };
+ return self.do_action(action);
+ });
+ },
+
+
+
+
+
+ create_lines_with_style: function(rec, attr, datas) {
+ var temp_str = "";
+ var style_name = "border-bottom: 1px solid #e6e6e6;";
+ var attr_name = attr + " style="+style_name;
+
+ temp_str += "<td class='child_col1' "+attr_name+" >"+rec['code'] +rec['name'] +"</td>";
+ if(datas.currency[1]=='after'){
+ temp_str += "<td class='child_col2' "+attr_name+" >"+rec['debit'].toFixed(2)+datas.currency[0]+"</td>";
+ temp_str += "<td class='child_col3' "+attr_name+" >"+rec['credit'].toFixed(2) +datas.currency[0]+ "</td>";
+ }
+ else{
+ temp_str += "<td class='child_col2' "+attr_name+" >"+datas.currency[0]+rec['debit'].toFixed(2) + "</td>";
+ temp_str += "<td class='child_col3' "+attr_name+">"+datas.currency[0]+rec['credit'].toFixed(2) + "</td>";
+
+ }
+ return temp_str;
+ },
+
+
+ journal_line_click: function (el){
+ click_num++;
+ var self = this;
+ var line = $(el.target).parent().data('id');
+ return self.do_action({
+ type: 'ir.actions.act_window',
+ view_type: 'form',
+ view_mode: 'form',
+ res_model: 'account.move',
+ views: [
+ [false, 'form']
+ ],
+ res_id: line,
+ target: 'current',
+ });
+
+ },
+ format_currency: function(currency, amount) {
+ if (typeof(amount) != 'number') {
+ amount = parseFloat(amount);
+ }
+ var formatted_value = (parseInt(amount)).toLocaleString(currency[2],{
+ minimumFractionDigits: 2
+ })
+ return formatted_value
+ },
+
+ show_drop_down: function(event) {
+ event.preventDefault();
+ var self = this;
+ var account_id = $(event.currentTarget).data('account-id');
+ var offset = 0;
+ var td = $(event.currentTarget).next('tr').find('td');
+ if (td.length == 1) {
+ var action_title = self._title
+ self._rpc({
+ model: 'account.general.ledger',
+ method: 'view_report',
+ args: [
+ [self.wizard_id], action_title
+ ],
+ }).then(function(data) {
+ _.each(data['report_lines'], function(rep_lines) {
+ _.each(rep_lines['move_lines'], function(move_line) {
+
+ move_line.debit = self.format_currency(data['currency'],move_line.debit);
+ move_line.credit = self.format_currency(data['currency'],move_line.credit);
+ move_line.balance = self.format_currency(data['currency'],move_line.balance);
+
+
+ });
+ });
+
+ for (var i = 0; i < data['report_lines'].length; i++) {
+
+ if (account_id == data['report_lines'][i]['id'] ){
+
+ $(event.currentTarget).next('tr').find('td .gl-table-div').remove();
+ $(event.currentTarget).next('tr').find('td ul').after(
+ QWeb.render('SubSection', {
+ account_data: data['report_lines'][i]['move_lines'],
+ currency_symbol : data.currency[0],
+ currency_position : data.currency[1],
+
+ }))
+ $(event.currentTarget).next('tr').find('td ul li:first a').css({
+ 'background-color': '#00ede8',
+ 'font-weight': 'bold',
+ });
+ }
+ }
+
+ });
+ }
+ },
+
+ view_acc_move: function(event) {
+ event.preventDefault();
+ var self = this;
+ var context = {};
+ var show_acc_move = function(res_model, res_id, view_id) {
+ var action = {
+ type: 'ir.actions.act_window',
+ view_type: 'form',
+ view_mode: 'form',
+ res_model: res_model,
+ views: [
+ [view_id || false, 'form']
+ ],
+ res_id: res_id,
+ target: 'current',
+ context: context,
+ };
+ return self.do_action(action);
+ };
+ rpc.query({
+ model: 'account.move',
+ method: 'search_read',
+ domain: [
+ ['id', '=', $(event.currentTarget).data('move-id')]
+ ],
+ fields: ['id'],
+ limit: 1,
+ })
+ .then(function(record) {
+ if (record.length > 0) {
+ show_acc_move('account.move', record[0].id);
+ } else {
+ show_acc_move('account.move', $(event.currentTarget).data('move-id'));
+ }
+ });
+ },
+
+ apply_filter: function(event) {
+
+ event.preventDefault();
+ var self = this;
+ self.initial_render = false;
+
+ var filter_data_selected = {};
+
+
+ var account_ids = [];
+ var account_text = [];
+
+ var account_res = document.getElementById("acc_res")
+ var account_list = $(".account").select2('data')
+ for (var i = 0; i < account_list.length; i++) {
+ if(account_list[i].element[0].selected === true){
+
+ account_ids.push(parseInt(account_list[i].id))
+ if(account_text.includes(account_list[i].text) === false){
+ account_text.push(account_list[i].text)
+ }
+ account_res.value = account_text
+ account_res.innerHTML=account_res.value;
+ }
+ }
+ if (account_list.length == 0){
+ account_res.value = ""
+ account_res.innerHTML="";
+
+ }
+ filter_data_selected.account_ids = account_ids
+
+
+
+ var journal_ids = [];
+ var journal_text = [];
+ var journal_res = document.getElementById("journal_res")
+ var journal_list = $(".journals").select2('data')
+
+ for (var i = 0; i < journal_list.length; i++) {
+ if(journal_list[i].element[0].selected === true){
+
+ journal_ids.push(parseInt(journal_list[i].id))
+ if(journal_text.includes(journal_list[i].text) === false){
+ journal_text.push(journal_list[i].text)
+ }
+ journal_res.value = journal_text
+ journal_res.innerHTML=journal_res.value;
+ }
+ }
+ if (journal_list.length == 0){
+ journal_res.value = ""
+ journal_res.innerHTML="";
+
+ }
+ filter_data_selected.journal_ids = journal_ids
+
+ var analytic_ids = []
+ var analytic_text = [];
+ var analytic_res = document.getElementById("analytic_res")
+ var analytic_list = $(".analytics").select2('data')
+
+ for (var i = 0; i < analytic_list.length; i++) {
+ if(analytic_list[i].element[0].selected === true){
+
+ analytic_ids.push(parseInt(analytic_list[i].id))
+ if(analytic_text.includes(analytic_list[i].text) === false){
+ analytic_text.push(analytic_list[i].text)
+ }
+ analytic_res.value = analytic_text
+ analytic_res.innerHTML=analytic_res.value;
+ }
+ }
+ if (analytic_list.length == 0){
+ analytic_res.value = ""
+ analytic_res.innerHTML="";
+
+ }
+ filter_data_selected.analytic_ids = analytic_ids
+
+ var analytic_tag_ids = []
+ var analytic_tag_text = [];
+ var analytic_tag_res = document.getElementById("analytic_tag_res")
+ var analytic_tag_list = $(".analytic_tags").select2('data')
+ for (var i = 0; i < analytic_tag_list.length; i++) {
+ if(analytic_tag_list[i].element[0].selected === true){
+
+ analytic_tag_ids.push(parseInt(analytic_tag_list[i].id))
+ if(analytic_tag_text.includes(analytic_tag_list[i].text) === false){
+ analytic_tag_text.push(analytic_tag_list[i].text)
+ }
+ analytic_tag_res.value = analytic_tag_text
+ analytic_tag_res.innerHTML=analytic_tag_res.value;
+ }
+ }
+ if (analytic_tag_list.length == 0){
+ analytic_tag_res.value = ""
+ analytic_tag_res.innerHTML="";
+
+ }
+ filter_data_selected.analytic_tag_ids = analytic_tag_ids
+
+ if ($("#date_from").val()) {
+
+ var dateString = $("#date_from").val();
+ filter_data_selected.date_from = dateString;
+ }
+ if ($("#date_to").val()) {
+ var dateString = $("#date_to").val();
+ filter_data_selected.date_to = dateString;
+ }
+
+ if ($(".target_move").length) {
+ var post_res = document.getElementById("post_res")
+ filter_data_selected.target_move = $(".target_move")[1].value
+ post_res.value = $(".target_move")[1].value
+ post_res.innerHTML=post_res.value;
+ if ($(".target_move")[1].value == "") {
+ post_res.innerHTML="posted";
+
+ }
+ }
+ rpc.query({
+ model: 'account.general.ledger',
+ method: 'write',
+ args: [
+ self.wizard_id, filter_data_selected
+ ],
+ }).then(function(res) {
+ self.initial_render = false;
+ self.load_data(self.initial_render);
+ });
+ },
+
+ });
+ core.action_registry.add("g_l", GeneralLedger);
+ return GeneralLedger;
+}); \ No newline at end of file
diff --git a/dynamic_accounts_report/static/src/js/partner_ledger.js b/dynamic_accounts_report/static/src/js/partner_ledger.js
new file mode 100644
index 0000000..ba78c48
--- /dev/null
+++ b/dynamic_accounts_report/static/src/js/partner_ledger.js
@@ -0,0 +1,431 @@
+odoo.define('dynamic_accounts_report.partner_ledger', function (require) {
+ 'use strict';
+ var AbstractAction = require('web.AbstractAction');
+ var core = require('web.core');
+ var field_utils = require('web.field_utils');
+ var rpc = require('web.rpc');
+ var session = require('web.session');
+ var utils = require('web.utils');
+ var QWeb = core.qweb;
+ var _t = core._t;
+
+ window.click_num = 0;
+ var PartnerLedger = AbstractAction.extend({
+ template: 'PartnerTemp',
+ events: {
+ 'click .parent-line': 'journal_line_click',
+ 'click .child_col1': 'journal_line_click',
+ 'click #apply_filter': 'apply_filter',
+ 'click #pdf': 'print_pdf',
+ 'click #xlsx': 'print_xlsx',
+ 'click .pl-line': 'show_drop_down',
+ 'click .view-account-move': 'view_acc_move',
+
+ },
+
+ init: function(parent, action) {
+ this._super(parent, action);
+ this.currency=action.currency;
+ this.report_lines = action.report_lines;
+ this.wizard_id = action.context.wizard | null;
+ },
+
+ start: function() {
+ var self = this;
+ self.initial_render = true;
+ rpc.query({
+ model: 'account.partner.ledger',
+ method: 'create',
+ args: [{
+ }]
+ }).then(function(t_res) {
+ self.wizard_id = t_res;
+ self.load_data(self.initial_render);
+ })
+ },
+
+ load_data: function (initial_render = true) {
+ var self = this;
+ self.$(".categ").empty();
+ try{
+ var self = this;
+ self._rpc({
+ model: 'account.partner.ledger',
+ method: 'view_report',
+ args: [[this.wizard_id]],
+ }).then(function(datas) {
+ _.each(datas['report_lines'], function(rep_lines) {
+ rep_lines.debit = self.format_currency(datas['currency'],rep_lines.debit);
+ rep_lines.credit = self.format_currency(datas['currency'],rep_lines.credit);
+ rep_lines.balance = self.format_currency(datas['currency'],rep_lines.balance);
+
+
+
+
+ });
+
+
+
+ if (initial_render) {
+ self.$('.filter_view_tb').html(QWeb.render('PLFilterView', {
+ filter_data: datas['filters'],
+ }));
+ self.$el.find('.journals').select2({
+ placeholder: ' Journals...',
+ });
+
+ self.$el.find('.account').select2({
+ placeholder: ' Accounts...',
+ });
+ self.$el.find('.partners').select2({
+ placeholder: 'Partners...',
+ });
+ self.$el.find('.reconciled').select2({
+ placeholder: 'Reconciled status...',
+ });
+ self.$el.find('.type').select2({
+ placeholder: 'Account Type...',
+ });
+ self.$el.find('.category').select2({
+ placeholder: 'Partner Tag...',
+ });
+ self.$el.find('.acc').select2({
+ placeholder: 'Select Acc...',
+ });
+ self.$el.find('.target_move').select2({
+ placeholder: 'Target Move...',
+ });
+ }
+ var child=[];
+
+ self.$('.table_view_tb').html(QWeb.render('PLTable', {
+ report_lines : datas['report_lines'],
+ filter : datas['filters'],
+ currency : datas['currency'],
+ credit_total : datas['credit_total'],
+ debit_total : datas['debit_total'],
+ debit_balance : datas['debit_balance']
+ }));
+ });
+
+ }
+ catch (el) {
+ window.location.href
+ }
+ },
+
+
+
+ format_currency: function(currency, amount) {
+ if (typeof(amount) != 'number') {
+ amount = parseFloat(amount);
+ }
+ var formatted_value = (parseInt(amount)).toLocaleString(currency[2],{
+ minimumFractionDigits: 2
+ })
+ return formatted_value
+ },
+
+ print_pdf: function(e) {
+ e.preventDefault();
+ var self = this;
+ self._rpc({
+ model: 'account.partner.ledger',
+ method: 'view_report',
+ args: [
+ [self.wizard_id]
+ ],
+ }).then(function(data) {
+ var action = {
+ 'type': 'ir.actions.report',
+ 'report_type': 'qweb-pdf',
+ 'report_name': 'dynamic_accounts_report.partner_ledger',
+ 'report_file': 'dynamic_accounts_report.partner_ledger',
+ 'data': {
+ 'report_data': data
+ },
+ 'context': {
+ 'active_model': 'account.partner.ledger',
+ 'landscape': 1,
+ 'partner_ledger_pdf_report': true
+ },
+ 'display_name': 'Partner Ledger',
+ };
+ return self.do_action(action);
+ });
+ },
+
+
+
+ print_xlsx: function() {
+ var self = this;
+ self._rpc({
+ model: 'account.partner.ledger',
+ method: 'view_report',
+ args: [
+ [self.wizard_id]
+ ],
+ }).then(function(data) {
+ var action = {
+ 'type': 'ir_actions_dynamic_xlsx_download',
+ 'data': {
+ 'model': 'account.partner.ledger',
+ 'options': JSON.stringify(data['filters']),
+ 'output_format': 'xlsx',
+ 'report_data': JSON.stringify(data['report_lines']),
+ 'report_name': 'Partner Ledger',
+ 'dfr_data': JSON.stringify(data),
+ },
+ };
+ return self.do_action(action);
+ });
+ },
+
+ journal_line_click: function (el){
+ click_num++;
+ var self = this;
+ var line = $(el.target).parent().data('id');
+ return self.do_action({
+ type: 'ir.actions.act_window',
+ view_type: 'form',
+ view_mode: 'form',
+ res_model: 'account.move',
+ views: [
+ [false, 'form']
+ ],
+ res_id: line,
+ target: 'current',
+ });
+ },
+
+ show_drop_down: function(event) {
+ event.preventDefault();
+ var self = this;
+ var account_id = $(event.currentTarget).data('account-id');
+ var offset = 0;
+ var td = $(event.currentTarget).next('tr').find('td');
+ if (td.length == 1) {
+ self._rpc({
+ model: 'account.partner.ledger',
+ method: 'view_report',
+ args: [
+ [self.wizard_id]
+ ],
+ }).then(function(data) {
+ _.each(data['report_lines'], function(rep_lines) {
+ _.each(rep_lines['move_lines'], function(move_line) {
+
+ move_line.debit = self.format_currency(data['currency'],move_line.debit);
+ move_line.credit = self.format_currency(data['currency'],move_line.credit);
+ move_line.balance = self.format_currency(data['currency'],move_line.balance);
+
+
+ });
+ });
+ for (var i = 0; i < data['report_lines'].length; i++) {
+
+ if (account_id == data['report_lines'][i]['id'] ){
+ $(event.currentTarget).next('tr').find('td .pl-table-div').remove();
+ $(event.currentTarget).next('tr').find('td ul').after(
+ QWeb.render('SubSectionPL', {
+ account_data: data['report_lines'][i]['move_lines'],
+ }))
+ $(event.currentTarget).next('tr').find('td ul li:first a').css({
+ 'background-color': '#00ede8',
+ 'font-weight': 'bold',
+ });
+ }
+ }
+ });
+ }
+ },
+
+ view_acc_move: function(event) {
+ event.preventDefault();
+ var self = this;
+ var context = {};
+ var show_acc_move = function(res_model, res_id, view_id) {
+ var action = {
+ type: 'ir.actions.act_window',
+ view_type: 'form',
+ view_mode: 'form',
+ res_model: res_model,
+ views: [
+ [view_id || false, 'form']
+ ],
+ res_id: res_id,
+ target: 'current',
+ context: context,
+ };
+ return self.do_action(action);
+ };
+ rpc.query({
+ model: 'account.move',
+ method: 'search_read',
+ domain: [
+ ['id', '=', $(event.currentTarget).data('move-id')]
+ ],
+ fields: ['id'],
+ limit: 1,
+ })
+ .then(function(record) {
+ if (record.length > 0) {
+ show_acc_move('account.move', record[0].id);
+ } else {
+ show_acc_move('account.move', $(event.currentTarget).data('move-id'));
+ }
+ });
+ },
+
+ apply_filter: function(event) {
+ event.preventDefault();
+ var self = this;
+ self.initial_render = false;
+ var filter_data_selected = {};
+
+ var account_ids = [];
+ var account_text = [];
+ var span_res = document.getElementById("account_res")
+ var account_list = $(".account").select2('data')
+ for (var i = 0; i < account_list.length; i++) {
+ if(account_list[i].element[0].selected === true)
+ {account_ids.push(parseInt(account_list[i].id))
+ if(account_text.includes(account_list[i].text) === false)
+ {account_text.push(account_list[i].text)
+ }
+ span_res.value = account_text
+ span_res.innerHTML=span_res.value;
+ }
+ }
+ if (account_list.length == 0){
+ span_res.value = ""
+ span_res.innerHTML=""; }
+ filter_data_selected.account_ids = account_ids
+
+
+ var journal_ids = [];
+ var journal_text = [];
+ var journal_res = document.getElementById("journal_res")
+ var journal_list = $(".journals").select2('data')
+ for (var i = 0; i < journal_list.length; i++) {
+ if(journal_list[i].element[0].selected === true){
+ journal_ids.push(parseInt(journal_list[i].id))
+ if(journal_text.includes(journal_list[i].text) === false){
+ journal_text.push(journal_list[i].text)
+ }
+ journal_res.value = journal_text
+ journal_res.innerHTML=journal_res.value;
+ }
+ }
+ if (journal_list.length == 0){
+ journal_res.value = ""
+ journal_res.innerHTML="";
+ }
+ filter_data_selected.journal_ids = journal_ids
+
+ var partner_ids = [];
+ var partner_text = [];
+ var span_res = document.getElementById("partner_res")
+ var partner_list = $(".partners").select2('data')
+ for (var i = 0; i < partner_list.length; i++) {
+ if(partner_list[i].element[0].selected === true)
+ {partner_ids.push(parseInt(partner_list[i].id))
+ if(partner_text.includes(partner_list[i].text) === false)
+ {partner_text.push(partner_list[i].text)
+ }
+ span_res.value = partner_text
+ span_res.innerHTML=span_res.value;
+ }
+ }
+ if (partner_list.length == 0){
+ span_res.value = ""
+ span_res.innerHTML="";
+ }
+ filter_data_selected.partner_ids = partner_ids
+
+ var account_type_ids = [];
+ var account_type_ids_text = [];
+ var span_res = document.getElementById("type_res")
+ var type_list = $(".type").select2('data')
+ for (var i = 0; i < type_list.length; i++) {
+ if(type_list[i].element[0].selected === true)
+ {account_type_ids.push(parseInt(type_list[i].id))
+ if(account_type_ids_text.includes(type_list[i].text) === false)
+ {account_type_ids_text.push(type_list[i].text)
+ }
+ span_res.value = account_type_ids_text
+ span_res.innerHTML=span_res.value;
+ }
+ }
+ if (type_list.length == 0){
+ span_res.value = ""
+ span_res.innerHTML="";
+ }
+ filter_data_selected.account_type_ids = account_type_ids
+
+ var partner_category_ids = [];
+ var partner_category_text = [];
+ var span_res = document.getElementById("category_res")
+ var category_list = $(".category").select2('data')
+ for (var i = 0; i < category_list.length; i++) {
+ if(category_list[i].element[0].selected === true)
+ {partner_category_ids.push(parseInt(category_list[i].id))
+ if(partner_category_text.includes(category_list[i].text) === false)
+ {partner_category_text.push(category_list[i].text)
+ }
+ span_res.value = partner_category_text
+ span_res.innerHTML=span_res.value;
+ }
+ }
+ if (category_list.length == 0){
+ span_res.value = ""
+ span_res.innerHTML="";
+ }
+ filter_data_selected.partner_category_ids = partner_category_ids
+
+ if ($("#date_from").val()) {
+ var dateString = $("#date_from").val();
+ filter_data_selected.date_from = dateString;
+ }
+ if ($("#date_to").val()) {
+ var dateString = $("#date_to").val();
+ filter_data_selected.date_to = dateString;
+ }
+
+ if ($(".reconciled").length){
+ var reconciled_res = document.getElementById("reconciled_res")
+ filter_data_selected.reconciled = $(".reconciled")[0].value
+ reconciled_res.value = $(".reconciled")[0].value
+ reconciled_res.innerHTML=reconciled_res.value;
+ if ($(".reconciled").value==""){
+ reconciled_res.innerHTML="unreconciled";
+ filter_data_selected.reconciled = "unreconciled"
+ }
+ }
+
+ if ($(".target_move").length) {
+ var post_res = document.getElementById("post_res")
+ filter_data_selected.target_move = $(".target_move")[1].value
+ post_res.value = $(".target_move")[1].value
+ post_res.innerHTML=post_res.value;
+ if ($(".target_move")[1].value == "") {
+ post_res.innerHTML="posted";
+
+ }
+ }
+ rpc.query({
+ model: 'account.partner.ledger',
+ method: 'write',
+ args: [
+ self.wizard_id, filter_data_selected
+ ],
+ }).then(function(res) {
+ self.initial_render = false;
+ self.load_data(self.initial_render);
+ });
+ },
+
+ });
+ core.action_registry.add("p_l", PartnerLedger);
+ return PartnerLedger;
+});
diff --git a/dynamic_accounts_report/static/src/js/trial_balance.js b/dynamic_accounts_report/static/src/js/trial_balance.js
new file mode 100644
index 0000000..6d21445
--- /dev/null
+++ b/dynamic_accounts_report/static/src/js/trial_balance.js
@@ -0,0 +1,263 @@
+odoo.define('dynamic_cash_flow_statements.trial', function (require) {
+ 'use strict';
+ var AbstractAction = require('web.AbstractAction');
+ var core = require('web.core');
+ var field_utils = require('web.field_utils');
+ var rpc = require('web.rpc');
+ var session = require('web.session');
+ var utils = require('web.utils');
+ var QWeb = core.qweb;
+ var _t = core._t;
+
+ window.click_num = 0;
+ var TrialBalance = AbstractAction.extend({
+ template: 'TrialTemp',
+ events: {
+ 'click .parent-line': 'journal_line_click',
+ 'click .child_col1': 'journal_line_click',
+ 'click #apply_filter': 'apply_filter',
+ 'click #pdf': 'print_pdf',
+ 'click #xlsx': 'print_xlsx',
+ 'click .show-gl': 'show_gl',
+ },
+
+ init: function(parent, action) {
+ this._super(parent, action);
+ this.currency=action.currency;
+ this.report_lines = action.report_lines;
+ this.wizard_id = action.context.wizard | null;
+ },
+
+
+ start: function() {
+ var self = this;
+ self.initial_render = true;
+ rpc.query({
+ model: 'account.trial.balance',
+ method: 'create',
+ args: [{
+
+ }]
+ }).then(function(t_res) {
+ self.wizard_id = t_res;
+ self.load_data(self.initial_render);
+ })
+ },
+
+
+ load_data: function (initial_render = true) {
+ var self = this;
+ self.$(".categ").empty();
+ try{
+ var self = this;
+ self._rpc({
+ model: 'account.trial.balance',
+ method: 'view_report',
+ args: [[this.wizard_id]],
+ }).then(function(datas) {
+ _.each(datas['report_lines'], function(rep_lines) {
+ rep_lines.debit = self.format_currency(datas['currency'],rep_lines.debit);
+ rep_lines.credit = self.format_currency(datas['currency'],rep_lines.credit);
+ rep_lines.balance = self.format_currency(datas['currency'],rep_lines.balance);
+
+
+
+ });
+ if (initial_render) {
+ self.$('.filter_view_tb').html(QWeb.render('TrialFilterView', {
+ filter_data: datas['filters'],
+ }));
+ self.$el.find('.journals').select2({
+ placeholder: 'Select Journals...',
+ });
+ self.$el.find('.target_move').select2({
+ placeholder: 'Target Move...',
+ });
+ }
+ var child=[];
+
+ self.$('.table_view_tb').html(QWeb.render('TrialTable', {
+
+ report_lines : datas['report_lines'],
+ filter : datas['filters'],
+ currency : datas['currency'],
+ credit_total : self.format_currency(datas['currency'],datas['debit_total']),
+ debit_total : self.format_currency(datas['currency'],datas['debit_total']),
+ }));
+ });
+
+ }
+ catch (el) {
+ window.location.href
+ }
+ },
+
+ show_gl: function(e) {
+ var self = this;
+ var account_id = $(e.target).attr('data-account-id');
+ var options = {
+ account_ids: [account_id],
+ }
+
+ var action = {
+ type: 'ir.actions.client',
+ name: 'GL View',
+ tag: 'g_l',
+ target: 'new',
+
+ domain: [['account_ids','=', account_id]],
+
+
+ }
+ return this.do_action(action);
+
+ },
+
+ print_pdf: function(e) {
+ e.preventDefault();
+ var self = this;
+ self._rpc({
+ model: 'account.trial.balance',
+ method: 'view_report',
+ args: [
+ [self.wizard_id]
+ ],
+ }).then(function(data) {
+ var action = {
+ 'type': 'ir.actions.report',
+ 'report_type': 'qweb-pdf',
+ 'report_name': 'dynamic_accounts_report.trial_balance',
+ 'report_file': 'dynamic_accounts_report.trial_balance',
+ 'data': {
+ 'report_data': data
+ },
+ 'context': {
+ 'active_model': 'account.trial.balance',
+ 'landscape': 1,
+ 'trial_pdf_report': true
+ },
+ 'display_name': 'Trial Balance',
+ };
+ return self.do_action(action);
+ });
+ },
+
+
+ format_currency: function(currency, amount) {
+ if (typeof(amount) != 'number') {
+ amount = parseFloat(amount);
+ }
+ var formatted_value = (parseInt(amount)).toLocaleString(currency[2],{
+ minimumFractionDigits: 2
+ })
+ return formatted_value
+ },
+
+ print_xlsx: function() {
+ var self = this;
+ self._rpc({
+ model: 'account.trial.balance',
+ method: 'view_report',
+ args: [
+ [self.wizard_id]
+ ],
+ }).then(function(data) {
+ var action = {
+ 'type': 'ir_actions_dynamic_xlsx_download',
+ 'data': {
+ 'model': 'account.trial.balance',
+ 'options': JSON.stringify(data['filters']),
+ 'output_format': 'xlsx',
+ 'report_data': JSON.stringify(data['report_lines']),
+ 'report_name': 'Trial Balance',
+ 'dfr_data': JSON.stringify(data),
+ },
+ };
+ return self.do_action(action);
+ });
+ },
+
+ journal_line_click: function (el){
+ click_num++;
+ var self = this;
+ var line = $(el.target).parent().data('id');
+ return self.do_action({
+ type: 'ir.actions.act_window',
+ view_type: 'form',
+ view_mode: 'form',
+ res_model: 'account.move',
+ views: [
+ [false, 'form']
+ ],
+ res_id: line,
+ target: 'current',
+ });
+
+ },
+
+
+ apply_filter: function(event) {
+
+ event.preventDefault();
+ var self = this;
+ self.initial_render = false;
+
+ var filter_data_selected = {};
+ var journal_ids = [];
+ var journal_text = [];
+ var journal_res = document.getElementById("journal_res")
+ var journal_list = $(".journals").select2('data')
+
+ for (var i = 0; i < journal_list.length; i++) {
+ if(journal_list[i].element[0].selected === true){
+
+ journal_ids.push(parseInt(journal_list[i].id))
+ if(journal_text.includes(journal_list[i].text) === false){
+ journal_text.push(journal_list[i].text)
+ }
+ journal_res.value = journal_text
+ journal_res.innerHTML=journal_res.value;
+ }
+ }
+ if (journal_list.length == 0){
+ journal_res.value = ""
+ journal_res.innerHTML="";
+
+ }
+ filter_data_selected.journal_ids = journal_ids
+
+ if ($("#date_from").val()) {
+ var dateString = $("#date_from").val();
+ filter_data_selected.date_from = dateString;
+ }
+ if ($("#date_to").val()) {
+ var dateString = $("#date_to").val();
+ filter_data_selected.date_to = dateString;
+ }
+
+ if ($(".target_move").length) {
+ var post_res = document.getElementById("post_res")
+ filter_data_selected.target_move = $(".target_move")[1].value
+ post_res.value = $(".target_move")[1].value
+ post_res.innerHTML=post_res.value;
+ if ($(".target_move")[1].value == "") {
+ post_res.innerHTML="posted";
+
+ }
+ }
+ rpc.query({
+ model: 'account.trial.balance',
+ method: 'write',
+ args: [
+ self.wizard_id, filter_data_selected
+ ],
+ }).then(function(res) {
+ self.initial_render = false;
+ self.load_data(self.initial_render);
+ });
+ },
+
+ });
+ core.action_registry.add("t_b", TrialBalance);
+ return TrialBalance;
+}); \ No newline at end of file
diff --git a/dynamic_accounts_report/static/src/xml/ageing.xml b/dynamic_accounts_report/static/src/xml/ageing.xml
new file mode 100644
index 0000000..aa63e88
--- /dev/null
+++ b/dynamic_accounts_report/static/src/xml/ageing.xml
@@ -0,0 +1,580 @@
+<templates>
+ <t t-name="AgeingTemp">
+ <div class="">
+ <div class="">
+ <h1 style="padding:10px">
+ Partner Ageing
+ </h1>
+
+ </div>
+
+ <div>
+ <div class="filter_view_tb"></div>
+ </div>
+ <br></br>
+ <div>
+ <div class="table_view_tb" style="right:20px;"></div>
+ </div>
+ </div>
+ </t>
+ <t t-name="Ageingtable">
+ <div>
+ <div class="table_main_view">
+ <table cellspacing="0" width="100%">
+ <thead>
+ <tr>
+ <th colspan="6">Partner</th>
+ <th class="mon_fld">Not Due</th>
+ <th class="mon_fld">0-30</th>
+ <th class="mon_fld">30-60</th>
+ <th class="mon_fld">60-90</th>
+ <th class="mon_fld">90-120</th>
+ <th class="mon_fld">120+</th>
+
+ <th class="mon_fld">Total</th>
+ </tr>
+ </thead>
+ <tbody>
+ <t t-set="none_value" t-value="_"/>
+ <t t-foreach="report_lines[0]" t-as="account">
+
+
+ <t t-set="common_id" t-value="0"/>
+
+ <tr style="border: 1.5px solid black;" class="gl-line"
+ data-toggle="collapse"
+ t-att-data-account-id="account['partner_id']"
+ t-attf-data-target=".a{{account['partner_id']}}">
+ <td colspan="6" style="border: 0px solid black;">
+ <i class="fa fa-caret-down" role="img" aria-label="Unfolded" title="Unfolded"></i>
+
+ <span>
+
+ <t t-esc="account['name']"/>
+ </span>
+ <t t-if="currency[1] == 'before'">
+ <td style="text-align:right;">
+ <t t-if="account['direction'] == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="currency[0]"/>
+ <t t-esc="account['direction']"/>
+<!-- <t t-esc="Math.round(account['direction'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ </t>
+
+ </td>
+ <td style="text-align:right;">
+ <t t-if="account['4'] == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="currency[0]"/>
+ <t t-esc="account['4']"/>
+<!-- <t t-esc="Math.round(account['4'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ </t>
+ </td>
+ <td style="text-align:right;">
+ <t t-if="account['3'] == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="currency[0]"/>
+ <t t-esc="account['3']"/>
+<!-- <t t-esc="Math.round(account['3'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ </t>
+ </td>
+ <td style="text-align:right;">
+ <t t-if="account['2'] == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="currency[0]"/>
+ <t t-esc="account['2']"/>
+<!-- <t t-esc="Math.round(account['2'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ </t>
+ </td>
+ <td style="text-align:right;">
+ <t t-if="account['1'] == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="currency[0]"/>
+ <t t-esc="account['1']"/>
+<!-- <t t-esc="Math.round(account['1'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ </t>
+ </td>
+ <td style="text-align:right;">
+ <t t-if="account['0'] == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="currency[0]"/>
+ <t t-esc="account['0']"/>
+<!-- <t t-esc="Math.round(account['0'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ </t>
+ </td>
+ <td style="text-align:right;">
+ <t t-if="account['total'] == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="currency[0]"/>
+ <t t-esc="account['total']"/>
+<!-- <t t-esc="Math.round(account['total'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ </t>
+ </td>
+ </t>
+ <t t-else="">
+ <td style="text-align:right;">
+ <t t-if="account['direction'] == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account['direction']"/>
+<!-- <t t-esc="Math.round(account['direction'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ <t t-esc="currency[0]"/>
+ </t>
+ </td>
+ <td style="text-align:right;">
+ <t t-if="account['4'] == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account['4']"/>
+
+<!-- <t t-esc="Math.round(account['4'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ <t t-esc="currency[0]"/>
+ </t>
+ </td>
+ <td style="text-align:right;">
+ <t t-if="account['3'] == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account['3']"/>
+<!-- <t t-esc="Math.round(account['3'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ <t t-esc="currency[0]"/>
+ </t>
+ </td>
+ <td style="text-align:right;">
+ <t t-if="account['2'] == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account['2']"/>
+<!-- <t t-esc="Math.round(account['2'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ <t t-esc="currency[0]"/>
+ </t>
+ </td>
+ <td style="text-align:right;">
+ <t t-if="account['1'] == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account['1']"/>
+<!-- <t t-esc="Math.round(account['1'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ <t t-esc="currency[0]"/>
+ </t>
+ </td>
+ <td style="text-align:right;">
+ <t t-if="account['0'] == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account['0']"/>
+<!-- <t t-esc="Math.round(account['0'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ <t t-esc="currency[0]"/>
+ </t>
+ </td>
+ <td style="text-align:right;">
+ <t t-if="account['total'] == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account['total']"/>
+<!-- <t t-esc="Math.round(account['total'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ <t t-esc="currency[0]"/>
+ </t>
+ </td>
+
+ </t>
+ </td>
+ <tr t-attf-class="collapse a{{account['partner_id']}}">
+ <td colspan="14">
+ <ul>
+
+ </ul>
+ </td>
+ </tr>
+ </tr>
+ </t>
+
+ </tbody>
+
+ </table>
+ </div>
+ </div>
+ </t>
+
+
+ <t t-name="AgeingFilterView">
+ <div class="" style="position: relative;">
+ <div class="sub_container_left">
+ <div class="report_print">
+ <button type="button" class="btn btn-primary" id="pdf"
+ style="left:10px; height:30px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD; padding:3px;">
+ Print (PDF)
+ </button>
+ <button type="button" class="btn btn-primary" id="xlsx"
+ style="left:10px; height:30px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD; padding:3px;">
+ Export (XLSX)
+ </button>
+ </div>
+ </div>
+ <br></br>
+ <div class="sub_container_right" style="width:50%;height:3%;right:0px;top:0px;position: absolute;">
+ <div class="" style="right:80x;">
+
+ <br></br>
+ <div class="row" style="right:100px;top:0px;position: absolute;width:50;">
+ <div class="time_range" style="">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
+ <span class="fa fa-calendar" title="Dates" role="img" aria-label="Dates"></span>
+ As On Date
+ </a>
+ <div class="dropdown-menu" role="menu">
+ <div class="">
+ <label class="" for="date_from">As On Date :</label>
+ <div class="">
+ <div class="" aria-atomic="true" id="">
+ <input type="date" id="date_from"></input>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="search-Result-Selection" style="">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown">
+ <span class="fa fa-book"></span>
+ Account Type:
+ </a>
+ <select id="selection" class="dropdown-menu result_selection" name="states[]">
+ <div role="separator" class="dropdown-divider"></div>
+ <option value="customer">Receivable Accounts</option>
+ <option value="supplier">Payable Accounts</option>
+ <option value="customer_supplier">Receivable and Payable Accounts</option>
+ </select>
+ <span id="account_res"></span>
+ </div>
+ <div class="partner_filter">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown">
+ <span class="fa fa-users"></span>
+ Partners:
+ </a>
+ <select class="dropdown-menu partners" name="states[]" multiple="multiple">
+ <t t-foreach="filter_data.partners_list" t-as="partner">
+ <option t-attf-value="{{partner[0]}}">
+ <t t-esc="partner[1]"/>
+ </option>
+ </t>
+ </select>
+ <span id="partner_res"></span>
+ </div>
+ <div class="category_filter">
+ <a type="button" class="dropdown-toggle"
+ data-toggle="dropdown">
+ <span class="fa fa-filter"></span>
+ Partner tag:
+ </a>
+ <select class="dropdown-menu category"
+ name="states[]" multiple="multiple">
+ <t t-foreach="filter_data.category_list"
+ t-as="category">
+ <option t-attf-value="{{category[0]}}">
+ <t t-esc="category[1]"/>
+ </option>
+ </t>
+ </select>
+ <span id="category_res"></span>
+
+ </div>
+
+
+ <div class="search-Target-move" style="">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown">
+ <span class="fa fa-filter"></span>
+ Target Move:
+ </a>
+ <select id="entries" class="dropdown-menu target_move" name="states[]">
+ <div role="separator" class="dropdown-divider"></div>
+ <option value="Posted">Posted Entries</option>
+ <option value="All">All Entries</option>
+
+ </select>
+ <span id="post_res"></span>
+ </div>
+ </div>
+
+ </div>
+ <div style="">
+ <button type="button" id="apply_filter" class="btn btn-primary"
+ style="top:0px;height:30px;right:20px;position: absolute;color:white;background-color: #00A0AD;border-color: #00A0AD;">
+ Apply
+ </button>
+
+ </div>
+ </div>
+ </div>
+ </t>
+
+ <t t-name="SubSectional">
+ <div class="gl-table-div">
+ <table class="table table-sm o_main_table"
+ style="border: 0px solid black;display compact;">
+ <thead>
+ <tr style="">
+ <th>Entry Label</th>
+ <th>DueDate</th>
+ <th>JRNL</th>
+ <th>Account</th>
+ <th>Not Due</th>
+ <th>0-30</th>
+ <th>30-60</th>
+ <th>60-90</th>
+ <th>90-120</th>
+ <th>120+</th>
+
+ </tr>
+ </thead>
+ <tbody>
+ <t t-foreach="account_data" t-as="account_line">
+
+
+ <tr>
+ <td>
+ <t t-if="account_line.mov_id">
+ <div class="dropdown dropdown-toggle">
+ <a data-toggle="dropdown" href="#">
+ <span class="caret"></span>
+ <span>
+ <t t-esc="account_line.move"/>
+ </span>
+ </a>
+ <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu">
+ <li>
+ <a class="view-account-move" tabindex="-1" href="#"
+ t-att-data-move-id="account_line.mov_id">
+ View Source move
+
+ </a>
+ </li>
+ </ul>
+ </div>
+ </t>
+ </td>
+ <td>
+ <t t-esc="account_line.date"/>
+ </td>
+ <td>
+ <t t-esc="account_line.jrnl"/>
+ </td>
+ <td>
+ <span>
+ <t t-esc="account_line.acc_code"/>
+ -
+ <t t-esc="account_line.acc_name"/>
+ </span>
+ </td>
+ <t t-if="account_line.currency== 'before'">
+ <td>
+ <t t-if="account_line.period6">
+ <t t-if="account_line.amount== 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account_line.symbol"/>
+ <t t-esc="account_line.amount"/>
+<!-- <t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ </t>
+
+ </t>
+ <t t-else="">
+ <span>-</span>
+ </t>
+ </td>
+ <td>
+ <t t-if="account_line.period5">
+ <t t-if="account_line.amount== 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account_line.symbol"/>
+ <t t-esc="account_line.amount"/>
+<!-- <t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ </t>
+
+ </t>
+ <t t-else="">
+ <span>-</span>
+ </t>
+ </td>
+ <td>
+ <t t-if="account_line.period4">
+ <t t-if="account_line.amount== 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account_line.symbol"/>
+ <t t-esc="account_line.amount"/>
+<!-- <t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ </t>
+
+
+ </t>
+ <t t-else="">
+ <span>-</span>
+ </t>
+ </td>
+ <td>
+ <t t-if="account_line.period3">
+ <t t-if="account_line.amount== 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account_line.symbol"/>
+ <t t-esc="account_line.amount"/>
+<!-- <t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ </t>
+
+
+ </t>
+ <t t-else="">
+ <span>-</span>
+ </t>
+ </td>
+ <td>
+ <t t-if="account_line.period2">
+ <t t-if="account_line.amount== 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account_line.symbol"/>
+ <t t-esc="account_line.amount"/>
+<!-- <t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ </t>
+
+ </t>
+ <t t-else="">
+ <span>-</span>
+ </t>
+ </td>
+ <td>
+ <t t-if="account_line.period1">
+ <t t-if="account_line.amount== 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account_line.symbol"/>
+ <t t-esc="account_line.amount"/>
+<!-- <t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ </t>
+ </t>
+ <t t-else="">
+ <span>-</span>
+ </t>
+ </td>
+ </t>
+ <t t-else="">
+ <td>
+ <t t-if="account_line.period6">
+ <t t-if="account_line.amount == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account_line.amount"/>
+<!-- <t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ <t t-esc="account_line.symbol"/>
+ </t>
+ </t>
+
+ </td>
+ <td>
+ <t t-if="account_line.period5">
+ <t t-if="account_line.amount == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account_line.amount"/>
+<!-- <t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ <t t-esc="account_line.symbol"/>
+ </t>
+ </t>
+
+ </td>
+ <td>
+ <t t-if="account_line.period4">
+ <t t-if="account_line.amount == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account_line.amount"/>
+<!-- <t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ <t t-esc="account_line.symbol"/>
+ </t>
+ </t>
+
+ </td>
+ <td>
+ <t t-if="account_line.period3">
+ <t t-if="account_line.amount == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account_line.amount"/>
+<!-- <t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ <t t-esc="account_line.symbol"/>
+ </t>
+ </t>
+
+ </td>
+ <td>
+ <t t-if="account_line.period2">
+ <t t-if="account_line.amount == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account_line.amount"/>
+<!-- <t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ <t t-esc="account_line.symbol"/>
+ </t>
+ </t>
+
+ </td>
+ <td>
+ <t t-if="account_line.period1">
+ <t t-if="account_line.amount == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account_line.amount"/>
+<!-- <t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ <t t-esc="account_line.symbol"/>
+ </t>
+ </t>
+
+ </td>
+
+
+ </t>
+
+ </tr>
+ </t>
+
+
+ </tbody>
+ </table>
+ </div>
+ </t>
+
+</templates> \ No newline at end of file
diff --git a/dynamic_accounts_report/static/src/xml/cash_flow_view.xml b/dynamic_accounts_report/static/src/xml/cash_flow_view.xml
new file mode 100644
index 0000000..33a3549
--- /dev/null
+++ b/dynamic_accounts_report/static/src/xml/cash_flow_view.xml
@@ -0,0 +1,351 @@
+
+<templates>
+ <t t-name="CFTemp">
+ <div class="">
+ <div class="">
+ <h1 style="padding:10px">
+ Cash Flow Statement
+ </h1>
+
+ </div>
+
+ <div>
+ <div class="filter_view_tb"></div>
+ </div>
+ <br></br>
+ <div>
+ <div class="table_view_tb" style="right:20px;"></div>
+ </div>
+ </div>
+ </t>
+ <t t-name="CashTable">
+ <div>
+ <div class="table_main_view">
+ <table cellspacing="0" width="100%">
+ <thead>
+ <tr>
+ <th colspan="6">Name</th>
+ <th class="cf_fld">Cash In</th>
+ <th class="cf_fld">Cash Out</th>
+ <th class="cf_fld">Balance</th>
+
+ </tr>
+ </thead>
+ <tbody>
+ <t t-foreach="account_data" t-as="account">
+ <t t-set="common_id" t-value=""/>
+ <t t-if="(level=='detailed' or level=='very' or level==false )">
+ <tr style="border: .5px solid black;" class="cf-line"
+ data-toggle="collapse"
+ t-att-data-account-id="account['id']"
+ t-attf-data-target=".a{{account['id']}}">
+
+ <td colspan="6" style="border: 0px solid black;">
+ <i class="fa fa-caret-down" role="img" aria-label="Unfolded" title="Unfolded"></i>
+ <span>
+ <t t-if="account['month_part']">
+ <t t-esc="account['month_part']"/>
+ </t>
+ <t t-esc="account['code']"/>
+ <t t-esc="account['name']"/>
+ </span>
+ </td>
+ <t t-if="currency[1] == 'before'">
+ <td class="cf_fld">
+ <t t-esc="currency[0]"/> <t t-raw="account['total_debit']"/>
+ </td>
+ <td class="cf_fld">
+ <t t-esc="currency[0]"/> <t t-raw="account['total_credit']"/>
+ </td>
+ <td class="cf_fld">
+ <t t-esc="currency[0]"/> <t t-raw="account['total_balance']"/>
+ </td>
+
+ </t>
+ <t t-else="">
+ <td class="cf_fld">
+ <t t-raw="account['total_debit']"/><t t-esc="currency[0]"/>
+ </td>
+ <td class="cf_fld">
+ <t t-raw="account['total_credit']"/><t t-esc="currency[0]"/>
+ </td>
+ <td class="cf_fld">
+ <t t-raw="account['total_balance']"/><t t-esc="currency[0]"/>
+ </td>
+ </t>
+ </tr>
+
+ </t>
+ <t t-else="">
+
+ <tr style="border: 1.5px solid black;" class=""
+ data-toggle="collapse"
+ t-att-data-account-id="account['id']"
+ t-attf-data-target=".a{{account['id']}}">
+
+ <td colspan="6" style="border: 0px solid black;">
+ <span>
+ <t t-if="account['month_part']">
+ <t t-esc="account['month_part']"/>
+ </t>
+ <t t-esc="account['code']"/>
+
+ <t t-esc="account['name']"/>
+ </span>
+ </td>
+ <t t-if="currency[1] == 'before'">
+ <td class="cf_fld">
+ <t t-esc="currency[0]"/> <t t-raw="account['total_debit']"/>
+ </td>
+ <td class="cf_fld">
+ <t t-esc="currency[0]"/> <t t-raw="account['total_credit']"/>
+ </td>
+ <td class="cf_fld">
+ <t t-esc="currency[0]"/> <t t-raw="account['total_balance']"/>
+ </td>
+
+ </t>
+ <t t-else="">
+ <td class="cf_fld">
+ <t t-raw="account['total_debit']"/><t t-esc="currency[0]"/>
+ </td>
+ <td class="cf_fld">
+ <t t-raw="account['total_credit']"/><t t-esc="currency[0]"/>
+ </td>
+ <td class="cf_fld">
+ <t t-raw="account['total_balance']"/><t t-esc="currency[0]"/>
+ </td>
+ </t>
+ </tr>
+ </t>
+ <tr t-attf-class="collapse a{{account['id']}}">
+ <td colspan="10">
+ <ul>
+
+ </ul>
+ </td>
+ </tr>
+ </t>
+ </tbody>
+
+
+ </table>
+ </div>
+ </div>
+ </t>
+
+
+
+
+ <t t-name="CashFilterView">
+
+ <div class="" style="position: relative;">
+ <div class="sub_container_left">
+ <div class="report_print">
+ <button type="button" class="btn btn-primary" id="pdf" style="left:10px; height:30px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD; padding:3px;">Print (PDF)</button>
+ <button type="button" class="btn btn-primary" id="xlsx" style="left:10px; height:30px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD; padding:3px;">Export (XLSX)</button>
+ </div>
+ </div>
+ <br></br>
+ <div class="sub_container_right" style="width:50%;height:3%;right:0px;top:0px;position: absolute;">
+ <div class="" style="right:80x;">
+
+ <br></br>
+ <div class="row" style="right:110px;top:0px;position: absolute;width:50;">
+ <div class="time_range" style="">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
+ <span class="fa fa-calendar" title="Dates" role="img" aria-label="Dates"></span>
+Date Range
+ </a>
+ <div class="dropdown-menu" role="menu">
+ <div class="" >
+ <label class="" for="date_from">Start Date :</label>
+ <div class="">
+ <div class="" aria-atomic="true" id="" >
+ <input type="date" id="date_from"></input>
+ </div>
+ </div>
+ <label class="" for="date_to">End Date :</label>
+ <div class="">
+ <div class="" aria-atomic="true" id="" >
+ <input type="date" id="date_to"></input>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+
+ <div class="search-Target-move" style="">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown">
+ <span class="fa fa-filter"></span>
+Target Move:
+ </a>
+ <select id="entries" class="dropdown-menu target_move" name="states[]" >
+ <div role="separator" class="dropdown-divider"></div>
+ <option value="Posted">Posted Entries</option>
+ <option value="All">All Entries </option>
+ </select>
+ <span id="post_res"></span>
+ </div>
+
+ <div class="search-levels">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown">
+ <span class="fa fa-book"></span>
+Level:
+ </a>
+ <select class="dropdown-menu levels" id="levels" name="states[]">
+ <option value="summary">Summary</option>
+ <option value="consolidated">Consolidated</option>
+ <option value="detailed">Detailed</option>
+ <option value="very">Very Detailed</option>
+ </select>
+ <span id="level_res"> </span>
+ </div>
+
+
+ </div>
+
+ </div>
+ <div style="">
+ <button type="button" id="apply_filter" class="btn btn-primary" style="top:0px;height:30px;right:20px;position: absolute;color:white;background-color: #00A0AD;border-color: #00A0AD;">Apply</button>
+
+ </div>
+ </div>
+ </div>
+ </t>
+
+
+
+ <t t-name="SubSectionCF">
+
+ <table cellspacing="0" width="100%">
+ <thead>
+ <tr>
+ <th colspan="6">Name</th>
+ <th class="cf_fld">Cash In</th>
+ <th class="cf_fld">Cash Out</th>
+ <th class="cf_fld">Balance</th>
+ </tr>
+ </thead>
+ <tbody>
+ <t t-foreach="account_data" t-as="data">
+
+ <t t-if="data.id == line_id">
+ <t t-foreach="data.journal_lines" t-as="account_line">
+ <t t-set="style" t-value="'font-style: italic;'"/>
+ <tr data-toggle=""
+ t-att-data-account-id="data.id"
+ t-attf-data-target=".a{{data.id}}">
+ <td colspan="6" style="border: 0px solid black;">
+ <t t-esc="account_line.name"/>
+ </td>
+ <t t-if="currency[1] == 'before'">
+ <td class="cf_fld">
+ <t t-esc="currency[0]"/><t t-raw="account_line.total_debit"/>
+ </td>
+ <td class="cf_fld">
+ <t t-esc="currency[0]"/><t t-raw="account_line.total_credit"/>
+ </td>
+ <td class="cf_fld">
+ <t t-esc="currency[0]"/><t t-raw="account_line.balance"/>
+ </td>
+ </t>
+ <t t-else="">
+ <td class="cf_fld">
+ <t t-raw="account_line.total_debit"/><t t-esc="currency[0]"/>
+ </td>
+ <td class="cf_fld">
+ <t t-raw="account_line.total_credit"/><t t-esc="currency[0]"/>
+ </td>
+ <td class="cf_fld">
+ <t t-raw="account_line.balance"/><t t-esc="currency[0]"/>
+ </td>
+ </t>
+ </tr>
+ </t>
+ </t>
+ </t>
+ </tbody>
+
+
+ </table>
+
+ </t>
+
+ <t t-name="ChildSubSectionCF">
+ <div class="c-cf-table-div">
+ <table cellspacing="1" width="100%">
+ <thead>
+ <t t-foreach="account_data" t-as="acc_data">
+ <t t-if="acc_data.id == line_id">
+ <t t-foreach="acc_data.journal_lines" t-as="data">
+ <tr style="">
+ <th colspan="6"><t t-esc="data.name"/> </th>
+ <t t-if="currency[1] == 'before'">
+ <th class="cf_fld" style="left: 100px;"><t t-esc="currency[0]"/><t t-esc="data.total_debit"/></th>
+ <th class="cf_fld"><t t-esc="currency[0]"/><t t-esc="data.total_credit"/></th>
+ <th class="cf_fld"><t t-esc="currency[0]"/><t t-esc="data.total_balance"/></th>
+ </t>
+ <t t-else="">
+ <th class="cf_fld" style="left: 100px;"><t t-esc="data.total_debit"/><t t-esc="currency[0]"/></th>
+ <th class="cf_fld"><t t-esc="data.total_credit"/><t t-esc="currency[0]"/></th>
+ <th class="cf_fld"><t t-esc="data.total_balance"/><t t-esc="currency[0]"/></th>
+ </t>
+
+ </tr>
+
+ <t t-foreach="acc_data.move_lines" t-as="account_line">
+ <t t-if="account_line.j_id == data.id">
+ <tr>
+
+ <td colspan="6">
+ <t t-esc="account_line.move_name"/>
+ </td>
+ <t t-if="currency[1] == 'before'">
+ <td class="cf_fld">
+ <t t-esc="currency[0]"/>
+ <t t-raw="account_line.total_debit"/>
+ </td>
+ <td class="cf_fld">
+ <t t-esc="currency[0]"/>
+ <t t-raw="account_line.total_credit"/>
+ </td>
+ <td class="cf_fld">
+ <t t-esc="currency[0]"/>
+ <t t-raw="account_line.balance"/>
+ </td>
+ </t>
+ <t t-else="">
+ <td class="cf_fld">
+ <t t-if="account_line.total_debit==0"/>
+ <t t-esc="currency[0]"/>
+ </td>
+ <td class="cf_fld">
+
+ <t t-raw="account_line.total_credit"/>
+ <t t-esc="currency[0]"/>
+ </td>
+ <td class="cf_fld">
+
+ <t t-raw="account_line.balance"/>
+ <t t-esc="currency[0]"/>
+ </td>
+ </t>
+ </tr>
+ </t>
+ </t>
+
+ <tr t-attf-class="collapse a{{data.id}}">
+
+ <td colspan=""></td>
+ </tr>
+ </t>
+ </t>
+ </t>
+ </thead>
+ </table>
+ </div>
+ </t>
+
+</templates> \ No newline at end of file
diff --git a/dynamic_accounts_report/static/src/xml/daybook.xml b/dynamic_accounts_report/static/src/xml/daybook.xml
new file mode 100644
index 0000000..653d345
--- /dev/null
+++ b/dynamic_accounts_report/static/src/xml/daybook.xml
@@ -0,0 +1,341 @@
+<templates>
+ <t t-name="DaybookTemp">
+ <div class="">
+ <div class="">
+ <h1 style="padding:10px">
+ Day Book
+ </h1>
+
+ </div>
+
+ <div>
+ <div class="filter_view_db"></div>
+ </div>
+ <br></br>
+ <div>
+ <div class="table_view_db" style="right:20px;"></div>
+ </div>
+ </div>
+ </t>
+ <t t-name="Daytable">
+ <div>
+ <div class="table_main_view">
+ <table cellspacing="0" width="100%">
+ <thead>
+ <tr>
+ <th colspan="6">Date</th>
+ <th class="mon_fld">Debit</th>
+ <th class="mon_fld">Credit</th>
+ <th class="mon_fld">Balance</th>
+
+ </tr>
+ </thead>
+<!-- <tbody style="width:100%;">-->
+<!-- </tbody>-->
+ <tbody>
+ <t t-foreach="report_lines" t-as="account">
+ <t t-set="common_id" t-value="0"/>
+ <tr style="border: 1.5px solid black;" class="db-line"
+ data-toggle="collapse"
+ t-att-data-account-id="account['id']"
+ t-attf-data-target=".a{{account['id']}}">
+ <t t-if="currency[1] == 'before'">
+
+ <td colspan="6" style="border: 0px solid black;">
+ <i class="fa fa-caret-down" role="img" aria-label="Unfolded"
+ title="Unfolded"></i>
+ <span>
+ <t t-esc="account['date']"/>
+ </span>
+ <td class="mon_fld">
+ <t t-esc="currency[0]"/>
+
+ <t t-raw="account['debit']"/>
+ </td>
+ <td class="mon_fld">
+ <t t-esc="currency[0]"/>
+
+ <t t-raw="account['credit']"/>
+ </td>
+ <td class="mon_fld">
+ <t t-esc="currency[0]"/>
+
+ <t t-raw="account['balance']"/>
+ </td>
+ <t t-set="common_id" t-value="'a'+account['id']"/>
+ </td>
+ </t>
+ <t t-else="">
+ <td colspan="6" style="border: 0px solid black;">
+ <i class="fa fa-caret-down" role="img" aria-label="Unfolded"
+ title="Unfolded"></i>
+ <span>
+ <t t-esc="account['date']"/>
+ </span>
+ <td class="mon_fld">
+
+ <t t-raw="account['debit']"/>
+ <t t-esc="currency[0]"/>
+
+ </td>
+ <td class="mon_fld">
+
+ <t t-raw="account['credit']"/>
+ <t t-esc="currency[0]"/>
+
+ </td>
+ <td class="mon_fld">
+
+ <t t-raw="account['balance']"/>
+ <t t-esc="currency[0]"/>
+
+ </td>
+ <t t-set="common_id" t-value="'a'+account['id']"/>
+ </td>
+
+ </t>
+
+ <tr t-attf-class="collapse a{{account['id']}}">
+ <td colspan="10">
+ <ul>
+ </ul>
+ </td>
+ </tr>
+ </tr>
+ </t>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </t>
+
+
+ <t t-name="DayFilterView">
+ <div class="" style="position: relative;">
+ <div class="sub_container_left">
+ <div class="report_print">
+ <button type="button" class="btn btn-primary" id="pdf"
+ style="left:10px; height:30px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD; padding:3px;">
+ Print (PDF)
+ </button>
+ <button type="button" class="btn btn-primary" id="xlsx"
+ style="left:10px; height:30px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD; padding:3px;">
+ Export (XLSX)
+ </button>
+ </div>
+ </div>
+ <br></br>
+ <div class="sub_container_right" style="width:50%;height:3%;right:0px;top:0px;position: absolute;">
+
+ <div class="" style="right:80x;">
+
+ <br></br>
+ <div class="row" style="right:100px;top:0px;position: absolute;width:50;">
+ <div class="time_range" style="">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
+ <span class="fa fa-calendar" title="Dates" role="img" aria-label="Dates"></span>
+ Date Range
+ </a>
+ <div class="dropdown-menu" role="menu">
+ <div class="">
+ <label class="" for="date_from">Start Date :</label>
+ <div class="">
+ <div class="" aria-atomic="true" id="">
+ <input type="date" id="date_from"></input>
+ </div>
+ </div>
+ <label class="" for="date_to">End Date :</label>
+ <div class="">
+ <div class="" aria-atomic="true" id="">
+ <input type="date" id="date_to"></input>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="journals_filter" style="">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown">
+ <span class="fa fa-book"></span>
+ Journals:
+ </a>
+ <select class="dropdown-menu journals" name="states[]" multiple="multiple">
+ <div role="separator" class="dropdown-divider"></div>
+ <t t-foreach="filter_data.journals_list" t-as="journal">
+ <option t-attf-value="{{journal[0]}}">
+ <t t-esc="journal[1]"/>
+ </option>
+ </t>
+ </select>
+ <span id="journal_res"></span>
+ </div>
+ <div class="accounts_filter">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown">
+ <span class="fa fa-book"></span>
+ Accounts:
+ </a>
+ <select class="dropdown-menu account" name="states[]" multiple="multiple">
+ <t t-foreach="filter_data.accounts_list" t-as="account">
+ <option t-attf-value="{{account[0]}}">
+ <t t-esc="account[1]"/>
+ </option>
+ </t>
+ </select>
+ <span id="acc_res"></span>
+ </div>
+
+
+ <div class="search-Target-move" style="">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown">
+ <span class="fa fa-filter"></span>
+ Target Move:
+ </a>
+ <select id="entries" class="dropdown-menu target_move" name="states[]">
+ <div role="separator" class="dropdown-divider"></div>
+ <option value="Posted">Posted Entries</option>
+ <option value="All">All Entries</option>
+ </select>
+ <span id="post_res"></span>
+ </div>
+ </div>
+
+ </div>
+ <div style="">
+ <button type="button" id="apply_filter" class="btn btn-primary"
+ style="top:0px;height:30px;right:20px;position: absolute;color:white;background-color: #00A0AD;border-color: #00A0AD;">
+ Apply
+ </button>
+
+ </div>
+ </div>
+ </div>
+ </t>
+
+ <t t-name="SubSectiondb">
+ <div class="db-table-div">
+ <table class="table table-sm o_main_table"
+ style="border: 0px solid black;display compact;">
+ <thead>
+ <tr style="">
+ <th>Date</th>
+ <th>JRNL</th>
+ <th>Partner</th>
+ <th>Move</th>
+ <th>Entry Label</th>
+ <th>Debit</th>
+ <th>Credit</th>
+ <th>Balance</th>
+
+ </tr>
+ </thead>
+ <tbody>
+ <t t-foreach="account_data" t-as="account_line">
+ <t t-set="style" t-value="''"/>
+ <tr>
+ <td>
+ <t t-if="account_line.ldate">
+ <div class="dropdown dropdown-toggle">
+ <a data-toggle="dropdown" href="#">
+ <span class="caret"/>
+ <span data-id="17">
+ <t t-esc="account_line.ldate"/>
+ </span>
+ </a>
+ <ul class="dropdown-menu"
+ role="menu"
+ aria-labelledby="dropdownMenu">
+ <li>
+ <a class="view-account-move"
+ tabindex="-1" href="#"
+ t-att-data-move-id="account_line.move_id">
+ View Source move
+ </a>
+ </li>
+ </ul>
+ </div>
+ </t>
+ </td>
+ <td>
+ <t t-esc="account_line.lcode"/>
+ </td>
+ <td>
+ <t t-esc="account_line.partner_name"/>
+ </td>
+ <td t-att-style="style">
+ <t t-esc="account_line.move_name"/>
+ </td>
+ <td t-att-style="style">
+ <t t-esc="account_line.lname"/>
+ </td>
+ <t t-if="currency_position == 'before'">
+ <td t-att-style="style" class="text-right">
+ <t t-if="account_line.debit == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="currency_symbol"/>
+ <t t-esc="account_line.debit"/>
+<!-- <t t-esc="Math.round(account_line.debit * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ </t>
+ </td>
+ <td t-att-style="style" class="text-right">
+ <t t-if="account_line.credit == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="currency_symbol"/>
+ <t t-esc="account_line.credit"/>
+<!-- <t t-esc="Math.round(account_line.credit * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ </t>
+ </td>
+ <td t-att-style="style" class="text-right">
+ <t t-if="account_line.balance == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="currency_symbol"/>
+ <t t-esc="account_line.balance"/>
+<!-- <t t-esc="Math.round(account_line.balance * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ </t>
+ </td>
+ </t>
+ <t t-else="">
+ <td t-att-style="style" class="amt">
+ <t t-if="account_line.debit == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account_line.debit"/>
+<!-- <t t-esc="Math.round(account_line.debit * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ <t t-esc="currency_symbol"/>
+ </t>
+ </td>
+ <td t-att-style="style" class="amt">
+ <t t-if="account_line.credit == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account_line.credit"/>
+<!-- <t t-esc="Math.round(account_line.credit * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ <t t-esc="currency_symbol"/>
+ </t>
+ </td>
+ <td t-att-style="style" class="amt">
+ <t t-if="account_line.balance == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account_line.balance"/>
+<!-- <t t-esc="Math.round(account_line.balance * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ <t t-esc="currency_symbol"/>
+ </t>
+ </td>
+
+ </t>
+ </tr>
+ </t>
+ </tbody>
+ </table>
+ </div>
+ </t>
+
+</templates> \ No newline at end of file
diff --git a/dynamic_accounts_report/static/src/xml/financial_reports_view.xml b/dynamic_accounts_report/static/src/xml/financial_reports_view.xml
new file mode 100644
index 0000000..80997ea
--- /dev/null
+++ b/dynamic_accounts_report/static/src/xml/financial_reports_view.xml
@@ -0,0 +1,266 @@
+
+<templates>
+ <t t-name="dfr_template_new">
+ <div class="">
+ <div>
+ <div class="filter_view_dfr"></div>
+ </div>
+ <br></br>
+ <div>
+ <div class="table_view_dfr" style="right:20px;"></div>
+ </div>
+ </div>
+ </t>
+
+ <t t-name="dfr_table">
+ <div>
+ <div class="table_main_view">
+ <table cellspacing="0" width="100%">
+ <thead>
+ <tr>
+ <th colspan="6"></th>
+ <th style="text-align: right; padding-right: 50px;">Debit</th>
+ <th style="text-align: right; padding-right: 50px;">Credit</th>
+ <th style="text-align: right; padding-right: 50px;">Balance</th>
+ </tr>
+ </thead>
+ <tbody>
+
+ <t t-set="none_value" t-value="_"/>
+ <t t-foreach="bs_lines" t-as="a">
+ <t t-if="a['code']">
+ <t t-foreach="report_lines" t-as="account">
+
+
+ <t t-set="common_id" t-value="0"/>
+ <t t-if="account['code'] == a['code']">
+ <tr style="border: 1.5px solid black;" class="gl-line"
+ data-toggle="collapse"
+ t-att-data-account-id="account['id']"
+ t-attf-data-target=".a{{account['id']}}">
+ <td colspan="6" style="border: 0px solid black; padding-left: 50px;">
+ <span>
+ <t t-esc="account['code']"/>
+ -
+ <t t-esc="account['name']"/>
+ </span>
+ <div class="" style="display: inline-block;">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
+ </a>
+ <div class="dropdown-menu " role="menu">
+ <div class="o_foldable_menu o_closed_menu " >
+ <div class="form-group ">
+ <div class="show-gl" aria-atomic="true" id="" data-target-input="">
+ <li role="presentation">
+ <a role="menuitem" style="background-color:aqua; font-weight:bold;" t-att-data-account-id="account['id']" class="show-gl" >View General Ledger</a>
+ </li>
+ </div>
+ </div>
+
+ </div>
+ </div>
+ </div>
+ </td>
+ <td t-att-style="fr_padding"><t t-esc="a['m_debit']" t-att-style="style"/></td>
+ <td t-att-style="fr_padding"><t t-esc="a['m_credit']" t-att-style="style"/></td>
+ <td t-att-style="fr_padding"><t t-esc="a['m_balance']" t-att-style="style"/></td>
+
+
+
+ <t t-set="common_id" t-value="'a'+account['id']"/>
+ </tr>
+ </t>
+ </t>
+
+ </t>
+ <t t-else="">
+ <t t-set="style" t-value="'padding: 5px;padding-left: 25px;'"/>
+ <t t-set="fr_head" t-value="'border-bottom: double;'"/>
+ <t t-set="fr_padding" t-value="'padding-top: 5px; text-align: right;padding-right: 50px; vertical-align: bottom;'"/>
+ <t t-if="a['level'] == 1">
+ <t t-set="style" t-value="'padding: 5px;padding-left: 15px; padding-top: 15px;'"/>
+ </t>
+ <t t-if="a['level'] == 2">
+ <t t-set="style" t-value="'padding: 5px;padding-left: 25px; padding-top: 25px;'"/>
+ </t>
+ <t t-if="a['level'] == 3">
+ <t t-set="style" t-value="'padding: 5px;padding-left: 50px;'"/>
+ <t t-set="fr_head" t-value="'border-bottom: 1px solid black;'"/>
+ </t>
+ <t t-if="a['level'] &gt; 3">
+ <t t-set="style" t-value="'padding: 5px;padding-left: 50px;'"/>
+ <t t-set="fr_head" t-value="'border-bottom: 1px solid black;'"/>
+ </t>
+ <tr t-att-style="fr_head">
+ <th colspan="6" t-att-style="style">
+ <t t-esc="a['name']"/>
+ </th>
+ <td t-att-style="fr_padding"><t t-esc="a['m_debit']"/></td>
+ <td t-att-style="fr_padding"><t t-esc="a['m_credit']"/></td>
+ <td t-att-style="fr_padding"><t t-esc="a['m_balance']"/></td>
+ </tr>
+ </t>
+
+ </t>
+
+ </tbody>
+
+ </table>
+
+ </div>
+ </div>
+ </t>
+ <t t-name="DfrFilterView">
+ <div class="">
+ <h1 style="padding:10px">
+ <t t-esc="title"/>
+ </h1>
+
+ </div>
+ <div class="" style="position: relative;">
+
+ <div class="sub_container_left">
+ <div class="report_print">
+ <button type="button" class="btn btn-primary" id="pdf"
+ style="left:10px; height:30px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD;
+ padding:3px;">
+ Print (PDF)
+ </button>
+ <button type="button" class="btn btn-primary" id="xlsx"
+ style="left:20px; height:30px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD;">
+ Export (XLSX)
+ </button>
+ </div>
+ </div>
+ <br></br>
+ <div class="sub_container_right" style="width:50%;height:3%;right:0px;top:0px;position: absolute;">
+ <div class="" style="right:80x;">
+
+ <br></br>
+ <div class="row" style="right:80px;top:0px;position: absolute;width:50;">
+ <div class="time_range" style="">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
+ <span class="fa fa-calendar" title="Dates" role="img" aria-label="Dates"></span>
+Date Range
+ </a>
+ <div class="dropdown-menu" role="menu">
+ <div class="" >
+ <label class="" for="date_from">Start Date :</label>
+ <div class="">
+ <div class="" aria-atomic="true" id="" >
+ <input type="date" id="date_from"></input>
+ </div>
+ </div>
+ <label class="" for="date_to">End Date :</label>
+ <div class="">
+ <div class="" aria-atomic="true" id="" >
+ <input type="date" id="date_to"></input>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="journals_filter" style="">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown">
+ <span class="fa fa-book"></span>
+Journals:
+ </a>
+ <select class="dropdown-menu journals" name="states[]" multiple="multiple">
+ <div role="separator" class="dropdown-divider"></div>
+ <t t-foreach="filter_data.journals_list" t-as="journal">
+ <option t-attf-value="{{journal[0]}}"><t t-esc="journal[1]"/>
+ </option>
+ </t>
+ </select>
+ <span id="journal_res"></span>
+ </div>
+
+ <div class="accounts_filter">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown">
+ <span class="fa fa-book"></span>
+ Accounts:
+ </a>
+ <select class="dropdown-menu account" name="states[]" multiple="multiple">
+ <t t-foreach="filter_data.accounts_list" t-as="account">
+ <option t-attf-value="{{account[0]}}">
+ <t t-esc="account[1]"/>
+ </option>
+ </t>
+ </select>
+ <span id="acc_res"></span>
+ </div>
+
+ <div class="account_tags_filter">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown">
+ <span class="fa fa-book"></span>
+ Account Tags:
+ </a>
+ <select class="dropdown-menu account-tag" name="states[]" multiple="multiple">
+ <t t-foreach="filter_data.account_tag_list" t-as="account_tag">
+ <option t-attf-value="{{account_tag[0]}}">
+ <t t-esc="account_tag[1]"/>
+ </option>
+ </t>
+ </select>
+ <span id="acc_tag_res"></span>
+ </div>
+
+ <div class="analytics_filter">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown">
+ <span class="fa fa-book"></span>
+ Analytic Accounts:
+ </a>
+ <select class="dropdown-menu analytics" name="states[]" multiple="multiple">
+ <t t-foreach="filter_data.analytic_list" t-as="analytic">
+ <option t-attf-value="{{analytic[0]}}">
+ <t t-esc="analytic[1]"/>
+ </option>
+ </t>
+ </select>
+ <span id="analytic_res"></span>
+ </div>
+
+ <div class="analytic_tags_filter">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown">
+ <span class="fa fa-book"></span>
+ Analytic Tags:
+ </a>
+ <select class="dropdown-menu analytic-tag" name="states[]" multiple="multiple">
+ <t t-foreach="filter_data.analytic_tag_list" t-as="analytic_tag">
+ <option t-attf-value="{{analytic_tag[0]}}">
+ <t t-esc="analytic_tag[1]"/>
+ </option>
+ </t>
+ </select>
+ <span id="analic_tag_res"></span>
+ </div>
+
+
+ <div class="search-Target-move" style="">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown">
+ <span class="fa fa-filter"></span>
+Target Move:
+ </a>
+ <select id="entries" class="dropdown-menu target_move" name="states[]" >
+ <div role="separator" class="dropdown-divider"></div>
+ <option value="Posted">Posted Entries</option>
+ <option value="All">All Entries</option>
+
+ </select>
+ <span id="post_res"></span>
+ </div>
+ </div>
+
+ </div>
+ <div style="">
+ <button type="button" id="apply_filter" class="btn btn-primary"
+ style="top:0px;height:30px;right:20px;position: absolute;color:white;background-color: #00A0AD;border-color: #00A0AD;">
+ Apply
+ </button>
+
+ </div>
+ </div>
+ </div>
+ </t>
+
+</templates> \ No newline at end of file
diff --git a/dynamic_accounts_report/static/src/xml/general_ledger_view.xml b/dynamic_accounts_report/static/src/xml/general_ledger_view.xml
new file mode 100644
index 0000000..7a5c582
--- /dev/null
+++ b/dynamic_accounts_report/static/src/xml/general_ledger_view.xml
@@ -0,0 +1,395 @@
+<templates>
+ <t t-name="GeneralTemp">
+ <div>
+ <div>
+ <div class="filter_view_tb"></div>
+ </div>
+ <br></br>
+ <div>
+ <div class="table_view_tb" style="right:20px;"></div>
+ </div>
+ </div>
+ </t>
+ <t t-name="GLTable">
+ <div>
+ <div class="table_main_view">
+ <table cellspacing="0" width="100%">
+ <thead>
+ <tr>
+ <th colspan="6">Account</th>
+ <th class="mon_fld">Debit</th>
+ <th class="mon_fld">Credit</th>
+ <th class="mon_fld">Balance</th>
+ </tr>
+ </thead>
+ <tbody>
+ <t t-set="none_value" t-value="_"/>
+ <t t-foreach="report_lines" t-as="account">
+ <t t-set="common_id" t-value="0"/>
+ <tr style="border: 1.5px solid black;" class="gl-line"
+ data-toggle="collapse"
+ t-att-data-account-id="account['id']"
+ t-attf-data-target=".a{{account['id']}}">
+ <td colspan="6" style="border: 0px solid black;">
+ <i class="fa fa-caret-down" role="img" aria-label="Unfolded" title="Unfolded"></i>
+ <span>
+ <t t-esc="account['code']"/>
+ -
+ <t t-esc="account['name']"/>
+ </span>
+ </td>
+
+ <t t-if="currency[1] == 'before'">
+ <td class="mon_fld">
+ <t t-if="account['debit'] == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="currency[0]"/>
+ <t t-esc="account['debit']"/>
+<!-- <t t-raw="Math.round(account['debit'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ </t>
+ </td>
+ <td class="mon_fld">
+ <t t-if="account['credit'] == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="currency[0]"/>
+ <t t-esc="account['credit']"/>
+<!-- <t t-raw="Math.round(account['credit'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ </t>
+ </td>
+ <td class="mon_fld">
+ <t t-if="account['balance'] == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="currency[0]"/>
+ <t t-esc="account['balance']"/>
+<!-- <t t-raw="Math.round(account['balance'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ </t>
+ </td>
+
+ </t>
+ <t t-else="">
+ <td class="mon_fld">
+ <t t-if="account['debit'] == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account['debit']"/>
+<!-- <t t-raw="Math.round(account['debit'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ <t t-esc="currency[0]"/>
+ </t>
+ </td>
+ <td class="mon_fld">
+ <t t-if="account['credit'] == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account['credit']"/>
+<!-- <t t-raw="Math.round(account['credit'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ <t t-esc="currency[0]"/>
+ </t>
+ </td>
+ <td class="mon_fld">
+ <t t-if="account['balance'] == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account['balance']"/>
+<!-- <t t-raw="Math.round(account['balance'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ <t t-esc="currency[0]"/>
+ </t>
+ </td>
+
+ </t>
+
+
+ <t t-set="common_id" t-value="'a'+account['id']"/>
+ </tr>
+
+ <tr t-attf-class="collapse a{{account['id']}}">
+ <td colspan="10">
+ <ul>
+ </ul>
+ </td>
+ </tr>
+
+ </t>
+
+ </tbody>
+
+ </table>
+ </div>
+ </div>
+ </t>
+
+
+ <t t-name="GLFilterView">
+ <div>
+ <h1 style="padding:10px">
+ <t t-esc="title"/>
+ </h1>
+
+ </div>
+ <div class="" style="position: relative;">
+ <div class="sub_container_left">
+ <div class="report_print">
+ <button type="button" class="btn btn-primary" id="pdf"
+ style="left:10px; height:30px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD; padding:3px;">
+ Print (PDF)
+ </button>
+ <button type="button" class="btn btn-primary" id="xlsx"
+ style="left:10px; height:30px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD; padding:3px;">
+ Export (XLSX)
+ </button>
+ </div>
+ </div>
+ <br></br>
+ <div class="sub_container_right" style="width:50%;height:3%;right:0px;top:0px;position: absolute;">
+ <div class="" style="right:80x;">
+
+ <br></br>
+ <div class="row" style="right:80px;top:0px;position: absolute;width:50;">
+ <div class="time_range" style="">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
+ <span class="fa fa-calendar" title="Dates" role="img" aria-label="Dates"></span>
+ Date Range
+ </a>
+ <div class="dropdown-menu" role="menu">
+ <div class="">
+ <label class="" for="date_from">Start Date :</label>
+ <div class="">
+ <div class="" aria-atomic="true" id="">
+ <input type="date" id="date_from"></input>
+ </div>
+ </div>
+ <label class="" for="date_to">End Date :</label>
+ <div class="">
+ <div class="" aria-atomic="true" id="">
+ <input type="date" id="date_to"></input>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="journals_filter" style="">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown">
+ <span class="fa fa-book"></span>
+ Journals:
+ </a>
+ <select class="dropdown-menu journals" name="states[]" multiple="multiple">
+ <div role="separator" class="dropdown-divider"></div>
+ <t t-foreach="filter_data.journals_list" t-as="journal">
+ <option t-attf-value="{{journal[0]}}">
+ <t t-esc="journal[1]"/>
+ </option>
+ </t>
+ </select>
+ <span id="journal_res"></span>
+ </div>
+
+ <div class="accounts_filter">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown">
+ <span class="fa fa-book"></span>
+ Accounts:
+ </a>
+ <select class="dropdown-menu account" name="states[]" multiple="multiple">
+ <t t-foreach="filter_data.accounts_list" t-as="account">
+ <option t-attf-value="{{account[0]}}">
+ <t t-esc="account[1]"/>
+ </option>
+ </t>
+ </select>
+ <span id="acc_res"></span>
+ </div>
+
+ <div class="analytics_filter">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown">
+ <span class="fa fa-book"></span>
+ Analytic Accounts:
+ </a>
+ <select class="dropdown-menu analytics" name="states[]" multiple="multiple">
+ <t t-foreach="filter_data.analytic_list" t-as="analytic">
+ <option t-attf-value="{{analytic[0]}}">
+ <t t-esc="analytic[1]"/>
+ </option>
+ </t>
+ </select>
+ <span id="analytic_res"></span>
+ </div>
+
+ <div class="analytic_tags_filter">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown">
+ <span class="fa fa-book"></span>
+ Analytic Tags:
+ </a>
+ <select class="dropdown-menu analytic_tags" name="states[]" multiple="multiple">
+ <t t-foreach="filter_data.analytic_tag_list" t-as="analytic_tag">
+ <option t-attf-value="{{analytic_tag[0]}}">
+ <t t-esc="analytic_tag[1]"/>
+ </option>
+ </t>
+ </select>
+ <span id="analytic_tag_res"></span>
+ </div>
+
+
+ <div class="search-Target-move" style="">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown">
+ <span class="fa fa-filter"></span>
+ Target Move:
+ </a>
+ <select id="entries" class="dropdown-menu target_move" name="states[]">
+ <div role="separator" class="dropdown-divider"></div>
+ <option value="Posted">Posted Entries</option>
+ <option value="All">All Entries</option>
+ </select>
+ <span id="post_res"></span>
+ </div>
+ </div>
+
+ </div>
+ <div style="">
+ <button type="button" id="apply_filter" class="btn btn-primary"
+ style="top:0px;height:30px;right:20px;position: absolute;color:white;background-color: #00A0AD;border-color: #00A0AD;">
+ Apply
+ </button>
+
+ </div>
+ </div>
+ </div>
+ </t>
+
+
+ <t t-name="SubSection">
+ <div class="gl-table-div">
+ <table class="table table-sm o_main_table"
+ style="border: 0px solid black;display compact;">
+ <thead>
+ <tr style="">
+ <th>Date</th>
+ <th>JRNL</th>
+ <th>Partner</th>
+ <th>Move</th>
+ <th>Entry Label</th>
+ <th class="mon_fld">Debit</th>
+ <th class="mon_fld">Credit</th>
+ <th class="mon_fld">Balance</th>
+ </tr>
+ </thead>
+ <tbody>
+ <t t-foreach="account_data" t-as="account_line">
+ <t t-set="style" t-value="''"/>
+ <t t-set="style_right" t-value="'text-align:right;'"/>
+ <tr>
+ <td>
+ <t t-if="account_line.ldate">
+ <div class="dropdown dropdown-toggle">
+ <a data-toggle="dropdown" href="#">
+ <span class="caret"></span>
+ <span>
+ <t t-esc="account_line.ldate"/>
+ </span>
+ </a>
+ <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu">
+ <li>
+ <a class="view-account-move" tabindex="-1" href="#"
+ t-att-data-move-id="account_line.move_id">
+ View Source move
+
+ </a>
+ </li>
+ </ul>
+ </div>
+ </t>
+ </td>
+ <td>
+ <t t-esc="account_line.lcode"/>
+ </td>
+ <td>
+ <t t-esc="account_line.partner_name"/>
+ </td>
+ <td t-att-style="style">
+ <t t-esc="account_line.move_name"/>
+ </td>
+ <td t-att-style="style">
+ <t t-esc="account_line.lname"/>
+ </td>
+ <t t-if="currency_position == 'before'">
+ <td t-att-style="style_right" class="amt">
+ <t t-if="account_line.debit == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account_line.currency_code"/>
+ <t t-esc="account_line.debit"/>
+<!-- <t t-esc="Math.round(account_line.debit * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ </t>
+ </td>
+ <td t-att-style="style_right" class="amt">
+ <t t-if="account_line.credit == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account_line.currency_code"/>
+ <t t-esc="account_line.credit"/>
+<!-- <t t-esc="Math.round(account_line.credit * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ </t>
+ </td>
+ <td t-att-style="style_right" class="amt">
+ <t t-if="account_line.balance == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account_line.currency_code"/>
+ <t t-esc="account_line.balance"/>
+<!-- <t t-esc="Math.round(account_line.balance * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ </t>
+ </td>
+ </t>
+ <t t-else="">
+ <td t-att-style="style_right" class="amt">
+ <t t-if="account_line.debit == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account_line.debit"/>
+<!-- <t t-esc="Math.round(account_line.debit * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ <t t-esc="account_line.currency_code"/>
+ </t>
+ </td>
+ <td t-att-style="style_right" class="amt">
+ <t t-if="account_line.credit == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account_line.credit"/>
+<!-- <t t-esc="Math.round(account_line.credit * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ <t t-esc="account_line.currency_code"/>
+ </t>
+ </td>
+ <td t-att-style="style_right" class="amt">
+ <t t-if="account_line.balance == 0">
+ <span>-</span>
+ </t>
+ <t t-else="">
+ <t t-esc="account_line.balance"/>
+<!-- <t t-esc="Math.round(account_line.balance * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ <t t-esc="account_line.currency_code"/>
+ </t>
+ </td>
+ </t>
+
+ </tr>
+
+ </t>
+ </tbody>
+ </table>
+ </div>
+ </t>
+
+
+</templates> \ No newline at end of file
diff --git a/dynamic_accounts_report/static/src/xml/partner_ledger_view.xml b/dynamic_accounts_report/static/src/xml/partner_ledger_view.xml
new file mode 100644
index 0000000..db244e5
--- /dev/null
+++ b/dynamic_accounts_report/static/src/xml/partner_ledger_view.xml
@@ -0,0 +1,340 @@
+<templates>
+ <t t-name="PartnerTemp">
+ <div class="">
+ <div class="">
+ <h1 style="padding:10px">
+ Partner Ledger
+ </h1>
+ </div>
+
+ <div>
+ <div class="filter_view_tb"></div>
+ </div>
+ <br></br>
+ <div>
+ <div class="table_view_tb" style="right:20px;"></div>
+ </div>
+ </div>
+ </t>
+ <t t-name="PLTable">
+ <div>
+ <div class="table_main_view">
+ <table cellspacing="0" width="100%">
+ <thead>
+ <tr>
+ <th colspan="6">Partner</th>
+ <th style="text-align:right;">Debit</th>
+ <th style="text-align:right;">Credit</th>
+ <th style="text-align:right;">Balance</th>
+ </tr>
+ </thead>
+
+ <tbody>
+ <t t-set="none_value" t-value="_"/>
+ <t t-foreach="report_lines" t-as="account">
+ <t t-set="common_id" t-value="0"/>
+ <tr style="border: 1.5px solid black;" class="pl-line"
+ data-toggle="collapse"
+ t-att-data-account-id="account['id']"
+ t-attf-data-target=".a{{account['id']}}">
+ <td colspan="6" style="border: 0px solid black;">
+ <i class="fa fa-caret-down" role="img" aria-label="Unfolded" title="Unfolded"></i>
+ <span>
+ <t t-esc="account['name']"/>
+ </span>
+ </td>
+
+ <t t-if="currency[1] == 'before'">
+ <td style="text-align:right;">
+ <t t-esc="currency[0]"/>
+ <t t-raw="account['debit']"/>
+ </td>
+ <td style="text-align:right;">
+ <t t-esc="currency[0]"/>
+ <t t-raw="account['credit']"/>
+ </td>
+ <td style="text-align:right;">
+ <t t-esc="currency[0]"/>
+ <t t-raw="account['balance']"/>
+ </td>
+
+ </t>
+ <t t-else="">
+ <td style="text-align:right;">
+ <t t-raw="account['debit']"/>
+ <t t-esc="currency[0]"/>
+ </td>
+ <td style="text-align:right;">
+ <t t-raw="account['credit']"/>
+ <t t-esc="currency[0]"/>
+ </td>
+ <td style="text-align:right;">
+ <t t-raw="account['balance']"/>
+ <t t-esc="currency[0]"/>
+ </td>
+
+ </t>
+ <t t-set="common_id" t-value="'a'+account['id']"/>
+ </tr>
+ <tr t-attf-class="collapse a{{account['id']}}">
+ <td colspan="10">
+ <ul>
+ </ul>
+ </td>
+ </tr>
+ </t>
+ </tbody>
+
+ </table>
+ </div>
+ </div>
+ </t>
+
+ <t t-name="PLFilterView">
+ <div class="" style="position: relative;">
+ <div class="sub_container_left">
+ <div class="report_print">
+ <button type="button" class="btn btn-primary" id="pdf"
+ style="left:10px; height:30px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD; padding:3px;">
+ Print (PDF)
+ </button>
+ <button type="button" class="btn btn-primary" id="xlsx"
+ style="left:10px; height:30px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD; padding:3px;">
+ Export (XLSX)
+ </button>
+ </div>
+ </div>
+ <br></br>
+ <div class="sub_container_right" style="width:50%;height:3%;right:0px;top:0px;position: absolute;">
+ <div class="" style="right:80x;">
+
+ <br></br>
+ <div class="row" style="right:80px;top:0px;position: absolute;width:50;">
+ <div class="time_range" style="">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
+ <span class="fa fa-calendar" title="Dates" role="img" aria-label="Dates"></span>
+ Date Range
+ </a>
+ <div class="dropdown-menu" role="menu">
+ <div class="">
+ <label class="" for="date_from">Start Date :</label>
+ <div class="">
+ <div class="" aria-atomic="true" id="">
+ <input type="date" id="date_from"></input>
+ </div>
+ </div>
+ <label class="" for="date_to">End Date :</label>
+ <div class="">
+ <div class="" aria-atomic="true" id="">
+ <input type="date" id="date_to"></input>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="partner_filter" style="">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown">
+ <span class="fa fa-users"></span>
+ Partners:
+ </a>
+ <select class="dropdown-menu partners " name="states[]" multiple="multiple">
+ <t t-foreach="filter_data.partners_list" t-as="partner">
+ <option t-attf-value="{{partner[0]}}">
+ <t t-esc="partner[1]"/>
+ </option>
+ </t>
+ </select>
+ <span id="partner_res"></span>
+
+ </div>
+
+ <div class="acccount_type_filter">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown">
+ <span class="fa fa-book"></span>
+ Account Type
+ </a>
+ <select class="dropdown-menu type" name="states[]" multiple="multiple">
+ <t t-foreach="filter_data.account_type_list" t-as="type">
+ <option t-attf-value="{{type[0]}}">
+ <t t-esc="type[1]"/>
+ </option>
+ </t>
+ </select>
+ <span id="type_res"></span>
+
+ </div>
+ <div class="category_filter">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown">
+ <span class="fa fa-filter"></span>
+ Partner tag:
+ </a>
+ <select class="dropdown-menu category" name="states[]" multiple="multiple">
+ <t t-foreach="filter_data.category_list" t-as="category">
+ <option t-attf-value="{{category[0]}}">
+ <t t-esc="category[1]"/>
+ </option>
+ </t>
+ </select>
+ <span id="category_res"></span>
+
+ </div>
+
+ <div class="journals_filter" style="">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown">
+ <span class="fa fa-book"></span>
+ Journals:
+ </a>
+ <select class="dropdown-menu journals" name="states[]" multiple="multiple">
+ <div role="separator" class="dropdown-divider"></div>
+ <t t-foreach="filter_data.journals_list" t-as="journal">
+ <option t-attf-value="{{journal[0]}}">
+ <t t-esc="journal[1]"/>
+ </option>
+ </t>
+ </select>
+ <span id="journal_res"></span>
+ </div>
+ <div class="acc_filter">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown">
+ <span class="fa fa-book"></span>
+ Accounts:
+ </a>
+ <select class="dropdown-menu account" name="states[]" multiple="multiple">
+ <t t-foreach="filter_data.accounts_list" t-as="account">
+ <option t-attf-value="{{account[0]}}">
+ <t t-esc="account[1]"/>
+ </option>
+ </t>
+ </select>
+ <span id="account_res"></span>
+
+
+ </div>
+
+
+ <div class="search-Target-move" style="">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown">
+ <span class="fa fa-filter"></span>
+ Target Move:
+ </a>
+ <select id="entries" class="dropdown-menu target_move" name="states[]">
+ <div role="separator" class="dropdown-divider"></div>
+ <option value="Posted">Posted Entries</option>
+ <option value="All">All Entries</option>
+ </select>
+ <span id="post_res"></span>
+ </div>
+ </div>
+
+ </div>
+ <div style="">
+ <button type="button" id="apply_filter" class="btn btn-primary"
+ style="top:0px;height:30px;right:20px;position: absolute;color:white;background-color: #00A0AD;border-color: #00A0AD;">
+ Apply
+ </button>
+
+ </div>
+ </div>
+ </div>
+ </t>
+
+ <t t-name="SubSectionPL">
+ <div class="pl-table-div">
+ <table class="table table-sm o_main_table"
+ style="border: 0px solid black;display compact;">
+ <thead>
+ <tr style="">
+ <th>Date</th>
+ <th>JRNL</th>
+ <th>Account</th>
+ <th>Move</th>
+ <th>Entry Label</th>
+ <th style="text-align:right;">Debit</th>
+ <th style="text-align:right;">Credit</th>
+ <th style="text-align:right;">Balance</th>
+ </tr>
+ </thead>
+ <tbody>
+ <t t-foreach="account_data" t-as="account_line">
+
+ <t t-set="style" t-value="'text-align:right;'"/>
+ <t t-set="styleleft" t-value="'text-align:left;'"/>
+ <tr>
+ <td>
+ <t t-if="account_line.ldate">
+ <div class="dropdown dropdown-toggle">
+ <a data-toggle="dropdown" href="#">
+ <span class="caret"></span>
+ <span>
+ <t t-esc="account_line.ldate"/>
+ </span>
+ </a>
+ <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu">
+ <li>
+ <a class="view-account-move" tabindex="-1" href="#"
+ t-att-data-move-id="account_line.move_id">
+ View Source move
+
+ </a>
+ </li>
+ </ul>
+ </div>
+ </t>
+ </td>
+ <td>
+ <t t-esc="account_line.lcode"/>
+
+ </td>
+ <td>
+ <span>
+ <t t-esc="account_line.account_name"/>
+ </span>
+ </td>
+ <td t-att-style="styleleft">
+ <t t-esc="account_line.move_name"/>
+ </td>
+ <td t-att-style="styleleft">
+ <t t-esc="account_line.lname"/>
+ </td>
+ <t t-if="account_line.currency_position == 'before'">
+ <td t-att-style="style" class="amt">
+ <t t-raw="account_line.currency_code"/>
+ <t t-raw="account_line.debit"/>
+
+ </td>
+ <td t-att-style="style" class="amt">
+ <t t-raw="account_line.currency_code"/>
+ <t t-raw="account_line.credit"/>
+
+ </td>
+ <td t-att-style="style" class="amt">
+ <t t-raw="account_line.currency_code"/>
+ <t t-raw="account_line.balance"/>
+
+ </td>
+
+ </t>
+ <t t-else="">
+ <td t-att-style="style" class="amt">
+ <t t-raw="account_line.debit"/>
+ <t t-raw="account_line.currency_code"/>
+ </td>
+ <td t-att-style="style" class="amt">
+ <t t-raw="account_line.credit"/>
+ <t t-raw="account_line.currency_code"/>
+ </td>
+ <td t-att-style="style" class="amt">
+ <t t-raw="account_line.balance"/>
+ <t t-raw="account_line.currency_code"/>
+ </td>
+
+ </t>
+
+ </tr>
+ </t>
+ </tbody>
+ </table>
+ </div>
+ </t>
+
+</templates> \ No newline at end of file
diff --git a/dynamic_accounts_report/static/src/xml/trial_balance_view.xml b/dynamic_accounts_report/static/src/xml/trial_balance_view.xml
new file mode 100644
index 0000000..76869be
--- /dev/null
+++ b/dynamic_accounts_report/static/src/xml/trial_balance_view.xml
@@ -0,0 +1,283 @@
+<templates>
+ <t t-name="TrialTemp">
+ <div class="">
+ <div class="">
+ <h1 style="padding:10px">
+ Trial Balance
+ </h1>
+
+ </div>
+
+ <div>
+ <div class="filter_view_tb"></div>
+ </div>
+ <br></br>
+ <div>
+ <div class="table_view_tb" style="right:20px;"></div>
+ </div>
+ </div>
+ </t>
+ <t t-name="TrialTable">
+ <div>
+ <div class="table_main_view">
+ <table cellspacing="0" width="100%">
+ <thead>
+ <tr>
+ <th colspan="6">Account</th>
+ <t t-if="filter['date_from']">
+ <th class="mon_fld">Initial Debit</th>
+ <th class="mon_fld">Initial Credit</th>
+
+ </t>
+ <th class="mon_fld">Debit</th>
+ <th class="mon_fld">Credit</th>
+ </tr>
+ </thead>
+
+ <tbody>
+
+ <t t-set="none_value" t-value="_"/>
+ <t t-foreach="report_lines" t-as="account">
+ <t t-set="common_id" t-value="0"/>
+ <tr style="border: 1.5px solid black;" class="gl-line"
+ data-toggle="collapse"
+ t-att-data-account-id="account['id']"
+ t-attf-data-target=".a{{account['id']}}">
+ <td colspan="6" style="border: 0px solid black;">
+ <span>
+ <t t-esc="account['code']"/>
+ -
+ <t t-esc="account['name']"/>
+ </span>
+ <div class="" style="display: inline-block;">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown"
+ aria-expanded="false">
+ </a>
+ <div class="dropdown-menu " role="menu">
+ <div class="o_foldable_menu o_closed_menu ">
+ <div class="form-group ">
+ <div class="show-gl" aria-atomic="true" id="" data-target-input="">
+ <li role="presentation">
+ <a role="menuitem" style="background-color:aqua; font-weight:bold;"
+ t-att-data-account-id="account['id']" class="show-gl">
+ View General Ledger
+ </a>
+ </li>
+ </div>
+ </div>
+
+ </div>
+ </div>
+ </div>
+ </td>
+ <t t-if="filter['date_from']">
+ <t t-if="account['Init_balance']">
+ <t t-if="currency[1] == 'before'">
+
+ <td class="mon_fld">
+ <t t-esc="currency[0]"/>
+ <t t-raw="account['Init_balance']['debit']"/>
+ </td>
+ <td class="mon_fld">
+ <t t-esc="currency[0]"/>
+ <t t-raw="account['Init_balance']['credit']"/>
+ </td>
+ </t>
+ <t t-else="">
+ <td class="mon_fld">
+ <t t-raw="account['Init_balance']['debit']"/>
+ <t t-esc="currency[0]"/>
+ </td>
+ <td class="mon_fld">
+ <t t-raw="account['Init_balance']['credit']"/>
+ <t t-esc="currency[0]"/>
+ </td>
+
+
+ </t>
+ </t>
+ <t t-else="">
+ <t t-if="currency[1] == 'before'">
+ <td class="mon_fld">
+ <t t-esc="currency[0]"/>0
+ </td>
+ <td class="mon_fld">
+ <t t-esc="currency[0]"/>0
+ </td>
+ </t>
+ <t t-else="">
+ <td class="mon_fld">
+ 0
+ <t t-esc="currency[0]"/>
+ </td>
+ <td class="mon_fld">
+ 0
+ <t t-esc="currency[0]"/>
+ </td>
+ </t>
+ </t>
+ </t>
+ <t t-if="currency[1] == 'before'">
+ <td class="mon_fld">
+ <t t-esc="currency[0]"/>
+ <t t-raw="account['debit']"/>
+ </td>
+ <td class="mon_fld">
+ <t t-esc="currency[0]"/>
+ <t t-raw="account['credit']"/>
+ </td>
+
+ </t>
+ <t t-else="">
+ <td class="mon_fld">
+ <t t-raw="account['debit']"/>
+ <t t-esc="currency[0]"/>
+ </td>
+ <td class="mon_fld">
+ <t t-raw="account['credit']"/>
+ <t t-esc="currency[0]"/>
+ </td>
+
+ </t>
+
+ <t t-set="common_id" t-value="'a'+account['id']"/>
+ </tr>
+ </t>
+ <td colspan="6" style="" class="">
+ <strong>Total</strong>
+ </td>
+ <t t-if="filter['date_from']">
+
+ <td class="mon_fld" style="">
+ <strong></strong>
+ </td>
+ <td class="mon_fld" style="">
+ <strong></strong>
+ </td>
+ </t>
+ <t t-if="currency[1] == 'before'">
+ <td class="mon_fld" style="">
+ <strong>
+ <t t-esc="currency[0]"/>
+<!-- <t t-raw="Math.round(debit_total * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ <t t-esc="debit_total"/>
+ </strong>
+ </td>
+ <td class="mon_fld" style="">
+ <strong>
+ <t t-esc="currency[0]"/>
+<!-- <t t-raw="Math.round(credit_total * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
+ <t t-esc="credit_total"/>
+ </strong>
+ </td>
+ </t>
+ <t t-else="">
+
+ <td class="mon_fld" style="">
+ <strong>
+ <t t-raw="Math.round(debit_total * Math.pow(10, 2)) / Math.pow(10, 2)"/>
+ <t t-esc="currency[0]"/>
+ </strong>
+ </td>
+ <td class="mon_fld" style="">
+ <strong>
+ <t t-raw="Math.round(credit_total * Math.pow(10, 2)) / Math.pow(10, 2)"/>
+ <t t-esc="currency[0]"/>
+ </strong>
+ </td>
+ </t>
+
+ </tbody>
+
+ </table>
+ </div>
+ </div>
+ </t>
+
+
+ <t t-name="TrialFilterView">
+
+ <div class="" style="position: relative;">
+ <div class="sub_container_left">
+ <div class="report_print">
+ <button type="button" class="btn btn-primary" id="pdf"
+ style="left:10px; height:30px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD; padding:3px;">
+ Print (PDF)
+ </button>
+ <button type="button" class="btn btn-primary" id="xlsx"
+ style="left:10px; height:30px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD; padding:3px;">
+ Export (XLSX)
+ </button>
+ </div>
+ </div>
+ <br></br>
+ <div class="sub_container_right" style="width:50%;height:3%;right:0px;top:0px;position: absolute;">
+ <div class="" style="right:80x;">
+
+ <br></br>
+ <div class="row" style="right:110px;top:0px;position: absolute;width:50;">
+ <div class="time_range" style="">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
+ <span class="fa fa-calendar" title="Dates" role="img" aria-label="Dates"></span>
+ Date Range
+ </a>
+ <div class="dropdown-menu" role="menu">
+ <div class="">
+ <label class="" for="date_from">Start Date :</label>
+ <div class="">
+ <div class="" aria-atomic="true" id="">
+ <input type="date" id="date_from"></input>
+ </div>
+ </div>
+ <label class="" for="date_to">End Date :</label>
+ <div class="">
+ <div class="" aria-atomic="true" id="">
+ <input type="date" id="date_to"></input>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="journals_filter" style="">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown">
+ <span class="fa fa-book"></span>
+ Journals:
+ </a>
+ <select class="dropdown-menu journals" name="states[]" multiple="multiple">
+ <div role="separator" class="dropdown-divider"></div>
+ <t t-foreach="filter_data.journals_list" t-as="journal">
+ <option t-attf-value="{{journal[0]}}">
+ <t t-esc="journal[1]"/>
+ </option>
+ </t>
+ </select>
+ <span id="journal_res"></span>
+ </div>
+
+ <div class="search-Target-move" style="">
+ <a type="button" class="dropdown-toggle" data-toggle="dropdown">
+ <span class="fa fa-filter"></span>
+ Target Move:
+ </a>
+ <select id="entries" class="dropdown-menu target_move" name="states[]">
+ <div role="separator" class="dropdown-divider"></div>
+ <option value="Posted">Posted Entries</option>
+ <option value="All">All Entries</option>
+ </select>
+ <span id="post_res"></span>
+ </div>
+ </div>
+
+ </div>
+ <div style="">
+ <button type="button" id="apply_filter" class="btn btn-primary"
+ style="top:0px;height:30px;right:20px;position: absolute;color:white;background-color: #00A0AD;border-color: #00A0AD;">
+ Apply
+ </button>
+
+ </div>
+ </div>
+ </div>
+ </t>
+
+</templates> \ No newline at end of file