[FIX] correct various date issues in reporting

* remove old 'day', 'month', 'field' and replace them by the actual
date/datetime field
* remove weird cast to char when creating the view to prevent crash
when grouping on them
* remove duplicates (such as 'creation_date' and 'create_date')
* fix typing errors (field type date defined as a datetime in the
postgres view)
* fix search view definition
This commit is contained in:
Géry Debongnie 2014-07-28 10:34:30 +02:00 committed by Olivier Dony
parent 6f563d6284
commit 366a30db95
38 changed files with 74 additions and 257 deletions

View File

@ -20,9 +20,7 @@
<filter string="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id'}"/>
<filter string="Product Unit of Measure" icon="terp-mrp" context="{'group_by':'product_uom_id'}"/>
<filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Date (day)" icon="terp-go-today" context="{'group_by':'date:day'}"/>
<filter string="Date (month)" name="Month" icon="terp-go-month" context="{'group_by':'date:month'}"/>
<filter string="Date (year)" icon="terp-go-year" context="{'group_by':'date:year'}"/>
<filter string="Date" name="Month" icon="terp-go-month" context="{'group_by':'date:month'}"/>
</group>
</search>
</field>

View File

@ -37,14 +37,8 @@ class account_entries_report(osv.osv):
'debit': fields.float('Debit', readonly=True),
'credit': fields.float('Credit', readonly=True),
'balance': fields.float('Balance', readonly=True),
'day': fields.char('Day', size=128, readonly=True),
'year': fields.char('Year', size=4, readonly=True),
'date': fields.date('Date', size=128, readonly=True),
'currency_id': fields.many2one('res.currency', 'Currency', readonly=True),
'amount_currency': fields.float('Amount Currency', digits_compute=dp.get_precision('Account'), 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),
'period_id': fields.many2one('account.period', 'Period', readonly=True),
'account_id': fields.many2one('account.account', 'Account', readonly=True),
'journal_id': fields.many2one('account.journal', 'Journal', readonly=True),
@ -53,7 +47,7 @@ class account_entries_report(osv.osv):
'product_uom_id': fields.many2one('product.uom', 'Product Unit of Measure', readonly=True),
'move_state': fields.selection([('draft','Unposted'), ('posted','Posted')], 'Status', readonly=True),
'move_line_state': fields.selection([('draft','Unbalanced'), ('valid','Valid')], 'State of Move Line', readonly=True),
'reconcile_id': fields.many2one('account.move.reconcile', readonly=True),
'reconcile_id': fields.many2one('account.move.reconcile', 'Reconciliation number', readonly=True),
'partner_id': fields.many2one('res.partner','Partner', readonly=True),
'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account', readonly=True),
'quantity': fields.float('Products Quantity', digits=(16,2), readonly=True),
@ -123,9 +117,6 @@ class account_entries_report(osv.osv):
am.state as move_state,
l.state as move_line_state,
l.reconcile_id as reconcile_id,
to_char(am.date, 'YYYY') as year,
to_char(am.date, 'MM') as month,
to_char(am.date, 'YYYY-MM-DD') as day,
l.partner_id as partner_id,
l.product_id as product_id,
l.product_uom_id as product_uom_id,

View File

@ -18,9 +18,6 @@
<field name="credit"/>
<field name="balance"/>
<field name="move_state" invisible="1"/>
<field name="day" invisible="1"/>
<field name="month" invisible="1"/>
<field name="year" invisible="1"/>
<field name="partner_id" invisible="1"/>
<field name="product_id" invisible="1"/>
<field name="product_uom_id" invisible="1"/>

View File

@ -86,9 +86,7 @@
<filter string="Journal" icon="terp-folder-orange" context="{'group_by':'journal_id'}"/>
<filter string="Account" icon="terp-folder-orange" context="{'group_by':'account_line_id'}"/>
<filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Invoice Date (day)" name="day" icon="terp-go-today" context="{'group_by':'date:day'}" help="Group by Invoice Date"/>
<filter string="Invoice Date (month)" name="month" icon="terp-go-month" context="{'group_by':'date:month'}" help="Group by month of Invoice Date"/>
<filter string="Invoice Date (year)" name="group_year" icon="terp-go-year" context="{'group_by':'date:year'}" help="Group by year of Invoice Date"/>
<filter string="Invoice Date" name="month" icon="terp-go-month" context="{'group_by':'date'}" help="Group by month of Invoice Date"/>
</group>
</search>
</field>

View File

