瀏覽代碼

[ADD] Statement Cancel

adrielso 6 年之前
父節點
當前提交
a354f4a2be

+ 1 - 0
models/__init__.py

@@ -6,3 +6,4 @@ import account_bank_statement_cashbox
 import account_bank_statement
 import cash_box_transfer
 import cashbox_statement_confirm
+import cashbox_statement_cancel

+ 47 - 4
models/account_bank_statement_config.py

@@ -9,7 +9,7 @@ class accountBankStatementConfig(models.Model):
     ## Forma de Importar Pagso en caja Ventas/compras/RRHH
     import_statement_payments = fields.Selection([('automatic_import', 'Automático'),('manual_import','Manual')],'Importar pagos en caja',default='automatic_import',help='Tipo de importar los pago en caja', required=True)
     import_statement_payslip = fields.Selection([('automatic_import', 'Automático'),('manual_import','Manual')],'Importar pagos de RRHH en caja',default='automatic_import',help='Tipo de importar los pago en caja', required=True)
-    
+
     ## TRANSFERENCIA
     transfer_user_ids = fields.Many2many('res.users', 'statement_config_transfer_user', 'account_bank_statement_config_id','res_users_id', string='statement_transfer_user')
     transfer_statement_ids = fields.Many2many('account.bank.statement.type', 'statement_config_transfer_statement', 'account_bank_statement_config_id', 'account_bank_statement_type_id', string="statement_config_transfer_statement")
@@ -31,6 +31,49 @@ class accountBankStatementConfig(models.Model):
     statement_open_config = fields.Boolean('statement_open_config', default=False, help="Permitir abrir mas de una caja(por usuario, por diario, por tipo de caja)")
 
     ## statement confirm
-    statement_confirm_user =fields.Many2many('res.users', 'statement_config_confirm_user', 'account_bank_statement_config_id', 'res_users_id', string='User allowed to close the box')
-    statement_confirm_transfer_user = fields.Many2many('res.users', 'statement_config_confirm_transfer_user', 'account_bank_statement_config_id', 'res_users_id', string='User allowed to transfer')
-    statement_confirm_balance = fields.Many2many('res.users', 'statement_config_confirm_balance', 'account_bank_statement_config_id', 'res_users_id', string='usuario permitido para ajuste de cierre')
+    statement_confirm_user = fields.Many2many('res.users', 'statement_config_confirm_user', 'account_bank_statement_config_id', 'res_users_id', string='Usuario permitido para cerrar Caja ')
+    statement_confirm_transfer_user = fields.Many2many('res.users', 'statement_config_confirm_transfer_user', 'account_bank_statement_config_id', 'res_users_id', string='Usuario permitido para realizar transferencia')
+    statement_confirm_balance = fields.Many2many('res.users', 'statement_config_confirm_balance', 'account_bank_statement_config_id', 'res_users_id', string='Usuario permitido para ajuste de cierre')
+    statement_confirm_negative_amount = fields.Many2many('res.users', 'statement_confirm_negative_amount', 'account_bank_statement_config_id', 'res_users_id', string='Usuario permitido para cerrar caja sin saldo ')
+
+    ## statement Cancel
+    statement_cancel_user = fields.Many2many('res.users', 'statement_config_cancel_user', 'account_bank_statement_config_id', 'res_users_id', string='Usuario permitido para cancelar Caja')
+
+
+    '''
+    ### Configuración de caja. ###
+
+    ## Forma de Importar Pagso en caja Ventas/compras/RRHH. ##
+        :fields import_statement_payments   : Forma que se importaran los pagos de ventas/compra/devoluciones en caja.
+        :fields import_statement_payslip    : Forma que se importaran los pagos de nomina y adelanto en caja.
+
+    ## TRANSFERENCIA. ##
+        :fields transfer_user_ids           : Usuario permitido a realizar transferencia.
+        :fields transfer_statement_ids      : Cajas permitidas para realizar transferencia.
+        :fields transfer_negative_amount    : Usuario que puedan borrar las transferencia.
+        :fields delete_transfer_user_ids    : Permitir Transferencia cuando la caja no tenga saldo.
+
+    ## Poner Dinero. ##
+        :fields input_cash_box_user_id          : Usuarios permitido para colocar dinero en la caja.
+        :fields input_cash_box_statement_ids    : Tipo de caja que se permita colocar dinero.
+        :fields delete_input_user_ids           : Usuario que puedan eliminar  la entrada de dinero.
+
+    ## Sacar Dinero. ##
+        :fields output_cash_box_user_id         : Usuarios permitido para sacar dinero en la caja.
+        :fields output_cash_box_statement_ids   : Tipo de caja que se permita sacar dinero.
+        :fields output_negative_amount          : Permitir sacar dinero si saldo en caja.
+        :fields delete_output_user_ids          : Usuario que puedan eliminar  las salida de dinero.
+
+    ## Abrir Cajas. ##
+        :fields statement_open_config   : Permitir abrir mas de una  caja por usuario.
+
+    ## statement confirm(Cerrar Caja). ##
+        :fields statement_confirm_user              : Usuario permitido a cerrar caja.
+        :fields statement_confirm_transfer_user     : Usuario permitido a realizar transferencia.
+        :fields statement_confirm_balance           : Usuario permitido a realizar Ajuste de caja.
+        :fields statement_confirm_negative_amount   : Permitir cerrar las caja con saldo negativo.
+
+    ## statement Cancel (Cancelar caja). ##
+        :fields statement_cancel_user       : Usuario permitido a cancelar caja.
+
+    '''

+ 136 - 0
models/cashbox_statement_cancel.py

