|
@@ -2,6 +2,7 @@ function widget_account_to_pay(widget) {
|
|
|
"use strict";
|
|
|
|
|
|
var model = openerp;
|
|
|
+ var Qweb = openerp.web.qweb;
|
|
|
|
|
|
widget.WidgetAccountToPayWidget = widget.Base.extend({
|
|
|
template: 'WidgetAccountToPay',
|
|
@@ -10,6 +11,7 @@ function widget_account_to_pay(widget) {
|
|
|
'click .today': 'showToday',
|
|
|
'click .thisWeek': 'showThisWeek',
|
|
|
'click .expire': 'showExpire',
|
|
|
+ 'click .number': 'showModal',
|
|
|
},
|
|
|
|
|
|
init: function (parent) {
|
|
@@ -58,6 +60,9 @@ function widget_account_to_pay(widget) {
|
|
|
return self.fetchResCurrecy();
|
|
|
}).then(function(ResCurrecy) {
|
|
|
self.ResCurrecy = ResCurrecy;
|
|
|
+ return self.fetchGetModelId();
|
|
|
+ }).then(function(modelId) {
|
|
|
+ self.modelId= modelId;
|
|
|
return self.showExpire();
|
|
|
});
|
|
|
},
|
|
@@ -153,6 +158,20 @@ function widget_account_to_pay(widget) {
|
|
|
return defer;
|
|
|
},
|
|
|
|
|
|
+ // getModelId
|
|
|
+ fetchGetModelId: function() {
|
|
|
+ var self = this;
|
|
|
+ var defer = $.Deferred();
|
|
|
+ var irModelData = new model.web.Model('ir.model.data');
|
|
|
+ var getObtjectReference = irModelData.get_func('get_object_reference');
|
|
|
+
|
|
|
+ this.alive(getObtjectReference('account', 'invoice_form')).then(function(results) {
|
|
|
+ defer.resolve(results);
|
|
|
+ });
|
|
|
+
|
|
|
+ return defer;
|
|
|
+ },
|
|
|
+
|
|
|
getResCurrency: function (id) {
|
|
|
var self = this;
|
|
|
return _.filter(self.ResCurrecy,function (item) {
|
|
@@ -197,7 +216,7 @@ function widget_account_to_pay(widget) {
|
|
|
});
|
|
|
}
|
|
|
self.$el.find('.widget-content.widget-loading').css('display','none');
|
|
|
- self.$el.find('.widget-content').find('a').text(accounting.formatMoney(amount, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
|
|
|
+ self.$el.find('.widget-content').find('.number').text(accounting.formatMoney(amount, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
|
|
|
},
|
|
|
|
|
|
showThisWeek: function () {
|
|
@@ -214,7 +233,7 @@ function widget_account_to_pay(widget) {
|
|
|
});
|
|
|
}
|
|
|
self.$el.find('.widget-content.widget-loading').css('display','none');
|
|
|
- self.$el.find('.widget-content').find('a').text(accounting.formatMoney(amount, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
|
|
|
+ self.$el.find('.widget-content').find('.number').text(accounting.formatMoney(amount, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
|
|
|
},
|
|
|
|
|
|
showExpire: function () {
|
|
@@ -231,7 +250,81 @@ function widget_account_to_pay(widget) {
|
|
|
});
|
|
|
}
|
|
|
self.$el.find('.widget-content.widget-loading').css('display','none');
|
|
|
- self.$el.find('.widget-content').find('a').text(accounting.formatMoney(amount, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
|
|
|
+ self.$el.find('.widget-content').find('.number').text(accounting.formatMoney(amount, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
|
|
|
+ },
|
|
|
+
|
|
|
+ showModal: function (e) {
|
|
|
+ var self = this;
|
|
|
+ if (self.AccountMoveLine <=0) {
|
|
|
+ model.web.notification.do_warn("Atención","Sin datos");
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ var moneda = self.ResCurrency;
|
|
|
+ var newmoveLine = self.AccountMoveLine;
|
|
|
+ var titleData = [
|
|
|
+ {
|
|
|
+ title: "Cuentas a Pagar"
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ var headerModal = [
|
|
|
+ {
|
|
|
+ title: "Proveedor"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "Numero de Factura"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "Vencimiento"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "Monto "
|
|
|
+ }
|
|
|
+ ];
|
|
|
+
|
|
|
+ var modal = Qweb.render('ExpiredAccountCountersModal', {
|
|
|
+ data: newmoveLine,
|
|
|
+ dataThead: headerModal,
|
|
|
+ modalTitle: titleData
|
|
|
+ });
|
|
|
+
|
|
|
+ $('.openerp_webclient_container').after(modal);
|
|
|
+ $('.expired-account-modal').modal()
|
|
|
+ $('.expired-account-modal').on('hidden.bs.modal', function (e) {
|
|
|
+ self.removeModal(e);
|
|
|
+ })
|
|
|
+
|
|
|
+ var contenido = $('.expired-account-modal').find('.table-tbody');
|
|
|
+ contenido.click(function (e) {
|
|
|
+ $(contenido).find('tr').removeClass('table-row-select');
|
|
|
+ $(e.target).closest('tr').addClass('table-row-select');
|
|
|
+ var chirdren_id =$(e.target).closest('tr').children()[0].textContent;
|
|
|
+ self.renderForm(chirdren_id);
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ // Remover <Modal></Modal>
|
|
|
+ removeModal: function (e) {
|
|
|
+ $('.expired-account-modal').remove();
|
|
|
+ $('.modal-backdrop').remove();
|
|
|
},
|
|
|
+
|
|
|
+ // Llamar form
|
|
|
+ renderForm: function(id){
|
|
|
+ var self = this;
|
|
|
+ id = parseInt(id);
|
|
|
+
|
|
|
+ this.do_action({
|
|
|
+ type: "ir.actions.act_window",
|
|
|
+ res_model: "account.invoice",
|
|
|
+ views: [[self.modelId[1], 'form']],
|
|
|
+ target: 'current',
|
|
|
+ domain: [['id', '=', id]],
|
|
|
+ context: {},
|
|
|
+ res_id: id,
|
|
|
+ }).then(function() {
|
|
|
+ self.removeModal();
|
|
|
+ });
|
|
|
+ }
|
|
|
});
|
|
|
}
|