Odoo Help


hr_expense_report group by date

Jorge Medina
on 9/18/13, 2:55 PM 1,642 views

good morning

I'm trying to add a group in the report Analysis of Expenses, the "date".

Changes made ​​are: In the tree view add:

< field name="date" / >

In the search view add:

context="{'group_by':'date'}" icon="terp-go-year" string="Date" <filter help="Date"/>

To group them by the "date" does not work by checking an error:

Server Traceback (most recent call last): File "/home/jorge-medina/openerp/instancias/7.0/modules/web/session.py", line 89, in send return openerp.netsvc.dispatch_rpc(service_name, method, args) File "/home/jorge-medina/openerp/instancias/7.0/server/openerp/netsvc.py", line 292, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params) File "/home/jorge-medina/openerp/instancias/7.0/server/openerp/service/web_services.py", line 626, in dispatch res = fn(db, uid, params) File "/home/jorge-medina/openerp/instancias/7.0/server/openerp/osv/osv.py", line 188, in execute_kw return self.execute(db, uid, obj, method, *args, *kw or {}) File "/home/jorge-medina/openerp/instancias/7.0/server/openerp/osv/osv.py", line 131, in wrapper return f(self, dbname, args, *kwargs) File "/home/jorge-medina/openerp/instancias/7.0/server/openerp/osv/osv.py", line 197, in execute res = self.execute_cr(cr, uid, obj, method, args, *kw) File "/home/jorge-medina/openerp/instancias/7.0/server/openerp/osv/osv.py", line 185, in execute_cr return getattr(object, method)(cr, uid, args, *kw) File "/home/jorge-medina/openerp/instancias/7.0/server/openerp/osv/orm.py", line 2708, in read_group date_value = datetime.datetime.strptime(d[groupby][:10], '%Y-%m-%d')

TypeError: 'datetime.datetime' object has no attribute '__getitem__'

Any idea?



In "google traslate"

Buen día, después de varias pruebas y error lo que hice fue lo siguiente, crear un módulo que altera la vista de postgresql agregando el campo date as date_capture, después heredando la vista del tree de hr_expense_report agregue el campo date_capture invisible y por último agregué un elemento en el group by date_capture (Fecha Captura) ya con esto conseguí que se pueda agrupar por la fecha de captura y no por la fecha de creación (day). Saludos, si ocupan algo similar les puedo pasar el branch.

Jorge Medina
on 9/20/13, 1:48 PM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 9/18/13, 2:55 PM
Seen: 1642 times
Last updated: 3/16/15, 8:10 AM