@@ -0,0 +1,136 @@
+# -*- coding: utf-8 -*-
+from openerp import models, fields, tools, api
+from datetime import datetime
+from pytz import timezone
+import openerp.addons.decimal_precision as dp
+
+DATE_FORMAT = '%Y-%m-%d'
+
+class eiru_account_statement_cancel(models.Model):
+    _inherit = 'account.bank.statement'
+
+    @api.model
+    def eiru_get_bank_statement_cancel(self, id):
+        return [{
+            'id': statement.id,
+            'name': statement.name,
+            'state': statement.state,
+            'date': statement.date,
+            'currencystatement': {
+                'id': statement.currency.id,
+                'symbol': statement.currency.symbol,
+                'rate': statement.currency.rate,
+                'thousandsSeparator': statement.currency.thousands_separator,
+                'decimalSeparator': statement.currency.decimal_separator,
+                'decimalPlaces': statement.currency.decimal_places,
+                'position': statement.currency.position,
+            },
+            'user': {
+                'id': statement.user_id.id,
+                'name': statement.user_id.name
+            },
+            'statementTransfer': [{
+                'id': transfer.id,
+                'name': transfer.name,
+                'amount': transfer.amount,
+                'ref': transfer.ref,
+                'date': transfer.date,
+                'outputStatement':{
+                    'id': transfer.output_statement.id,
+                    'name': transfer.output_statement.name,
+                    'state': transfer.output_statement.state,
+                    'statementUser': str(transfer.output_statement.name) +" / "+str(transfer.output_statement.user_id.name)
+                },
+                'inputStatement':{
+                    'id': transfer.input_statement.id,
+                    'name': transfer.input_statement.name,
+                    'state': transfer.input_statement.state,
+                    'statementUser': str(transfer.input_statement.name)+" / "+str(transfer.input_statement.user_id.name)
+                },
+                'outputLineId': transfer.output_line.id,
+                'inputLineId': transfer.input_line.id,
+                'type': 'in' if (transfer.input_statement.id == statement.id) else 'out'
+            } for transfer in self.env['cash.box.transfer'].search(['|', ('output_statement.id','=',statement.id), ('input_statement.id','=',statement.id)])],
+            'statementConfirm': [{
+                'id': casBox.id,
+                'name': casBox.name,
+                'amountStatement': casBox.amount_statement,
+                'amountReal': casBox.amount_real,
+                'amountDifference': casBox.amount_difference,
+                'amountNextOpen': casBox.amount_next_open,
+                'type': 'open' if (casBox.statement_open.id == statement.id) else 'confirm',
+                'statementConfirm':{
+                    'id': casBox.statement_id.id if (casBox.statement_id) else '',
+                    'name': casBox.statement_id.name if (casBox.statement_id) else '',
+                    'state': casBox.statement_id.state if (casBox.statement_id) else '',
+                    'statementUser': str(casBox.statement_id.name)+" / "+str(casBox.statement_id.user_id.name) if (casBox.statement_id) else ''
+                },
+                'statementOpen':{
+                    'id': casBox.statement_open.id if (casBox.statement_open) else '',
+                    'name': casBox.statement_open.name if (casBox.statement_open) else '',
+                    'state': casBox.statement_open.state if (casBox.statement_open) else '',
+                    'statementUser': str(casBox.statement_open.name) +" / "+str(casBox.statement_open.user_id.name) if (casBox.statement_open) else ''
+                }
+            } for casBox in self.env['cashbox.statement.confirm'].search(['|', ('statement_id.id','=',statement.id), ('statement_open.id','=',statement.id)])],
+        } for statement in self.env['account.bank.statement'].search([('id','=',id)])]
+
+    '''
+          ____ _____  _  _____ _____ __  __ _____ _   _ _____    ____    _    _   _  ____ _____ _
+         / ___|_   _|/ \|_   _| ____|  \/  | ____| \ | |_   _|  / ___|  / \  | \ | |/ ___| ____| |
+         \___ \ | | / _ \ | | |  _| | |\/| |  _| |  \| | | |   | |     / _ \ |  \| | |   |  _| | |
+          ___) || |/ ___ \| | | |___| |  | | |___| |\  | | |   | |___ / ___ \| |\  | |___| |___| |___
+         |____/ |_/_/   \_\_| |_____|_|  |_|_____|_| \_| |_|    \____/_/   \_\_| \_|\____|_____|_____|
+    '''
+    @api.model
+    def eiru_statement_cancel(self, id):
+        print("\n\neiru_statement_cancel\n\n")
+        '''
+        cashbox.statement.cancel
+            name
+            ref
+            date
+            message
+            statement_id
+            journal_id
+            user_statement
+            user_cancel
+        '''
+        '''
+        cashbox.statement.cancel.line
+            cancel_id
+            statement_line
+            date
+            name
+            ref
+            partner_id
+            amount
+        '''
+'''
+    Registro de caja cancel.
+'''
+class cashbox_statement_cancel(models.Model):
+    _name = "cashbox.statement.cancel"
+
+    ### fields Basic
+    name = fields.Char('name')
+    ref = fields.Char('Ref')
+    date = fields.Date()
+    message = fields.Text('Message Cancel')
+    ### statement, journal, users
+    statement_id = fields.Many2one('account.bank.statement', 'Bank Statement Cancel')
+    journal_id = fields.Many2one('account.journal', 'Journal')
+    user_statement = fields.Many2one('res.users', 'User Statement')
+    user_cancel = fields.Many2one('res.users', 'Usaer Cancel')
+
+
+class cashbox_statement_cancel_line(models.Model):
+    _name = "cashbox.statement.cancel.line"
+
+    ### cashbox.statement.cancel
+    cancel_id = fields.Many2one('cashbox.statement.cancel', 'Statement Cancel')
+    statement_line = fields.Many2one('account.bank.statement.line', 'statement Line')
+    date = fields.Date()
+    name = fields.Char('name')
+    ref = fields.Char('Ref')
+    partner_id = fields.Many2one('res.partner', 'partner')
+    amount = fields.Float('Amount Line', digits_compute=dp.get_precision('Account'))

+ 2 - 0
security/ir.model.access.csv

@@ -5,3 +5,5 @@ access_cash_box_transfer,cash.box.transfer,model_cash_box_transfer,account.group
 access_cash_box_in,cash.box.in,model_cash_box_in,account.group_account_user,1,1,1,1
 access_cash_box_out,cash.box.out,model_cash_box_out,account.group_account_user,1,1,1,1
 access_cashbox_statement_confirm,cashbox.statement.confirm,model_cashbox_statement_confirm,account.group_account_user,1,1,1,1
+access_cashbox_statement_cancel,cashbox.statement.cancel,model_cashbox_statement_cancel,account.group_account_user,1,1,1,1
+access_cashbox_statement_cancel_line,cashbox.statement.cancel.line,model_cashbox_statement_cancel_line,account.group_account_user,1,1,1,1

+ 184 - 1
static/src/css/style.css

@@ -15,6 +15,10 @@
     width: auto;
     float: left;
 }
