Kaynağa Gözat

[FIX] ajuste en el widget de gastos

Rodney Elpidio Enciso Arias 6 yıl önce
ebeveyn
işleme
707c69dcb7

+ 1 - 0
static/src/js/widgets/widget_balance.js

@@ -466,6 +466,7 @@ function widget_balance(widget) {
 
         showThisMonth: function () {
             var self = this;
+            // console.log(self);
             if(self.DashboardObjetive.length > 0){
                 self.objective = self.DashboardObjetive.shift().expected_profit;
             }else{

+ 29 - 23
static/src/js/widgets/widget_expense.js

@@ -54,7 +54,7 @@ function widget_expense(widget) {
             });
         },
 
-        /* 
+        /*
             USER
         */
 
@@ -91,9 +91,15 @@ function widget_expense(widget) {
             var journal_ids = _.flatten(_.map(this.AccountJournal, function (item) {
                 return item.id;
             }));
-            var date = moment().format('YYYY-MM-01');
+            var date = moment().format('YYYY-MM');
             var fields = ['id', 'name', 'date_invoice', 'amount_total','currency_id'];
-            var domain = [['state', 'not in', ['draft','cancel']],['origin','=',false],['type','=','in_invoice'],['journal_id','in',journal_ids],['date_invoice','>=',date]];
+            var domain = [
+                ['state', 'not in', ['draft','cancel']],
+                ['type','=','in_invoice'],
+                ['journal_id','in',journal_ids],
+                ['date_invoice','like',date],
+                '|',['origin','not like','%PO%'],['origin','=',false]
+            ];
             var AccountInvoice = new model.web.Model('account.invoice');
             AccountInvoice.query(fields).filter(domain).all().then(function(results) {
                 defer.resolve(results);
@@ -148,7 +154,7 @@ function widget_expense(widget) {
             })
         },
 
-        /* 
+        /*
             ACCOUNT INVOICE
         */
 
@@ -175,16 +181,16 @@ function widget_expense(widget) {
             }));
         },
 
-        /* 
+        /*
             ACCOUNT INVOICE BY MONTH
         */
 
         // getMonthAccountInvoice:function(mes) {
         //     var self = this;
         //     if (mes < 10){
-        //         var fecha = moment().format('YYYY')+'-'+'0'+mes;    
+        //         var fecha = moment().format('YYYY')+'-'+'0'+mes;
         //     }else{
-        //         var fecha = moment().format('YYYY')+'-'+mes;    
+        //         var fecha = moment().format('YYYY')+'-'+mes;
         //     }
         //     return _.flatten(_.filter(self.AccountInvoice,function (inv) {
         //         return moment(inv.date_invoice).format('YYYY-MM') === fecha;
