Browse Source

Crear eiru reports corregir quitando timbrado_name.

SEBAS 2 weeks ago
parent
commit
1005d3acb0

+ 20 - 4
controller/helpers/account_invoice_line.py

@@ -112,7 +112,8 @@ def get_account_invoice_line_out_invoice(): #analisis de venta
             template.product_brand_id,
             brand.name,
             line.discount,
-            line.name
+            line.name,
+            sales_partner.name AS vendedor
             FROM account_invoice AS invoice
             LEFT JOIN account_invoice_line AS line
             ON line.invoice_id = invoice.id
@@ -135,6 +136,10 @@ def get_account_invoice_line_out_invoice(): #analisis de venta
             ON rate.currency_id = invoice.currency_id
             LEFT JOIN res_partner AS partner
             ON partner.id = invoice.partner_id
+            LEFT JOIN res_users AS sales_user
+            ON sales_user.id = invoice.user_id
+            LEFT JOIN res_partner AS sales_partner
+            ON sales_partner.id = sales_user.partner_id
             LEFT JOIN product_brand AS brand
             ON brand.id = template.product_brand_id
             WHERE invoice.state NOT IN ('draft', 'cancel')
@@ -159,7 +164,8 @@ def get_account_invoice_line_out_invoice(): #analisis de venta
             invoice.journal_id,
             template.product_brand_id,
             brand.name,
-            line.name
+            line.name,
+            sales_partner.name
     '''
 
     query_without_brand = '''
@@ -191,7 +197,8 @@ def get_account_invoice_line_out_invoice(): #analisis de venta
             (array_agg(attr_value.name)) AS attr_value,
             (array_agg(attr.id)) AS attr,
             line.discount,
-            line.name
+            line.name,
+            sales_partner.name AS vendedor
             FROM account_invoice AS invoice
             LEFT JOIN account_invoice_line AS line
             ON line.invoice_id = invoice.id
@@ -212,6 +219,12 @@ def get_account_invoice_line_out_invoice(): #analisis de venta
             ON history.product_template_id = product.product_tmpl_id
             LEFT JOIN res_currency_rate AS rate
             ON rate.currency_id = invoice.currency_id
+            LEFT JOIN res_partner AS partner
+            ON partner.id = invoice.partner_id
+            LEFT JOIN res_users AS sales_user
+            ON sales_user.id = invoice.user_id
+            LEFT JOIN res_partner AS sales_partner
+            ON sales_partner.id = sales_user.partner_id
             WHERE invoice.state NOT IN ('draft', 'cancel')
             AND invoice.type = 'out_invoice'
         GROUP BY
@@ -232,7 +245,8 @@ def get_account_invoice_line_out_invoice(): #analisis de venta
             product.id,
             invoice.company_id,
             invoice.journal_id,
-            line.name
+            line.name,
+            sales_partner.name
     '''
 
     r.cr.execute(validate_brand)
@@ -269,6 +283,7 @@ def get_account_invoice_line_out_invoice(): #analisis de venta
                 'brand_name': j[23],
                 'discount': j[24],
                 'name': j[25],
+                'vendedor': j[26],
             } for j in r.cr.fetchall()
         ]
     else:
@@ -299,6 +314,7 @@ def get_account_invoice_line_out_invoice(): #analisis de venta
                 'attribute_ids': j[21],
                 'discount': j[22],
                 'name': j[23],
+                'vendedor': j[24],
             } for j in r.cr.fetchall()
         ]
 

+ 18 - 4
controller/helpers/pos_order_line.py

@@ -51,7 +51,8 @@ def get_pos_order_line():
             customer.ruc,
             customer.name,
             customer.id,
-            line.discount
+            line.discount,
+            sales_partner.name AS vendedor
         FROM pos_order AS pos
         LEFT JOIN pos_order_line AS line
         ON pos.id = line.order_id
@@ -73,6 +74,10 @@ def get_pos_order_line():
         ON brand.id = template.product_brand_id
         LEFT JOIN res_partner AS customer
         ON customer.id = pos.partner_id
+        LEFT JOIN res_users AS sales_user
+        ON sales_user.id = pos.user_id
+        LEFT JOIN res_partner AS sales_partner
+        ON sales_partner.id = sales_user.partner_id
         WHERE pos.state NOT IN ('draft')
         GROUP BY
         	pos.id,
@@ -94,7 +99,8 @@ def get_pos_order_line():
             product.id,
             customer.ruc,
             customer.name,
-            customer.id
+            customer.id,
+            sales_partner.name
     '''
 
     query_without_brand = '''
@@ -125,7 +131,8 @@ def get_pos_order_line():
             customer.ruc,
             customer.name,
             customer.id,
-            line.discount
+            line.discount,
+            sales_partner.name AS vendedor
         FROM pos_order AS pos
         LEFT JOIN pos_order_line AS line
         ON pos.id = line.order_id
@@ -145,6 +152,10 @@ def get_pos_order_line():
         ON history.product_template_id = product.product_tmpl_id
         LEFT JOIN res_partner AS customer
         ON customer.id = pos.partner_id
+        LEFT JOIN res_users AS sales_user
+        ON sales_user.id = pos.user_id
+        LEFT JOIN res_partner AS sales_partner
+        ON sales_partner.id = sales_user.partner_id
         WHERE pos.state NOT IN ('draft')
         GROUP BY
         	pos.id,
@@ -164,7 +175,8 @@ def get_pos_order_line():
             product.id,
             customer.ruc,
             customer.name,
-            customer.id
+            customer.id,
+            sales_partner.name
     '''
 
     r.cr.execute(validate)
