[MERGE] forward port of branch 7.0 up to 78a29b3
[odoo/odoo.git] / addons / point_of_sale / report / pos_order_report.py
index 1f053a0..547b223 100644 (file)
@@ -27,12 +27,7 @@ class pos_order_report(osv.osv):
     _description = "Point of Sale Orders Statistics"
     _auto = False
     _columns = {
-        'date': fields.date('Date Order', readonly=True),
-        'year': fields.char('Year', size=4, readonly=True),
-        'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
-            ('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
-            ('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
-        'day': fields.char('Day', size=128, readonly=True),
+        'date': fields.datetime('Date Order', readonly=True),
         'partner_id':fields.many2one('res.partner', 'Partner', readonly=True),
         'product_id':fields.many2one('product.product', 'Product', readonly=True),
         'state': fields.selection([('draft', 'New'), ('paid', 'Closed'), ('done', 'Synchronized'), ('invoiced', 'Invoiced'), ('cancel', 'Cancelled')],
@@ -41,7 +36,7 @@ class pos_order_report(osv.osv):
         'price_total':fields.float('Total Price', readonly=True),
         'total_discount':fields.float('Total Discount', readonly=True),
         'average_price': fields.float('Average Price', readonly=True,group_operator="avg"),
-        'shop_id':fields.many2one('sale.shop', 'Shop', readonly=True),
+        'warehouse_id':fields.many2one('stock.warehouse', 'Warehouse', readonly=True),
         'company_id':fields.many2one('res.company', 'Company', readonly=True),
         'nbr':fields.integer('# of Lines', readonly=True),
         'product_qty':fields.integer('# of Qty', readonly=True),
@@ -57,19 +52,16 @@ class pos_order_report(osv.osv):
                 select
                     min(l.id) as id,
                     count(*) as nbr,
-                    to_date(to_char(s.date_order, 'dd-MM-YYYY'),'dd-MM-YYYY') as date,
+                    s.date_order as date,
                     sum(l.qty * u.factor) as product_qty,
                     sum(l.qty * l.price_unit) as price_total,
                     sum((l.qty * l.price_unit) * (l.discount / 100)) as total_discount,
                     (sum(l.qty*l.price_unit)/sum(l.qty * u.factor))::decimal as average_price,
                     sum(cast(to_char(date_trunc('day',s.date_order) - date_trunc('day',s.create_date),'DD') as int)) as delay_validation,
-                    to_char(s.date_order, 'YYYY') as year,
-                    to_char(s.date_order, 'MM') as month,
-                    to_char(s.date_order, 'YYYY-MM-DD') as day,
                     s.partner_id as partner_id,
                     s.state as state,
                     s.user_id as user_id,
-                    s.shop_id as shop_id,
+                    s.warehouse_id as warehouse_id,
                     s.company_id as company_id,
                     s.sale_journal as journal_id,
                     l.product_id as product_id
@@ -79,12 +71,10 @@ class pos_order_report(osv.osv):
                     left join product_template pt on (pt.id=p.product_tmpl_id)
                     left join product_uom u on (u.id=pt.uom_id)
                 group by
-                    to_char(s.date_order, 'dd-MM-YYYY'),to_char(s.date_order, 'YYYY'),to_char(s.date_order, 'MM'),
-                    to_char(s.date_order, 'YYYY-MM-DD'), s.partner_id,s.state,
-                    s.user_id,s.shop_id,s.company_id,s.sale_journal,l.product_id,s.create_date
+                    s.date_order, s.partner_id,s.state,
+                    s.user_id,s.warehouse_id,s.company_id,s.sale_journal,l.product_id,s.create_date
                 having
                     sum(l.qty * u.factor) != 0)""")
 
-pos_order_report()
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: