|
@@ -82,6 +82,17 @@ function report_session_analytic(reporting){
|
|
|
}else{
|
|
|
self.$el.find('.store').css('display','none');
|
|
|
}
|
|
|
+ return self.fetchPosCategory();
|
|
|
+ }).then(function(PosCategory){
|
|
|
+ self.PosCategory = PosCategory;
|
|
|
+ if(PosCategory.length > 1){
|
|
|
+ self.$el.find('#current-category').append('<option value="9999999">Todas las categorias</option>');
|
|
|
+ _.each(PosCategory,function(item){
|
|
|
+ self.$el.find('#current-category').append('<option value="' + item.id + '">' + item.complete_name + '</option>');
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ self.$el.find('.category').css('display','none');
|
|
|
+ }
|
|
|
return self.fetchAccountJournal();
|
|
|
}).then(function(AccountJournal){
|
|
|
self.AccountJournal = AccountJournal;
|
|
@@ -160,6 +171,18 @@ function report_session_analytic(reporting){
|
|
|
return defer;
|
|
|
},
|
|
|
|
|
|
+ /*====================================================================
|
|
|
+ RES STORE
|
|
|
+ ====================================================================*/
|
|
|
+ fetchPosCategory: function(){
|
|
|
+ var self = this;
|
|
|
+ var domain = [];
|
|
|
+ var PosCategory = new model.web.Model('pos.category');
|
|
|
+ return PosCategory.call('getPosCategory',[domain], {
|
|
|
+ context: new model.web.CompoundContext()
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
/*====================================================================
|
|
|
ACCOUNT JOURNAL
|
|
|
====================================================================*/
|
|
@@ -359,12 +382,16 @@ function report_session_analytic(reporting){
|
|
|
====================================================================*/
|
|
|
fetchProductProduct: function () {
|
|
|
var self = this;
|
|
|
+ var category = self.$el.find('#current-category').val();
|
|
|
var line_ids = _.flatten(_.map(self.PosOrderLine, function (item) {
|
|
|
return item.product_id[0];
|
|
|
}));
|
|
|
var domain = [
|
|
|
['id','in',line_ids],
|
|
|
];
|
|
|
+ if(category && category != 9999999){
|
|
|
+ domain.push(['pos_categ_id','=',parseInt(category)]);
|
|
|
+ };
|
|
|
var ProductProduct = new model.web.Model('product.product');
|
|
|
return ProductProduct.call('getProductProduct',[domain], {
|
|
|
context: new model.web.CompoundContext()
|
|
@@ -498,35 +525,34 @@ function report_session_analytic(reporting){
|
|
|
var utc_stop = ' ';
|
|
|
utc_start = moment.utc(item.start_at,'YYYY-MM-DD h:mm:ss A');
|
|
|
utc_start = moment(utc_start._d).format('DD/MM/YYYY HH:mm:ss');
|
|
|
-
|
|
|
if(item.stop_at){
|
|
|
utc_stop = moment.utc(item.stop_at,'YYYY-MM-DD h:mm:ss A');
|
|
|
utc_stop = moment(utc_stop._d).format('DD/MM/YYYY HH:mm:ss');
|
|
|
};
|
|
|
-
|
|
|
- data.push({
|
|
|
- id: item.id,
|
|
|
- config_id: item.config_id[1],
|
|
|
- name: item.name,
|
|
|
- user_id: item.user_id[1],
|
|
|
- start_at: utc_start,
|
|
|
- stop_at: utc_stop,
|
|
|
- /*
|
|
|
- ================================
|
|
|
- TOTAL FOOTER CONFIGURATION
|
|
|
- ================================
|
|
|
- */
|
|
|
- decimal_places : CurrencyBase.decimal_places,
|
|
|
- thousands_separator: CurrencyBase.thousands_separator,
|
|
|
- decimal_separator: CurrencyBase.decimal_separator,
|
|
|
- /*
|
|
|
- ================================
|
|
|
- DATA
|
|
|
- ================================
|
|
|
- */
|
|
|
- info: info,
|
|
|
- });
|
|
|
-
|
|
|
+ if(info.length > 0){
|
|
|
+ data.push({
|
|
|
+ id: item.id,
|
|
|
+ config_id: item.config_id[1],
|
|
|
+ name: item.name,
|
|
|
+ user_id: item.user_id[1],
|
|
|
+ start_at: utc_start,
|
|
|
+ stop_at: utc_stop,
|
|
|
+ /*
|
|
|
+ ================================
|
|
|
+ TOTAL FOOTER CONFIGURATION
|
|
|
+ ================================
|
|
|
+ */
|
|
|
+ decimal_places : CurrencyBase.decimal_places,
|
|
|
+ thousands_separator: CurrencyBase.thousands_separator,
|
|
|
+ decimal_separator: CurrencyBase.decimal_separator,
|
|
|
+ /*
|
|
|
+ ================================
|
|
|
+ DATA
|
|
|
+ ================================
|
|
|
+ */
|
|
|
+ info: info,
|
|
|
+ });
|
|
|
+ };
|
|
|
});
|
|
|
self.content = data;
|
|
|
self.loadTable(data);
|