Browse Source

[ADD] Analisis detallado con click

adrielso 7 years ago
parent
commit
7d9b27b7e8

+ 13 - 0
static/src/css/eiru_reporting.css

@@ -76,3 +76,16 @@
 .sucursal{
     font-weight: bold;
 }
+/*.table >.table-hover >.table-condensed > tbody > tr > td :hover{*/
+.table_utility > tbody > tr > td:nth-child(1):hover{
+     background-color: #d4e2f3;
+    cursor:pointer;
+}
+.table_utility > tbody > tr > td:nth-child(2):hover{
+     background-color: #d4e2f3;
+    cursor:pointer;
+}
+.table_paint_first_row > tbody > tr > td:nth-child(1):hover{
+     background-color: #d4e2f3;
+    cursor:pointer;
+}

+ 19 - 0
static/src/js/reports/report_expenses.js

@@ -21,6 +21,7 @@ function report_expenses (reporting){
             'change #from' : 'factSearch',
             'change #to' : 'factSearch',
             'click  #volver_btn' : 'volver',
+            'click-row.bs.table #table ' : 'ckickAnalysisDetail',
         },
         // Initil
         init : function(parent){
@@ -34,6 +35,23 @@ function report_expenses (reporting){
             this.fecthFecha();
             this.submitForm();
         },
+        // Analisis Detallado
+        ckickAnalysisDetail: function(e, row, $element,field){
+            if (field== 'number'){
+                this.do_action({
+                    name:"Factura de proveedor",
+                    type: 'ir.actions.act_window',
+                    res_model: "account.invoice",
+                    views: [[false,'form']],
+                    target: 'new',
+                    domain: [['type', '=', 'in_invoice'],['id','=', row.id]],
+                    context: {},
+                    flags: {'form': {'action_buttons': false, 'options': {'mode': 'view'}}},
+                    res_id: row.id,
+                });
+            }
+            e.stopImmediatePropagation();
+        },
         // volver
         volver: function(){
             this.$el.find('#volver').empty();
@@ -228,6 +246,7 @@ function report_expenses (reporting){
             var data = [];
             _.each(invoices, function(invoice){
                 data.push({
+                        id : invoice.id,
                         number: invoice.number,
                         supplier_invoice_number: self.valorNull(invoice.supplier_invoice_number),
                         partner: invoice.partner_id[1],

+ 35 - 0
static/src/js/reports/report_invoice_utility.js

@@ -20,6 +20,8 @@ function report_invoice_utility (reporting){
             'change #from' : 'fectSearch',
             'change #to': 'fectSearch',
             'click #volver_btn': 'volver',
+            // 'click-row.bs.table #table ' : 'ckickAnalysisDetail',
+            'click-row.bs.table #table' : 'ckickAnalysisDetail',
         },
         init : function(parent){
           this._super(parent);
@@ -30,6 +32,37 @@ function report_invoice_utility (reporting){
             this.fecthFecha();
             this.submitForm();
         },
+        // Analisis Detallado
+        ckickAnalysisDetail: function(e, row, $element, field){
+
+            if (field == 'name'){
+                this.do_action({
+                    name : "Variantes de Producto",
+                    type : 'ir.actions.act_window',
+                    res_model : "product.product",
+                    views : [[false,'form']],
+                    target : 'new',
+                    domain : [['id','=', row.id_product]],
+                    context : {},
+                    flags : {'form': {'action_buttons': false, 'options': {'mode': 'view'}}},
+                    res_id : row.id_product,
+                });
+            }
+            if (field == 'number'){
+                this.do_action({
+                    name : "Factura de Cliente",
+                    type : 'ir.actions.act_window',
+                    res_model : "account.invoice",
+                    views : [[false,'form']],
+                    target : 'new',
+                    domain : [['type', '=', 'out_invoice'],['id','=', row.id]],
+                    context : {},
+                    flags : {'form': {'action_buttons': false, 'options': {'mode': 'view'}}},
+                    res_id : row.id,
+                });
+            }
+            e.stopImmediatePropagation();
+        },
         // volver
         volver: function(){
             this.$el.find('#volver').empty();
@@ -229,7 +262,9 @@ function report_invoice_utility (reporting){
                 }
                 if (producto.type =="product"){
                     data.push({
+                            id : invoice.id,
                             number : (invoice.number),
+                            id_product : producto.id,
                             name : (item.name),
                             quantity : accounting.formatNumber((item.quantity),0, ".", ","),
                             price_unity : accounting.formatNumber((item.price_unit / invoice.rate),2, ".", ","),

+ 21 - 1
static/src/js/reports/report_puchases.js

@@ -21,6 +21,7 @@ function report_puchases (reporting){
             'change #from' : 'factSearch',
             'change #to' : 'factSearch',
             'click  #volver_btn' : 'volver',
+            'click-row.bs.table #table ' : 'ckickAnalysisDetail',
         },
         // Initil
         init : function(parent){
@@ -34,6 +35,23 @@ function report_puchases (reporting){
             this.fecthFecha();
             this.submitForm();
         },
+        // Analisis Detallado
+        ckickAnalysisDetail: function(e, row, $element, field){
+            if (field == 'number'){
+                this.do_action({
+                    name:"Factura de proveedor",
+                    type: 'ir.actions.act_window',
+                    res_model: "account.invoice",
+                    views: [[false,'form']],
+                    target: 'new',
+                    domain: [['type', '=', 'in_invoice'],['id','=', row.id]],
+                    context: {},
+                    flags: {'form': {'action_buttons': false, 'options': {'mode': 'view'}}},
+                    res_id: row.id,
+                });
+            }
+            e.stopImmediatePropagation();
+        },
         // volver
         volver: function(){
             this.$el.find('#volver').empty();
@@ -228,6 +246,7 @@ function report_puchases (reporting){
             var data = [];
             _.each(invoices, function(invoice){
                 data.push({
+                        id : invoice.id,
                         number: invoice.number,
                         supplier_invoice_number: self.valorNull(invoice.supplier_invoice_number),
                         partner: invoice.partner_id[1],
@@ -239,7 +258,8 @@ function report_puchases (reporting){
                         amount: invoice.amount_total,
                         journal_id : invoice.journal_id[0],
                         currency_id : invoice.currency_id[0],
-                        partner_id : invoice.partner_id[0]
+                        partner_id : invoice.partner_id[0],
+                        origin: invoice.origin
                     });
             });
             self.newInvoice = data;

+ 21 - 3
static/src/js/reports/report_stock_product.js

@@ -12,6 +12,7 @@ function report_stock_product (reporting){
 
         events : {
             'click #toolbar > button' : 'clickOnAction',
+            'click-row.bs.table #table ' : 'ckickAnalysisDetail',
         },
         init : function(parent){
             this._super(parent);
@@ -23,6 +24,23 @@ function report_stock_product (reporting){
             table.bootstrapTable({data : self.prodcut});
             self.fecthInitial();
         },
+        // Analisis Detallado
+        ckickAnalysisDetail: function(e, row, $element,field){
+            if (field == 'product'){
+                this.do_action({
+                    name:"Variantes de 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();
+        },
         // Consulta Inicial
         fecthInitial: function(){
             var self = this;
@@ -104,8 +122,8 @@ function report_stock_product (reporting){
                         return mamo + num;
                     },0);
                     quant=itemQuant.shift();
-                    stock.push({
-                                prodcut : quant.product_id[1],
+                    stock.push({ id : quant.product_id[0],
+                                product : quant.product_id[1],
                                 qty : cat,
                                 standard_price : accounting.formatNumber(itemProduct.standard_price,2, ".", ","),
                                 lst_price : accounting.formatNumber(itemProduct.lst_price,2, ".", ","),
@@ -176,7 +194,7 @@ function report_stock_product (reporting){
             pdfDoc.autoTable(getColumns, rows, {
                     styles: { overflow: 'linebreak', fontSize:8 , columnWidth: 'wrap'},
                    columnStyles:{
-                                    prodcut :{columnWidth: '8px'},
+                                    product :{columnWidth: '8px'},
                                    qty : {halign:'center'},
                                    standard_price : {halign:'right'},
                                    lst_price : {halign:'right'},

+ 1 - 1
static/src/reports/all_purchases.xml

@@ -24,7 +24,7 @@
 
                 <button class="oe_button oe_form_button oe_highlight btn-block" value="pdf">Exportar a PDF</button>
             </div>
-            <table id="table"
+            <table id="table" class="table_paint_first_row"
                 data-pagination="true"
                 data-toggle="table"
                 data-reorderable-columns="true"

+ 1 - 1
static/src/reports/report_expenses.xml

@@ -24,7 +24,7 @@
 
                 <button class="oe_button oe_form_button oe_highlight btn-block" value="pdf">Exportar a PDF</button>
             </div>
-            <table id="table"
+            <table id="table" class="table_paint_first_row"
                 data-pagination="true"
                 data-toggle="table"
                 data-reorderable-columns="true"

+ 1 - 1
static/src/reports/report_invoice_utility.xml

@@ -16,7 +16,7 @@
             <button class="oe_button oe_form_button oe_highlight" value="pdf">Exportar a PDF</button>
             <button class="oe_button oe_form_button oe_highlight" value="chart">Graficar</button>
         </div>
-        <table id="table"
+        <table id="table" class="table_utility"
             data-pagination="true"
             data-toggle="table"
             data-reorderable-columns="true"

+ 5 - 4
static/src/reports/report_stock_product.xml

@@ -9,7 +9,7 @@
                 <div id="toolbar">
                     <button class="oe_button oe_form_button oe_highlight" value="pdf" id="pdf">Exportar a PDF</button>
                 </div>
-                <table id="table"
+                <table id="table" class="table_paint_first_row"
                        data-pagination="true"
                        data-toggle="table"
                        data-reorderable-columns="true"
@@ -19,10 +19,11 @@
                        data-height="auto"
                        data-classes="table table-hover table-condensed"
                        data-row-style="rowStyle"
-                       data-search="true">
-                    <thead>
+                       data-search="true"
+                       >
+                    <thead  class="table_header">
                         <tr>
-                            <th data-field="prodcut" data-sortable="true" >Productos</th>
+                            <th data-field="product" data-sortable="true">Productos</th>
                             <th data-field="qty" data-sortable="true" data-align="center">Cantidad</th>
                             <th data-field="standard_price" data-sortable="true" data-align="right">Precio de compra</th>
                             <th data-field="lst_price" data-sortable="true" data-align="right">Precio de venta </th>