diff --git a/addons/account/account_analytic_line.py b/addons/account/account_analytic_line.py index 3e3266044b4..0b723b4c9e4 100644 --- a/addons/account/account_analytic_line.py +++ b/addons/account/account_analytic_line.py @@ -24,6 +24,7 @@ import time from osv import fields from osv import osv from tools.translate import _ +import tools class account_analytic_line(osv.osv): _name = 'account.analytic.line' @@ -113,20 +114,24 @@ class timesheet_invoice(osv.osv): _description = "Analytic account costs and revenues" _auto = False _columns = { - 'name': fields.date('Month', readonly=True), + 'name': fields.char('Year',size=64,required=False, readonly=True), 'account_id':fields.many2one('account.analytic.account', 'Analytic Account', readonly=True, select=True), 'journal_id': fields.many2one('account.analytic.journal', 'Journal', readonly=True), 'quantity': fields.float('Quantities', readonly=True), 'cost': fields.float('Credit', readonly=True), - 'revenue': fields.float('Debit', readonly=True) + 'revenue': fields.float('Debit', 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 = 'name desc, account_id' def init(self, cr): + tools.drop_view_if_exists(cr, 'report_hr_timesheet_invoice_journal') cr.execute(""" create or replace view report_hr_timesheet_invoice_journal as ( select min(l.id) as id, - date_trunc('month', l.date)::date as name, + to_char(l.date, 'YYYY') as name, + to_char(l.date,'MM') as month, sum( CASE WHEN l.amount>0 THEN 0 ELSE l.amount END @@ -141,7 +146,8 @@ class timesheet_invoice(osv.osv): from account_analytic_line l LEFT OUTER join product_uom u on (u.id=l.product_uom_id) group by - date_trunc('month', l.date), + to_char(l.date, 'YYYY'), + to_char(l.date,'MM'), journal_id, account_id )""") diff --git a/addons/account/project/project_view.xml b/addons/account/project/project_view.xml index 00dd4d821fc..8b5da45e965 100644 --- a/addons/account/project/project_view.xml +++ b/addons/account/project/project_view.xml @@ -362,29 +362,40 @@ + + + + report.hr.timesheet.invoice.journal.search + report.hr.timesheet.invoice.journal + search + + + + + + + + + + + + + Account cost and revenue by journal report.hr.timesheet.invoice.journal form tree,graph + - - - - Account cost and revenue by journal (This Month) - report.hr.timesheet.invoice.journal - form - tree - [('name','=',time.strftime('%Y-%m-01'))] - - + diff --git a/addons/report_analytic/report_analytic_view.xml b/addons/report_analytic/report_analytic_view.xml index dc1a6fd1b71..50d861a10b6 100644 --- a/addons/report_analytic/report_analytic_view.xml +++ b/addons/report_analytic/report_analytic_view.xml @@ -57,7 +57,7 @@ tree,graph [('state','=','open')] - + diff --git a/addons/report_analytic_line/report_analytic_line_view.xml b/addons/report_analytic_line/report_analytic_line_view.xml index e5c9a3d2c06..545021bccd4 100644 --- a/addons/report_analytic_line/report_analytic_line_view.xml +++ b/addons/report_analytic_line/report_analytic_line_view.xml @@ -57,7 +57,7 @@ form tree,graph - + diff --git a/addons/sale_journal/picking_journal_view.xml b/addons/sale_journal/picking_journal_view.xml index 3a91aeb37b7..a8b2abb351d 100644 --- a/addons/sale_journal/picking_journal_view.xml +++ b/addons/sale_journal/picking_journal_view.xml @@ -70,17 +70,6 @@ - - Picking by journal - sale_journal.picking.journal - form - tree,form - [('state','=','open')] - - - - - Picking by invoice_method sale_journal.invoice.type.tree diff --git a/addons/sale_journal/picking_journal_view_report.xml b/addons/sale_journal/picking_journal_view_report.xml index 060b1fd1da6..79c795145f5 100644 --- a/addons/sale_journal/picking_journal_view_report.xml +++ b/addons/sale_journal/picking_journal_view_report.xml @@ -12,6 +12,7 @@
+ @@ -29,6 +30,7 @@ + @@ -39,6 +41,24 @@ + + sale_journal.invoice.type.stats.search + sale_journal.invoice.type.stats + search + + + + + + + + + + + + + + Statistics on picking to invoice sale_journal.invoice.type.stats @@ -48,18 +68,7 @@ [('invoice_state','=','2binvoiced'),('invoice_type_id','=',active_id)] - - Picking by invoice method - sale_journal.invoice.type.stats - ir.actions.act_window - form - tree,form - [('name','=',time.strftime('%Y-%m-01'))] - - - - Picking by invoice method @@ -67,10 +76,10 @@ ir.actions.act_window form tree,form + - - + # # Packing by journal @@ -83,6 +92,7 @@ + @@ -108,27 +118,34 @@ - - - Picking by journal - sale_journal.picking.stats - ir.actions.act_window - form - tree,form - [('name','=',time.strftime('%Y-%m-01'))] + + sale_journal.picking.stats.search + sale_journal.picking.stats + search + + + + + + + + + + + + - - Picking by journal sale_journal.picking.stats ir.actions.act_window form tree,form + - + diff --git a/addons/sale_journal/sale_journal_picking_report.py b/addons/sale_journal/sale_journal_picking_report.py index 5ae9ee814e4..d7735b2a29c 100644 --- a/addons/sale_journal/sale_journal_picking_report.py +++ b/addons/sale_journal/sale_journal_picking_report.py @@ -20,13 +20,14 @@ ############################################################################## from osv import fields,osv +import tools class report_sale_journal_invoice_type_stats(osv.osv): _name = "sale_journal.invoice.type.stats" _description = "Stats on packing by invoice method" _auto = False _columns = { - 'name': fields.date('Month', readonly=True), + 'name': fields.char('Year',size=64,required=False, readonly=True), 'invoice_state':fields.selection([ ("invoiced","invoiced"), ("2binvoiced","to be invoiced"), @@ -45,14 +46,19 @@ class report_sale_journal_invoice_type_stats(osv.osv): 'price_total': fields.float('Total Price', readonly=True), 'price_average': fields.float('Average Price', readonly=True), 'count': fields.integer('# of Lines', 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 = 'state,invoice_state,name desc' def init(self, cr): + tools.drop_view_if_exists(cr, 'sale_journal_invoice_type_stats') cr.execute(""" create or replace view sale_journal_invoice_type_stats as ( select min(l.id) as id, - to_char(s.date, 'YYYY-MM-01') as name, + to_char(s.date, 'YYYY') as name, + to_char(s.date, 'MM') as month, s.state, s.invoice_state, s.invoice_type_id, @@ -63,7 +69,7 @@ class report_sale_journal_invoice_type_stats(osv.osv): from stock_picking s left join stock_move l on (s.id=l.picking_id) left join sale_order_line ol on (l.sale_line_id=ol.id) - group by s.invoice_type_id, to_char(s.date, 'YYYY-MM-01'),s.state, s.invoice_state + group by s.invoice_type_id, to_char(s.date, 'YYYY'),to_char(s.date, 'MM'),s.state, s.invoice_state order by s.invoice_type_id, s.invoice_state, s.state ) """) @@ -74,7 +80,7 @@ class report_sale_journal_picking(osv.osv): _description = "Picking lists by Journal" _auto = False _columns = { - 'name': fields.date('Month', readonly=True), + 'name': fields.char('Year',size=64,required=False, readonly=True), 'state': fields.selection([ ('draft','draft'), ('auto','waiting'), @@ -88,14 +94,19 @@ class report_sale_journal_picking(osv.osv): 'price_total': fields.float('Total Price', readonly=True), 'price_average': fields.float('Average Price', readonly=True), 'count': fields.integer('# of Lines', 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 = 'journal_id,name desc,price_total desc' def init(self, cr): + tools.drop_view_if_exists(cr, 'sale_journal_picking_stats') cr.execute(""" create or replace view sale_journal_picking_stats as ( select min(l.id) as id, - to_char(s.date, 'YYYY-MM-01') as name, + to_char(s.date, 'YYYY') as name, + to_char(s.date, 'MM') as month, s.state, s.journal_id, sum(l.product_qty) as quantity, @@ -105,7 +116,7 @@ class report_sale_journal_picking(osv.osv): from stock_picking s right join stock_move l on (s.id=l.picking_id) right join sale_order_line ol on (l.sale_line_id=ol.id) - group by s.journal_id, to_char(s.date, 'YYYY-MM-01'),s.state + group by s.journal_id, to_char(s.date, 'YYYY'),to_char(s.date, 'MM'),s.state ) """) report_sale_journal_picking() diff --git a/addons/sale_journal/sale_journal_report.py b/addons/sale_journal/sale_journal_report.py index f1fe7e96946..2aee0ba09e9 100644 --- a/addons/sale_journal/sale_journal_report.py +++ b/addons/sale_journal/sale_journal_report.py @@ -20,13 +20,14 @@ ############################################################################## from osv import fields,osv +import tools class report_sale_journal_sale(osv.osv): _name = "sale_journal.sale.stats" _description = "Sales Orders by Journal" _auto = False _columns = { - 'name': fields.date('Month', readonly=True), + 'name': fields.char('Year',size=64,required=False, readonly=True), 'state': fields.selection([ ('draft','Quotation'), ('waiting_date','Waiting Schedule'), @@ -42,14 +43,18 @@ class report_sale_journal_sale(osv.osv): 'price_total': fields.float('Total Price', readonly=True), 'price_average': fields.float('Average Price', readonly=True), 'count': fields.integer('# of Lines', 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 = 'journal_id,name desc,price_total desc' def init(self, cr): + tools.drop_view_if_exists(cr, 'sale_journal_sale_stats') cr.execute(""" create or replace view sale_journal_sale_stats as ( select min(l.id) as id, - to_char(s.date_order, 'YYYY-MM-01') as name, + to_char(s.date_order, 'YYYY') as name, + to_char(s.date_order,'MM') as month, s.state, s.journal_id, sum(l.product_uom_qty) as quantity, @@ -58,7 +63,7 @@ class report_sale_journal_sale(osv.osv): (sum(l.product_uom_qty*l.price_unit)/sum(l.product_uom_qty))::decimal(16,2) as price_average from sale_order s right join sale_order_line l on (s.id=l.order_id) - group by s.journal_id, to_char(s.date_order, 'YYYY-MM-01'),s.state + group by s.journal_id, to_char(s.date_order, 'YYYY'),to_char(s.date_order, 'MM'),s.state ) """) report_sale_journal_sale() diff --git a/addons/sale_journal/sale_journal_view.xml b/addons/sale_journal/sale_journal_view.xml index a10c46c3a1a..5fe8e511870 100644 --- a/addons/sale_journal/sale_journal_view.xml +++ b/addons/sale_journal/sale_journal_view.xml @@ -91,10 +91,31 @@ + + + sale_journal.sale.journal.search + sale_journal.sale.journal + search + + + + + + + + + + + + + + + sale_journal.sale.journal form tree,form + @@ -104,32 +125,11 @@ form tree,form [] + - - My open journals - sale_journal.sale.journal - form - tree,form - [('user_id','=',uid),('state','=','open')] - - - - - - - Open journals - sale_journal.sale.journal - form - tree,form - [('state','=','open')] - - - - - sale.order.journal.view.form form