+.eiru-statement-utility-cancel {
+    width: auto;
+    float: left;
+}
 .eiru-statement-print{
     width: auto;
     float: left;
@@ -322,5 +326,184 @@
 .button-print-confirm {
     height: 50px;
     width: 120px;
-    font-size: 20px !important; 
+    font-size: 20px !important;
+}
+
+/*table Statement Cancel ransferencia */
+.cancel-transfer-table{
+    margin-top: 0px !important;
+    margin-bottom: 0px !important;
+}
+.expired-account-modal .modal-head-wrapper-statement-cancel-transfer {
+    width: 100%;
+    background: red !important;
+}
+.expired-account-modal .modal-item-statement-cancel-transfer {
+    width: 100%;
+    height: 106px;
+    overflow-y: auto;
+}
+.expired-account-modal .cancel-transfer-table table tbody tr {
+    height: 35px;
+}
+.expired-account-modal .cancel-transfer-table table thead tr {
+    height: 40px !important;
+}
+/*id*/
+.expired-account-modal .cancel-transfer-table table tbody tr td:nth-child(1){
+    display: none;
+}
+.expired-account-modal .cancel-transfer-table table thead tr th:nth-child(1){
+    display: none;
+}
+/* Date */
+.expired-account-modal .cancel-transfer-table table tbody tr td:nth-child(2){
+    width: 110px ;
+    font-size: 12pt;
+    text-align: left;
+    padding-left: 10px;
+    padding-top: 8px;
+}
+.expired-account-modal .cancel-transfer-table table thead tr th:nth-child(2){
+    width: 110px;
+    padding-right: 10px;
+    text-align: left;
+    font-size: 14pt;
+    font-weight: bold;
+}
+/* statement  */
+.expired-account-modal .cancel-transfer-table table tbody tr td:nth-child(3){
+    width: 453px ;
+    padding-right: 10px;
+    text-align: left;
+    font-size: 12pt;
+    padding-top: 8px;
+}
+.expired-account-modal .cancel-transfer-table table thead tr th:nth-child(3){
+    width: 453px;
+    padding-right: 10px;
+    text-align: left;
+    font-size: 14pt;
+    font-weight: bold;
+}
+/* amount */
+.expired-account-modal .cancel-transfer-table table tbody tr td:nth-child(4){
+    width: 160px ;
+    padding-right: 20px;
+    text-align: right;
+    font-size: 12pt;
+    padding-top: 8px;
+}
+.expired-account-modal .cancel-transfer-table table thead tr th:nth-child(4){
+    width: 160px;
+    padding-right: 20px;
+    text-align: right;
+    font-size: 14pt;
+    font-weight: bold;
+}
+/* State */
+.expired-account-modal .cancel-transfer-table table tbody tr td:nth-child(5){
+    width: 100px ;
+    text-align: center;
+    font-size: 12pt;
+    padding-top: 8px;
 }
+.expired-account-modal .cancel-transfer-table table thead tr th:nth-child(5){
+    width: 114px;
+    text-align: center;
+    font-size: 14pt;
+    font-weight: bold;
+}
+.cancel-transfer-messege {
+    display: none;
+    margin-top: 5px;
+    margin-left: 20px;
+    font-weight: bold;
+    color: red;
+}
+
+
+/*table Statement Cancel Confirm */
+/* .cancel-transfer-table{
+    margin-top: 0px !important;
+}
+.expired-account-modal .modal-head-wrapper-statement-cancel-transfer {
+    width: 100%;
+    background: red !important;
+}
+.expired-account-modal .modal-item-statement-cancel-transfer {
+    width: 100%;
+    height: 106px;
+    overflow-y: auto;
+} */
+/* .expired-account-modal .cancel-transfer-table table tbody tr {
+    height: 35px;
+}
+.expired-account-modal .cancel-transfer-table table thead tr {
+    height: 40px !important;
+} */
+/*id*/
+/* .expired-account-modal .cancel-transfer-table table tbody tr td:nth-child(1){
+    display: none;
+}
+.expired-account-modal .cancel-transfer-table table thead tr th:nth-child(1){
+    display: none;
+} */
+/* Date */
+/* .expired-account-modal .cancel-transfer-table table tbody tr td:nth-child(2){
+    width: 110px ;
+    font-size: 12pt;
+    text-align: left;
+    padding-left: 10px;
+    padding-top: 8px;
+} */
+/* .expired-account-modal .cancel-transfer-table table thead tr th:nth-child(2){
+    width: 110px;
+    padding-right: 10px;
+    text-align: left;
+    font-size: 14pt;
+    font-weight: bold;
+} */
+/* statement  */
+/* .expired-account-modal .cancel-transfer-table table tbody tr td:nth-child(3){
+    width: 453px ;
+    padding-right: 10px;
+    text-align: left;
+    font-size: 12pt;
+    padding-top: 8px;
+} */
+/* .expired-account-modal .cancel-transfer-table table thead tr th:nth-child(3){
+    width: 453px;
+    padding-right: 10px;
+    text-align: left;
+    font-size: 14pt;
+    font-weight: bold;
+} */
+/* amount */
+/* .expired-account-modal .cancel-transfer-table table tbody tr td:nth-child(4){
+    width: 160px ;
+    padding-right: 20px;
+    text-align: right;
+    font-size: 12pt;
+    padding-top: 8px;
+} */
+/* .expired-account-modal .cancel-transfer-table table thead tr th:nth-child(4){
+    width: 160px;
+    padding-right: 20px;
+    text-align: right;
+    font-size: 14pt;
+    font-weight: bold;
+} */
+/* State */
+/* .expired-account-modal .cancel-transfer-table table tbody tr td:nth-child(5){
+    width: 100px ;
+    text-align: center;
+    font-size: 12pt;
+    padding-top: 8px;
+} */
+/* .expired-account-modal .cancel-transfer-table table thead tr th:nth-child(5){
+    width: 114px;
+    text-align: center;
+    font-size: 14pt;
+    font-weight: bold;
+} */

+ 283 - 0
static/src/js/eiru_statement_cancel.js

@@ -0,0 +1,283 @@
+(function() {
+    openerp.widgetInstanceStatementCancel = null;
+    openerp.parentInstanceStatementCancel = {};
+    var QWeb = openerp.web.qweb;
+    var instanceWeb = openerp.web;
+    // Abrir caja
+    openerp.EiruStatementCancel = openerp.Widget.extend({
+        template: 'EiruStatementUtility.Cancel',
+        id: undefined,
+        buttons: undefined,
+        bankStatement: [],
+        resUser: [],
+        statementConfig: [],
+        /* init */
+        init: function(parent) {
+            this._super(parent);
+            this.buttons = parent.$buttons;
+        },
+        /* start */
+        start: function () {
+            var self = this
+            this.$el.click(function() {
+                self.fetchInitial();
+            });
+            self.buttons.click(function(e) {
+                /* C (Crear) */
+                if (e.target.accessKey === 'C')
+                    self.$el.css('display','none');
+                /* E (Editar) */
+                if (e.target.accessKey === 'E')
+                    self.$el.css('display','none');
+                /* S (Guarrdar) */
+                if (e.target.accessKey === 'S')
+                    self.$el.css('display','flex');
+                /* D (Cancelar) */
+                if (e.target.accessKey === 'D')
+                    self.$el.css('display','flex');
+            });
+        },
+        /* Actualizar Id de la visat actual  */
+        updateId: function(id) {
+            var self = this;
+            self.id = id;
+        },
+        /* Reload Page*/
+        reloadPage: function() {
+             openerp.parentInstanceStatementCancel.reload();
+        },
+        /* Description: Función para remover el modal */
+        removeModal: function() {
+            $('.expired-account-modal').remove();
+            $('.modal-backdrop').remove();
+        },
+        /* Método inicial */
+        fetchInitial: function() {
+            var self = this;
+            self.fetchBankStatement(self.id).then(function(bankStatement) {
+                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.showModal();
+            });
+        },
+        /* Account bank Statement */
+        fetchBankStatement: function(id) {
+            var bankStatement = new instanceWeb.Model('account.bank.statement');
+            return bankStatement.call('eiru_get_bank_statement_cancel',[parseInt(id)], {
+                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_cancel_user'];
+            var domain = [['active', '=', true]];
+            var statementConfig = new openerp.web.Model('account.bank.statement.config');
+            return statementConfig.query(fields).filter(domain).all();
+        },
+        /* get Transferencia */
+        getTransfer: function(){
+            var self = this;
+            var statement = self.bankStatement[0];
+            var transfer = [];
+            var currency = statement.currencystatement;
+
+            if(!currency)
+                return transfer;
+
+            _.each(statement.statementTransfer, function(item) {
+
+                transfer.push({
+                    'id': item.id,
+                    'date': moment(item.date).format("DD-MM-YYYY"),
+                    'amount': accounting.formatNumber(item.amount, currency.decimalPlaces, currency.thousandsSeparator, currency.decimalSeparator),
+                    'statementUser': item.type === 'out' ? item.inputStatement.statementUser :item.outputStatement.statementUser,
+                    'statement': item.type === 'out' ? item.inputStatement.name :item.outputStatement.name,
+                    'statementState': item.type === 'out' ? item.inputStatement.state : item.outputStatement.state,
+                    'type': item.type === 'in' ?'Entrada' :'Salida',
+                    'typeStatement':  item.type
+                });
+            });
+            return transfer;
+        },
+        getStatementState: function(statement, state){
+            return _.filter(statement,function(item){
+                return item.statementState === state;
+            });
+        },
+        getStateTransfer: function(statement, id) {
+            return _.filter(statement, function(item){
+                return item.id === id;
+            });
+        },
+        /* Get Statement Confirm*/
+        getStatementConfirm: function(){
+            var self = this;
+            var statement = self.bankStatement[0];
+            var confirm = [];
+            var currency = statement.currencystatement;
+            if (!currency)
+                return confirm;
+
+            _.each(statement.statementConfirm, function(item) {
+                if ((item.type === 'confirm') && (!item.statementOpen.statementUser))
+                    return false;
+
+                confirm.push({
+                    'id': item.id,
+                    'date': moment(item.date).format("DD-MM-YYYY"),
+                    'amountNextOpen': accounting.formatNumber(item.amountNextOpen, currency.decimalPlaces, currency.thousandsSeparator, currency.decimalSeparator),
+                    'statement': item.type === 'open' ?item.statementConfirm.name :item.statementOpen.name,
+                    'statementUser': item.type === 'open' ?item.statementConfirm.statementUser :item.statementOpen.statementUser,
+                    'messege': 'Saldo de Apertura',
+                });
+            })
+            return confirm;
+        },
+        /*Modal  */
+        showModal: function() {
+            var self = this;
+            var defer =$.Deferred();
+            var results = true;
+            var transfer = self.getTransfer();
+            var confirm = self.getStatementConfirm();
+
+            var modal = QWeb.render('ModalStatementUtility.Cancel',{
+                'transfer': transfer,
+                'confirm': confirm
+            });
+
+            $('.openerp_webclient_container').after(modal);
+            $('.expired-account-modal').modal();
+
+            /* Transferencia */
+            var cancelTransferMessege = $('.expired-account-modal').find('.cancel-transfer-messege');
+            var tableTransfer = $('.expired-account-modal').find('.table-tbody-transfer').find('tr');
+            /* confirm */
+            var cancelConfirmMessege = $('.expired-account-modal').find('.cancel-confirm-messege');
+            /* Motivo */
+            var messegeCancel = $('.expired-account-modal').find('.messege-cancel');
+            /* button */
+            var buttonSave = $('.expired-account-modal').find('.button-save');
+
+            if (!transfer.length)
+                $('.expired-account-modal').find('.cancel-transfer').css('display','none');
+
+            if (!confirm.length)
+                $('.expired-account-modal').find('.cancel-confirm').css('display','none');
+
+
+            _.each(tableTransfer, function(tr) {
+                var idTransfer  = (($(tr).children()[0]).textContent).trim();
+                var stateTransfer = self.getStateTransfer(transfer, parseInt(idTransfer));
+                if (!stateTransfer.length)
+                    return false;
+                if (stateTransfer[0].statementState === 'confirm'){
+                    $(tr).css('color','red')
+                }
+            });
+            /* Caja Cerrada */
+            stateStatement = self.getStatementState(transfer, 'confirm');
+            cancelTransferMessege.css('display','none');
+            cancelTransferMessege.text("");
+            if (stateStatement.length)
+                cancelTransferMessege.css('display','flex');
+                cancelTransferMessege.text("Existe "+stateStatement.length+" caja cerrada ");
+
+
+            /*Click buttonSave*/
+            buttonSave.click(function(e) {
+                if (!messegeCancel.val()){
+                    instanceWeb.notification.do_warn("Atencion", "Debes ingresar el motivo para continuar.");
+                    messegeCancel.css('border-color','red');
+                    messegeCancel.focus();
+                    return  false;
+                }
+                messegeCancel.css('border-color','#ccc');
+
+                self.cancelStatement().then(function(resultsConfirm) {
+                    return resultsConfirm;
+                }).then(function(resultsConfirm) {
+                    self.reloadPage();
+                    self.removeModal(e);
+                    if (!resultsConfirm)
+                        results = false;
+                });
+
+                defer.resolve(results);
+            });
+
+            /* Click Cerrar */
+            $('.expired-account-modal').on('hidden.bs.modal', function(e) {
+                results = false;
+                defer.resolve(results);
+                self.removeModal(e);
+            });
+
+            return defer;
+        },
+
+        cancelStatement:function(statementId){
+            var bankStatementUser = new instanceWeb.Model('account.bank.statement');
+            return bankStatementUser.call('eiru_statement_cancel',[statementId], {
+                context: new instanceWeb.CompoundContext()
+            });
+        }
+    });
+
+    if (openerp.web && openerp.web.FormView) {
+        openerp.web.FormView.include({
+            load_record: function(record) {
+                this._super.apply(this, arguments);
+
+                if (this.model !== 'account.bank.statement')
+                    return;
+
+                openerp.parentInstanceStatementCancel = this;
+
+                if (openerp.widgetInstanceStatementCancel) {
+                    openerp.widgetInstanceStatementCancel.updateId(record.id);
+                    if (this.$el.find('.button-statement-cancel').length !== 0 )
+                        return ;
+                }
+
+                if (this.$el.find('.button-statement-cancel').length !== 0 )
+                    return;
+
+                openerp.widgetInstanceStatementCancel = new openerp.EiruStatementCancel(this);
+                var element =this.$el.find('.oe_form').find('.eiru-statement-utility-cancel');
+
+                openerp.widgetInstanceStatementCancel.appendTo(element[0]);
+                openerp.widgetInstanceStatementCancel.updateId(record.id);
+            }
+        });
+    }
+})();

+ 12 - 7
static/src/js/eiru_statement_confirm.js

@@ -83,9 +83,7 @@
                     instanceWeb.notification.do_warn("Atencion", "El usuario no tiene autorización para cerrar la caja.");
                     return false;
                 }
-
                 return self.showModal();
-                console.log("Cierre");
             });
         },
         /* Account bank Statement */
