|
@@ -1,7 +1,7 @@
|
|
|
function payments_today_counters (widget) {
|
|
|
"use strict";
|
|
|
|
|
|
- var model= openerp;
|
|
|
+ var model = openerp;
|
|
|
|
|
|
widget.PaymentsTodayCountersWidget = widget.Base.extend({
|
|
|
template: 'PaymentsTodayCounters',
|
|
@@ -16,7 +16,7 @@ function payments_today_counters (widget) {
|
|
|
|
|
|
init: function (parent) {
|
|
|
this._super(parent, {
|
|
|
- width : 3,
|
|
|
+ width: 3,
|
|
|
height: 2
|
|
|
});
|
|
|
},
|
|
@@ -45,7 +45,7 @@ function payments_today_counters (widget) {
|
|
|
}).then(function (resCompany) {
|
|
|
self.resCompany = resCompany;
|
|
|
return self.fetchResCurrecy(resCompany);
|
|
|
- }).then(function(resCurrecy){
|
|
|
+ }).then(function(resCurrecy) {
|
|
|
self.resCurrecy = resCurrecy;
|
|
|
return self.fetchVoucherCurrency();
|
|
|
});
|
|
@@ -54,7 +54,7 @@ function payments_today_counters (widget) {
|
|
|
fetchAccountVoucher: function () {
|
|
|
var self = this;
|
|
|
var defer = $.Deferred();
|
|
|
- var hoy =moment().format('YYYY-MM-DD');
|
|
|
+ var hoy = moment().format('YYYY-MM-DD');
|
|
|
var fields = ['id', 'amount', 'currency_id', 'payment_rate_currency_id'];
|
|
|
var domain = [['state', '=', 'posted'], ['type', '=', 'payment'], ['date', '=', hoy]];
|
|
|
var accountVoucher = new model.web.Model('account.voucher');
|
|
@@ -62,30 +62,32 @@ function payments_today_counters (widget) {
|
|
|
accountVoucher.query(fields).filter(domain).all().then(function (results) {
|
|
|
defer.resolve(results);
|
|
|
});
|
|
|
+
|
|
|
return defer;
|
|
|
},
|
|
|
//Comapnia
|
|
|
fetchResCompany: function () {
|
|
|
var self = this;
|
|
|
var defer = $.Deferred();
|
|
|
- var fields =['id','name', 'currency_id','logo'];
|
|
|
- var domain =[['id', '=', 1]];
|
|
|
+ var fields = ['id','name', 'currency_id','logo'];
|
|
|
+ var domain = [['id', '=', 1]];
|
|
|
var resCompany = new model.web.Model('res.company');
|
|
|
|
|
|
resCompany.query(fields).filter(domain).all().then(function (results) {
|
|
|
defer.resolve(results);
|
|
|
});
|
|
|
+
|
|
|
return defer;
|
|
|
},
|
|
|
// Moneda
|
|
|
- fetchResCurrecy : function(){
|
|
|
+ fetchResCurrecy : function() {
|
|
|
var self = this;
|
|
|
var defer = $.Deferred();
|
|
|
- var fields =['id','name', 'symbol', 'rate_silent', 'base', 'decimal_separator', 'decimal_places', 'thousands_separator', 'symbol_position'];
|
|
|
- var domain =[['active','=',true]];
|
|
|
+ var fields = ['id','name', 'symbol', 'rate_silent', 'base', 'decimal_separator', 'decimal_places', 'thousands_separator', 'symbol_position'];
|
|
|
+ var domain = [['active','=',true]];
|
|
|
var resCurrecy = new model.web.Model('res.currency');
|
|
|
|
|
|
- resCurrecy.query(fields).filter(domain).all().then(function(results){
|
|
|
+ resCurrecy.query(fields).filter(domain).all().then(function(results) {
|
|
|
defer.resolve(results);
|
|
|
});
|
|
|
|
|
@@ -111,8 +113,8 @@ function payments_today_counters (widget) {
|
|
|
}
|
|
|
|
|
|
newVoucher.push({
|
|
|
- amount : itemVoucher.amount,
|
|
|
- amount_rate : (itemVoucher.amount * (currencyBase.rate_silent / currencyVoucher.rate_silent))
|
|
|
+ amount: itemVoucher.amount,
|
|
|
+ amount_rate: (itemVoucher.amount * (currencyBase.rate_silent / currencyVoucher.rate_silent))
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -138,21 +140,28 @@ function payments_today_counters (widget) {
|
|
|
// modal
|
|
|
showCustomers: function (e) {
|
|
|
var self = this;
|
|
|
- if (self.accountVoucher.length === 0){
|
|
|
+ if (self.accountVoucher.length === 0) {
|
|
|
model.web.notification.do_warn("Atención","Sin datos");
|
|
|
return
|
|
|
}
|
|
|
var hoy =moment().format('YYYY-MM-DD');
|
|
|
|
|
|
this.do_action({
|
|
|
- name:"Listado de pagos realizados hoy",
|
|
|
+ name: "Listado de pagos realizados hoy",
|
|
|
type: 'ir.actions.act_window',
|
|
|
res_model: "account.voucher",
|
|
|
views: [[false, 'list'],[false, 'form']],
|
|
|
target: 'new',
|
|
|
domain: [['state', '=', 'posted'], ['type', '=', 'payment'], ['date', '=', hoy]],
|
|
|
context: {},
|
|
|
- flags: {'form': {'action_buttons': false, 'options': {'mode': 'view'}}},
|
|
|
+ flags: {
|
|
|
+ 'form': {
|
|
|
+ 'action_buttons': false,
|
|
|
+ 'options': {
|
|
|
+ 'mode': 'view'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
});
|
|
|
}
|
|
|
});
|