Ver Fonte

[FIX] ajustar regla css

adrielso há 7 anos atrás
pai
commit
6a1930d6b0

+ 2 - 0
.gitignore

@@ -0,0 +1,2 @@
+*.pyc
+.scannerwork

+ 0 - 7
model/account_bank_voucher_import.py

@@ -1,5 +1,4 @@
 # -*- coding: utf-8 -*-
-
 from openerp import models, fields, api,  _
 
 
@@ -7,9 +6,3 @@ class account_bank_statement_line(models.Model):
     _inherit = 'account.bank.statement.line'
 
     voucher_id = fields.Many2one('account.voucher', 'Voucher', readonly=True)
-
-
-# class account_voucher(models.Model):
-#     _inherit = 'account.voucher'
-#
-#     bank_statement_line_ids = fields.One2many('account.bank.statement.line', 'voucher_id', string="Statement Lines")

BIN
model/account_bank_voucher_import.pyc


+ 6 - 0
sonar-project.properties

@@ -0,0 +1,6 @@
+sonar.projectKey=account:bank:voucher:import
+sonar.projectName=account_bank_voucher_import
+sonar.projectVersion=1.0
+sonar.sources=.
+sonar.login=92576b87269fc3444a0e399bfe79f2cd30843db5
+sonar.javascript.globals=openerp,accounting

+ 3 - 7
static/src/css/style.css