@@ -207,6 +219,7 @@ def get_pos_order_line():
                     'customer_name': j[22],
                     'customer_id': j[23],
                     'discount': j[24],
+                    'vendedor': j[25],
                 } for j in r.cr.fetchall()
             ]
         else:
@@ -236,6 +249,7 @@ def get_pos_order_line():
                     'customer_name': j[20],
                     'customer_id': j[21],
                     'discount': j[22],
+                    'vendedor': j[23],
                 } for j in r.cr.fetchall()
             ]
     else:

+ 6 - 3
static/src/js/reports/report_sale_analytic.js

@@ -611,6 +611,7 @@ function report_sale_analytic(reporting){
                     untaxed:accounting.formatMoney(item.subtotal, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
                     tax:accounting.formatMoney(item.tax, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
                     total:accounting.formatMoney(item.subtotal + item.tax, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                    vendedor:self.valorNull(item.vendedor),
                     /*
                     =============================
                         NO FORMAT
@@ -666,6 +667,7 @@ function report_sale_analytic(reporting){
                     untaxed:accounting.formatMoney(item.subtotal, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
                     tax:accounting.formatMoney(item.tax, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
                     total:accounting.formatMoney(item.subtotal + item.tax, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                    vendedor:self.valorNull(item.vendedor),
                     /*
                     =============================
                         NO FORMAT
@@ -774,16 +776,17 @@ function report_sale_analytic(reporting){
                 var pdf_name = 'analisis_de_venta_';
                 var pdf_columnStyles = {
                     number:{columnWidth: 25, halign:'center'},
-                    date:{columnWidth: 20, halign:'center'},
+                    date:{columnWidth: 18, halign:'center'},
                     ruc:{columnWidth: 20, halign:'center'},
                     customer_name:{halign:'center'},
                     product_name:{columnWidth: 'auto', halign:'left'},
                     product_category:{columnWidth: 40, halign:'left'},
                     price_unit:{columnWidth: 20, halign:'right'},
-                    quantity:{columnWidth: 20, halign:'right'},
+                    quantity:{columnWidth: 16, halign:'right'},
                     untaxed:{columnWidth: 20, halign:'right'},
-                    tax:{columnWidth: 20, halign:'right'},
+                    tax:{columnWidth: 18, halign:'right'},
                     total:{columnWidth: 20, halign:'right'},
+                    vendedor:{columnWidth: 14, halign:'right'},
                 };
                 /*
                 ============================================================

+ 6 - 2
static/src/reports/report_sale_analytic.xml

@@ -139,12 +139,12 @@
                                     data-align="right"
                                     data-footer-formatter="PriceUnitFooter"
                                     data-width="150"
-                                    >Precio Unitario</th>
+                                    >Precio Unit.</th>
                                 <th data-field="quantity"
                                     data-align="right"
                                     data-footer-formatter="QuantityFooter"
                                     data-width="100px"
-                                    >Cantidad</th>
+                                    >Cant.</th>
                                 <th data-field="discount"
                                     data-align="center"
                                     data-visible="false"
@@ -170,6 +170,10 @@
                                     data-footer-formatter="TotalFooter"
                                     data-width="100"
                                     >Total</th>
+                                <th data-field="vendedor"
+                                    data-align="left"
+                                    data-width="60px"
+                                    >Vendedor</th>
                             </tr>
                         </thead>
                     </table>