0
votes

Do many2one fields have to be named like 'othermodel_id'?

I had a many2one field on my Course model to a Major model that I had named 'major,' and when I tried to select a major for my course (say Calculus for Mechanical Engineering) I got a generic validation error. And in my console I had the bad SQL update query where it failed:

2016-07-12 18:55:34,530 5484 INFO test openerp.sql_db: bad query: UPDATE 

"aidentest_course" SET "major"=14,"write_uid"=1,"write_date"=(now() at time 

zone 'UTC') WHERE id IN (6)

I renamed 'major' to 'major_id', upgraded my module and now I can add majors. Does the many2one have to be 'tomodel_id' and if so, why?

1

1 Answers

0
votes

NO i don't think so may you forget to do upgrade before but is a good practice to name the field model_name_id and for m2m model_name_ids