← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/fixed_task_2141 into lp:~openobject-training/openobject-addons/training

 

gpa(Open ERP) has proposed merging lp:~openerp-dev/openobject-addons/fixed_task_2141 into lp:~openobject-training/openobject-addons/training.

Requested reviews:
  Bhumika (OpenERP) (sbh-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/fixed_task_2141/+merge/56157

Fixed the task 2141, top suppliers problem solved
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/fixed_task_2141/+merge/56157
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/fixed_task_2141.
=== modified file 'training_report/training_report.py'
--- training_report/training_report.py	2011-04-04 10:19:27 +0000
+++ training_report/training_report.py	2011-04-04 13:21:02 +0000
@@ -194,13 +194,14 @@
 
 
         def execute_query_invoice_supplier(group_column, column_name):
+
             cr.execute("""
                 SELECT ai.%(gc)s as %(cn)s,
                        sum(CASE WHEN ai.type = 'in_refund' THEN -ai.amount_untaxed ELSE ai.amount_untaxed END) as turnover,
                        COALESCE(sum(invoice_summary.request_count),0) AS request_count
                   FROM account_invoice ai
-             LEFT JOIN (SELECT ai.id, count(tpsr.id) AS request_count FROM account_invoice ai
-                        LEFT JOIN purchase_order po ON (po.invoice_id = ai.id)
+             LEFT JOIN (SELECT ai.id, count(tpsr.id) AS request_count FROM account_invoice ai, purchase_order po
+                        LEFT JOIN purchase_invoice_rel pi ON (pi.purchase_id = po.id)
                         LEFT JOIN training_participation_stakeholder_request tpsr ON (tpsr.purchase_order_id = po.id)
                         GROUP BY ai.id) AS invoice_summary ON (ai.id = invoice_summary.id)
                  WHERE ai.type IN ('in_invoice','in_refund')
@@ -210,6 +211,9 @@
               ORDER BY turnover DESC, request_count DESC
             """ % {'gc': group_column, 'cn': column_name}
             , (this.date_start, this.date_stop))
+
+
+
             return cr.fetchall()
 
         def execute_query_offer(group_column, column_name):
@@ -228,6 +232,7 @@
 
         def write_to_xls(row_id, iterable):
             row = stream.row(row_id)
+
             for idx, column_name in enumerate(REPORTS[this.report]['header']):
                 value = iterable[idx]
                 if value is None:
@@ -268,7 +273,6 @@
         row_id = stream_write_row(row_id, [REPORTS[this.report]['fields'][header]['string'] for header in REPORTS[this.report]['header']])
         length_headers = len(REPORTS[this.report]['header'])
 
-
         if this.report == 'sale.partner':
             for temp in execute_query_invoice('partner_id', 'partner_id'):
                 row_id = write_to_xls(row_id, temp)


Follow ups