Browse Source

[fix]:Mejorar la condicion if

Adrielso 7 years ago
parent
commit
749f124078
3 changed files with 14 additions and 7 deletions
  1. 2 2
      .scannerwork/report-task.txt
  2. BIN
      __init__.pyc
  3. 12 5
      static/src/js/report_invoice_utility.js

+ 2 - 2
.scannerwork/report-task.txt

@@ -1,5 +1,5 @@
 projectKey=report:invoice:utility
 serverUrl=http://192.168.100.142:9600
 dashboardUrl=http://192.168.100.142:9600/dashboard/index/report:invoice:utility
-ceTaskId=AVuqp_usm9Hw3l9yF9oZ
-ceTaskUrl=http://192.168.100.142:9600/api/ce/task?id=AVuqp_usm9Hw3l9yF9oZ
+ceTaskId=AVur7DWPPtDHAqJ-mvye
+ceTaskUrl=http://192.168.100.142:9600/api/ce/task?id=AVur7DWPPtDHAqJ-mvye

BIN
__init__.pyc


+ 12 - 5
static/src/js/report_invoice_utility.js

@@ -41,7 +41,7 @@ openerp.report_invoice_utility = function (instance, local) {
               try {
                 date = $.datepicker.parseDate( dateFormat1, (fechaSel[1]+"/"+fechaSel[0]+"/"+fechaSel[2]));
               } catch( error ) {
-                date = null;
+               date = null;
               }
               return date;
             }
@@ -115,12 +115,19 @@ openerp.report_invoice_utility = function (instance, local) {
           return defer;
         },
         // Cansultar
+        verifFecha: function (desde, hasta){
+          var status = false;
+          if (((desde.length == 0) && (hasta.length > 0)) || ((desde.length > 0) && (hasta.length == 0))){
+            status = true;
+          }
+          return status;
+        },
         submitForm: function (e) {
           var desde =this.$el.find('#from').val();
           var hasta =this.$el.find('#to').val();
             e.preventDefault();
             var formData = this.$(e.currentTarget).serializeJSON();
-            if ((formData.journal == 0) || (((desde.length == 0) && (hasta.length > 0)) || ((desde.length > 0) && (hasta.length == 0)))){
+            if ((formData.journal == 0) || ((this.verifFecha(desde,hasta)) === true)){
                 $("#dialog" ).dialog({
                     autoOpen: true,
                     resizable: false,
@@ -175,7 +182,7 @@ openerp.report_invoice_utility = function (instance, local) {
               var currency_new;
               var item = this.invoices[i];
               var id = item.currency_id[0];
-              currency_new = this.getCutrrency(id)
+              currency_new = this.getCutrrency(id);
               if (!currency_new){
                   currency_new={};
                   currency_new.rate=1;
@@ -205,8 +212,8 @@ openerp.report_invoice_utility = function (instance, local) {
 
           for (var i = 0; i < this.invoiceLines.length; i++) {
             item = this.invoiceLines[i];
-            invoice = this.getInvoice(item.id)
-            producto =this.getProduct(item.product_id)
+            invoice = this.getInvoice(item.id);
+            producto =this.getProduct(item.product_id);
             if (!producto){
               producto={};
               producto.standard_price=0;