Odoo Help

On 11/10/15, 11:31 PM

It's better do it this way:

<filter string="Day" domain="[ ]" context="{'group_by': 'create_date:day'}" />
On 7/29/13, 3:44 PM

I made a workaround, the idea is that you create a function field(store=True) of type char that copy the date string detail to the function field, the level of detail is determined by that you want to group, if you want to group by day copy the datetime till the day.

Then you add that new field in your groupby filters in the searchview you want

Hey Felipe, Your idea will work for him. This is the way used in most official addons of OpenERP out of the box. This idea works. Just check code of Sales Analysis or Invoice analysis, you will find more useful techniques

on 10/8/13, 9:11 AM

What are the name of directories and files that you pointed out? Thanks

on 2/17/14, 8:07 AM
Alex Gallien
On 9/1/15, 8:14 PM

This is an old question, but I thought I would add some code in case anyone is trying to do this. Mine was adding a sort by day field to account_voucher, so you may need to adjust yours to whatever you are trying to inherit. I am not putting the whole code, just the relevant snippets.


class ec_account_voucher(osv.osv):
_inherit = 'account.voucher'
_name = 'account.voucher'
def _get_string_date(self, cr, uid, ids, name, args, context=None):
res = {}
for voucher in self.browse(cr, uid, ids, context=context):
res[voucher.id] = str(voucher.date)
return res
_columns = {
'x_string_date': fields.function(_get_string_date, type='char', string='Date (String)', store=True)


       <record model="ir.ui.view" id="voucher_form_ec">
<field name="name">account.voucher.tree.inherit</field>
<field name="model">account.voucher</field>
<field name="inherit_id" ref="account_voucher.view_voucher_tree"/>
<field name="arch" type="xml">
<field name="date" position="after">
<field name="x_string_date" invisible="1"/>
<record id="ec_view_voucher_filter" model="ir.ui.view">
<field name="name">account.voucher.select.inherit</field>
<field name="model">account.voucher</field>
<field name="inherit_id" ref="account_voucher.view_voucher_filter_vendor_pay"/>
<field name="arch" type="xml">
<xpath expr="//filter[@string='Status']" position="before">
<filter string="Day" icon="terp-go-month" domain="[]" context="{'group_by':'x_string_date'}"/>

Hope that helps someone!

Thank you so much :D

on 10/1/15, 11:17 AM

No problem - glad it helped!

Alex Gallien
on 10/1/15, 2:33 PM

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)


Asked: 7/18/13, 7:16 PM
Seen: 12515 times
Last updated: 12/14/16, 5:05 AM