Odoo Help


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.


function get latest date

on 1/25/16, 12:42 PM 362 views

I want to get the latest date of intervention of a centre in a new field named "intervention_id" in a "centre" form view which is related to another menuitem named intervention that shows every centre's dates of interventions(maintenance of equipements in each center),these 2 classes are of course related with relational fields so I tried this function :

def _get_latest_intervention(self, cr, uid, ids, field_name, args, context=None):

res = {}

obj_intervention = self.pool.get('c.intervention')

for interv in self.browse(cr, uid, ids, context=context):

intervention_ids = obj_intervention.search(cr, uid, [('centre_id', '=', intervention_id)], order='date_intv', context=context)

if intervention_ids:

res[intervention_id] = intervention_ids[-1:][0]


res[intervention_id] = False

return res

and it gaves me this error: would any one please tells me what could be wrong with it :

TypeError: _get_latest_intervention() takes at least 6 arguments (5 given)

Axel Mendoza

--Axel Mendoza--
| 6 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

Axel Mendoza
On 1/25/16, 1:51 PM

You could fix it like:

def _get_latest_intervention(self, cr, uid, ids, field_name, args=None, context=None):

well it didn't work it gives same error !!

on 2/4/16, 6:17 AM

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

1 follower(s)


Asked: 1/25/16, 12:42 PM
Seen: 362 times
Last updated: 1/25/16, 1:51 PM