@@ -192,9 +198,9 @@ function widget_expense(widget) {
         // },
 
         /*
-            TODAY    
+            TODAY
         */
-        
+
         showToday: function () {
             var self = this;
             var amount = 0;
@@ -217,7 +223,7 @@ function widget_expense(widget) {
             self.today = accounting.formatMoney(amount, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator);
         },
 
-        /* 
+        /*
             WEEK
         */
 
@@ -246,9 +252,9 @@ function widget_expense(widget) {
         showThisMonth: function () {
             var self = this;
             if(self.DashboardObjetive.length > 0){
-                self.objective = self.DashboardObjetive.shift().expense_limit;   
+                self.objective = self.DashboardObjetive.shift().expense_limit;
             }else{
-                self.objective = 0;    
+                self.objective = 0;
             }
             var amount = 0;
             var data = [];
@@ -268,15 +274,15 @@ function widget_expense(widget) {
                 });
             }
             self.month = accounting.formatMoney(amount, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator);
-            
-            if(self.objective > 0){ 
-                var percentage = (amount*100)/self.objective;    
+
+            if(self.objective > 0){
+                var percentage = (amount*100)/self.objective;
             }else{
                 var percentage = 0;
             }
 
             self.percentage = percentage;
-            
+
             $("#circle-expense").circliful({
                 animationStep: 10,
                 foregroundBorderWidth: 15,
@@ -286,11 +292,11 @@ function widget_expense(widget) {
                 foregroundColor: '#ef6c00',
                 percentageTextSize: 35,
             });
-            
+
             self.$el.find('.widget-content').find('a').text(accounting.formatMoney(amount, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
         },
 
-        /* 
+        /*
             MONTH
         */
 
@@ -318,13 +324,13 @@ function widget_expense(widget) {
         //                 return memo + num;
         //             });
         //         }
-        //         var total = invoice_total; 
+        //         var total = invoice_total;
         //         data.push(total);
         //     }
         //     self.data = data;
         // },
 
-        /* 
+        /*
             MODAL
         */
 
@@ -352,7 +358,7 @@ function widget_expense(widget) {
             $('.widget-modal').on('hidden.bs.modal', function (e) {
                 self.removeModal(e);
             })
-            
+
             $("#myItemModal").circliful({
                 animationStep: 10,
                 foregroundBorderWidth: 15,
@@ -371,7 +377,7 @@ function widget_expense(widget) {
             $('.modal-backdrop').remove();
         },
 
-        /* 
+        /*
             BUILD A CHART
         */
 
@@ -437,4 +443,4 @@ function widget_expense(widget) {
         //     });
         // },
     });
-}
+}

+ 15 - 15
static/src/js/widgets/widget_purchase.js

@@ -15,7 +15,7 @@ function widget_purchase(widget) {
 
         events: {
             'click .number': 'showModal',
-        }, 
+        },
 
         init: function (parent) {
             this._super(parent, {
@@ -57,7 +57,7 @@ function widget_purchase(widget) {
             });
         },
 
-        /* 
+        /*
             USER
         */
 
@@ -158,7 +158,7 @@ function widget_purchase(widget) {
             })
         },
 
-        /* 
+        /*
             ACCOUNT INVOICE
         */
 
@@ -185,16 +185,16 @@ function widget_purchase(widget) {
             }));
         },
 
-        /* 
+        /*
             ACCOUNT INVOICE BY MONTH
         */
 
         // getMonthAccountInvoice:function(mes) {
         //     var self = this;
         //     if (mes < 10){
-        //         var fecha = moment().format('YYYY')+'-'+'0'+mes;    
+        //         var fecha = moment().format('YYYY')+'-'+'0'+mes;
         //     }else{
-        //         var fecha = moment().format('YYYY')+'-'+mes;    
+        //         var fecha = moment().format('YYYY')+'-'+mes;
         //     }
         //     return _.flatten(_.filter(self.AccountInvoice,function (inv) {
         //         return moment(inv.date_invoice).format('YYYY-MM') === fecha;
@@ -253,16 +253,16 @@ function widget_purchase(widget) {
             self.week = amount;
         },
 
-        /* 
+        /*
             MONTH
         */
 
         showThisMonth: function () {
             var self = this;
             if(self.DashboardObjetive.length > 0){
-                self.objective = self.DashboardObjetive.shift().purchase_limit;   
+                self.objective = self.DashboardObjetive.shift().purchase_limit;
             }else{
-                self.objective = 0;    
+                self.objective = 0;
             }
             var amount = 0;
             var data = [];
@@ -282,8 +282,8 @@ function widget_purchase(widget) {
                 });
             }
             self.month = amount;
-            if(self.objective > 0){ 
-                var percentage = (amount*100)/self.objective;    
+            if(self.objective > 0){
+                var percentage = (amount*100)/self.objective;
             }else{
                 var percentage = 0;
             }
@@ -324,7 +324,7 @@ function widget_purchase(widget) {
         //                 return memo + num;
         //             });
         //         }
-        //         var total = invoice_total; 
+        //         var total = invoice_total;
         //         data.push(total);
         //     }
         //     self.data = data;
@@ -333,7 +333,7 @@ function widget_purchase(widget) {
         /*
             MODAL
         */
-       
+
         showModal: function (e) {
             var self = this;
             self.showThisWeek();
@@ -377,7 +377,7 @@ function widget_purchase(widget) {
             $('.modal-backdrop').remove();
         },
 
-        /* 
+        /*
             BUILD A CHART
         */
 
@@ -444,4 +444,4 @@ function widget_purchase(widget) {
         // },
 
     });
-}
+}