Odoo Help

Welcome!

This community 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.

0

hr_expense_report group by date

By
Jorge Medina
on 9/18/13, 2:55 PM 1,321 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?

thanks

regards

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

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

Question tools

0 follower(s)

Stats

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