|  | @@ -0,0 +1,59 @@
 | 
	
		
			
				|  |  | +(function() {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    openerp.widgetInstancePosAddExpenses = null;
 | 
	
		
			
				|  |  | +    openerp.parentInstancePosAddExpenses = {};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    openerp.EiruPosAddExpenses = openerp.Widget.extend({
 | 
	
		
			
				|  |  | +        template: 'EiruPosAdd.Expenses',
 | 
	
		
			
				|  |  | +        id: undefined,
 | 
	
		
			
				|  |  | +        /* init */
 | 
	
		
			
				|  |  | +        init: function(parent) {
 | 
	
		
			
				|  |  | +            this._super(parent);
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        /* start */
 | 
	
		
			
				|  |  | +        start: function () {
 | 
	
		
			
				|  |  | +            var self = this
 | 
	
		
			
				|  |  | +            this.$el.click(function() {
 | 
	
		
			
				|  |  | +                self.posAddExpenses();
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        posAddExpenses: function() {
 | 
	
		
			
				|  |  | +            this.do_action({
 | 
	
		
			
				|  |  | +                name: 'Registrar Gastos',
 | 
	
		
			
				|  |  | +                type: 'ir.actions.act_window',
 | 
	
		
			
				|  |  | +                res_model: 'account.invoice',
 | 
	
		
			
				|  |  | +                views: [[false,'form']],
 | 
	
		
			
				|  |  | +                target: 'current',
 | 
	
		
			
				|  |  | +                domain:[('type','=','in_invoice')],
 | 
	
		
			
				|  |  | +                context: {'default_type': 'in_invoice', 'type': 'in_invoice', 'journal_type': 'purchase'},
 | 
	
		
			
				|  |  | +                flags: {'form': {'action_buttons': true, 'options': {'model': 'view'}}},
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if (openerp.web && openerp.web.FormView) {
 | 
	
		
			
				|  |  | +        openerp.web.FormView.include({
 | 
	
		
			
				|  |  | +            load_record: function(record) {
 | 
	
		
			
				|  |  | +                this._super.apply(this, arguments);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                if (this.model !== 'pos.session')
 | 
	
		
			
				|  |  | +                    return;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                openerp.parentInstancePosAddExpenses = this;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                if (openerp.widgetInstancePosAddExpenses) {
 | 
	
		
			
				|  |  | +                    if (this.$el.find('.button-pos-add-expenses').length !== 0 )
 | 
	
		
			
				|  |  | +                        return ;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                if (this.$el.find('.button-pos-add-expenses').length !== 0 )
 | 
	
		
			
				|  |  | +                    return;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                openerp.widgetInstancePosAddExpenses = new openerp.EiruPosAddExpenses(this);
 | 
	
		
			
				|  |  | +                var element =this.$el.find('.oe_form').find('.eiru-statement-pos');
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                openerp.widgetInstancePosAddExpenses.appendTo(element[0]);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +})();
 |