|
@@ -58,29 +58,27 @@
|
|
|
return bankStatement;
|
|
|
}).then(function(bankStatement) {
|
|
|
self.bankStatement = bankStatement;
|
|
|
-
|
|
|
- // return self.fetchGetUserLogin();
|
|
|
- // }).then(function(resUser){
|
|
|
- // self.resUser = resUser;
|
|
|
- // return self.fetchStatementConfigTransfer();
|
|
|
- // }).then(function(statementConfig){
|
|
|
- // self.statementConfig = statementConfig;
|
|
|
- // /* Verificar el usuario */
|
|
|
- // if (!self.resUser.length){
|
|
|
- // instanceWeb.notification.do_warn("Atencion", "No estas autorizado a realizar esta operación.");
|
|
|
- // return false;
|
|
|
- // }
|
|
|
- // /* Verificar si existe configuracion */
|
|
|
- // if (!self.statementConfig.length){
|
|
|
- // instanceWeb.notification.do_warn("Atencion", "No estas autorizado a realizar esta operación, no existe configuración de caja.");
|
|
|
- // return false;
|
|
|
- // }
|
|
|
- // /* Verificar si el usuario tiene autorización para cerrar la caja */
|
|
|
- // if (!(_.contains(self.statementConfig[0].statement_cancel_user, self.resUser[0].id))){
|
|
|
- // instanceWeb.notification.do_warn("Atencion", "El usuario no tiene autorización para cancelar la caja.");
|
|
|
- // return false;
|
|
|
- // }
|
|
|
-
|
|
|
+ return self.fetchGetUserLogin();
|
|
|
+ }).then(function(resUser){
|
|
|
+ self.resUser = resUser;
|
|
|
+ return self.fetchStatementConfigTransfer();
|
|
|
+ }).then(function(statementConfig){
|
|
|
+ self.statementConfig = statementConfig;
|
|
|
+ /* Verificar el usuario */
|
|
|
+ if (!self.resUser.length){
|
|
|
+ instanceWeb.notification.do_warn("Atencion", "No estas autorizado a realizar esta operación.");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ /* Verificar si existe configuracion */
|
|
|
+ if (!self.statementConfig.length){
|
|
|
+ instanceWeb.notification.do_warn("Atencion", "No estas autorizado a realizar esta operación, no existe configuración de caja.");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ /* Verificar si el usuario tiene autorización para cerrar la caja */
|
|
|
+ if (!(_.contains(self.statementConfig[0].statement_unlink_user, self.resUser[0].id))){
|
|
|
+ instanceWeb.notification.do_warn("Atencion", "El usuario no tiene autorización para eliminar caja.");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
return self.showModal();
|
|
|
});
|
|
|
},
|
|
@@ -91,6 +89,20 @@
|
|
|
context: new instanceWeb.CompoundContext()
|
|
|
});
|
|
|
},
|
|
|
+ /*Get User*/
|
|
|
+ fetchGetUserLogin: function(){
|
|
|
+ var bankStatementUser = new instanceWeb.Model('account.bank.statement');
|
|
|
+ return bankStatementUser.call('eiru_transfers_get_user', {
|
|
|
+ context: new instanceWeb.CompoundContext()
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /* statement Config */
|
|
|
+ fetchStatementConfigTransfer: function() {
|
|
|
+ var fields = ['id','name','statement_unlink_user'];
|
|
|
+ var domain = [['active', '=', true]];
|
|
|
+ var statementConfig = new openerp.web.Model('account.bank.statement.config');
|
|
|
+ return statementConfig.query(fields).filter(domain).all();
|
|
|
+ },
|
|
|
/* Get state Object*/
|
|
|
getStatementState: function(statement, state){
|
|
|
return _.filter(statement,function(item){
|
|
@@ -150,9 +162,6 @@
|
|
|
var table = $('.expired-account-modal').find('.table-tbody').find('tr');
|
|
|
var buttonSave = $('.expired-account-modal').find('.button-save');
|
|
|
|
|
|
- if (!lineStatement.length)
|
|
|
- $('.expired-account-modal').find('.statement-line').css('display', 'none');
|
|
|
-
|
|
|
_.each(table, function(tr) {
|
|
|
var idLine = (($(tr).children()[0]).textContent).trim();
|
|
|
var stateStatement = self.getStateTransfer(lineStatement, parseInt(idLine));
|
|
@@ -172,6 +181,11 @@
|
|
|
lineMessege.css('display','flex');
|
|
|
lineMessege.text("Existe "+stateStatement.length+" caja relacionada que ya están cerrada.");
|
|
|
|
|
|
+
|
|
|
+ if (!lineStatement.length)
|
|
|
+ $('.expired-account-modal').find('.statement-line').css('display', 'none');
|
|
|
+ lineMessege.css('display','flex');
|
|
|
+ lineMessege.text("No existe movimiento en la caja seleccionada.");
|
|
|
/*Click buttonSave*/
|
|
|
buttonSave.click(function(e) {
|
|
|
stateStatement = self.getStatementState(lineStatement, 'confirm');
|
|
@@ -180,7 +194,6 @@
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
self.unlinkStatement(self.id).then(function(resultsUnlink) {
|
|
|
return resultsUnlink;
|
|
|
}).then(function(resultsUnlink) {
|