[7.0 ] context is not passed to constraints function
Bug #1152204 reported by
Nicolas Bessi - Camptocamp
This bug report is a duplicate of:
Bug #891592: Context not passed to _constraints functions.
Edit
Remove
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) |
New
|
Undecided
|
Unassigned |
Bug Description
when you redefine a constraint function used in _constraints property of Model Class. The context passed to the CRUD function is not transmitted to constraint functions. It is probabely the same if the function in redefined.
Regards
Nicolas
To post a comment you must log in.
Hello Nicolas,
I think this one is a duplicate of some invalid bug. Indeed, model constraints apply to the persistent data in OpenERP philosophy. That is you could just pull the data from the database and apply constraint validation upon these data with no context.
Whereas context is something related to the transient context of the user interaction (menu, time etc...).
So I think it's a bit normal I think.
Now, yes, OpenObject (remember it's supposed to be a framework) totally lacks handy object life cycle hooks like a validate method that would validate data before saving both for write and create and considering the context. Well, you can always roll your own one, it's just ugly but ultimately it get the job done.
Hope this helps. Then eventually one could invalidate that bug.