|
@@ -128,6 +128,9 @@ function report_stock_move(reporting){
|
|
|
return self.fetchResPartner();
|
|
|
}).then(function(ResPartner){
|
|
|
self.ResPartner=ResPartner;
|
|
|
+ return self.fetchProductProduct();
|
|
|
+ }).then(function(ProductProduct){
|
|
|
+ self.ProductProduct=ProductProduct;
|
|
|
return self.fetchStockLocation();
|
|
|
}).then(function(StockLocation){
|
|
|
self.StockLocation=StockLocation;
|
|
@@ -140,6 +143,7 @@ function report_stock_move(reporting){
|
|
|
self.$el.find('#current-location-destiny').append('<option value="' + item.id + '">'+ item.location_id[1] + " / " + item.name + '</option>');
|
|
|
});
|
|
|
self.search();
|
|
|
+ self.searchProduct();
|
|
|
return self.BuildTable();
|
|
|
});
|
|
|
},
|
|
@@ -163,6 +167,15 @@ function report_stock_move(reporting){
|
|
|
});
|
|
|
return defer;
|
|
|
},
|
|
|
+ fetchProductProduct: function() {
|
|
|
+ var self = this;
|
|
|
+ var defer = $.Deferred();
|
|
|
+ var ProductProduct = new instance.web.Model('product.product');
|
|
|
+ ProductProduct.query(['id', 'name',]).filter([['active', '=', true]]).all().then(function (results) {
|
|
|
+ defer.resolve(results);
|
|
|
+ });
|
|
|
+ return defer;
|
|
|
+ },
|
|
|
fetchStockLocation : function(){
|
|
|
var self = this;
|
|
|
var defer = $.Deferred();
|
|
@@ -173,8 +186,7 @@ function report_stock_move(reporting){
|
|
|
defer.resolve(results);
|
|
|
})
|
|
|
return defer;
|
|
|
- },
|
|
|
-
|
|
|
+ },
|
|
|
search: function () {
|
|
|
var self = this;
|
|
|
var results = self.ResPartner;
|
|
@@ -200,6 +212,31 @@ function report_stock_move(reporting){
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ searchProduct: function () {
|
|
|
+ var self = this;
|
|
|
+ var results = self.ProductProduct;
|
|
|
+ results = _.map(results, function (item) {
|
|
|
+ return {
|
|
|
+ label: item.id + '- '+ ' [ ' + self.valorNull(item.default_code) + ' ] ' + ' - ' + item.name + ' ( ' + self.valorNull(item.ean13) + ' )',
|
|
|
+ value: item.id + '- '+ ' [ ' + self.valorNull(item.default_code) + ' ] ' + ' - ' + item.name + ' ( ' + self.valorNull(item.ean13) + ' ) '
|
|
|
+ }
|
|
|
+ });
|
|
|
+ self.$('#product').autocomplete({
|
|
|
+ source: results,
|
|
|
+ minLength:0,
|
|
|
+ search: function(event, ui) {
|
|
|
+ if (!(self.$('#product').val())){
|
|
|
+ self.factSearch();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ close: function( event, ui ) {
|
|
|
+ self.factSearch();
|
|
|
+ },
|
|
|
+ select: function(event, ui) {
|
|
|
+ self.factSearch();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
BuildTable: function(){
|
|
|
var self = this;
|
|
|
var StockMove = self.StockMove;
|
|
@@ -231,11 +268,12 @@ function report_stock_move(reporting){
|
|
|
factSearch: function(){
|
|
|
var self = this;
|
|
|
var hoy = moment().format('YYYY-MM-DD');
|
|
|
- var desde =this.$el.find('#from').val();
|
|
|
- var hasta =this.$el.find('#to').val();
|
|
|
+ var desde = this.$el.find('#from').val();
|
|
|
+ var hasta = this.$el.find('#to').val();
|
|
|
var location_id = this.$el.find('#current-location-origin').val();
|
|
|
var location_dest_id = this.$el.find('#current-location-destiny').val();
|
|
|
- var partner= this.$el.find('#partner').val().split('-');
|
|
|
+ var partner = this.$el.find('#partner').val().split('-');
|
|
|
+ var product = this.$el.find('#product').val().split('-');
|
|
|
var content = self.content;
|
|
|
if ($('#A').is(":checked")){
|
|
|
content = _.filter(content, function (inv){
|
|
@@ -298,6 +336,11 @@ function report_stock_move(reporting){
|
|
|
return inv.partner_id == partner[0];
|
|
|
});
|
|
|
}
|
|
|
+ if (product != ''){
|
|
|
+ content = _.filter(content, function(inv){
|
|
|
+ return inv.product_id == product[0];
|
|
|
+ });
|
|
|
+ }
|
|
|
if (location_id != 9999999){
|
|
|
content = _.filter(content, function(inv){
|
|
|
return inv.location_id == location_id;
|