[IMP]: Changed the report_XXX modules. Date field in all monthly reports are splitted in two separate fields as year and month.
bzr revid: uco@tinyerp.co.in-20091124133415-n3qjchamrw398f0m
This commit is contained in:
parent
56c69a3fca
commit
caa1f39746
|
@ -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"),
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -124,8 +124,8 @@
|
|||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Sales by Account">
|
||||
<field name="name"/>
|
||||
<field name="period_id"/>
|
||||
<field name="name" select="1"/>
|
||||
<field name="month" select="1"/>
|
||||
<field name="product_id"/>
|
||||
<field name="account_id"/>
|
||||
<field name="quantity"/>
|
||||
|
@ -175,6 +175,7 @@
|
|||
<field name="arch" type="xml">
|
||||
<tree string="Sales by Account type">
|
||||
<field name="name"/>
|
||||
<field name="month"/>
|
||||
<field name="period_id"/>
|
||||
<field name="product_id"/>
|
||||
<field name="user_type"/>
|
||||
|
@ -185,6 +186,18 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_report_account_type_sales_form" model="ir.ui.view">
|
||||
<field name="name">report.account_type.sales.form</field>
|
||||
<field name="model">report.account_type.sales</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Sales by Account type">
|
||||
<field name="name" select="1"/>
|
||||
<field name="month" select="1"/>
|
||||
<field name="product_id" select="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_report_account_type_sales_graph" model="ir.ui.view">
|
||||
<field name="name">report.account_type.sales.graph</field>
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<field name="arch" type="xml">
|
||||
<form string="Analytic Lines to Invoice">
|
||||
<field name="name" select="1"/>
|
||||
<field name="month" select="1"/>
|
||||
<field name="account_id" select="1"/>
|
||||
<newline/>
|
||||
<field name="product_id" select="1"/>
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Cases by User and Section">
|
||||
<field name="name"/>
|
||||
<field name="name" />
|
||||
<field name="month"/>
|
||||
<field name="user_id"/>
|
||||
<field name="section_id"/>
|
||||
<field name="nbr"/>
|
||||
|
@ -32,6 +33,7 @@
|
|||
<field name="arch" type="xml">
|
||||
<form string="Cases by User and Section">
|
||||
<field name="name" select="1"/>
|
||||
<field name="month" select="1"/>
|
||||
<field name="user_id" select="1"/>
|
||||
<field name="section_id" select="1" widget="selection"/>
|
||||
<field name="nbr" select="1"/>
|
||||
|
@ -103,6 +105,7 @@
|
|||
<field name="arch" type="xml">
|
||||
<tree string="Cases by User and Section">
|
||||
<field name="name"/>
|
||||
<field name="month"/>
|
||||
<field name="categ_id"/>
|
||||
<field name="section_id"/>
|
||||
<field name="nbr"/>
|
||||
|
@ -122,6 +125,7 @@
|
|||
<field name="arch" type="xml">
|
||||
<form string="Cases by User and Section">
|
||||
<field name="name" select="1"/>
|
||||
<field name="month" select="1"/>
|
||||
<field name="categ_id" select="1"/>
|
||||
<field name="section_id" select="1" widget="selection"/>
|
||||
<field name="nbr" select="1"/>
|
||||
|
@ -165,6 +169,7 @@
|
|||
<field name="arch" type="xml">
|
||||
<tree string="Cases by Section">
|
||||
<field name="name" select="1"/>
|
||||
<field name="month" select="1"/>
|
||||
<field name="section_id" select="1"/>
|
||||
<field name="nbr_cases" select="1"/>
|
||||
<field name="avg_answers"/>
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -209,13 +209,14 @@
|
|||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Files by Month">
|
||||
<field name="name" />
|
||||
<field name="name"/>
|
||||
<field name="month"/>
|
||||
<field name="nbr"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_view_files_by_month_graph">
|
||||
<record model="ir.actions.act_window" id="action_view_files_by_month_graph">
|
||||
<field name="name">Files by Month</field>
|
||||
<field name="res_model">report.document.user</field>
|
||||
<field name="view_id" ref="view_files_by_month_graph"></field>
|
||||
|
@ -269,11 +270,27 @@
|
|||
<field name="arch" type="xml">
|
||||
<tree string="Files per Month">
|
||||
<field name="name"/>
|
||||
<field name="month"/>
|
||||
<field name="partner"/>
|
||||
<field name="nbr"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_files_by_partner_form">
|
||||
<field name="name">view.files.partner.form</field>
|
||||
<field name="model">report.files.partner</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Files per Month">
|
||||
<field name="name" select="1"/>
|
||||
<field name="month" select="1"/>
|
||||
<field name="partner"/>
|
||||
<field name="nbr"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_view_files_by_partner">
|
||||
<field name="name">Files Per Partner</field>
|
||||
<field name="res_model">report.files.partner</field>
|
||||
|
|
Loading…
Reference in New Issue