[5.0] cannot inherit a _constraint
Bug #568431 reported by
Christophe CHAUVET
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) |
Invalid
|
High
|
Stephane Wirtel (OpenERP) |
Bug Description
OpenObject: 5.0
Server revno: 2038
Addons revno: 2711
Client revno: 1069
I just wants to inherit a constraint (_constraint) but the code below doesn't execute.
I think the bug 330427 is to be the same as mine.
-------
from osv import osv
from osv import fields
class product_
_inherit = 'product.
def _check_date(self, cursor, user, ids):
print 'Inherit OK'
return True
product_
-------
Distribution: Ubuntu
Version: 9.10 (karmic)
Python 2.6.4
Locale:
LANG=fr_FR.UTF-8
Related branches
Changed in openobject-server: | |
status: | New → Invalid |
Changed in openobject-server: | |
status: | Won't Fix → Confirmed |
assignee: | nobody → Stephane (Open ERP) (stephane-openerp) |
Changed in openobject-server: | |
milestone: | 5.0.10 → 5.0.12 |
status: | Confirmed → Invalid |
Changed in openobject-server: | |
status: | Invalid → Confirmed |
Changed in openobject-server: | |
milestone: | 5.0.12 → 6.1 |
Changed in openobject-server: | |
status: | Confirmed → Invalid |
To post a comment you must log in.
I'm sorry, but it's not a bug. In the definition of a constraint in OpenERP, you give the reference to the method and not a name.
def _check_date(self, cr, uid, ids, context=None):
pass
_constraints = [
(_check_date, "message", []),
]
In this case, _check_date is a reference to the _check_date method.
You can use an other way to solve this problem
1. define your method;
In the parent object, you can define a method
def _nested_ check_date( self, cr, uid, ids, context=None):
return True
def _check_date(self, cr, uid, ids, context=None): check_date( cr, uid, ids, context=context)
return self._nested_
2. in the other object:
you can redefined the _nested_check_date method.