diff --git a/addons/account/account.py b/addons/account/account.py index f9ec8763fc5..cf79514bcf8 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -758,7 +758,7 @@ class account_move(osv.osv): 'period_id': fields.many2one('account.period', 'Period', required=True, states={'posted':[('readonly',True)]}), 'journal_id': fields.many2one('account.journal', 'Journal', required=True, states={'posted':[('readonly',True)]}), 'state': fields.selection([('draft','Draft'), ('posted','Posted')], 'State', required=True, readonly=True, - help='When new account move is created the state will be \'Draft\'. When all the payments are done it will be in \'Valid\' state.'), + help='When new account move is created the state will be \'Draft\'. When all the payments are done it will be in \'Posted\' state.'), 'line_id': fields.one2many('account.move.line', 'move_id', 'Entries', states={'posted':[('readonly',True)]}), 'to_check': fields.boolean('To Be Verified'), 'partner_id': fields.related('line_id', 'partner_id', type="many2one", relation="res.partner", string="Partner"), diff --git a/addons/report_account/report_receivable.py b/addons/report_account/report_receivable.py index 45dc1f5a376..8d106193cf7 100644 --- a/addons/report_account/report_receivable.py +++ b/addons/report_account/report_receivable.py @@ -24,6 +24,7 @@ import datetime import mx.DateTime import pooler +import tools from osv import fields,osv @@ -207,21 +208,25 @@ class report_account_type_sales(osv.osv): _description = "Report of the Sales by Account Type" _auto = False _columns = { - 'name': fields.char('Month', size=64, readonly=True), + 'name': fields.char('Year',size=64,required=False, readonly=True), 'period_id': fields.many2one('account.period', 'Force Period',readonly=True), 'product_id': fields.many2one('product.product', 'Product',readonly=True), 'quantity': fields.float('Quantity', readonly=True), 'user_type': fields.many2one('account.account.type', 'Account Type', readonly=True), 'amount_total': fields.float('Total', readonly=True), - 'currency_id': fields.many2one('res.currency', 'Currency', readonly=True), + 'currency_id': fields.many2one('res.currency', 'Currency', 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,amount_total desc' def init(self, cr): + tools.drop_view_if_exists(cr, 'report_account_type_sales') cr.execute("""create or replace view report_account_type_sales as ( select min(inv_line.id) as id, - to_char(inv.date_invoice, 'YYYY-MM-01') as name, + to_char(inv.date_invoice, 'YYYY') as name, + to_char(inv.date_invoice,'MM') as month, sum(inv_line.price_subtotal) as amount_total, inv.currency_id as currency_id, inv.period_id, @@ -235,7 +240,7 @@ class report_account_type_sales(osv.osv): where inv.state in ('open','paid') group by - to_char(inv.date_invoice, 'YYYY-MM-01'),inv.currency_id, inv.period_id, inv_line.product_id, account.user_type + to_char(inv.date_invoice, 'YYYY'),to_char(inv.date_invoice,'MM'),inv.currency_id, inv.period_id, inv_line.product_id, account.user_type )""") report_account_type_sales() @@ -245,21 +250,25 @@ class report_account_sales(osv.osv): _description = "Report of the Sales by Account" _auto = False _columns = { - 'name': fields.char('Month', size=64, readonly=True), + 'name': fields.char('Year',size=64,required=False, readonly=True), 'period_id': fields.many2one('account.period', 'Force Period',readonly=True), 'product_id': fields.many2one('product.product', 'Product',readonly=True), 'quantity': fields.float('Quantity', readonly=True), 'account_id': fields.many2one('account.account', 'Account', readonly=True), 'amount_total': fields.float('Total', readonly=True), - 'currency_id': fields.many2one('res.currency', 'Currency', readonly=True), + 'currency_id': fields.many2one('res.currency', 'Currency', 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,amount_total desc' def init(self, cr): + tools.drop_view_if_exists(cr, 'report_account_sales') cr.execute("""create or replace view report_account_sales as ( select min(inv_line.id) as id, - to_char(inv.date_invoice, 'YYYY-MM-01') as name, + to_char(inv.date_invoice, 'YYYY') as name, + to_char(inv.date_invoice,'MM') as month, sum(inv_line.price_subtotal) as amount_total, inv.currency_id as currency_id, inv.period_id, @@ -273,7 +282,7 @@ class report_account_sales(osv.osv): where inv.state in ('open','paid') group by - to_char(inv.date_invoice, 'YYYY-MM-01'),inv.currency_id, inv.period_id, inv_line.product_id, account.id + to_char(inv.date_invoice, 'YYYY'),to_char(inv.date_invoice,'MM'),inv.currency_id, inv.period_id, inv_line.product_id, account.id )""") report_account_sales() diff --git a/addons/report_account/report_receivable_view.xml b/addons/report_account/report_receivable_view.xml index 694bdf690e7..7ef469c96fe 100644 --- a/addons/report_account/report_receivable_view.xml +++ b/addons/report_account/report_receivable_view.xml @@ -124,8 +124,8 @@ tree - - + + @@ -175,6 +175,7 @@ + @@ -185,6 +186,18 @@ + + report.account_type.sales.form + report.account_type.sales + form + + + + + + + + report.account_type.sales.graph diff --git a/addons/report_analytic_line/report_analytic_line.py b/addons/report_analytic_line/report_analytic_line.py index 006a36cc3a4..42f219df1f3 100644 --- a/addons/report_analytic_line/report_analytic_line.py +++ b/addons/report_analytic_line/report_analytic_line.py @@ -20,27 +20,32 @@ ############################################################################## from osv import fields,osv +import tools class report_account_analytic_line_to_invoice(osv.osv): _name = "report.account.analytic.line.to.invoice" _description = "Analytic lines to invoice report" _auto = False _columns = { - 'name': fields.date('Month', readonly=True), + 'name': fields.char('Year',size=64,required=False, readonly=True), 'product_id':fields.many2one('product.product', 'Product', readonly=True), 'account_id':fields.many2one('account.analytic.account', 'Analytic account', readonly=True), 'product_uom_id':fields.many2one('product.uom', 'UoM', readonly=True), 'unit_amount': fields.float('Units', readonly=True), 'sale_price': fields.float('Sale price', readonly=True), 'amount': fields.float('Amount', 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, product_id asc, account_id asc' def init(self, cr): + tools.drop_view_if_exists(cr, 'report_account_analytic_line_to_invoice') cr.execute(""" CREATE OR REPLACE VIEW report_account_analytic_line_to_invoice AS ( SELECT - DISTINCT(to_char(l.date,'YYYY-MM-DD')) AS name, + DISTINCT(to_char(l.date,'MM')) as month, + to_char(l.date, 'YYYY') as name, MIN(l.id) AS id, l.product_id, l.account_id, @@ -57,7 +62,7 @@ class report_account_analytic_line_to_invoice(osv.osv): WHERE (invoice_id IS NULL) and (to_invoice IS NOT NULL) GROUP BY - to_char(l.date,'YYYY-MM-DD'), product_id, product_uom_id, account_id + to_char(l.date, 'YYYY'), to_char(l.date,'MM'), product_id, product_uom_id, account_id ) """) report_account_analytic_line_to_invoice() diff --git a/addons/report_analytic_line/report_analytic_line_view.xml b/addons/report_analytic_line/report_analytic_line_view.xml index ef61bd70645..e5c9a3d2c06 100644 --- a/addons/report_analytic_line/report_analytic_line_view.xml +++ b/addons/report_analytic_line/report_analytic_line_view.xml @@ -9,6 +9,7 @@
+ diff --git a/addons/report_crm/report_crm.py b/addons/report_crm/report_crm.py index df133b53b4f..d6c2e9d0066 100644 --- a/addons/report_crm/report_crm.py +++ b/addons/report_crm/report_crm.py @@ -20,6 +20,7 @@ ############################################################################## from osv import fields,osv +import tools AVAILABLE_STATES = [ ('draft','Draft'), @@ -34,7 +35,7 @@ class report_crm_case_user(osv.osv): _description = "Cases by user and section" _auto = False _columns = { - 'name': fields.date('Month', readonly=True), + 'name': fields.char('Year',size=64,required=False, readonly=True), 'user_id':fields.many2one('res.users', 'User', readonly=True), 'section_id':fields.many2one('crm.case.section', 'Section', readonly=True), 'amount_revenue': fields.float('Est.Revenue', readonly=True), @@ -44,14 +45,18 @@ class report_crm_case_user(osv.osv): 'probability': fields.float('Avg. Probability', readonly=True), 'state': fields.selection(AVAILABLE_STATES, 'Status', size=16, readonly=True), 'delay_close': fields.char('Delay to close', size=20, 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, user_id, section_id' def init(self, cr): + tools.drop_view_if_exists(cr, 'report_crm_case_user') cr.execute(""" create or replace view report_crm_case_user as ( select min(c.id) as id, - to_char(c.create_date, 'YYYY-MM-01') as name, + to_char(c.create_date, 'YYYY') as name, + to_char(c.create_date, 'MM') as month, c.state, c.user_id, c.section_id, @@ -63,7 +68,7 @@ class report_crm_case_user(osv.osv): to_char(avg(date_closed-c.create_date), 'DD"d" HH24:MI:SS') as delay_close from crm_case c - group by to_char(c.create_date, 'YYYY-MM-01'), c.state, c.user_id, c.section_id + group by to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'), c.state, c.user_id, c.section_id )""") report_crm_case_user() @@ -72,7 +77,7 @@ class report_crm_case_categ(osv.osv): _description = "Cases by section and category" _auto = False _columns = { - 'name': fields.date('Month', readonly=True), + 'name': fields.char('Year',size=64,required=False, readonly=True), 'categ_id':fields.many2one('crm.case.categ', 'Category', readonly=True), 'section_id':fields.many2one('crm.case.section', 'Section', readonly=True), 'amount_revenue': fields.float('Est.Revenue', readonly=True), @@ -82,14 +87,18 @@ class report_crm_case_categ(osv.osv): 'probability': fields.float('Avg. Probability', readonly=True), 'state': fields.selection(AVAILABLE_STATES, 'Status', size=16, readonly=True), 'delay_close': fields.char('Delay Close', size=20, 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, categ_id, section_id' def init(self, cr): + tools.drop_view_if_exists(cr, 'report_crm_case_categ') cr.execute(""" create or replace view report_crm_case_categ as ( select min(c.id) as id, - to_char(c.create_date, 'YYYY-MM-01') as name, + to_char(c.create_date, 'YYYY') as name, + to_char(c.create_date, 'MM') as month, c.state, c.categ_id, c.section_id, @@ -101,7 +110,7 @@ class report_crm_case_categ(osv.osv): to_char(avg(date_closed-c.create_date), 'DD"d" HH24:MI:SS') as delay_close from crm_case c - group by to_char(c.create_date, 'YYYY-MM-01'), c.state, c.categ_id, c.section_id + group by to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'), c.state, c.categ_id, c.section_id )""") report_crm_case_categ() @@ -134,7 +143,7 @@ class report_crm_case_section(osv.osv): return res _columns = { - 'name': fields.date('Month', readonly=True), + 'name': fields.char('Year',size=64,required=False, readonly=True), # 'user_id':fields.many2one('res.users', 'User', readonly=True), 'section_id':fields.many2one('crm.case.section', 'Section', readonly=True), 'nbr_cases': fields.integer('# of Cases', readonly=True), @@ -142,14 +151,18 @@ class report_crm_case_section(osv.osv): 'perc_done': fields.function(_get_data,string='%Done', method=True,type="float"), 'perc_cancel': fields.function(_get_data,string='%Cancel', method=True,type="float"), 'delay_close': fields.char('Delay to close', size=20, 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, section_id' def init(self, cr): + tools.drop_view_if_exists(cr, 'report_crm_case_section') cr.execute(""" create or replace view report_crm_case_section as ( select min(c.id) as id, - to_char(c.create_date, 'YYYY-MM-01') as name, + to_char(c.create_date, 'YYYY') as name, + to_char(c.create_date, 'MM') as month, c.section_id as section_id, count(*) as nbr_cases, 0 as avg_answers, @@ -158,7 +171,7 @@ class report_crm_case_section(osv.osv): to_char(avg(date_closed-c.create_date), 'DD"d" HH24:MI:SS') as delay_close from crm_case c - group by to_char(c.create_date, 'YYYY-MM-01'),c.section_id + group by to_char(c.create_date, 'YYYY'),to_char(c.create_date, 'MM'),c.section_id )""") report_crm_case_section() diff --git a/addons/report_crm/report_crm_view.xml b/addons/report_crm/report_crm_view.xml index 947a457c289..4e9af483d67 100644 --- a/addons/report_crm/report_crm_view.xml +++ b/addons/report_crm/report_crm_view.xml @@ -12,7 +12,8 @@ tree - + + @@ -32,6 +33,7 @@ + @@ -103,6 +105,7 @@ + @@ -122,6 +125,7 @@ + @@ -165,6 +169,7 @@ + diff --git a/addons/report_document/report_document.py b/addons/report_document/report_document.py index 0da5b3430e5..911dc3a6ace 100644 --- a/addons/report_document/report_document.py +++ b/addons/report_document/report_document.py @@ -32,7 +32,7 @@ from osv import fields,osv import time - +import tools class report_document_user(osv.osv): _name = "report.document.user" @@ -81,7 +81,7 @@ class report_files_partner(osv.osv): _description = "Files details by Partners" _auto = False _columns = { - 'name': fields.date('Month', readonly=True), + 'name': fields.char('Year',size=64,required=False, readonly=True), 'file_title': fields.char('File Name',size=64,readonly=True), 'directory': fields.char('Directory',size=64,readonly=True), 'create_date': fields.datetime('Date Created', readonly=True), @@ -90,19 +90,23 @@ class report_files_partner(osv.osv): 'nbr':fields.integer('# of Files', readonly=True), 'type':fields.char('Directory Type',size=64,readonly=True), 'partner':fields.char('Partner',size=64,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), } def init(self, cr): + tools.drop_view_if_exists(cr, 'report_files_partner') cr.execute(""" create or replace view report_files_partner as ( select min(f.id) as id,count(*) as nbr, - min(to_char(f.create_date,'YYYY-MM-01')) as name, + to_char(f.create_date,'YYYY') as name, + min(to_char(f.create_date,'MM')) as month, min(f.title) as file_title, p.name as partner from ir_attachment f inner join res_partner p on (f.partner_id=p.id) where f.datas_fname is not null - group by p.name + group by p.name, to_char(f.create_date,'YYYY') ) """) report_files_partner() diff --git a/addons/report_document/report_document_view.xml b/addons/report_document/report_document_view.xml index 746bf6d89c4..7226e953aa9 100644 --- a/addons/report_document/report_document_view.xml +++ b/addons/report_document/report_document_view.xml @@ -209,13 +209,14 @@ tree - + + - + Files by Month report.document.user @@ -269,11 +270,27 @@ + + + + view.files.partner.form + report.files.partner + form + + + + + + + + + + Files Per Partner report.files.partner