|
|
@ -9,6 +9,9 @@ odoo.define('dynamic_accounts_report.financial_reports', function (require) { |
|
|
|
var QWeb = core.qweb; |
|
|
|
var _t = core._t; |
|
|
|
|
|
|
|
var datepicker = require('web.datepicker'); |
|
|
|
var time = require('web.time'); |
|
|
|
|
|
|
|
window.click_num = 0; |
|
|
|
var ProfitAndLoss = AbstractAction.extend({ |
|
|
|
template: 'dfr_template_new', |
|
|
@ -19,6 +22,7 @@ odoo.define('dynamic_accounts_report.financial_reports', function (require) { |
|
|
|
'click #pdf': 'print_pdf', |
|
|
|
'click #xlsx': 'print_xlsx', |
|
|
|
'click .show-gl': 'show_gl', |
|
|
|
'mousedown div.input-group.date[data-target-input="nearest"]': '_onCalendarIconClick', |
|
|
|
}, |
|
|
|
|
|
|
|
init: function(parent, action) { |
|
|
@ -41,6 +45,35 @@ odoo.define('dynamic_accounts_report.financial_reports', function (require) { |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
_onCalendarIconClick: function (ev) { |
|
|
|
var $calendarInputGroup = $(ev.currentTarget); |
|
|
|
|
|
|
|
var calendarOptions = { |
|
|
|
|
|
|
|
minDate: moment({ y: 1000 }), |
|
|
|
maxDate: moment().add(200, 'y'), |
|
|
|
calendarWeeks: true, |
|
|
|
defaultDate: moment().format(), |
|
|
|
sideBySide: true, |
|
|
|
buttons: { |
|
|
|
showClear: true, |
|
|
|
showClose: true, |
|
|
|
showToday: true, |
|
|
|
}, |
|
|
|
|
|
|
|
icons : { |
|
|
|
date: 'fa fa-calendar', |
|
|
|
|
|
|
|
}, |
|
|
|
locale : moment.locale(), |
|
|
|
format : time.getLangDateFormat(), |
|
|
|
widgetParent: 'body', |
|
|
|
allowInputToggle: true, |
|
|
|
}; |
|
|
|
|
|
|
|
$calendarInputGroup.datetimepicker(calendarOptions); |
|
|
|
}, |
|
|
|
|
|
|
|
load_data: function (initial_render = true) { |
|
|
|
var self = this; |
|
|
|
var action_title = self._title; |
|
|
@ -53,6 +86,7 @@ odoo.define('dynamic_accounts_report.financial_reports', function (require) { |
|
|
|
args: [[this.wizard_id], action_title], |
|
|
|
}).then(function(datas) { |
|
|
|
|
|
|
|
|
|
|
|
if (initial_render) { |
|
|
|
self.$('.filter_view_dfr').html(QWeb.render('DfrFilterView', { |
|
|
|
filter_data: datas['filters'], |
|
|
@ -76,6 +110,7 @@ odoo.define('dynamic_accounts_report.financial_reports', function (require) { |
|
|
|
|
|
|
|
} |
|
|
|
var child=[]; |
|
|
|
|
|
|
|
self.$('.table_view_dfr').html(QWeb.render('dfr_table', { |
|
|
|
|
|
|
|
report_lines : datas['report_lines'], |
|
|
@ -86,6 +121,7 @@ odoo.define('dynamic_accounts_report.financial_reports', function (require) { |
|
|
|
debit_balance : datas['debit_balance'], |
|
|
|
bs_lines : datas['bs_lines'], |
|
|
|
})); |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
catch (el) { |
|
|
@ -317,13 +353,21 @@ odoo.define('dynamic_accounts_report.financial_reports', function (require) { |
|
|
|
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_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 (this.$el.find('.datetimepicker-input[name="date_from"]').val()) { |
|
|
|
filter_data_selected.date_from = moment(this.$el.find('.datetimepicker-input[name="date_from"]').val(), time.getLangDateFormat()).locale('en').format('YYYY-MM-DD'); |
|
|
|
} |
|
|
|
if ($("#date_to").val()) { |
|
|
|
var dateString = $("#date_to").val(); |
|
|
|
filter_data_selected.date_to = dateString; |
|
|
|
|
|
|
|
if (this.$el.find('.datetimepicker-input[name="date_to"]').val()) { |
|
|
|
filter_data_selected.date_to = moment(this.$el.find('.datetimepicker-input[name="date_to"]').val(), time.getLangDateFormat()).locale('en').format('YYYY-MM-DD'); |
|
|
|
} |
|
|
|
|
|
|
|
if ($(".target_move").length) { |
|
|
|