Browse Source

commit inicial

Rodney Elpidio Enciso Arias 6 years ago
commit
8ca6c2deed

+ 3 - 0
__init__.py

@@ -0,0 +1,3 @@
+# -*- coding: utf-8 -*-
+import controllers
+import models

BIN
__init__.pyc


+ 24 - 0
__openerp__.py

@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+{
+    'name': "Eiru Reports - Athletic",
+    'author': "Eiru",
+    'category': 'report',
+    'version': '0.1',
+    'depends': [
+        'base',
+        'product',
+        'account',
+        'stock',
+        'eiru_assets',
+        'eiru_reports',
+    ],
+    'qweb': [
+        'static/src/xml/*.xml',
+        'static/src/reports/*.xml'
+    ],
+    'data': [
+        'templates.xml',
+        'views/actions.xml',
+        'views/menus.xml',
+    ],
+}

+ 2 - 0
controllers.py

@@ -0,0 +1,2 @@
+# -*- coding: utf-8 -*-
+from openerp import http

BIN
controllers.pyc


+ 35 - 0
models.py

@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+
+from openerp import models, fields, api
+
+class ProductProduct(models.Model):
+	_inherit = 'product.product'
+
+	@api.model
+	def getProductProductStockAthletic(self,domain):
+		ProductProduct = self.env['product.product'].search(domain)
+		values = []
+		for product in ProductProduct:
+			attributeValuesLines = map(lambda x: x.id, product.attribute_value_ids)
+			attributeIDS = []
+			for arttIds in self.env['product.attribute.value'].search([('id', 'in', attributeValuesLines)]):
+				attributeIDS.append(arttIds.attribute_id.id)
+
+			values.append({
+				'id': product.id,
+				'display_name': product.display_name,
+				'standard_price': product.standard_price,
+				'lst_price': product.lst_price,
+				'categ_id': {
+					'id': product.categ_id.id,
+					'name': product.categ_id.name,
+					'complete_name': product.categ_id.complete_name,
+				},
+				'atribute_value_ids': attributeValuesLines,
+				'attribute_ids': attributeIDS,
+				'default_code': product.default_code,
+				'factory_reference': product.factory_reference,
+				'ean13': product.ean13,
+			})
+
+		return values

BIN
models.pyc


BIN
static/description/icon.png


+ 15 - 0
static/src/js/main.js

@@ -0,0 +1,15 @@
+openerp.eiru_reports_athletic = function (instance) {
+    "use strict";
+
+    var reporting = instance.eiru_reports_athletic;
+
+    reporting_base(instance,reporting);
+
+    try {
+        report_stock_athletic(reporting);
+    } catch (e) {
+        // ignorar error
+    }
+
+    instance.web.client_actions.add('eiru_reports_athletic.report_stock_athletic_action', 'instance.eiru_reports_athletic.ReportStockAthleticWidget');
+}

+ 22 - 0
static/src/js/reporting_base.js

@@ -0,0 +1,22 @@
+function reporting_base (instance, widget) {
+    "use strict";
+
+    widget.Base = instance.Widget.extend({
+
+        position: 0,
+
+        init: function (parent, position) {
+            this._super(parent);
+            this.position = position || this.position;
+        },
+        start: function () {
+            
+        },
+        getPosition: function () {
+            return this.position;
+        },
+        setPosition: function (position) {
+            this.position = position;
+        }
+    });
+}

+ 760 - 0
static/src/js/reports/report_stock_athletic.js