@@ -1,8 +1,4 @@
-/*.oe_right.oe_button_box.payslip_import{
-    width: auto;
-    height:auto;
-}*/
-.oe_right.oe_button_box{
-    width: auto;
-    height:auto;
+.voucher-import {
+    width: auto !important;
+    height: auto !important;
 }

+ 48 - 49
static/src/js/account_bank_voucher_import.js

@@ -4,31 +4,31 @@ openerp.account_bank_voucher_import = function (instance, local) {
 
     local.VoucherImportWidget = instance.Widget.extend({
         template: 'account_bank_voucher_import.VoucherImport',
-        id : undefined,
-        accountStatement : [],
-        statementLine : [],
-        accountVoucher :[],
-        voucherImport : [],
+        id: undefined,
+        accountStatement: [],
+        statementLine: [],
+        accountVoucher: [],
+        voucherImport: [],
 
         init: function (parent) {
             this._super(parent);
         },
         // Actualizar id del Objeto
-        updateId : function(id){
+        updateId: function(id){
             var self = this;
-            self.id=id;
+            self.id = id;
         },
         start: function () {
             var self = this;
-            this.$el.click(function (e){
+            this.$el.click(function() {
                 self.fetchInitial();
             });
         },
         // Iniciar
-        fetchInitial: function(){
-            var self= this;
+        fetchInitial: function() {
+            var self = this;
 
-            self.fetchBankStatement().then(function(accountStatement){
+            self.fetchBankStatement().then(function(accountStatement) {
                 return accountStatement;
             }).then(function(accountStatement){
                 self.accountStatement = accountStatement;
@@ -52,57 +52,55 @@ openerp.account_bank_voucher_import = function (instance, local) {
             });
         },
         // Registro de Caja
-        fetchBankStatement : function(){
+        fetchBankStatement: function() {
             var self = this;
             var defer = $.Deferred();
-            var fields=['id','journal_id'];
-            var domain=[['id','=',self.id]];
+            var fields=['id', 'journal_id'];
+            var domain=[['id', 'in', self.id]];
             var statement = new instance.web.Model('account.bank.statement');
 
-            statement.query(fields).filter(domain).all().then(function (results){
+            statement.query(fields).filter(domain).all().then(function (results) {
                 defer.resolve(results);
             });
 
             return defer;
         },
         // Linea del Registro de Caja
-        fetchBankStatementLine : function(){
-            var self = this;
+        fetchBankStatementLine: function() {
             var defer = $.Deferred();
-            var fields=['id','voucher_id'];
-            // var domain=[['statement_id','=',self.id]];
-            var domain=[['voucher_id','!=', false]];
+            var fields=['id', 'voucher_id'];
+            var domain=[['voucher_id', '!=', false]];
+
             var statementLine = new instance.web.Model('account.bank.statement.line');
-            statementLine.query(fields).filter(domain).all().then(function (results){
-            // statementLine.query(fields).all().then(function (results){
+            statementLine.query(fields).filter(domain).all().then(function (results) {
                 defer.resolve(results);
             });
 
             return defer;
         },
         //Consultar Voucher
-        fetchVoucher : function(){
+        fetchVoucher: function() {
             var self = this;
-            var defer =$.Deferred();
+            var defer = $.Deferred();
 
-            var journal = _.flatten(_.map(self.accountStatement,function(map){
+            var journal = _.flatten(_.map(self.accountStatement,function(map) {
                 return map.journal_id[0];
             }));
-            var voucher =_.flatten(_.map(self.statementLine,function(map){
-                return map.voucher_id[0]
+            var voucher =_.flatten(_.map(self.statementLine,function(map) {
+                return map.voucher_id[0];
             }));
-            //
-            var fields =['id','partner_id','amount','journal_id','reference','move_id','account_id','state','type'];
-            var domain =[['state','=','posted'],['journal_id','in',journal],["id",'not in',voucher]];
+            var fields =['id', 'partner_id', 'amount', 'journal_id', 'reference', 'move_id', 'account_id', 'state', 'type'];
+            var domain =[['state', '=', 'posted'], ['journal_id', 'in', journal], ["id", 'not in', voucher]];
             var accountVouche = new instance.web.Model('account.voucher');
 
-            accountVouche.query(fields).filter(domain).all().then(function(results){
+            accountVouche.query(fields).filter(domain).all().then(function(results) {
                 defer.resolve(results);
             });
+
             return defer;
         },
         // Generar Objeto principal
-        fetchJoinVoucher:function(){
+        fetchJoinVoucher:function() {
             var self = this;
             var defer = $.Deferred();
             var itemvoucher;
@@ -110,29 +108,30 @@ openerp.account_bank_voucher_import = function (instance, local) {
             var ammount = 0;
             for (var i = 0; i < self.accountVouche.length; i++) {
                 itemvoucher = self.accountVouche[i];
-                if (itemvoucher.type == 'payment'){
-                    ammount = (itemvoucher.amount*-1);
+                if (itemvoucher.type === 'payment'){
+                    ammount = (itemvoucher.amount * -1 );
                 }else {
                     ammount = (itemvoucher.amount);
                 }
 
                 voucherImport.push({
-                                    statement_id : this.id,
-                                    name : itemvoucher.reference,
-                                    partner_id : itemvoucher.partner_id[0],
-                                    amount : ammount,
-                                    voucher_id : itemvoucher.id,
-                                    journal_id : itemvoucher.journal_id[0],
-                                    account_id : itemvoucher.account_id[0],
-                                    journal_entry_id : itemvoucher.move_id[0]
-                                  });
+                    statement_id: this.id,
+                    name: itemvoucher.reference,
+                    partner_id: itemvoucher.partner_id[0],
+                    amount: ammount,
+                    voucher_id: itemvoucher.id,
+                    journal_id: itemvoucher.journal_id[0],
+                    account_id: itemvoucher.account_id[0],
+                    journal_entry_id: itemvoucher.move_id[0]
+                });
             }
             defer.resolve(voucherImport);
+
             return defer;
         },
         // insertar la Linea
-        insertBankStatementLine : function(){
-            var self =this;
+        insertBankStatementLine: function() {
+            var self = this;
             var defer = $.Deferred();
             var accountBanckStatementLine = new instance.web.Model('account.bank.statement.line');
 
@@ -141,10 +140,10 @@ openerp.account_bank_voucher_import = function (instance, local) {
 
                 accountBanckStatementLine.call('create',[objeto], {
                     context: new instance.web.CompoundContext()
-                }).then(function (results) {
+                }).then(function() {
                     loop.next();
                });
-             }, function () {
+             }, function() {
                 defer.resolve(self.voucherImport.length);
              });
 
@@ -201,12 +200,12 @@ openerp.account_bank_voucher_import = function (instance, local) {
                     local.widgetInstance.updateId(record.id);
                 }
 
-                if (this.$el.find('.import_voucher').length != 0) return;
+                if (this.$el.find('.import-voucher').length !== 0) return;
 
                 local.widgetInstance = new local.VoucherImportWidget(this);
 
                 var elemento = this.$el.find('.oe_form_sheet.oe_form_sheet_width');
-                elemento =  elemento.find('.oe_right.oe_button_box.voucher_import');
+                elemento =  elemento.find('.oe_right.oe_button_box.voucher-import');
 
                 local.widgetInstance.appendTo(elemento);
                 local.widgetInstance.updateId(record.id);

+ 1 - 1
static/src/xml/account_bank_voucher_import.xml

@@ -2,7 +2,7 @@
 
 <templates xml:space="preserve">
     <t t-name="account_bank_voucher_import.VoucherImport">
-        <button class="import_voucher oe_stat_button btn btn-default oe_inline">
+        <button class="import-voucher oe_stat_button btn btn-default oe_inline">
               <div class="stat_button_icon fa fa-exchange"></div>
               <div>Pagos</div>
             </button>

+ 1 - 1
views/voucher_import.xml

@@ -8,7 +8,7 @@
             <field name="inherit_id" ref="account.view_bank_statement_form2"/>
             <field name="arch" type="xml">
                 <label for="name" position="before">
-                    <div class="oe_right oe_button_box voucher_import" attrs="{'invisible': [('state','!=','open')]} "  groups="account.group_account_user"></div>
+                    <div class="oe_right oe_button_box voucher-import" attrs="{'invisible': [('state','!=','open')]} "  groups="account.group_account_user"></div>
                 </label>
             </field>
         </record>