~openerp-commiter/openobject-addons/trunk-extra-addons

« back to all changes in this revision

Viewing changes to sale_journal/sale_journal_report.py

  • Committer: ced
  • Date: 2008-01-08 09:18:48 UTC
  • Revision ID: ced-a6b046cada8a6ffe9df77e9961dc0e1a4666edd1
Change substring to to_char for pg8.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
                        create or replace view sale_journal_sale_stats as (
58
58
                                select
59
59
                                        min(l.id) as id,
60
 
                                        substring(s.date_order for 7)||'-'||'01' as name,
 
60
                                        to_char(s.date_order, 'YYYY-MM-01') as name,
61
61
                                        s.state,
62
62
                                        s.journal_id,
63
63
                                        sum(l.product_uom_qty) as quantity,
66
66
                                        (sum(l.product_uom_qty*l.price_unit)/sum(l.product_uom_qty))::decimal(16,2) as price_average
67
67
                                from sale_order s
68
68
                                        right join sale_order_line l on (s.id=l.order_id)
69
 
                                group by s.journal_id, substring(s.date_order for 7),s.state
 
69
                                group by s.journal_id, to_char(s.date_order, 'YYYY-MM-01'),s.state
70
70
                        )
71
71
                """)
72
72
report_sale_journal_sale()