@ -28,11 +28,6 @@ class sale_receipt_report(osv.osv):
_rec_name = 'date'
_columns = {
'date': fields.date('Date', readonly=True),
'year': fields.char('Year', size=4, readonly=True),
'day': fields.char('Day', size=128, 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),
'currency_id': fields.many2one('res.currency', 'Currency', readonly=True),
'journal_id': fields.many2one('account.journal', 'Journal', readonly=True),
'partner_id': fields.many2one('res.partner', 'Partner', readonly=True),
@ -69,9 +64,6 @@ class sale_receipt_report(osv.osv):
create or replace view sale_receipt_report as (
select min(avl.id) as id,
av.date as date,
to_char(av.date, 'YYYY') as year,
to_char(av.date, 'MM') as month,
to_char(av.date, 'YYYY-MM-DD') as day,
av.partner_id as partner_id,
aj.currency as currency_id,
av.journal_id as journal_id,
@ -107,9 +99,6 @@ class sale_receipt_report(osv.osv):
group by
av.date,
av.id,
to_char(av.date, 'YYYY'),
to_char(av.date, 'MM'),
to_char(av.date, 'YYYY-MM-DD'),
av.partner_id,
aj.currency,
av.journal_id,

View File

@ -1,34 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<!-- <record id="view_sale_receipt_report_tree" model="ir.ui.view">
<field name="name">sale.receipt.report.tree</field>
<field name="model">sale.receipt.report</field>
<field name="arch" type="xml">
<tree colors="blue:state == 'draft';gray:state in ('cancel','paid');black:state in ('proforma','proforma2')" create="false" string="Sales Receipts Analysis">
<field name="date" invisible="1"/>
<field name="user_id" invisible="1"/>
<field name="year" invisible="1"/>
<field name="day" invisible="1"/>
<field name="month" invisible="1"/>
<field name="type" invisible="1"/>
<field name="company_id" invisible="1"/>
<field name="partner_id" invisible="1"/>
<field name="state" invisible="1"/>
<field name="currency_id" invisible="1"/>
<field name="journal_id" invisible="1"/>
<field name="date_due" invisible="1"/>
<field name="account_id" invisible="1"/>
<field name="nbr" sum="# of Voucher Lines"/>
<field name="price_total" sum="Total Without Tax"/>
<field name="price_total_tax" sum="Total With Tax"/>
<field name="due_delay" sum="Avg. Due Delay"/>
<field name="delay_to_pay" sum="Avg. Delay To Pay"/>
</tree>
</field>
</record>
-->
<record id="view_sale_receipt_report_graph" model="ir.ui.view">
<field name="name">sale.receipt.report.graph</field>
<field name="model">sale.receipt.report</field>
@ -65,9 +38,7 @@
<filter string="Journal" icon="terp-folder-orange" context="{'group_by':'journal_id'}"/>
<filter string="Due Month" icon="terp-go-today" context="{'group_by':'date_due'}"/>
<filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Day" name="day" icon="terp-go-today" context="{'group_by':'day'}" help="Group by Invoice Date"/>
<filter string="Month" name="month" icon="terp-go-month" context="{'group_by':'month'}" help="Group by month of Invoice Date"/>
<filter string="Year" name="year" icon="terp-go-year" context="{'group_by':'year'}" help="Group by year of Invoice Date"/>
<filter string="Invoice Date" name="month" icon="terp-go-month" context="{'group_by':'date'}" help="Group by month of Invoice Date"/>
</group>
</search>
</field>

View File

@ -91,7 +91,7 @@ class crm_lead_report(osv.osv):
date(c.date_open) as opening_date,
date(c.date_closed) as date_closed,
date_trunc('day',c.date_last_stage_update) as date_last_stage_update,
c.date_last_stage_update as date_last_stage_update,
c.user_id,
c.probability,
@ -107,7 +107,7 @@ class crm_lead_report(osv.osv):
c.country_id,
c.planned_revenue,
c.planned_revenue*(c.probability/100) as probable_revenue,
date_trunc('day',c.create_date) as create_date,
c.create_date as create_date,
extract('epoch' from (c.date_closed-c.create_date))/(3600*24) as delay_close,
abs(extract('epoch' from (c.date_deadline - c.date_closed))/(3600*24)) as delay_expected,
extract('epoch' from (c.date_open-c.create_date))/(3600*24) as delay_open

View File

@ -55,7 +55,6 @@ class crm_phonecall_report(osv.osv):
'partner_id': fields.many2one('res.partner', 'Partner' , readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'opening_date': fields.date('Opening Date', readonly=True, select=True),
'creation_date': fields.date('Creation Date', readonly=True, select=True),
'date_closed': fields.date('Close Date', readonly=True, select=True),
}
@ -69,9 +68,8 @@ class crm_phonecall_report(osv.osv):
create or replace view crm_phonecall_report as (
select
id,
to_char(c.create_date, 'YYYY-MM-DD') as creation_date,
to_char(c.date_open, 'YYYY-MM-DD') as opening_date,
to_char(c.date_closed, 'YYYY-mm-dd') as date_closed,
date(c.date_open) as opening_date,
date(c.date_closed) as date_closed,
c.state,
c.user_id,
c.section_id,
@ -81,7 +79,7 @@ class crm_phonecall_report(osv.osv):
c.company_id,
c.priority,
1 as nbr,
date_trunc('day',c.create_date) as create_date,
c.create_date as create_date,
extract('epoch' from (c.date_closed-c.create_date))/(3600*24) as delay_close,
extract('epoch' from (c.date_open-c.create_date))/(3600*24) as delay_open
from

View File

@ -41,7 +41,6 @@
<group expand="0" string="Extended Filters...">
<field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="creation_date"/>
<field name="opening_date"/>
<field name="date_closed"/>
</group>
@ -53,9 +52,7 @@
<filter string="Category" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'categ_id'}" />
<filter string="Status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}" />
<filter string="Company" icon="terp-go-home" domain="[]" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Creation Date (day)" icon="terp-go-today" domain="[]" context="{'group_by':'create_date:day'}" help="Date of call"/>
<filter string="Creation Date (month)" icon="terp-go-month" domain="[]" context="{'group_by':'create_date:month'}" help="Month of call"/>
<filter string="Creation Date (year)" icon="terp-go-year" domain="[]" context="{'group_by':'create_date:name'}" help="Year of call"/>
<filter string="Creation Date" icon="terp-go-month" domain="[]" context="{'group_by':'create_date:month'}" help="Month of call"/>
</group>
</search>
</field>

View File

@ -37,19 +37,12 @@ class crm_claim_report(osv.osv):
_description = "CRM Claim Report"
_columns = {
'name': fields.char('Year', required=False, readonly=True),
'user_id':fields.many2one('res.users', 'User', readonly=True),
'section_id':fields.many2one('crm.case.section', 'Section', readonly=True),
'nbr': fields.integer('# of Cases', 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),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'create_date': fields.datetime('Create Date', readonly=True, select=True),
'day': fields.char('Day', size=128, readonly=True),
'claim_date': fields.datetime('Claim Date', readonly=True),
'delay_close': fields.float('Delay to close', digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to close the case"),
'stage_id': fields.many2one ('crm.case.stage', 'Stage', readonly=True,domain="[('section_ids','=',section_id)]"),
'categ_id': fields.many2one('crm.case.categ', 'Category',\
@ -76,11 +69,9 @@ class crm_claim_report(osv.osv):
create or replace view crm_claim_report as (
select
min(c.id) as id,
to_char(c.date, 'YYYY') as name,
to_char(c.date, 'MM') as month,
to_char(c.date, 'YYYY-MM-DD') as day,
to_char(c.date_closed, 'YYYY-MM-DD') as date_closed,
to_char(c.date_deadline, 'YYYY-MM-DD') as date_deadline,
c.date as claim_date,
date(c.date_closed) as date_closed,
c.date_deadline as date_deadline,
c.user_id,
c.stage_id,
c.section_id,
@ -90,13 +81,13 @@ class crm_claim_report(osv.osv):
count(*) as nbr,
c.priority as priority,
c.type_action as type_action,
date_trunc('day',c.create_date) as create_date,
c.create_date as create_date,
avg(extract('epoch' from (c.date_closed-c.create_date)))/(3600*24) as delay_close,
(SELECT count(id) FROM mail_message WHERE model='crm.claim' AND res_id=c.id) AS email,
extract('epoch' from (c.date_deadline - c.date_closed))/(3600*24) as delay_expected
from
crm_claim c
group by to_char(c.date, 'YYYY'), to_char(c.date, 'MM'),to_char(c.date, 'YYYY-MM-DD'),\
group by c.date,\
c.user_id,c.section_id, c.stage_id,\
c.categ_id,c.partner_id,c.company_id,c.create_date,
c.priority,c.type_action,c.date_deadline,c.date_closed,c.id

View File

@ -53,9 +53,7 @@
<filter string="Category" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'categ_id'}" />
<filter string="Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'type_action'}" help="Action Type"/>
<filter string="Company" icon="terp-go-home" domain="[]" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Day" icon="terp-go-today" domain="[]" context="{'group_by':'day'}" help="Date of claim"/>
<filter string="Month" icon="terp-go-month" domain="[]" context="{'group_by':'month'}" help="Month of claim"/>
<filter string="Year" icon="terp-go-year" domain="[]" context="{'group_by':'name'}" help="Year of claim"/>
<filter string="Claim Date" icon="terp-go-month" domain="[]" context="{'group_by':'claim_date'}" help="Month of claim"/>
</group>
</search>
</field>

View File

@ -39,17 +39,11 @@ class crm_helpdesk_report(osv.osv):
_auto = False
_columns = {
'name': fields.char('Year', required=False, readonly=True),
'date': fields.datetime('Date', readonly=True),
'user_id':fields.many2one('res.users', 'User', readonly=True),
'section_id':fields.many2one('crm.case.section', 'Section', readonly=True),
'nbr': fields.integer('# of Cases', readonly=True),
'state': fields.selection(AVAILABLE_STATES, 'Status', 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),
'delay_close': fields.float('Delay to Close',digits=(16,2),readonly=True, group_operator="avg"),
'partner_id': fields.many2one('res.partner', 'Partner' , readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
@ -64,7 +58,6 @@ class crm_helpdesk_report(osv.osv):
'create_date': fields.date('Creation Date' , readonly=True, select=True),
'date_closed': fields.date('Close Date', readonly=True, select=True),
'delay_expected': fields.float('Overpassed Deadline',digits=(16,2),readonly=True, group_operator="avg"),
'day': fields.char('Day', size=128, readonly=True),
'email': fields.integer('# Emails', size=128, readonly=True),
}
@ -80,11 +73,9 @@ class crm_helpdesk_report(osv.osv):
create or replace view crm_helpdesk_report as (
select
min(c.id) as id,
to_char(c.date, 'YYYY') as name,
to_char(c.date, 'MM') as month,
to_char(c.date, 'YYYY-MM-DD') as day,
to_char(c.create_date, 'YYYY-MM-DD') as create_date,
to_char(c.date_closed, 'YYYY-mm-dd') as date_closed,
c.date as date,
date(c.create_date) as create_date,
date(c.date_closed) as date_closed,
c.state,
c.user_id,
c.section_id,
@ -102,7 +93,7 @@ class crm_helpdesk_report(osv.osv):
from
crm_helpdesk c
where c.active = 'true'
group by to_char(c.date, 'YYYY'), to_char(c.date, 'MM'),to_char(c.date, 'YYYY-MM-DD'),\
group by c.date,\
c.state, c.user_id,c.section_id,c.priority,\
c.partner_id,c.company_id,c.date_deadline,c.create_date,c.date,c.date_closed,\
c.categ_id,c.channel_id,c.planned_cost,c.id

View File

@ -49,9 +49,7 @@
<filter string="Channel" icon="terp-call-start" domain="[]" context="{'group_by':'channel_id'}" />
<filter string="Status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}" />
<filter string="Company" icon="terp-go-home" domain="[]" groups="base.group_multi_company" context="{'group_by':'company_id'}" />
<filter string="Day" icon="terp-go-today" domain="[]" context="{'group_by':'day'}" help="Date of helpdesk requests"/>
<filter string="Month" icon="terp-go-month" domain="[]" context="{'group_by':'month'}" help="Month of helpdesk requests"/>
<filter string="Year" icon="terp-go-year" domain="[]" context="{'group_by':'name'}" help="Year of helpdesk requests" />
<filter string="Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}" help="Month of helpdesk requests"/>
</group>
</search>
</field>

View File

@ -48,7 +48,6 @@ class crm_lead_report_assign(osv.osv):
'stage_id': fields.many2one ('crm.case.stage', 'Stage', domain="[('section_ids', '=', section_id)]"),
'partner_id': fields.many2one('res.partner', 'Customer' , readonly=True),
'opening_date': fields.date('Opening Date', readonly=True),
'creation_date': fields.date('Creation Date', readonly=True),
'date_closed': fields.date('Close Date', readonly=True),
'nbr': fields.integer('# of Cases', readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
@ -69,9 +68,8 @@ class crm_lead_report_assign(osv.osv):
CREATE OR REPLACE VIEW crm_lead_report_assign AS (
SELECT
c.id,
to_char(c.create_date, 'YYYY-MM-DD') as creation_date,
to_char(c.date_open, 'YYYY-MM-DD') as opening_date,
to_char(c.date_closed, 'YYYY-mm-dd') as date_closed,
date(c.date_open) as opening_date,
date(c.date_closed) as date_closed,
c.date_assign,
c.user_id,
c.probability,
@ -89,7 +87,7 @@ class crm_lead_report_assign(osv.osv):
p.date as partner_date,
c.planned_revenue*(c.probability/100) as probable_revenue,
1 as nbr,
date_trunc('day',c.create_date) as create_date,
c.create_date as create_date,
extract('epoch' from (c.write_date-c.create_date))/(3600*24) as delay_close,
extract('epoch' from (c.date_deadline - c.date_closed))/(3600*24) as delay_expected,
extract('epoch' from (c.date_open-c.create_date))/(3600*24) as delay_open

View File

@ -18,7 +18,6 @@
<field name="stage_id" widget="selection" domain="[('section_ids', '=', 'section_id')]"/>
<separator />
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<field name="creation_date"/>
<field name="opening_date"/>
<field name="date_closed"/>
</group>
@ -35,9 +34,7 @@
<filter string="Stage" icon="terp-stage" domain="[]" context="{'group_by':'stage_id'}"/>
<filter string="Priority" icon="terp-rating-rated" domain="[]" context="{'group_by':'priority'}" />
<filter string="Company" icon="terp-go-home" domain="[]" context="{'group_by':'company_id'}" />
<filter string="Assign Date (day)" icon="terp-go-today" domain="[]" context="{'group_by':'date_assign:day'}"/>
<filter string="Assign Date (month)" icon="terp-go-month" domain="[]" context="{'group_by':'date_assign:month'}"/>
<filter string="Assign Date (year)" icon="terp-go-year" domain="[]" context="{'group_by':'date_assign:year'}"/>
<filter string="Assign Date" icon="terp-go-month" domain="[]" context="{'group_by':'date_assign:month'}"/>
</group>
</search>
</field>

View File

@ -41,9 +41,7 @@
<filter string="Event State" icon="terp-stock_effects-object-colorize" context="{'group_by':'event_state'}"/>
<filter string="Registration State" icon="terp-stock_effects-object-colorize" context="{'group_by':'registration_state'}"/>
<filter string="Company" icon="terp-go-home" domain="[]" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Event Date (day)" domain="[]" context="{'group_by':'event_date:day'}" help="Event Beginning Date"/>
<filter string="Event Date (month)" domain="[]" context="{'group_by':'event_date:month'}" help="Event Beginning Date"/>
<filter string="Event Date (year)" domain="[]" context="{'group_by':'event_date:year'}" help="Event Beginning Date"/>
<filter string="Event Date" domain="[]" context="{'group_by':'event_date'}" help="Event Beginning Date"/>
</group>
<group expand="0" string="Display">
<filter icon="terp-camera_test" string="Show Confirmed Registrations"

View File

@ -53,15 +53,6 @@ class fleet_vehicle_cost(osv.Model):
odometer_id = self.pool.get('fleet.vehicle.odometer').create(cr, uid, data, context=context)
return self.write(cr, uid, id, {'odometer_id': odometer_id}, context=context)
def _year_get_fnc(self, cr, uid, ids, name, unknow_none, context=None):
res = {}
for record in self.browse(cr, uid, ids, context=context):
if (record.date):
res[record.id] = str(time.strptime(record.date, tools.DEFAULT_SERVER_DATE_FORMAT).tm_year)
else:
res[record.id] = _('Unknown')
return res
_columns = {
'name': fields.related('vehicle_id', 'name', type="char", string='Name', store=True),
'vehicle_id': fields.many2one('fleet.vehicle', 'Vehicle', required=True, help='Vehicle concerned by this log'),
@ -76,7 +67,6 @@ class fleet_vehicle_cost(osv.Model):
'date' :fields.date('Date',help='Date when the cost has been executed'),
'contract_id': fields.many2one('fleet.vehicle.log.contract', 'Contract', help='Contract attached to this cost'),
'auto_generated': fields.boolean('Automatically Generated', readonly=True, required=True),
'year': fields.function(_year_get_fnc, type="char", string='Year', store=True),
}
_defaults ={

View File

@ -919,13 +919,12 @@
<search string="Vehicles costs" >
<field name="vehicle_id" />
<field name="cost_subtype_id"/>
<field name="year"/>
<field name="date"/>
<field name="parent_id"/>
<filter name="parent_false" domain="[('parent_id','=',False)]" string="Effective Costs"/>
<filter name="parent_true" domain="[('parent_id','!=',False)]" string="Indicative Costs"/>
<group expand="1" string="Group By">
<filter name="groupby_year" context="{'group_by' : 'year'}" string="Year"/>
<filter name="groupby_year" context="{'group_by' : 'date:year'}" string="Year"/>
<filter name="groupby_date" context="{'group_by' : 'date'}" string="Vehicle Costs Month" help="Vehicle Costs by Month"/>
<filter name="groupby_cost_type" context="{'group_by' : 'cost_type'}" string="Cost Type"/>
<filter name="groupby_cost_subtype_id" context="{'group_by' : 'cost_subtype_id'}" string="Cost Subtype"/>

View File

@ -31,14 +31,9 @@ class hr_evaluation_report(osv.Model):
'create_date': fields.date('Create Date', readonly=True),
'delay_date': fields.float('Delay to Start', digits=(16, 2), readonly=True),
'overpass_delay': fields.float('Overpassed Deadline', digits=(16, 2), readonly=True),
'day': fields.char('Day', size=128, readonly=True),
'deadline': fields.date("Deadline", readonly=True),
'request_id': fields.many2one('survey.user_input', 'Request_id', readonly=True),
'closed': fields.date("closed", readonly=True),
'year': fields.char('Year', size=4, 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),
'plan_id': fields.many2one('hr_evaluation.plan', 'Plan', readonly=True),
'employee_id': fields.many2one('hr.employee', "Employee", readonly=True),
'rating': fields.selection([
@ -73,16 +68,13 @@ class hr_evaluation_report(osv.Model):
create or replace view hr_evaluation_report as (
select
min(l.id) as id,
date_trunc('day',s.create_date) as create_date,
to_char(s.create_date, 'YYYY-MM-DD') as day,
date(s.create_date) as create_date,
s.employee_id,
l.request_id,
s.plan_id,
s.rating,
s.date as deadline,
s.date_close as closed,
to_char(s.create_date, 'YYYY') as year,
to_char(s.create_date, 'MM') as month,
count(l.*) as nbr,
s.state,
avg(extract('epoch' from age(s.create_date,CURRENT_DATE)))/(3600*24) as delay_date,
@ -93,10 +85,6 @@ class hr_evaluation_report(osv.Model):
hr_evaluation_evaluation s on (s.id=l.evaluation_id)
GROUP BY
s.create_date,
date_trunc('day',s.create_date),
to_char(s.create_date, 'YYYY-MM-DD'),
to_char(s.create_date, 'YYYY'),
to_char(s.create_date, 'MM'),
s.state,
s.employee_id,
s.date,

View File

@ -35,9 +35,7 @@
<filter string="Plan" icon="terp-stock_align_left_24" context="{'group_by':'plan_id'}"/>
<filter string="Appreciation" icon="terp-face-plain" context="{'group_by':'rating'}"/>
<filter string="Status" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
<filter string="Day" icon="terp-go-today" context="{'group_by':'day'}" help="Creation Date"/>
<filter string="Month" icon="terp-go-month" context="{'group_by':'create_date'}" help="Creation Date"/>
<filter string="Year" icon="terp-go-month" context="{'group_by':'year'}" help="Creation Date"/>
<filter string="Creation Date" icon="terp-go-month" context="{'group_by':'create_date'}" help="Creation Date"/>
</group>
</search>
</field>

View File

@ -32,11 +32,7 @@ class hr_expense_report(osv.osv):
_rec_name = 'date'
_columns = {
'date': fields.date('Date ', readonly=True),
'year': fields.char('Year', size=4, readonly=True),
'day': fields.char('Day', size=128, 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),
'create_date': fields.datetime('Creation Date', readonly=True),
'product_id':fields.many2one('product.product', 'Product', readonly=True),
'journal_id': fields.many2one('account.journal', 'Force Journal', readonly=True),
'product_qty':fields.float('Qty', readonly=True),
@ -70,17 +66,15 @@ class hr_expense_report(osv.osv):
create or replace view hr_expense_report as (
select
min(l.id) as id,
date_trunc('day',s.date) as date,
s.date as date,
s.create_date as create_date,
s.employee_id,
s.journal_id,
s.currency_id,
to_date(to_char(s.date_confirm, 'dd-MM-YYYY'),'dd-MM-YYYY') as date_confirm,
to_date(to_char(s.date_valid, 'dd-MM-YYYY'),'dd-MM-YYYY') as date_valid,
s.date_confirm as date_confirm,
s.date_valid as date_valid,
s.user_valid as user_id,
s.department_id,
to_char(date_trunc('day',s.create_date), 'YYYY') as year,
to_char(date_trunc('day',s.create_date), 'MM') as month,
to_char(date_trunc('day',s.create_date), 'YYYY-MM-DD') as day,
avg(extract('epoch' from age(s.date_valid,s.date)))/(3600*24) as delay_valid,
avg(extract('epoch' from age(s.date_valid,s.date_confirm)))/(3600*24) as delay_confirm,
l.product_id as product_id,
@ -97,12 +91,10 @@ class hr_expense_report(osv.osv):
left join hr_expense_expense s on (s.id=l.expense_id)
left join product_uom u on (u.id=l.uom_id)
group by
date_trunc('day',s.date),
to_char(date_trunc('day',s.create_date), 'YYYY'),
to_char(date_trunc('day',s.create_date), 'MM'),
to_char(date_trunc('day',s.create_date), 'YYYY-MM-DD'),
to_date(to_char(s.date_confirm, 'dd-MM-YYYY'),'dd-MM-YYYY'),
to_date(to_char(s.date_valid, 'dd-MM-YYYY'),'dd-MM-YYYY'),
s.date,
s.create_date,
s.date_confirm,
s.date_valid,
l.product_id,
l.analytic_account,
s.currency_id,

View File

@ -43,9 +43,7 @@
<filter string="Analytic account" icon="terp-folder-green" context="{'group_by':'analytic_account'}" groups="analytic.group_analytic_accounting"/>
<filter string="Status" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
<filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Day" icon="terp-go-today" context="{'group_by':'day'}" help="Creation Date"/>
<filter string="Month" icon="terp-go-month" context="{'group_by':'month'}" help="Creation Date"/>
<filter string="Year" icon="terp-go-year" context="{'group_by':'year'}" help="Creation Date"/>
<filter string="Create Date" icon="terp-go-month" context="{'group_by':'create_date'}" help="Creation Date"/>
</group>
</search>
</field>

View File

@ -61,11 +61,8 @@ class hr_recruitment_report(osv.Model):
select
min(s.id) as id,
s.create_date as date_create,
date_trunc('day',s.date_closed) as date_closed,
date_trunc('day',s.date_last_stage_update) as date_last_stage_update,
to_char(s.create_date, 'YYYY') as year,
to_char(s.create_date, 'MM') as month,
to_char(s.create_date, 'YYYY-MM-DD') as day,
date(s.date_closed) as date_closed,
s.date_last_stage_update as date_last_stage_update,
s.partner_id,
s.company_id,
s.user_id,
@ -84,8 +81,6 @@ class hr_recruitment_report(osv.Model):
count(*) as nbr
from hr_applicant s
group by
date_trunc('day',s.create_date),
date_trunc('day',s.date_closed),
s.date_open,
s.create_date,
s.write_date,

View File

@ -67,10 +67,7 @@
<filter string="Last Stage" help="Match this group by with a specific stage filter in order to analyse the recruitment process" context="{'group_by':'last_stage_id'}"/>
<filter string="Stage" context="{'group_by':'stage_id'}" />
<filter string="Last Stage Update" context="{'group_by':'date_last_stage_update'}" />
<filter string="Creation Date (day)" context="{'group_by':'date_create:day'}" help="Creation Date"/>
<filter string="Creation Date (week)" context="{'group_by':'date_create:week'}" help="Creation Date"/>
<filter string="Creation Date (month)" context="{'group_by':'date_create:month'}" help="Creation Date"/>
<filter string="Creation Date (year)" context="{'group_by':'date_create:year'}" help="Creation Date"/>
<filter string="Creation Date" context="{'group_by':'date_create'}" help="Creation Date"/>
</group>
</search>
</field>

View File

@ -8,11 +8,6 @@ class hr_timesheet_report(osv.osv):
_description = "Timesheet"
_auto = False
_columns = {
'year': fields.char('Year',size=64,required=False, readonly=True),
'day': fields.char('Day', size=128, 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),
'date': fields.date('Date', readonly=True),
'name': fields.char('Description', size=64,readonly=True),
'product_id' : fields.many2one('product.product', 'Product',readonly=True),
@ -29,9 +24,6 @@ class hr_timesheet_report(osv.osv):
select_str = """
SELECT min(hat.id) as id,
aal.date as date,
to_char(aal.date, 'YYYY-MM-DD') as day,
to_char(aal.date,'YYYY') as year,
to_char(aal.date,'MM') as month,
sum(aal.amount) as cost,
sum(aal.unit_amount) as quantity,
aal.account_id as account_id,

View File

@ -35,9 +35,7 @@
<filter string="Analytic Account" name="analytic_account" icon="terp-folder-green" context="{'group_by':'account_id'}"/>
<filter string="General Account" name="general_account" icon="terp-folder-orange" context="{'group_by':'general_account_id'}"/>
<filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Day" icon="terp-go-today" context="{'group_by':'day'}" help="Group by day of date"/>
<filter string="Month" icon="terp-go-month" context="{'group_by':'month'}" help="Group by month of date"/>
<filter string="Year" icon="terp-go-year" context="{'group_by':'year'}" help="Group by year of date"/>
<filter string="Date" icon="terp-go-month" context="{'group_by':'date'}" help="Group by month of date"/>
</group>
</search>
</field>
@ -48,7 +46,7 @@
<field name="res_model">hr.timesheet.report</field>
<field name="view_type">form</field>
<field name="view_mode">graph</field>
<field name="context">{'search_default_year':1,'search_default_month':1,'search_default_group_user_id':1,'group_by_no_leaf':1,'group_by':[]}</field>
<field name="context">{'search_default_group_user_id':1,'group_by_no_leaf':1,'group_by':[]}</field>
</record>
<menuitem action="action_hr_timesheet_report_stat_all" id="menu_hr_timesheet_report_all"

View File

@ -33,7 +33,6 @@ class hr_timesheet_report(osv.osv):
'department_id':fields.many2one('hr.department','Department',readonly=True),
'date_from': fields.date('Date from',readonly=True,),
'date_to': fields.date('Date to',readonly=True),
'date_current': fields.date('Current date', required=True),
'state' : fields.selection([
('new', 'New'),
('draft','Draft'),

View File

@ -39,17 +39,10 @@ class report_membership(osv.osv):
_name = 'report.membership'
_description = __doc__
_auto = False
_rec_name = 'year'
_rec_name = 'start_date'
_columns = {
'year': fields.char('Year', size=4, readonly=True, select=1),
'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),
'date_from': fields.datetime('Start Date', readonly=True, help="Start membership date"),
'date_to': fields.datetime('End Date', readonly=True, help="End membership date"),
'start_date': fields.date('Start Date', readonly=True),
'date_to': fields.date('End Date', readonly=True, help="End membership date"),
'num_waiting': fields.integer('# Waiting', readonly=True),
'num_invoiced': fields.integer('# Invoiced', readonly=True),
'num_paid': fields.integer('# Paid', readonly=True),
@ -75,10 +68,8 @@ class report_membership(osv.osv):
membership_state,
associate_member_id,
membership_amount,
date_from,
date_to,
year,
month,
start_date,
COUNT(num_waiting) AS num_waiting,
COUNT(num_invoiced) AS num_invoiced,
COUNT(num_paid) AS num_paid,
@ -94,10 +85,8 @@ class report_membership(osv.osv):
p.membership_state AS membership_state,
p.associate_member AS associate_member_id,
p.membership_amount AS membership_amount,
TO_CHAR(p.membership_start, 'YYYY-MM-DD') AS date_from,
TO_CHAR(p.membership_stop, 'YYYY-MM-DD') AS date_to,
TO_CHAR(p.membership_start, 'YYYY') AS year,
TO_CHAR(p.membership_start,'MM') AS month,
p.membership_stop AS date_to,
p.membership_start AS start_date,
CASE WHEN ml.state = 'waiting' THEN ml.id END AS num_waiting,
CASE WHEN ml.state = 'invoiced' THEN ml.id END AS num_invoiced,
CASE WHEN ml.state = 'paid' THEN ml.id END AS num_paid,
@ -116,19 +105,14 @@ class report_membership(osv.osv):
p.membership_state,
p.associate_member,
p.membership_amount,
TO_CHAR(p.membership_start, 'YYYY-MM-DD'),
TO_CHAR(p.membership_stop, 'YYYY-MM-DD'),
TO_CHAR(p.membership_start, 'YYYY'),
TO_CHAR(p.membership_start,'MM'),
p.membership_start,
ml.membership_id,
p.company_id,
ml.state,
ml.id
) AS foo
GROUP BY
year,
month,
date_from,
start_date,
date_to,
partner_id,
user_id,

View File

@ -7,7 +7,6 @@
<field name="model">report.membership</field>
<field name="arch" type="xml">
<search string="Membership">
<field name="date_from"/>
<filter string="Forecast" icon="terp-gtk-jump-to-ltr" context="{'waiting_invoiced_totpending_visible':0}" help="This will display waiting, invoiced and total pending columns"/>
<filter string="Revenue Done" name="Revenue" icon="terp-dolar" context="{'paid_old_totearned_visible':0}" help="This will display paid, old and total earned columns"/>
<field name="partner_id"/>
@ -24,10 +23,8 @@
domain="[]" context="{'group_by':'membership_state'}"/>
<filter string="Company" icon="terp-go-home"
domain="[]" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Year" name="year" icon="terp-go-year"
domain="[]" context="{'group_by':'year'}"/>
<filter string="Month" name="month" icon="terp-go-month"
domain="[]" context="{'group_by':'month'}"/>
<filter string="Date" name="start_date" icon="terp-go-year"
domain="[]" context="{'group_by':'start_date:year'}"/>
</group>
</search>
</field>
@ -38,7 +35,6 @@
<field name="model">report.membership</field>
<field name="arch" type="xml">
<graph string="Membership" type="pivot">
<field name="year" type="row" />
<field name="num_paid" type="measure"/>
<field name="tot_earned" type="measure"/>
</graph>
@ -51,7 +47,7 @@
<field name="view_type">form</field>
<field name="view_mode">graph</field>
<field name="search_view_id" ref="view_report_membership_search"/>
<field name="context">{"search_default_year":1,"search_default_member":1, 'search_default_Revenue':1, 'search_default_this_month':1, 'search_default_salesman':1,'group_by_no_leaf':1}</field>
<field name="context">{"search_default_start_date":1,"search_default_member":1, 'search_default_Revenue':1, 'search_default_this_month':1, 'search_default_salesman':1,'group_by_no_leaf':1}</field>
</record>
<menuitem name="Members Analysis" parent="base.menu_report_association"

View File

@ -45,7 +45,7 @@ class mrp_workorder(osv.osv):
cr.execute("""
create or replace view mrp_workorder as (
select
to_date(to_char(wl.date_planned, 'MM-dd-YYYY'),'MM-dd-YYYY') as date,
date(wl.date_planned) as date,
min(wl.id) as id,
mp.product_id as product_id,
sum(wl.hour) as total_hours,

View File

@ -34,9 +34,7 @@
<filter string="Work Center" name="Workcenter" icon="terp-go-home" context="{'group_by':'workcenter_id'}" />
<filter string="Production" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'production_id'}"/>
<filter string="Status" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
<filter string="Date Planned (day)" icon="terp-go-today" context="{'group_by':'date:day'}" help="Planned Day"/>
<filter string="Date Planned (month)" name="terp-go-month" icon="terp-go-month" context="{'group_by':'date:month'}" help="Planned Month"/>
<filter string="Date Planned (year)" icon="terp-go-year" context="{'group_by':'date:year'}" help="Planned Year"/>
<filter string="Date Planned" name="terp-go-month" icon="terp-go-month" context="{'group_by':'date:month'}" help="Planned Month"/>
</group>
</search>
</field>

View File

@ -37,9 +37,7 @@
<filter string="Customer" icon="terp-personal" context="{'group_by':'partner_id'}"/>
<filter string="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id'}"/>
<filter string="Stock Location" context="{'group_by': 'location_id'}"/>
<filter string="Order Date (day)" icon="terp-go-today" context="{'group_by':'date:day'}" help="Day of order date"/>
<filter string="Order Date (month)" icon="terp-go-month" context="{'group_by':'date:month'}" help="Month of order date"/>
<filter string="Order Date (year)" icon="terp-go-year" context="{'group_by':'date:year'}" help="Year of order date"/>
<filter string="Order Date" icon="terp-go-month" context="{'group_by':'date:month'}" help="Month of order date"/>
</group>
</search>
</field>

View File

@ -65,11 +65,10 @@ class report_project_task_user(osv.osv):
SELECT
(select 1 ) AS nbr,
t.id as id,
date_trunc('day',t.date_start) as date_start,
date_trunc('day',t.date_end) as date_end,
date_trunc('day',t.date_last_stage_update) as date_last_stage_update,
to_date(to_char(t.date_deadline, 'dd-MM-YYYY'),'dd-MM-YYYY') as date_deadline,
-- sum(cast(to_char(date_trunc('day',t.date_end) - date_trunc('day',t.date_start),'DD') as int)) as no_of_days,
date(t.date_start) as date_start,
date(t.date_end) as date_end,
date(t.date_last_stage_update) as date_last_stage_update,
t.date_deadline as date_deadline,
abs((extract('epoch' from (t.write_date-t.date_start)))/(3600*24)) as no_of_days,
t.user_id,
t.reviewer_id,

View File

@ -64,9 +64,7 @@
<filter string="Contact" context="{'group_by':'partner_id'}" />
<filter string="Assigned to" name="User" context="{'group_by':'user_id'}" />
<filter string="Company" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Assignation date (day)" context="{'group_by':'date_start:day'}" help="Creation Date"/>
<filter string="Assignation date (month)" context="{'group_by':'date_start:month'}" help="Creation Date"/>
<filter string="Assignation date (year)" context="{'group_by':'date_start:year'}" help="Creation Date"/>
<filter string="Assignation date" context="{'group_by':'date_start:month'}" help="Creation Date"/>
<filter string="Last Stage Update" context="{'group_by':'date_last_stage_update'}" help="Last Stage Update"/>
</group>
</search>

View File

@ -29,13 +29,10 @@ class project_issue_report(osv.osv):
_auto = False
_columns = {
'name': fields.char('Year', size=64, required=False, readonly=True),
'section_id':fields.many2one('crm.case.section', 'Sale Team', readonly=True),
'month':fields.selection(fields.date.MONTHS, 'Month', readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'day': fields.char('Day', size=128, readonly=True),
'opening_date': fields.date('Date of Opening', readonly=True),
'creation_date': fields.date('Creation Date', readonly=True),
'create_date': fields.date('Create Date', readonly=True),
'date_closed': fields.date('Date of Closing', readonly=True),
'date_last_stage_update': fields.date('Last Stage Update', readonly=True),
'stage_id': fields.many2one('project.task.type', 'Stage'),
@ -63,18 +60,15 @@ class project_issue_report(osv.osv):
CREATE OR REPLACE VIEW project_issue_report AS (
SELECT
c.id as id,
to_char(c.create_date, 'YYYY') as name,
to_char(c.create_date, 'MM') as month,
to_char(c.create_date, 'YYYY-MM-DD') as day,
to_char(c.date_open, 'YYYY-MM-DD') as opening_date,
to_char(c.create_date, 'YYYY-MM-DD') as creation_date,
date_trunc('day',c.date_last_stage_update) as date_last_stage_update,
date(c.date_open) as opening_date,
date(c.create_date) as create_date,
date(c.date_last_stage_update) as date_last_stage_update,
c.user_id,
c.working_hours_open,
c.working_hours_close,
c.section_id,
c.stage_id,
to_char(c.date_closed, 'YYYY-mm-dd') as date_closed,
date(c.date_closed) as date_closed,
c.company_id as company_id,
c.priority as priority,
c.project_id as project_id,
@ -83,7 +77,6 @@ class project_issue_report(osv.osv):
c.partner_id,
c.channel,
c.task_id,
date_trunc('day',c.create_date) as create_date,
c.day_open as delay_open,
c.day_close as delay_close,
(SELECT count(id) FROM mail_message WHERE model='project.issue' AND res_id=c.id) AS email

View File

@ -34,7 +34,6 @@
<field name="model">project.issue.report</field>
<field name="arch" type="xml">
<search string="Search">
<field name="creation_date"/>
<field name="project_id"/>
<field name="user_id"/>
<field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
@ -54,9 +53,7 @@
<filter string="Priority" icon="terp-rating-rated" domain="[]" context="{'group_by':'priority'}" />
<filter string="Stage" icon="terp-stage" domain="[]" context="{'group_by':'stage_id'}"/>
<filter string="Company" icon="terp-go-home" domain="[]" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Day" icon="terp-go-today" domain="[]" context="{'group_by':'day'}" help="Creation Date"/>
<filter string="Month" icon="terp-go-month" domain="[]" context="{'group_by':'month'}" help="Creation Date"/>
<filter string="Year" icon="terp-go-year" domain="[]" context="{'group_by':'name'}" help="Creation Date"/>
<filter string="Create Date" icon="terp-go-month" domain="[]" context="{'group_by':'create_date'}" help="Create Date"/>
<filter string="Last Stage Update" context="{'group_by':'date_last_stage_update'}"/>
</group>
</search>

View File

@ -68,7 +68,7 @@ class purchase_report(osv.osv):
create or replace view purchase_report as (
select
min(l.id) as id,
s.date_order as date,
date(s.date_order) as date,
s.state,
s.date_approve,
s.minimum_planned_date as expected_date,

View File

@ -47,9 +47,7 @@
<filter string="Destination" icon="terp-gtk-jump-to-ltr" context="{'group_by':'location_id'}"/>
<filter string="Status" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
<filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Order Date (day)" icon="terp-go-today" context="{'group_by':'date:day'}" help="Order of Day"/>
<filter string="Order Date (month)" icon="terp-go-month" context="{'group_by':'date:month'}" help="Order of Day"/>
<filter string="Order Date (year)" icon="terp-go-year" context="{'group_by':'date:year'}" help="Order of Day"/>
<filter string="Order Date" icon="terp-go-month" context="{'group_by':'date:month'}" help="Order of Day"/>
</group>
</search>
</field>