3296
|
|
|
Fabien Pinckaers |
13 years ago
|
|
|
3295
|
|
|
qdp-launchpad at tin... |
13 years ago
|
|
|
3294
|
|
|
Launchpad Translatio... |
13 years ago
|
|
|
3293
|
|
|
P. Christeas |
13 years ago
|
|
|
3292
|
|
|
Anup(OpenERP) |
13 years ago
|
|
|
3291
|
|
|
Olivier Dony |
13 years ago
|
|
|
3290
|
|
|
Olivier Dony |
13 years ago
|
|
|
3289
|
|
|
Vo Minh Thu |
13 years ago
|
|
|
3288
|
|
|
Olivier Dony |
13 years ago
|
|
|
3287
|
|
|
Olivier Dony |
13 years ago
|
|
|
3286
|
|
|
Vo Minh Thu |
13 years ago
|
|
|
3285
|
|
|
Yogesh (OpenERP) |
13 years ago
|
|
|
3284
|
|
|
Yogesh (OpenERP) |
13 years ago
|
|
|
3283
|
|
|
Olivier Dony |
13 years ago
|
|
|
3282
|
|
|
qdp-launchpad at tin... |
13 years ago
|
|
|
3281
|
|
|
Vo Minh Thu (OpenERP... |
13 years ago
|
|
|
3280
|
|
|
Olivier Dony |
13 years ago
|
|
|
3279
|
|
|
Yogesh (OpenERP) |
13 years ago
|
|
|
3278
|
|
|
Olivier Dony |
13 years ago
|
|
|
3277
|
|
[FIX] osv: _constraints can be inherited by redefining a constraint with the same name
Indeed, when we define an expression like
class bar(osv.osv): _inherit = 'bar.bar'
def _check_foo(self, cr, uid, ids, context): return True
_constraints = [ (_check_foo, "Foo failed!", ['foo']) ]
... it means that _check_foo will be passed as an *object* to the model's structure of _constraints. Therefore, it would be unequal and just append the list of any existing constraints. So, an older (_check_foo, , ['foo']) would always remain active using the previous code. This has to do with the _check_foo being an unbound (ie. not inheritable) function.
Now, we check the /string name/ of the function, too. We say that if the inherited class's constraint function has the same name "_check_foo", the old ones shall be replaced.
Note: this MAY introduce unpredictable results, if several modules try to override the same inherited constraint. There is no guaranteed order of inheritance. Please avoid using this feature unless necessary.
|
P. Christeas |
13 years ago
|
|
|