@@ -118,7 +116,7 @@
         },
         /* statement Config */
         fetchStatementConfigTransfer: function() {
-            var fields = ['id','name','statement_confirm_user','statement_confirm_transfer_user','statement_confirm_balance'];
+            var fields = ['id','name','statement_confirm_user','statement_confirm_transfer_user','statement_confirm_balance','statement_confirm_negative_amount'];
             var domain = [['active', '=', true]];
             var statementConfig = new openerp.web.Model('account.bank.statement.config');
             return statementConfig.query(fields).filter(domain).all();
@@ -223,7 +221,7 @@
                 var realAmount = accounting.unformat(amountReal.val(),currency.decimalSeparator);
                 var cashBoxAmount = accounting.unformat(amountCashbox.val(),currency.decimalSeparator);
 
-                if (realAmount <= 0) {
+                if ((realAmount <= 0) && !(_.contains(self.statementConfig[0].statement_confirm_negative_amount, self.resUser[0].id))) {
                     instanceWeb.notification.do_warn("Atencion", "El valor de cierre debes de ser mayo que 0.");
                     amountReal.css('border-color','red');
                     amountReal.focus();
@@ -305,13 +303,20 @@
             });
 
             /*Click buttonSave*/
-            buttonSave.click(function(e){
+            buttonSave.click(function(e) {
                 var cashBoxAmount = accounting.unformat(amountCashbox.val(),currency.decimalSeparator);
                 var realAmount = accounting.unformat(amountReal.val(),currency.decimalSeparator);
                 var transferAmount = accounting.unformat(amountTransfer.val(),currency.decimalSeparator);
-
+                var amount_negative =  _.contains(self.statementConfig[0].statement_confirm_negative_amount, self.resUser[0].id)
+
+                // if (!amount_negative) {
+                //     instanceWeb.notification.do_warn("Atencion", "El usuario no tiene autorización para cerrar la caja sin saldo.");
+                //     amountReal.css('border-color','red');
+                //     amountReal.focus();
+                //     return false;
+                // }
                 // amountReal
-                if (realAmount <= 0){
+                if ((realAmount <= 0) && (!amount_negative)) {
                     instanceWeb.notification.do_warn("Atencion", "El valor de cierre debes de ser mayo que 0.");
                     amountReal.css('border-color','red');
                     amountReal.focus();

+ 5 - 0
static/src/js/eiru_statement_confirm_print.js

@@ -59,6 +59,11 @@
                 return statementConfirm;
             }).then(function(statementConfirm) {
                 self.statementConfirm = statementConfirm;
+                if (!self.statementConfirm.length){
+                    instanceWeb.notification.do_warn("Atencion", "No existe resume de cierre de caja.");
+                    return  false;
+                }
+
                 return  self.printSelectedType();
             });
         },

+ 8 - 0
static/src/xml/eiru_statement_cancel.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<templates xml:space="preserve">
+    <t t-name="EiruStatementUtility.Cancel">
+        <button class="button-statement-cancel eiru-statement-button oe_button oe_form_button oe_highlight">
+            <span>Cancelar caja Eiru</span>
+        </button>
+  </t>
+</templates>

+ 126 - 0
static/src/xml/modal/modal_statement_cancel.xml

@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template xml:space="preserve">
+    <t t-name="ModalStatementUtility.Cancel">
+        <div class="modal in expired-account-modal" tabindex="-1" role="dialog">
+            <div class="modal-dialog modal-lg" role="document">
+                <div class="modal-content openerp">
+                    <div class="modal-header paymnets-invoice-header">
+                        <button type="button" class="close" data-dismiss="modal" aria-label="Close" aria-hidden="true">×</button>
+                        <h3 class="modal-title">Cancelar caja</h3>
+                    </div>
+                    <!-- Body -->
+                    <div class="modal-body">
+
+                        <div class="row cancel-transfer">
+                            <label class="confirm-title" style="padding-left: 30px">Transferencia realizadas</label>
+                        </div>
+                        <!-- table -->
+                        <div class="oe_view_manager_body cancel-transfer-table cancel-transfer">
+                            <div class="modal-head-wrapper-statement-cancel-transfer">
+                                <table class="oe_list_content">
+                                    <thead >
+                                        <tr class="oe_list_header_columns"  >
+                                            <th class="oe_list_header_char oe_sortable"></th>
+                                            <th class="oe_list_header_char oe_sortable">Fecha</th>
+                                            <th class="oe_list_header_char oe_sortable">Caja </th>
+                                            <th class="oe_list_header_char oe_sortable">Valor</th>
+                                            <th class="oe_list_header_char oe_sortable">Operación</th>
+                                        </tr>
+                                    </thead>
+                                </table>
+                            </div>
+                            <div class="modal-item-statement-cancel-transfer">
+                                <table class="oe_list_content">
+                                    <tbody class="table-tbody-transfer">
+                                        <tr t-foreach="transfer" t-as="line">
+                                            <td>
+                                                <t t-esc="line_value.id"/>
+                                            </td>
+                                            <td>
+                                                <t t-esc="line_value.date"/>
+                                            </td>
+                                            <td>
+                                                <t t-esc="line_value.statementUser"/>
+                                                <t t-set="state" t-value="line_value.statementState"/>
+                                                <t t-js="ctx">
+                                                    ctx.state = ctx.state === "open" ?"Abierta": "Cerrada";
+                                                </t>
+                                                <t t-esc="'('+state+')'"/>
+                                            </td>
+                                            <td>
+                                                <t t-esc="line_value.amount"/>
+                                            </td>
+                                            <td>
+                                                <t t-esc="line_value.type"/>
+                                            </td>
+                                        </tr>
+                                    </tbody>
+                                </table>
+                            </div>
+                        </div>
+                        <div class="cancel-transfer-messege"></div>
+
+
+                        <div class="row cancel-confirm">
+                            <label class="confirm-title" style="padding-left: 30px">Cierre de cajas.</label>
+                        </div>
+                        <!-- table -->
+                        <div class=" oe_view_manager_body transfer-deleted-table  cancel-confirm">
+                            <div class="modal-head-wrapper-statement-transfer">
+                                <table class="oe_list_content">
+                                    <thead >
+                                        <tr class="oe_list_header_columns"  >
+                                            <th class="oe_list_header_char oe_sortable"></th>
+                                            <th class="oe_list_header_char oe_sortable">Fecha</th>
+                                            <th class="oe_list_header_char oe_sortable">Caja</th>
+                                            <th class="oe_list_header_char oe_sortable">valor</th>
+                                            <th class="oe_list_header_char oe_sortable">Obs</th>
+                                        </tr>
+                                    </thead>
+                                </table>
+                            </div>
+                            <div class="modal-item-statement-transfer">
+                                <table class="oe_list_content">
+                                    <tbody class="table-tbody">
+                                        <tr t-foreach="confirm" t-as="line">
+                                            <td>
+                                                <t t-esc="line_value.id"/>
+                                            </td>
+                                            <td>
+                                                <t t-esc="line_value.date"/>
+                                            </td>
+                                            <td>
+                                                <t t-esc="line_value.statementUser"/>
+                                            </td>
+                                            <td>
+                                                <t t-esc="line_value.amountNextOpen"/>
+                                            </td>
+                                            <td>
+                                                <t t-esc="line_value.messege"/>
+                                            </td>
+                                        </tr>
+                                    </tbody>
+                                </table>
+                            </div>
+                        </div>
+
+                        <!-- Motivo  -->
+                        <div class="row">
+                            <div class="col-xs-12">
+                                <label class="statement-input-labe">Motivo</label>
+                                <div class="statement-input-group">
+                                    <input type="text" class="form-control statement-input-number input-letters messege-cancel"></input>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                    <!-- footer -->
+                    <div class="modal-footer statement-utility-footer">
+                        <button type="button" class="oe_button oe_form_button oe_highlight statement-utility-button button-save">Guardar</button>
+                        <button type="button" class="oe_button oe_form_button oe_link dismmis-modal statement-utility-button" data-dismiss="modal">Salir</button>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </t>
+</template>

+ 139 - 136
views/account_bank_statemente_config.xml

@@ -22,147 +22,150 @@
 
                     <notebook>
                         <!-- Pagos && RRHH -->
-                        <page string="Importar pagos &amp; RRHH en caja">
-                            <separator string="Forma de importar pagos en caja"/>
-
-                            <div class="openerp oe_form oe_form_field">
-                                <span class="oe_form_text_content"></span>
-                            </div>
-
-                            <group style="margin: 0px">
-                                <label for="import_statement_payments" string="Pagos ventas/compras/gastos" style="width: 200px"></label>
-                                <field name="import_statement_payments"  style="width: 200px" nolabel="1" />
-                            </group>
-                            <group style="margin: 0px">
-                                <label for="import_statement_payslip" string="Pagos de nominas" style="width: 200px"></label>
-                                <field name="import_statement_payslip"  style="width: 200px" nolabel="1"/>
-                            </group>
-                        </page>
-
-                        <!-- Transferencia -->
-                        <page string="Transferencia de valores">
-                            <separator string="Transferencia de cajas"/>
-                            <div class="openerp oe_form oe_form_field">
-                                <span class="oe_form_text_content">Permite a los usuarios a realizar transferencia de valores para otras cajas.</span>
-                            </div>
-                            <group col="2">
-                                <group style="margin: 0px" string="Cajas permitidas">
-                                    <label for="transfer_statement_ids" string="Tipos de caja permitidas" style="width: 200px"></label>
-                                    <field name="transfer_statement_ids" widget="many2many_checkboxes" nolabel="1"/>
-                                </group>
-                                <group style="margin: 0px" string="Usuarios permitidos">
-                                    <label for="transfer_user_ids" string="Usuarios permitidos" style="width: 200px"></label>
-                                    <field name="transfer_user_ids" class="oe_inline"  widget="many2many_tags" options="{'no_create': True}" nolabel="1"/>
-                                </group>
-                            </group>
-                            <group col='2'>
-                                <group string="Transferencia sin saldo en caja">
-                                    <label for="transfer_negative_amount" string="Permitir transferencia sin saldo" style="width: 200px"></label>
-                                    <field name="transfer_negative_amount" class="oe_inline" nolabel="1"/>
-                                </group>
-                                <group string="Eliminar transferencia">
-                                    <label for="delete_transfer_user_ids" string="Usuarios permitidos" style="width: 200px"></label>
-                                    <field name="delete_transfer_user_ids" class="oe_inline"  widget="many2many_tags" options="{'no_create': True}" nolabel="1"/>
-                                </group>
-                            </group>
+                        <page string="Forma de sincronizar los pago en caja.">
+                            <notebook>
+                                <!-- Pagos de venta/compras/devoluciones -->
+                                <page string="Pagos de ventas/compras/gastos/devoluciones.">
+                                    <separator string="Define como sera la sincronización de los pago con las cajas." style="font-size: 12pt"/>
+                                    <group style="margin: 0px" string="Forma de sincronizar los pagos.">
+                                        <label for="import_statement_payments" string="Tipo de sincronización" style="width: 200px"></label>
+                                        <field name="import_statement_payments"  style="width: 200px" nolabel="1" />
+                                    </group>
+                                </page>
+
+                                <!-- Pagos de nominas adelanto -->
+                                <page string="Pago de nominas y adelantos.">
+                                    <separator string="Define como sera la sincronización de los pago con las cajas." style="font-size: 12pt"/>
+                                    <group style="margin: 0px" string="Forma de sincronizar los pagos.">
+                                        <label for="import_statement_payslip" string="Tipo de sincronización" style="width: 200px"></label>
+                                        <field name="import_statement_payslip"  style="width: 200px" nolabel="1"/>
+                                    </group>
+                                </page>
+                            </notebook>
                         </page>
-
-                        <!-- Poner Dinero -->
-                        <page string="Poner dinero">
-                            <separator string="Permitir poner dinero"/>
-                            <div class="openerp oe_form oe_form_field">
-                                <span class="oe_form_text_content">
-                                    Permite a los usuario ingresar dinero en las cajas.
-                                </span>
-                            </div>
-                            <group col="2">
-                                <group style="margin: 0px" string="Cajas permitidas">
-                                    <label for="input_cash_box_statement_ids" string="Tipos de caja permitidas" style="width: 200px"></label>
-                                    <field name="input_cash_box_statement_ids" widget="many2many_checkboxes"  nolabel="1"/>
-                                </group>
-                                <group style="margin: 0px"  string="Usuarios permitidos">
-                                    <label for="input_cash_box_user_id" string="Usuarios permitidos" style="width: 200px"></label>
-                                    <field name="input_cash_box_user_id" widget="many2many_tags" options="{'no_create': True}" nolabel="1"/>
-                                </group>
-                            </group>
-                            <group col="2">
-                                <group string="Eliminar las entradas de dinero">
-                                    <label for="delete_input_user_ids" string="Usuarios permitidos" style="width: 200px"></label>
-                                    <field name="delete_input_user_ids" class="oe_inline"  widget="many2many_tags" options="{'no_create': True}" nolabel="1"/>
-                                </group>
-                            </group>
+                        <!-- Transacciones de caja (transferencia, Poner/sacar dienro) -->
+                        <page string="Transacciones de caja">
+                            <notebook>
+                                <!-- TRANSFERENCIA -->
+                                <page string="Transferencias de cajas">
+                                    <separator string="Permite a los usuarios a realizar transferencia de valores para otras cajas." style="font-size: 12pt"/>
+                                    <group col="2">
+                                        <group style="margin: 0px" string="Cajas permitidas">
+                                            <label for="transfer_statement_ids" string="Tipos de caja permitidas" style="width: 200px"></label>
+                                            <field name="transfer_statement_ids" widget="many2many_checkboxes" nolabel="1"/>
+                                        </group>
+                                        <group style="margin: 0px" string="Usuarios permitidos">
+                                            <label for="transfer_user_ids" string="Usuarios permitidos" style="width: 200px"></label>
+                                            <field name="transfer_user_ids" class="oe_inline"  widget="many2many_tags" options="{'no_create': True}" nolabel="1"/>
+                                        </group>
+                                    </group>
+                                    <group col='2'>
+                                        <group string="Transferencia sin saldo en caja">
+                                            <label for="transfer_negative_amount" string="Permitir transferencia sin saldo" style="width: 200px"></label>
+                                            <field name="transfer_negative_amount" class="oe_inline" nolabel="1"/>
+                                        </group>
+                                        <group string="Eliminar transferencia">
+                                            <label for="delete_transfer_user_ids" string="Usuarios permitidos" style="width: 200px"></label>
+                                            <field name="delete_transfer_user_ids" class="oe_inline"  widget="many2many_tags" options="{'no_create': True}" nolabel="1"/>
+                                        </group>
+                                    </group>
+                                </page>
+                                <!-- Poner Dinero -->
+                                <page string="Poner dinero">
+                                    <separator string="Permite a los usuario ingresar dinero en las cajas." style="font-size: 12pt"/>
+                                    <group col="2">
+                                        <group style="margin: 0px" string="Cajas permitidas">
+                                            <label for="input_cash_box_statement_ids" string="Tipos de caja permitidas" style="width: 200px"></label>
+                                            <field name="input_cash_box_statement_ids" widget="many2many_checkboxes"  nolabel="1"/>
+                                        </group>
+                                        <group style="margin: 0px"  string="Usuarios permitidos">
+                                            <label for="input_cash_box_user_id" string="Usuarios permitidos" style="width: 200px"></label>
+                                            <field name="input_cash_box_user_id" widget="many2many_tags" options="{'no_create': True}" nolabel="1"/>
+                                        </group>
+                                    </group>
+                                    <group col="2">
+                                        <group string="Eliminar las entradas de dinero">
+                                            <label for="delete_input_user_ids" string="Usuarios permitidos" style="width: 200px"></label>
+                                            <field name="delete_input_user_ids" class="oe_inline"  widget="many2many_tags" options="{'no_create': True}" nolabel="1"/>
+                                        </group>
+                                    </group>
+                                </page>
+                                <!-- Sacar Dinero -->
+                                <page string="Sacar dinero">
+                                    <separator string="Permite a los usuario extraer dinero de las cajas." style="font-size: 12pt"/>
+                                    <group col="2">
+                                        <group style="margin: 0px" string="Cajas permitidas">
+                                            <label for="output_cash_box_statement_ids" string="Tipos de caja permitidas" style="width: 200px"></label>
+                                            <field name="output_cash_box_statement_ids" widget="many2many_checkboxes" nolabel="1"/>
+                                        </group>
+                                        <group style="margin: 0px" string="Usuarios permitidos">
+                                            <label for="output_cash_box_user_id" string="Usuarios permitidos" style="width: 200px"></label>
+                                            <field name="output_cash_box_user_id" widget="many2many_tags" options="{'no_create': True}" nolabel="1"/>
+                                        </group>
+                                    </group>
+                                    <group col="2">
+                                        <group string="Sacar dinero sin saldo en caja">
+                                            <label for="output_negative_amount" string="Permitir sacar dinero" style="width: 200px"></label>
+                                            <field name="output_negative_amount" class="oe_inline" nolabel="1"/>
+                                        </group>
+                                        <group string="Eliminar las extracción de dinero">
+                                            <label for="delete_output_user_ids" string="Usuarios permitidos" style="width: 200px"></label>
+                                            <field name="delete_output_user_ids" class="oe_inline"  widget="many2many_tags" options="{'no_create': True}" nolabel="1"/>
+                                        </group>
+                                    </group>
+                                </page>
+                            </notebook>
                         </page>
 
-                        <!-- Sacar Dinero -->
-                        <page string="Sacar dinero">
-                            <separator string="Permitir sacar dinero"/>
-                            <div class="openerp oe_form oe_form_field">
-                                <span class="oe_form_text_content">
-                                    Permite a los usuario extraer dinero de las cajas.
-                                </span>
-                            </div>
-                            <group col="2">
-                                <group style="margin: 0px" string="Cajas permitidas">
-                                    <label for="output_cash_box_statement_ids" string="Tipos de caja permitidas" style="width: 200px"></label>
-                                    <field name="output_cash_box_statement_ids" widget="many2many_checkboxes" nolabel="1"/>
-                                </group>
-                                <group style="margin: 0px" string="Usuarios permitidos">
-                                    <label for="output_cash_box_user_id" string="Usuarios permitidos" style="width: 200px"></label>
-                                    <field name="output_cash_box_user_id" widget="many2many_tags" options="{'no_create': True}" nolabel="1"/>
-                                </group>
-                            </group>
-                            <group col="2">
-                                <group string="Sacar dinero sin saldo en caja">
-                                    <label for="output_negative_amount" string="Permitir sacar dinero" style="width: 200px"></label>
-                                    <field name="output_negative_amount" class="oe_inline" nolabel="1"/>
-                                </group>
-                                <group string="Eliminar las extracción de dinero">
-                                    <label for="delete_output_user_ids" string="Usuarios permitidos" style="width: 200px"></label>
-                                    <field name="delete_output_user_ids" class="oe_inline"  widget="many2many_tags" options="{'no_create': True}" nolabel="1"/>
-                                </group>
-                            </group>
+                        <!-- Caja (Abir, cerrar, Cancelar cajas) -->
+                        <page string='Caja'>
+                            <notebook>
+                                <!-- Abrir a caja  -->
+                                <page string="Apertura de caja ">
+                                    <separator string="Permite configurar si el usuario podrá o no tener mas de una caja abierta." style="font-size: 12pt"/>
+                                    <group string="Apertura de caja">
+                                        <label for="statement_open_config" string="Permitir abrir mas de una caja" style="width: 200px"></label>
+                                        <field name="statement_open_config"  style="width: 200px" nolabel="1" />
+                                    </group>
+                                </page>
+                                <!-- Cerrar caja  -->
+                                <page string="Cierre de caja">
+                                    <separator string="Permite configurar si el usuario  podrá hacer el cierre de caja, la transferencia a caja General o el ajuste de saldo." style="font-size: 12pt"/>
+                                    <group col="2">
+                                        <group  string="Cerrar caja">
+                                            <label for="statement_confirm_user" string="Usuarios permitidos" style="width: 200px"></label>
+                                            <field name="statement_confirm_user" class="oe_inline"  widget="many2many_tags" options="{'no_create': True}" nolabel="1"/>
+                                        </group>
+                                        <group string="Ajuste de saldo de cierre">
+                                            <label for="statement_confirm_balance" string="Usuarios permitidos" style="width: 200px"></label>
+                                            <field name="statement_confirm_balance" class="oe_inline"  widget="many2many_tags" options="{'no_create': True}" nolabel="1"/>
+                                        </group>
+                                    </group>
+                                    <group col="2">
+                                        <group  string ="Transferencia a caja general">
+                                            <label for="statement_confirm_transfer_user" string="Usuarios permitidos" style="width: 200px"></label>
+                                            <field name="statement_confirm_transfer_user" class="oe_inline"  widget="many2many_tags" options="{'no_create': True}" nolabel="1"/>
+                                        </group>
+                                        <group string="Permitir cerrar caja sin saldo">
+                                            <label for="statement_confirm_negative_amount" string="Usuarios permitidos" style="width: 200px"></label>
+                                            <field name="statement_confirm_negative_amount" class="oe_inline"  widget="many2many_tags" options="{'no_create': True}" nolabel="1"/>
+                                        </group>
+                                    </group>
+                                </page>
+                                <!-- Cancelar Caja  -->
+                                <page string="Cancelar Caja">
+                                    <separator string="Permite configurar si el usuario podrá cancelar la caja." style="font-size: 12pt"/>
+                                    <group col="2">
+                                        <group string="Permitir cancelar caja.">
+                                            <label for="statement_cancel_user" string="Usuarios permitidos" style="width: 200px"></label>
+                                            <field name="statement_cancel_user" class="oe_inline"  widget="many2many_tags" options="{'no_create': True}" nolabel="1"/>
+                                        </group>
+
+                                    </group>
+                                </page>
+                            </notebook>
                         </page>
 
-                        <!-- open -confirm statement -->
-                        <page string="Apertura &amp; Cierre caja">
-                            <separator string="Apertura de caja"/>
-
-                            <div class="openerp oe_form oe_form_field">
-                                <span class="oe_form_text_content">
-                                    Permite configurar si el usuario podrá o no tener mas de una caja abierta.
-                                </span>
-                            </div>
-
-                            <group style="margin: 0px">
-                                <label for="statement_open_config" string="Permitir abrir mas de una caja" style="width: 200px"></label>
-                                <field name="statement_open_config"  style="width: 200px" nolabel="1" />
-                            </group>
-
-                            <separator string="Cierre de caja"/>
-
-                            <div class="openerp oe_form oe_form_field">
-                                <span class="oe_form_text_content">
-                                    Permite configurar si el usuario  podrá hacer el cierre de caja, la transferencia a caja General o el ajuste de saldo.
-                                </span>
-                            </div>
-
-                            <group col="2">
-                                <group  string="Cerrar caja">
-                                    <label for="statement_confirm_user" string="Usuarios permitidos" style="width: 200px"></label>
-                                    <field name="statement_confirm_user" class="oe_inline"  widget="many2many_tags" options="{'no_create': True}" nolabel="1"/>
-                                </group>
-                                <group string="Ajuste de saldo de cierre">
-                                    <label for="statement_confirm_balance" string="Usuarios permitidos" style="width: 200px"></label>
-                                    <field name="statement_confirm_balance" class="oe_inline"  widget="many2many_tags" options="{'no_create': True}" nolabel="1"/>
-                                </group>
-                            </group>
-                            <group col="2">
-                                <group  string ="Transferencia a caja general">
-                                    <label for="statement_confirm_transfer_user" string="Usuarios permitidos" style="width: 200px"></label>
-                                    <field name="statement_confirm_transfer_user" class="oe_inline"  widget="many2many_tags" options="{'no_create': True}" nolabel="1"/>
-                                </group>
-                            </group>
-                        </page>
                     </notebook>
                 </form>
             </field>

+ 10 - 0
views/eiru_statement_utility.xml

@@ -11,6 +11,10 @@
 					<div class="eiru-statement-utility" attrs="{'invisible': [('state','!=','open')]}"></div>
 				</field>
 
+				<!-- <field name='state' position="before">
+					<div class="eiru-statement-utility" attrs="{'invisible': [('state','!=','open')]}"></div>
+				</field> -->
+
 				<!-- open -->
 				<xpath expr="//button[@name='button_open']" position="replace">
 					<div class="eiru-statement-utility-open" states="draft"> </div>
@@ -19,6 +23,12 @@
 				<!-- confirm -->
 				<xpath expr="//button[@name='button_confirm_cash']" position="replace"></xpath>
 
+				<!-- Cancel  -->
+				<xpath expr="//button[@name='button_cancel']" position="before">
+					<div class="eiru-statement-utility-cancel" attrs="{'invisible': [('state','!=','confirm')]}"></div>
+					<!-- <button name="button_cancel" states="open" string="Cancel CashBox" type="object"/> -->
+				</xpath>
+
 				<!-- print -->
 				<field name='state' position="before">
 					<div class="eiru-statement-print" attrs="{'invisible': [('state','!=','confirm')]}"></div>

+ 4 - 0
views/import_statement.xml

@@ -2,6 +2,7 @@
 <openerp>
 	<data>
 		<function model="account.bank.statement" name="update_statement_type_defualt"/>
+
 		<!-- Registros de caja -->
         <record id="eiru_import_statement_cash" model="ir.ui.view">
             <field name="name">eiru.import.statement.cash</field>
@@ -16,6 +17,7 @@
 				</field>
             </field>
         </record>
+
 		<!-- Extractos bancarios -->
 		<record id="eiru_import_statement_bank" model="ir.ui.view">
             <field name="name">eiru.import.statement.bank</field>
@@ -30,6 +32,7 @@
 				</field>
             </field>
         </record>
+
 		<!-- Agrupación por tipo de caja  cash-->
 		<record id="eiru_import_statement_search" model="ir.ui.view">
 			<field name="name">eiru.import.statement.search</field>
@@ -43,6 +46,7 @@
 				</search>
 			</field>
 		</record>
+
 		<!-- Agrupación por tipo de caja Bank -->
 		<record id="eiru_import_statement_search_bank" model="ir.ui.view">
 			<field name="name">eiru.import.statement.search.bank</field>

+ 2 - 0
views/template.xml

@@ -18,6 +18,8 @@
                 <script type="text/javascript" src="/eiru_account_bank_statement_utility/static/src/js/eiru_statement_confirm.js"/>
                 <!-- print confirm -->
                 <script type="text/javascript" src="/eiru_account_bank_statement_utility/static/src/js/eiru_statement_confirm_print.js"/>
+                <!-- cancel statement -->
+                <script type="text/javascript" src="/eiru_account_bank_statement_utility/static/src/js/eiru_statement_cancel.js"/>
                 <!-- Importar Cajas -->
                 <!-- <script type="text/javascript" src="/eiru_account_bank_statement_utility/static/src/js/import_statement.js"/> -->
             </xpath>