Kaynağa Gözat

Crear eiru reports corregir quitando timbrado_name.

SEBAS 4 hafta önce
ebeveyn
işleme
968f6a86d8

+ 4 - 16
controller/helpers/account_invoice_line.py

@@ -112,8 +112,7 @@ def get_account_invoice_line_out_invoice(): #analisis de venta
             template.product_brand_id,
             brand.name,
             line.discount,
-            line.name,
-            sales_partner.name
+            line.name
             FROM account_invoice AS invoice
             LEFT JOIN account_invoice_line AS line
             ON line.invoice_id = invoice.id
@@ -138,10 +137,6 @@ def get_account_invoice_line_out_invoice(): #analisis de venta
             ON partner.id = invoice.partner_id
             LEFT JOIN product_brand AS brand
             ON brand.id = template.product_brand_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
@@ -164,8 +159,7 @@ def get_account_invoice_line_out_invoice(): #analisis de venta
             invoice.journal_id,
             template.product_brand_id,
             brand.name,
-            line.name,
-            sales_partner.name
+            line.name
     '''
 
     query_without_brand = '''
@@ -197,8 +191,7 @@ 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,
-            sales_partner.name
+            line.name
             FROM account_invoice AS invoice
             LEFT JOIN account_invoice_line AS line
             ON line.invoice_id = invoice.id
@@ -219,8 +212,6 @@ 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
             WHERE invoice.state NOT IN ('draft', 'cancel')
             AND invoice.type = 'out_invoice'
         GROUP BY
@@ -241,8 +232,7 @@ def get_account_invoice_line_out_invoice(): #analisis de venta
             product.id,
             invoice.company_id,
             invoice.journal_id,
-            line.name,
-            sales_partner.name
+            line.name
     '''
 
     r.cr.execute(validate_brand)
@@ -279,7 +269,6 @@ def get_account_invoice_line_out_invoice(): #analisis de venta
                 'brand_name': j[23],
                 'discount': j[24],
                 'name': j[25],
-                'vendor_name': j[26],
             } for j in r.cr.fetchall()
         ]
     else:
@@ -310,7 +299,6 @@ def get_account_invoice_line_out_invoice(): #analisis de venta
                 'attribute_ids': j[21],
                 'discount': j[22],
                 'name': j[23],
-                'vendor_name': j[24],
             } for j in r.cr.fetchall()
         ]
 

+ 4 - 14
controller/helpers/pos_order_line.py

@@ -51,8 +51,7 @@ def get_pos_order_line():
             customer.ruc,
             customer.name,
             customer.id,
-            line.discount,
-            sales_partner.name 
+            line.discount
         FROM pos_order AS pos
         LEFT JOIN pos_order_line AS line
         ON pos.id = line.order_id
@@ -74,10 +73,6 @@ 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,
@@ -99,8 +94,7 @@ def get_pos_order_line():
             product.id,
             customer.ruc,
             customer.name,
-            customer.id,
-            sales_partner.name
+            customer.id
     '''
 
     query_without_brand = '''
@@ -131,8 +125,7 @@ def get_pos_order_line():
             customer.ruc,
             customer.name,
             customer.id,
-            line.discount,
-            sales_partner.name
+            line.discount
         FROM pos_order AS pos
         LEFT JOIN pos_order_line AS line
         ON pos.id = line.order_id
@@ -171,8 +164,7 @@ def get_pos_order_line():
             product.id,
             customer.ruc,
             customer.name,
-            customer.id,
-            sales_partner.name
+            customer.id
     '''
 
     r.cr.execute(validate)
@@ -215,7 +207,6 @@ def get_pos_order_line():
                     'customer_name': j[22],
                     'customer_id': j[23],
                     'discount': j[24],
-                    'vendor_name': j[25],
                 } for j in r.cr.fetchall()
             ]
         else:
@@ -245,7 +236,6 @@ def get_pos_order_line():
                     'customer_name': j[20],
                     'customer_id': j[21],
                     'discount': j[22],
-                    'vendor_name': j[23],
                 } for j in r.cr.fetchall()
             ]
     else:

+ 15 - 1
controller/main.py

@@ -156,10 +156,24 @@ class ReportController(http.Controller):
 
 
     # PAGOS DE CLIENTES
+    # @http.route('/report-account-voucherrefund-customer-payment', auth='user', methods=['GET', 'POST'])
+    # def getCustomerAccountRefundVoucher(self, **kw):
+    #     return make_gzip_response({
+    #         'vouchers': hp.get_account_voucher_payment(),
+    #         'statement_lines': hp.get_account_bank_statement_line(),
+    #         'move_lines': hp.get_account_move_line(),
+    #         'invoices': hp.get_account_invoice_sale_and_refund_type(),
+    #     })
+
     @http.route('/report-account-voucherrefund-customer-payment', auth='user', methods=['GET', 'POST'])
     def getCustomerAccountRefundVoucher(self, **kw):
+        try:
+            vouchers = hp.get_account_voucher_payment() or []
+        except Exception as e:
+            LOGGER.exception("Error fetching customer account refund vouchers")
+            vouchers = []
         return make_gzip_response({
-            'vouchers': hp.get_account_voucher_payment(),
+            'vouchers': vouchers,
             'statement_lines': hp.get_account_bank_statement_line(),
             'move_lines': hp.get_account_move_line(),
             'invoices': hp.get_account_invoice_sale_and_refund_type(),

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

@@ -611,7 +611,6 @@ 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),
-                    vendor_name:self.valorNull(item.vendor_name),
                     /*
                     =============================
                         NO FORMAT
@@ -667,7 +666,6 @@ 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),
-                    vendor_name:self.valorNull(item.vendor_name),
                     /*
                     =============================
                         NO FORMAT
@@ -786,7 +784,6 @@ function report_sale_analytic(reporting){
                     untaxed:{columnWidth: 20, halign:'right'},
                     tax:{columnWidth: 20, halign:'right'},
                     total:{columnWidth: 20, halign:'right'},
-                    vendor_name:{columnWidth: 20, halign:'right'},
                 };
                 /*
                 ============================================================

+ 1 - 5
static/src/reports/report_sale_analytic.xml

@@ -122,7 +122,7 @@
                                     >Fecha</th>
                                 <th data-field="ruc"
                                     data-align="left"
-                                    data-width="60px"                                    
+                                    data-width="60px"
                                     >Cliente</th>
                                 <th data-field="customer_name"
                                     data-align="left"
@@ -170,10 +170,6 @@
                                     data-footer-formatter="TotalFooter"
                                     data-width="100"
                                     >Total</th>
-                                <th data-field="vendor_name"
-                                    data-align="left"
-                                    data-width="100"
-                                    >Vendedor</th>
                             </tr>
                         </thead>
                     </table>