@@ -0,0 +1,760 @@
+function report_stock_athletic(reporting){
+    "use strict";
+
+    var model = openerp;
+
+    reporting.ReportStockAthleticWidget = reporting.Base.extend({
+        template: 'ReportStockAthletic',
+        rowsData :[],
+        content :[],
+        modules: ['product_brand'],
+
+        events:{
+            'click #toolbar > button' : 'clickOnAction',
+            'click #generate' : 'fetchGenerate',
+            'click-row.bs.table #table' : 'clickAnalysisDetail',
+            'change #current-company' : 'updateSelections',
+            'change #current-attribute' : 'updateAttributeSelections',
+            'click #btnPrint' : 'callprint',
+        },
+
+        init : function(parent){
+            this._super(parent);
+        },
+
+        start: function () {
+            var table = this.$el.find('#table');
+            table.bootstrapTable({data : self.rowsData});
+            this.fetchInitial();
+        },
+
+        checkModel : function(model){
+            var self = this;
+            return _.filter(self.IrModuleModule,function(item){
+                return item.name === model
+            });
+        },
+
+        valorNull:function(dato){
+            var valor = "";
+            if (dato){
+                valor = dato;
+            }
+            return valor;
+        },
+
+        clickAnalysisDetail: function(e, row, $element,field){
+            if (field == 'name'){
+                this.do_action({
+                    name:"Producto",
+                    type: 'ir.actions.act_window',
+                    res_model: "product.product",
+                    views: [[false,'form']],
+                    target: 'new',
+                    domain: [['id','=', row.id]],
+                    context: {},
+                    flags: {'form': {'action_buttons': false, 'options': {'mode': 'view'}}},
+                    res_id: row.id,
+                });
+            }
+            e.stopImmediatePropagation();
+        },
+
+        fetchInitial: function () {
+            var self = this;
+            self.fecthIrModuleModule().then(function (IrModuleModule) {
+                return IrModuleModule;
+            }).then(function(IrModuleModule) {
+                self.IrModuleModule = IrModuleModule;
+                return self.fetchResCompany();
+            }).then(function(ResCompany){
+                self.ResCompany = ResCompany;
+                if(ResCompany.length > 1){
+                    self.$el.find('#current-company').append('<option value="9999999">Todas las empresas</option>');
+                    _.each(ResCompany,function(item){
+                        self.$el.find('#current-company').append('<option value="' + item.id + '">' + item.name + '</option>');
+                    });
+                }else{
+                    self.$el.find('.company').css('display','none');
+                }
+                return self.fetchStockLocation();
+            }).then(function(StockLocation){
+                self.StockLocation = StockLocation;
+                if(StockLocation.length > 1){
+                    self.$el.find('#current-location').append('<option value="9999999">Todas las ubicaciones</option>');
+                    _.each(StockLocation,function(item){
+                        self.$el.find('#current-location').append('<option value="' + item.id + '">' + item.display_name + '</option>');
+                    });
+                }else{
+                    self.$el.find('.location').css('display','none');
+                }
+                return self.fetchProductBrand();
+            }).then(function(ProductBrand){
+                self.ProductBrand = ProductBrand;
+                if(ProductBrand.length > 1){
+                    self.$el.find('#current-brand').append('<option value="9999999">Todas las marcas</option>');
+                    _.each(ProductBrand,function(item){
+                        self.$el.find('#current-brand').append('<option value="' + item.id + '">' + item.name + '</option>');
+                    });
+                }else{
+                    self.$el.find('.brand').css('display','none');
+                }
+                return self.fetchProductCategory();
+            }).then(function(ProductCategory){
+                self.ProductCategory = ProductCategory;
+                if(ProductCategory.length > 1){
+                    self.$el.find('#current-category').append('<option value="9999999">Todas las categorias</option>');
+                    _.each(ProductCategory,function(item){
+                        self.$el.find('#current-category').append('<option value="' + item.id + '">' + item.display_name + '</option>');
+                    });
+                }else{
+                    self.$el.find('.category').css('display','none');
+                }
+                return self.fetchProductAttribute();
+            }).then(function(ProductAttribute){
+                self.ProductAttribute = ProductAttribute;
+                if(ProductAttribute.length > 1){
+                    self.$el.find('#current-attribute').append('<option value="9999999">Todos los atributos</option>');
+                    _.each(ProductAttribute,function(item){
+                        self.$el.find('#current-attribute').append('<option value="' + item.id + '">' + item.name + '</option>');
+                    });
+                }else{
+                    self.$el.find('.attribute').css('display','none');
+                }
+                return self.fetchProductAttributeValue();
+            }).then(function(ProductAttributeValue){
+                self.ProductAttributeValue = ProductAttributeValue;
+                if(ProductAttributeValue.length > 1){
+                    self.$el.find('#current-attribute-value').append('<option value="9999999">Todos los valores de atributos</option>');
+                    _.each(ProductAttributeValue,function(item){
+                        self.$el.find('#current-attribute-value').append('<option value="' + item.id + '">' + item.name + '</option>');
+                    });
+                }else{
+                    self.$el.find('.attribute-value').css('display','none');
+                }
+                return self.fetchResCurrency();
+            }).then(function(ResCurrency){
+                self.ResCurrency = ResCurrency;
+            });
+            self.$el.find('#generate').css('display','inline');
+            return;
+        },
+
+        fetchGenerate: function () {
+            var self = this;
+            self.$el.find('.search-form').block({
+                message: null,
+                overlayCSS: {
+                    backgroundColor: '#FAFAFA'
+                }
+            });
+            self.$el.find('.report-form').block({
+                message: null,
+                overlayCSS: {
+                    backgroundColor: '#FAFAFA'
+                }
+            });
+            self.fetchStockQuant().then(function(StockQuant) {
+                return StockQuant;
+            }).then(function (StockQuant) {
+                self.StockQuant = StockQuant;
+                return self.fetchProductProduct();
+            }).then(function (ProductProduct){
+                self.ProductProduct = ProductProduct;
+                return self.BuildTable();
+            });
+        },
+
+        /*=====================================================================
+            IR MODULE
+        =====================================================================*/
+        fecthIrModuleModule: function(){
+            var self = this;
+            var defer = $.Deferred();
+            var fields = ['name','id'];
+            var domain=[['state','=','installed'],['name','in',self.modules]];
+            var IrModuleModule = new model.web.Model('ir.module.module');
+            IrModuleModule.query(fields).filter(domain).all().then(function(results){
+                defer.resolve(results);
+            })
+            return defer;
+        },
+
+        /*====================================================================
+            RES COMPANY
+        ====================================================================*/
+        fetchResCompany: function(){
+            var self = this;
+            var defer = $.Deferred();
+            var currency = new model.web.Model('res.company');
+            var field=['id','name','currency_id','logo'];
+            currency.query(field).filter().all().then(function(results){
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
+        /*====================================================================
+            STOCK LOCATION
+        ====================================================================*/
+        fetchStockLocation: function () {
+            var self = this;
+            var company = self.$el.find('#current-company').val();
+            var domain = [
+                ['active', '=',true],
+                ['usage', '=','internal'],
+            ];
+            if(company && company != 9999999){
+                domain.push(['company_id','=',parseInt(company)]);
+            }
+            var StockLocation = new model.web.Model('stock.location');
+            return StockLocation.call('getStockLocation',[domain], {
+                context: new model.web.CompoundContext()
+            });
+        },
+
+        /*====================================================================
+            PRODUCT BRAND
+        ====================================================================*/
+        fetchProductBrand: function () {
+            var self = this;
+            var domain = [];
+            var modules = self.checkModel('product_brand');
+            if (modules.length > 0){
+                var ProductBrand = new model.web.Model('product.product');
+                return ProductBrand.call('getProductBrand',[domain], {
+                    context: new model.web.CompoundContext()
+                });
+            }else{
+                var ProductBrand = [];
+                return ProductBrand;
+            }
+        },
+
+        /*====================================================================
+            PRODUCT CATEGORY
+        ====================================================================*/
+        fetchProductCategory: function () {
+            var self = this;
+            var domain = [];
+            var ProductCategory = new model.web.Model('product.category');
+            return ProductCategory.call('getProductCategory',[domain], {
+                context: new model.web.CompoundContext()
+            });
+        },
+
+        /*====================================================================
+            PRODUCT ATTRIBUTE
+        ====================================================================*/
+        fetchProductAttribute: function () {
+            var self = this;
+            var domain = [];
+            var ProductAttribute = new model.web.Model('product.attribute');
+            return ProductAttribute.call('getProductAttribute',[domain], {
+                context: new model.web.CompoundContext()
+            });
+        },
+
+        /*====================================================================
+            PRODUCT ATTRIBUTE VALUE
+        ====================================================================*/
+        fetchProductAttributeValue: function () {
+            var self = this;
+            var domain = [];
+            var ProductAttributeValue = new model.web.Model('product.attribute.value');
+            return ProductAttributeValue.call('getProductAttributeValue',[domain], {
+                context: new model.web.CompoundContext()
+            });
+        },
+
+        /*====================================================================
+            RES CURRENCY
+        ====================================================================*/
+        fetchResCurrency : function(){
+            var self = this;
+            var domain = [['active', '=', true]];
+            var ResCurrency = new model.web.Model('res.currency');
+            return ResCurrency.call('getResCurrency',[domain], {
+                context: new model.web.CompoundContext()
+            });
+        },
+
+        /*====================================================================
+            STOCK QUANT
+        ====================================================================*/
+        fetchStockQuant: function () {
+            var self = this;
+            var company = self.$el.find('#current-company').val();
+            var location = self.$el.find('#current-location').val();
+            var location_ids = _.flatten(_.map(self.StockLocation, function (item) {
+                return item.id;
+            }));
+            var domain = [
+                ['location_id', 'in',location_ids],
+            ];
+            if(company && company != 9999999){
+                domain.push(['company_id','=',parseInt(company)]);
+            }
+            if(location && location != 9999999){
+                domain.push(['location_id','=',parseInt(location)]);
+            }
+            var StockQuant = new model.web.Model('stock.quant');
+            return StockQuant.call('getStockQuant',[domain], {
+                context: new model.web.CompoundContext()
+            });
+        },
+
+        /*====================================================================
+            PRODUCT PRODUCT
+        ====================================================================*/
+        fetchProductProduct: function () {
+            var self = this;
+            var categ_ids = [];
+            var company = self.$el.find('#current-company').val();
+            var brand = self.$el.find('#current-brand').val();
+            var category = self.$el.find('#current-category').val();
+            var state = self.$el.find('#current-state').val();
+            var domain = [
+                ['active','=',true],
+                ['type','=','product'],
+            ];
+            if(state == 'available'){
+                var product_ids = _.flatten(_.map(self.StockQuant, function (item) {
+                    return item.product_id[0];
+                }));
+                domain.push(['id','in',product_ids]);
+            };
+            if(company && company != 9999999){
+                domain.push(['company_id','=',parseInt(company)]);
+            };
+            if(category){
+                var category_ids = _.map(_.filter(self.ProductCategory,function (item) {
+                    return item.id == category || item.parent_id[0] == category;
+                }), function(map){
+                    return map.id;
+                });
+                var category_children_ids = _.map(_.filter(self.ProductCategory,function (item) {
+                    return _.contains(category_ids, item.parent_id[0]) || item.id == category;
+                }), function(map){
+                    return map.id;
+                });
+                var category_grandchildren_ids = _.map(_.filter(self.ProductCategory,function (item) {
+                    return _.contains(category_children_ids, item.parent_id[0]) || item.id == category;
+                }), function(map){
+                    return map.id;
+                }) ;
+                categ_ids =  _.map(_.filter(self.ProductCategory,function (item) {
+                    return _.contains(category_grandchildren_ids, item.parent_id[0]) || item.id == category;
+                }), function(map){
+                    return map.id;
+                });
+            };
+            if(brand && brand != 9999999){
+                domain.push(['product_brand_id','=',parseInt(brand)]);
+            }
+            if(category && category != 9999999){
+                domain.push(['categ_id','in',categ_ids]);
+            }
+            var ProductProduct = new model.web.Model('product.product');
+            return ProductProduct.call('getProductProductStockAthletic',[domain], {
+                context: new model.web.CompoundContext()
+            });
+        },
+
+        /*====================================================================
+            UPDATE SELECTIONS
+        ====================================================================*/
+        updateSelections: function () {
+            var self = this;
+            var company = self.$el.find('#current-company').val();
+            if(company != 9999999){
+                /*======================
+                    LOCATION SELECTION
+                ======================*/
+                var location = self.$el.find('#current-location').empty();
+                self.$el.find('#current-location').append('<option value="9999999">Todas las ubicaciones</option>');
+                _.each(self.StockLocation,function(item){
+                    if(parseInt(company) == item.company_id[0]){
+                        self.$el.find('#current-location').append('<option value="' + item.id + '">' + item.display_name + '</option>');
+                    }
+                });
+            }else{
+                /*=====================
+                    LOCATION SELECTION
+                =====================*/
+                var location = self.$el.find('#current-location').empty();
+                self.$el.find('#current-location').append('<option value="9999999">Todas las ubicaciones</option>');
+                _.each(self.StockLocation,function(item){
+                    self.$el.find('#current-location').append('<option value="' + item.id + '">' + item.display_name + '</option>');
+                });
+            }
+        },
+
+        updateAttributeSelections: function () {
+            var self = this;
+            var attribute = self.$el.find('#current-attribute').val();
+            if(attribute != 9999999){
+                /*=============================
+                    ATTRIBUTE VALUE SELECTION
+                =============================*/
+                var attribute_value = self.$el.find('#current-attribute-value').empty();
+                self.$el.find('#current-attribute-value').append('<option value="9999999">Todos los valores de atributos</option>');
+                _.each(self.ProductAttributeValue,function(item){
+                    if(parseFloat(attribute) == item.attribute_id[0]){
+                        self.$el.find('#current-attribute-value').append('<option value="' + item.id + '">' + item.name + '</option>');
+                    }
+                });
+            }else{
+                /*=============================
+                    ATTRIBUTE VALUE SELECTION
+                =============================*/
+                var attribute_value = self.$el.find('#current-attribute-value').empty();
+                self.$el.find('#current-attribute-value').append('<option value="9999999">Todos los valores de atributos</option>');
+                _.each(self.ProductAttributeValue,function(item){
+                    self.$el.find('#current-attribute-value').append('<option value="' + item.id + '">' + item.name + '</option>');
+                });
+            }
+        },
+
+        /*====================================================================
+            GET RES COMPANY
+        ====================================================================*/
+        getResCompany: function (id) {
+            var self = this;
+            return _.filter(self.ResCompany,function (item) {
+                return item.id == id;
+            })
+        },
+
+        /*====================================================================
+            GET CURRENT LOCATION
+        ====================================================================*/
+        getCurrentLocation: function (id) {
+            var self = this;
+            return _.filter(self.StockLocation,function (item) {
+                return item.id == id;
+            })
+        },
+
+        /*====================================================================
+            GET RES CURRENCY BASE
+        ====================================================================*/
+        getResCurrency: function (id) {
+            var self = this;
+            return _.filter(self.ResCurrency,function (item) {
+                return item.id === id;
+            })
+        },
+
+        /*====================================================================
+            GET PRODUCT PRODUCT
+        ====================================================================*/
+        getProductProduct: function () {
+            var self = this;
+            var content = self.ProductProduct;
+            var attribute = self.$el.find('#current-attribute').val();
+            var attribute_value = self.$el.find('#current-attribute-value').val();
+            if(attribute && attribute != 9999999 && attribute_value == 9999999){
+                content = _.filter(content,function (item) {
+                    return _.contains(item.attribute_ids, parseInt(attribute));
+                });
+            }
+            if(attribute_value && attribute_value != 9999999){
+                content = _.filter(content,function (item) {
+                    return _.contains(item.atribute_value_ids, parseFloat(attribute_value));
+                });
+            }
+            return content;
+        },
+
+        /*====================================================================
+            GET STOCK QUANT
+        ====================================================================*/
+        getStockQuant: function(id){
+            var self = this;
+            return _.filter(self.StockQuant, function(item){
+                return item.product_id[0] === id;
+            });
+        },
+
+        /*====================================================================
+            BUILD
+        ====================================================================*/
+        BuildTable: function(){
+            var self = this;
+            var data = [];
+            console.log(self);
+            var company = $('#current-company').val();
+            var state = $('#current-state').val();
+            if(company && company != 9999999){
+                var ResCompany = self.getResCompany(company).shift();
+                var CurrencyBase = self.getResCurrency(ResCompany.currency_id[0]).shift();
+            }else{
+                var CurrencyBase = self.getResCurrency(self.ResCompany[0].currency_id[0]).shift();
+            }
+            var ProductProduct = self.getProductProduct();
+            _.each(ProductProduct, function(item){
+                var quantity = 0;
+                var StockQuant = self.getStockQuant(item.id);
+                if(StockQuant.length > 0){
+                    quantity = _.reduce(_.map(StockQuant,function(item){
+                        return item.qty;
+                    }),function(mamo, num){
+                        return mamo + num;
+                    },0);
+                };
+                data.push({
+                    /*=======================
+                        IDS
+                    =======================*/
+                    id : item.id,
+                    /*=======================
+                        INFO
+                    =======================*/
+                    default_code: item.default_code,
+                    factory_reference: item.factory_reference,
+                    name : item.display_name,
+                    ean13 : self.valorNull(item.ean13),
+                    category : item.categ_id.complete_name,
+                    standard_price_total : accounting.formatMoney(item.standard_price, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                    lst_price_total : accounting.formatMoney(item.lst_price, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                    quantity : accounting.formatNumber(quantity,2,'.',','),
+                    valuation_cost_total : accounting.formatMoney((item.standard_price * quantity), '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                    valuation_sale_total : accounting.formatMoney((item.lst_price * quantity), '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                    utility_total : accounting.formatMoney(((item.lst_price * quantity)-(item.standard_price * quantity)), '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                    /*=======================
+                        VALORES SIN FORMATEAR
+                    =======================*/
+                    qty : quantity,
+                    standard_price : item.standard_price,
+                    lst_price : item.lst_price,
+                    valuation_cost : item.standard_price * quantity,
+                    valuation_sale : item.lst_price * quantity,
+                    utility : (item.lst_price * quantity)-(item.standard_price * quantity),
+                    /*==============================
+                        TOTAL FOOTER CONFIGURATION
+                    ==============================*/
+                    decimal_places : CurrencyBase.decimal_places,
+                    thousands_separator: CurrencyBase.thousands_separator,
+                    decimal_separator: CurrencyBase.decimal_separator,
+                });
+
+                if(state && state == 'available' && quantity <= 0){
+                    data.pop();
+                }
+
+                if(state && state == 'unavailable' && quantity > 0){
+                    data.pop();
+                }
+
+            });
+            self.content = data;
+            self.loadTable(data);
+            self.$el.find('.report-form').css('display','block');
+            self.$el.find('.search-form').unblock();
+            self.$el.find('.report-form').unblock();
+        },
+
+        /*====================================================================
+            LOAD BOOTSTRAP TABLE
+        ====================================================================*/
+        loadTable:function(rowsTable){
+            var self = this;
+            self.rowsData = rowsTable;
+            var table = this.$el.find('#table');
+            table.bootstrapTable('load', rowsTable);
+        },
+
+        callprint: function (e) {
+            var self = this;
+            var pdf = new reporting.ReportPdfWidget(self);
+            pdf.getPDFFileButton();
+        },
+
+        /*====================================================================
+            PRINT PDF
+        ====================================================================*/
+        clickOnAction: function (e) {
+            var self = this;
+            var ResCompany;
+            var action = this.$el.find(e.target).val();
+            var company = $('#current-company').val();
+            var location = $('#current-location').val();
+            var pdf_type = $('#current-pdf-type').val();
+            var current_location = [];
+            if(location && location != 9999999){
+                current_location = self.getCurrentLocation(location);
+            }
+            if(company && company != 9999999){
+                ResCompany = self.getResCompany(company).shift();
+                var CurrencyBase = self.getResCurrency(ResCompany.currency_id[0]).shift();
+            }else{
+                ResCompany = self.ResCompany[0];
+                var CurrencyBase = self.getResCurrency(self.ResCompany[0].currency_id[0]).shift();
+            }
+            var getColumns=[];
+            var rows=[];
+            var table = this.$el.find("#table");
+            var column = table.bootstrapTable('getVisibleColumns');
+            var row = table.bootstrapTable('getData');
+
+            var qty = qtyFormatter(row);
+            var valuation_cost_total = CostValuationFormatter(row);
+            var valuation_sale_total = SaleValuationFormatter(row);
+            var utility_total = UtilityFormatter(row);
+
+            row.push({
+                default_code : 'Totales',
+                quantity : qty,
+                valuation_cost_total : valuation_cost_total,
+                valuation_sale_total : valuation_sale_total,
+                utility_total : utility_total,
+            });
+
+            if (action === 'pdf') {
+                var data = _.map(column, function (val){ return val.field});
+                _.each(_.map(column,function(val){
+                    return val}), function(item){
+                        if(item.field != 'image'){
+                            getColumns.push([{
+                                title: item.title,
+                                dataKey: item.field
+                            }]);
+                        }
+                });
+                /*
+                ============================================================
+                    CONFIGURACION DEL PDF
+                ============================================================
+                */
+                var pdf_title = 'Valoracion de Inventario';
+                var pdf_name = 'valoracion_de_inventario_';
+                if(pdf_type == 1){
+                    pdf_type = 'l';
+                    var pdf_columnStyles = {
+                        name :{halign:'left'},
+                        ean13 :{columnWidth: 21, halign:'center'},
+                        category :{halign:'left'},
+                        standard_price_total :{columnWidth: 20, halign:'right'},
+                        lst_price_total :{columnWidth: 20, halign:'right'},
+                        quantity : {columnWidth: 20, halign:'right'},
+                        valuation_cost_total : {columnWidth: 20, halign:'right'},
+                        valuation_sale_total : {columnWidth: 20, halign:'right'},
+                        utility_total : {columnWidth: 20, halign:'right'},
+                    };
+                }else{
+                    pdf_type = '';
+                    var pdf_columnStyles = {
+                        name :{halign:'left'},
+                        ean13 :{columnWidth: 21, halign:'center'},
+                        category :{halign:'left'},
+                        standard_price_total :{columnWidth: 20, halign:'right'},
+                        lst_price_total :{columnWidth: 20, halign:'right'},
+                        quantity : {columnWidth: 20, halign:'right'},
+                        valuation_cost_total : {columnWidth: 20, halign:'right'},
+                        valuation_sale_total : {columnWidth: 20, halign:'right'},
+                        utility_total : {columnWidth: 20, halign:'right'},
+                    };
+                };
+                /*
+                ============================================================
+                    LLAMAR FUNCION DE IMPRESION
+                ============================================================
+                */
+                var filter = self.getFilter();
+                var pdf = new model.eiru_reports.ReportPdfWidget(self);
+                pdf.drawPDF(
+                    _.flatten(getColumns),
+                    row,
+                    ResCompany,
+                    pdf_title,
+                    pdf_type,
+                    pdf_name,
+                    pdf_columnStyles,
+                    filter,
+                );
+            }
+        },
+        getFilter: function(){
+          var self = this;
+          var company = self.$el.find('#current-company').val();
+          var location = self.$el.find('#current-location').val();
+          var brand = self.$el.find('#current-brand').val();
+          var category = self.$el.find('#current-category').val();
+          var attribute = self.$el.find('#current-attribute').val();
+          var attribute_value = self.$el.find('#current-attribute-value').val();
+          var state = self.$el.find('#current-state').val();
+          var filter = [];
+
+          if(company && company){
+            var ResCompany = _.filter(self.ResCompany, function(item){
+              return item.id == company;
+            });
+            filter.push({
+              title:'Empresa',
+              value: ResCompany[0].name,
+            });
+          }
+
+          if(location && location != 9999999){
+            var StockLocation =  _.filter(self.StockLocation,function (item) {
+                return item.id == location;
+            });
+
+            filter.push({
+                 title: 'Ubicación',
+                 value:  StockLocation[0].display_name,
+               });
+
+          }
+
+          if(brand && brand != 9999999){
+            var brand =  _.filter(self.ProductBrand,function (item) {
+                return item.id == brand;
+            });
+            filter.push({
+                 title: 'Marca',
+                 value: brand[0].name,
+               });
+          }
+
+          if(category && category != 9999999){
+            var categ =  _.filter(self.ProductCategory,function (item) {
+                return item.id == category;
+            });
+            filter.push({
+                 title: 'Categoría',
+                 value: categ[0].name,
+               });
+          }
+
+          if(attribute && attribute != 9999999){
+            var attr =  _.filter(self.ProductAttribute,function (item) {
+                return item.id == attribute;
+            });
+            filter.push({
+                 title: 'Atributo',
+                 value: attr[0].name,
+               });
+          }
+
+          if(attribute_value && attribute_value != 9999999){
+            var attr_value =  _.filter(self.ProductAttributeValue,function (item) {
+                return item.id == attribute_value;
+            });
+            filter.push({
+                 title: 'Valor de Atributo',
+                 value: attr_value[0].name,
+               });
+          }
+
+          if(state && state != 9999999){
+            filter.push({
+                 title: 'Estado',
+                 value:  $("#current-state option:selected").text(),
+               });
+          }
+          return filter;
+        }
+    });
+}

+ 189 - 0
static/src/reports/report_stock_athletic.xml

@@ -0,0 +1,189 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template xml:space="preserve">
+    <t t-name="ReportStockAthletic">
+        <div class="report_view">
+            <div class="reporting_page_header">
+                <h1 class="report_title">Valoración de Stock</h1>
+            </div>
+            <div class="container search-form" style="border-bottom:1px solid #eee; width:90%;">
+                <div class="row">
+                    <div class="col-lg-3 company filter-style">
+                        <label>Empresa</label>
+                        <select id="current-company" class="form-control form-control-sm"></select>
+                    </div>
+                    <div class="col-lg-3 location filter-style">
+                        <label>Ubicación</label>
+                        <select id="current-location" class="form-control form-control-sm">
+                        </select>
+                    </div>
+                    <div class="col-lg-3 brand filter-style">
+                        <label>Marca</label>
+                        <select id="current-brand" class="form-control form-control-sm">
+                        </select>
+                    </div>
+                    <div class="col-lg-3 category filter-style">
+                        <label>Categoría</label>
+                        <select id="current-category" class="form-control form-control-sm">
+                        </select>
+                    </div>
+                    <div class="col-lg-3 attribute filter-style">
+                        <label>Atributo</label>
+                        <select id="current-attribute" class="form-control form-control-sm">
+                        </select>
+                    </div>
+                    <div class="col-lg-3 attribute-value filter-style">
+                        <label>Valor del Atributo</label>
+                        <select id="current-attribute-value" class="form-control form-control-sm">
+                        </select>
+                    </div>
+                    <div class="col-lg-3 filter-style">
+                        <label>Estado</label>
+                        <select id="current-state" class="form-control form-control-sm">
+                            <option value="9999999">Todos los estados</option>
+                            <option value="available">Disponible</option>
+                            <option value="unavailable">No Disponible</option>
+                        </select>
+                    </div>
+                    <div class="col-lg-3 filter-style">
+                        <label>Orientacion de impresión</label>
+                        <select id="current-pdf-type" class="form-control form-control-sm">
+                            <option value="0">Vertical</option>
+                            <option value="1">Horizontal</option>
+                        </select>
+                    </div>
+                </div>
+                <div class="row">
+                    <div class="text-center" style="padding-top:20px;">
+                        <button id="generate" class="myButton" aria-label="Left Align" style="color:#fff;display:none;">
+                            Generar
+                        </button>
+                    </div>
+                    <br/>
+                </div>
+            </div>
+
+            <div class="report-form" style="display:none;">
+                <div id="toolbar">
+                    <button class="oe_button myButton" value="pdf">Imprimir Informe</button>
+                </div>
+                <div class="container" style="width:90%;">
+                    <table id="table"
+                        data-pagination="true"
+                        data-toggle="table"
+                        data-toolbar="#toolbar"
+                        data-show-columns="true"
+                        data-classes="table table-condensed  table-no-bordered"
+                        data-search="true"
+                        data-show-export="true"
+                        data-show-toggle="true"
+                        data-pagination-detail-h-align="left"
+                        data-show-footer="true"
+                        data-footer-style="footerStyle"
+                        data-buttons-class="oe_button myButton"
+                        data-show-pagination-switch="true"
+                        data-page-size="10"
+                        data-search-on-enter-key="true"
+                        data-undefined-text=" "
+                        >
+                        <thead style="background:none;">
+                            <tr>
+                                <th data-field="default_code" data-align="left" data-sortable="true" data-footer-formatter="Totales">Codigo</th>
+                                <th data-field="factory_reference" data-align="left" data-sortable="true">Referencia</th>
+                                <th data-field="name" data-align="left">Producto</th>
+                                <th data-field="category" data-align="left">Categoria</th>
+                                <th data-field="standard_price_total" data-align="right">Precio Costo</th>
+                                <th data-field="lst_price_total" data-align="right">Precio Venta</th>
+                                <th data-field="quantity" data-footer-formatter="qtyFormatter" data-align="right">Cantidad</th>
+                                <th data-field="valuation_cost_total" data-align="right" data-footer-formatter="CostValuationFormatter" data-width="12%">Valoracion Coste</th>
+                                <th data-field="valuation_sale_total" data-align="right" data-footer-formatter="SaleValuationFormatter" data-width="12%">Valoracion Venta</th>
+                                <th data-field="utility_total" data-align="right" data-footer-formatter="UtilityFormatter" data-width="12%">Utilidad</th>
+                            </tr>
+                        </thead>
+                    </table>
+                </div>
+            </div>
+
+            <script>
+                <!--
+                    CANTIDAD
+                -->
+                function qtyFormatter(rowsTable) {
+                    var quantity =  _.reduce(_.map(rowsTable,function(item){
+                        return (item.qty);
+                    }), function(memo, num){
+                    return memo + num; },0)
+                    return accounting.formatNumber(quantity,2,'.',',');
+                }
+
+                <!--
+                    VALORACION DE COSTE
+                -->
+                function CostValuationFormatter(rowsTable) {
+                    var decimal_places = 0;
+                    var thousands_separator = '.';
+                    var decimal_separator = ',';
+                    if(rowsTable.length > 0){
+                        decimal_places = rowsTable[0].decimal_places;
+                        thousands_separator = rowsTable[0].thousands_separator;
+                        decimal_separator = rowsTable[0].decimal_separator;
+                    }
+                    var total =  _.reduce(_.map(rowsTable,function(item){
+                        return (item.valuation_cost);
+                    }), function(memo, num){
+                    return memo + num; },0)
+                    return accounting.formatNumber(total,decimal_places,thousands_separator,decimal_separator);
+                }
+
+                <!--
+                    VALORACION DE VENTA
+                -->
+                function SaleValuationFormatter(rowsTable) {
+                    var decimal_places = 0;
+                    var thousands_separator = '.';
+                    var decimal_separator = ',';
+                    if(rowsTable.length > 0){
+                        decimal_places = rowsTable[0].decimal_places;
+                        thousands_separator = rowsTable[0].thousands_separator;
+                        decimal_separator = rowsTable[0].decimal_separator;
+                    }
+                    var total =  _.reduce(_.map(rowsTable,function(item){
+                        return (item.valuation_sale);
+                    }), function(memo, num){
+                    return memo + num; },0)
+                    return accounting.formatNumber(total,decimal_places,thousands_separator,decimal_separator);
+                }
+
+                <!--
+                    VALORACION DE VENTA
+                -->
+                function UtilityFormatter(rowsTable) {
+                    var decimal_places = 0;
+                    var thousands_separator = '.';
+                    var decimal_separator = ',';
+                    if(rowsTable.length > 0){
+                        decimal_places = rowsTable[0].decimal_places;
+                        thousands_separator = rowsTable[0].thousands_separator;
+                        decimal_separator = rowsTable[0].decimal_separator;
+                    }
+                    var total =  _.reduce(_.map(rowsTable,function(item){
+                        return (item.utility);
+                    }), function(memo, num){
+                    return memo + num; },0)
+                    return accounting.formatNumber(total,decimal_places,thousands_separator,decimal_separator);
+                }
+
+                <!--
+                    FOOTER STYLE
+                -->
+                function footerStyle(row, index) {
+                    return {
+                        css: {
+                          "font-weight": "bold"
+                        }
+                    };
+                };
+
+            </script>
+        </div>
+    </t>
+</template>

+ 5 - 0
static/src/xml/eiru_reporting.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<template xml:space="preserve">
+    
+</template>

+ 5 - 0
static/src/xml/eiru_reporting_base.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<template xml:space="preserve">
+    
+</template>

+ 21 - 0
templates.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data>
+        <template id="eiru_reports_athletic_assets" inherit_id="eiru_assets.assets">
+            <xpath expr="." position="inside">
+
+                <!-- configuration < main > -->
+                <script type="text/javascript" src="/eiru_reports_athletic/static/src/js/main.js" />
+                <script type="text/javascript" src="/eiru_reports_athletic/static/src/js/reporting_base.js" />
+                <!-- Ranking de Doctores -->
+                <script type="text/javascript" src="/eiru_reports_athletic/static/src/js/reports/report_stock_athletic.js"/>
+
+            </xpath>
+        </template>
+
+        <record id="eiru_reports_action" model="ir.actions.client">
+            <field name="name">Eiru Reports Athletic</field>
+            <field name="tag">eiru_reports_athletic.action_report</field>
+        </record>
+    </data>
+</openerp>

+ 11 - 0
views/actions.xml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+	<data>
+
+		<record id="report_stock_athletic_action" model="ir.actions.client">
+            <field name="name">Valoracion de Stock</field>
+            <field name="tag">eiru_reports_athletic.report_stock_athletic_action</field>
+        </record>
+
+    </data>
+</openerp>

+ 12 - 0
views/menus.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data>
+
+        <menuitem id="stock_menu"
+            parent="eiru_reports.stock_parent_menu"
+            name="Valoracion de Stock"
+            action="report_stock_athletic_action"
+            sequence="0"/>
+
+    </data>
+</openerp>