diff --git a/addons/sale/board_sale_view.xml b/addons/sale/board_sale_view.xml index d04b6204940..f1055bc4df2 100644 --- a/addons/sale/board_sale_view.xml +++ b/addons/sale/board_sale_view.xml @@ -30,12 +30,12 @@
- - + + - - + +
diff --git a/addons/sale/report/sale_report.py b/addons/sale/report/sale_report.py index 5aa1ac1aed4..8c24b5000ee 100644 --- a/addons/sale/report/sale_report.py +++ b/addons/sale/report/sale_report.py @@ -112,131 +112,5 @@ class sale_report(osv.osv): """) sale_report() -class sale_order_by_clients(osv.osv): - _name = "sale.order.by.clients" - _description = "Sales order by clients" - _auto = False - _rec_name = 'partner' - _columns = { - 'total_orders': fields.integer('Total'), - 'partner_id':fields.many2one('res.partner', 'Partner', readonly=True) - } - _order = 'total_orders desc' - def init(self, cr): - tools.drop_view_if_exists(cr, 'sale_order_by_clients') - cr.execute(""" - create or replace view sale_order_by_clients as ( - select - min(s.id) as id, - count(*) as total_orders, - s.partner_id as partner_id - from - sale_order s - where - s.state='manual' or s.state='progress' - group by - s.partner_id - ) - """) -sale_order_by_clients() - -class uninvoiced_lines_per_month(osv.osv): - _name = "uninvoiced.lines.per.month" - _description = "Uninvoiced lines per month" - _auto = False - _rec_name = 'month' - _columns = { - 'number_of_lines': fields.integer('Total Lines', readonly=True), - 'year': fields.char('Year', size=10, 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), - - } - _order = 'number_of_lines desc' - def init(self, cr): - tools.drop_view_if_exists(cr, 'uninvoiced_lines_per_month') - cr.execute(""" - create or replace view uninvoiced_lines_per_month as ( - select - min(s.id) as id, - count(*) as number_of_lines, - to_char(s.create_date, 'MM') as month, - to_char(s.create_date, 'YYYY') as year - from - sale_order_line s - where - s.state='draft' - group by - to_char(s.create_date, 'MM'),to_char(s.create_date, 'YYYY') - ) - """) -uninvoiced_lines_per_month() - -class product_bought_by_sale_order(osv.osv): - _name = "product.bought.by.sale.order" - _description = "Product bought by sale order" - _auto = False - _rec_name = 'month' - _columns = { - 'total_products': fields.integer('Total Products', readonly=True), - 'product_id':fields.many2one('product.product', 'Product', 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), - 'year': fields.char('Year', size=64, readonly=True) - } - _order = 'total_products desc' - def init(self, cr): - tools.drop_view_if_exists(cr, 'product_bought_by_sale_order') - cr.execute(""" - create or replace view product_bought_by_sale_order as ( - select - min(s.id) as id, - l.product_id as product_id, - to_char(l.create_date, 'MM') as month, - to_char(l.create_date, 'YYYY') as year, - count(*) as total_products - from - sale_order_line l - left join - sale_order s on (s.id=l.order_id) - where - s.state='manual' or s.state='progress' - group by - l.product_id, to_char(l.create_date, 'MM'), to_char(l.create_date, 'YYYY') - ) - """) -product_bought_by_sale_order() - -class sales_by_regions(osv.osv): - _name = "sales.by.regions" - _description = "Sales by regions" - _auto = False - _rec_name = 'name' - _columns = { - 'total_sales': fields.integer('Total Sales', readonly=True), - 'name': fields.char('Country', size=64, readonly=True), - } - _order = 'total_sales desc' - def init(self, cr): - tools.drop_view_if_exists(cr, 'sales_by_regions') - cr.execute(""" - create or replace view sales_by_regions as ( - select - min(s.id) as id, - rc.name as name, - count(s.name) as total_sales - from - sale_order s,res_partner_address p,res_country rc - where - s.partner_id=p.id and - p.country_id=rc.id and - (s.state='manual' or s.state='progress') - group by - rc.name - ) - """) -sales_by_regions() diff --git a/addons/sale/report/sale_report_view.xml b/addons/sale/report/sale_report_view.xml index 5024e09672c..168b10897f7 100644 --- a/addons/sale/report/sale_report_view.xml +++ b/addons/sale/report/sale_report_view.xml @@ -139,137 +139,112 @@ - - sale.order.by.clients.tree - sale.order.by.clients + + sales.by.partner.tree + sale.report tree - + - + - - sale.order.by.clients.graph - sale.order.by.clients + + sales.by.partner.graph + sale.report graph - + - + - - Sales Orders - sale.order.by.clients - form - tree,graph - - - - - uninvoiced.lines.per.month.tree - uninvoiced.lines.per.month - tree - - - - - - - - - - - uninvoiced.lines.per.month.graph - uninvoiced.lines.per.month - graph - - - - - - - - - - Uninvoiced Lines - uninvoiced.lines.per.month - form - tree,graph - - - - - product.bought.by.sale.order.tree - product.bought.by.sale.order - tree - - - - - - - - - - - - product.bought.by.sale.order.graph - product.bought.by.sale.order - graph - - - - - - - - - - - Product bought by sale order - product.bought.by.sale.order + + Sales By Partner + sale.report form graph,tree - [('year','=', time.strftime('%Y'))] - + [('state','in',('manual','progress')),('date','<=', time.strftime('%Y-%m-%d')),('date','>',(datetime.date.today()-datetime.timedelta(days=90)).strftime('%Y-%m-%d'))] + - - sales.by.regions.tree - sales.by.regions + + sales.by.salesman.tree + sale.report tree - - - + + + - - sales.by.regions.graph - sales.by.regions + + sales.by.salesman.graph + sale.report graph - - - + + + - - Sales by regions - sales.by.regions + + Sales By Salesman + sale.report form - tree,graph - + graph,tree + [('state','in',('manual','progress')),('date','<=', time.strftime('%Y-%m-%d')),('date','>',(datetime.date.today()-datetime.timedelta(days=90)).strftime('%Y-%m-%d'))] + + + + + sold.product.total.price.tree + sale.report + tree + + + + + + + + + + sold.product.total.price.graph + sale.report + graph + + + + + + + + + + Sold product and Total Price + sale.report + form + graph,tree + [('state','in',('manual','progress')),('date','<=', time.strftime('%Y-%m-%d')),('date','>',(datetime.date.today()-datetime.timedelta(days=90)).strftime('%Y-%m-%d'))] + + + + + Quotation For Sale + sale.order + form + tree,form + [('state','=','draft'),('date_order','<=', time.strftime('%Y-%m-%d')),('date_order','>',(datetime.date.today()-datetime.timedelta(days=90)).strftime('%Y-%m-%d'))] +