[MERGE] forward port of branch 8.0 up to ed1c173
[odoo/odoo.git] / addons / point_of_sale / report / pos_order_report.py
index 8e42eca..abdf384 100644 (file)
@@ -26,8 +26,9 @@ class pos_order_report(osv.osv):
     _name = "report.pos.order"
     _description = "Point of Sale Orders Statistics"
     _auto = False
+
     _columns = {
-        'date': fields.date('Date Order', 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')],
@@ -38,10 +39,11 @@ class pos_order_report(osv.osv):
         'average_price': fields.float('Average Price', readonly=True,group_operator="avg"),
         'location_id':fields.many2one('stock.location', 'Location', 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),
+        'nbr':fields.integer('# of Lines', readonly=True),  # TDE FIXME master: rename into nbr_lines
+        'product_qty':fields.integer('Product Quantity', readonly=True),
         'journal_id': fields.many2one('account.journal', 'Journal'),
         'delay_validation': fields.integer('Delay Validation'),
+        'product_categ_id': fields.many2one('product.category', 'Product Category', readonly=True),
     }
     _order = 'date desc'
 
@@ -64,14 +66,15 @@ class pos_order_report(osv.osv):
                     s.location_id as location_id,
                     s.company_id as company_id,
                     s.sale_journal as journal_id,
-                    l.product_id as product_id
+                    l.product_id as product_id,
+                    pt.categ_id as product_categ_id
                 from pos_order_line as l
                     left join pos_order s on (s.id=l.order_id)
                     left join product_product p on (l.product_id=p.id)
                     left join product_template pt on (p.product_tmpl_id=pt.id)
                     left join product_uom u on (u.id=pt.uom_id)
                 group by
-                    s.date_order, s.partner_id,s.state,
+                    s.date_order, s.partner_id,s.state, pt.categ_id,
                     s.user_id,s.location_id,s.company_id,s.sale_journal,l.product_id,s.create_date
                 having
                     sum(l.qty * u.factor) != 0)""")