openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #14164
[Bug 1030864] Re: [6.0] constraints on one2many validated too early
Hello Marco Dieckhoff ,
I have checked this issue with trunk ,6.1 as well as 6.0.But I did not face any problem
like yours.I have applyed test case with res.partner for address
field and hr_department for member_ids field as yous.for 6.1 it not
working with partner because of lp:980529 and for hr constriant working fine and constrint is execute after saving a record.As per your bug discription constraint is execute before a saving record.
So would you please provide detail information regarding this issue.
Thanks and waiting for reply!
** Changed in: openobject-server
Status: New => Incomplete
--
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/1030864
Title:
[6.0] constraints on one2many validated too early
Status in OpenERP Server:
Incomplete
Bug description:
I have a one2many "sub objects" embedded in the related "parent
object" form view.
As "required" does not work on one2many (compare bug 1013636), I have
a constraint checking that at least one item exists in this relation:
def _check_related(self, cr, uid, ids):
for i in self.browse(cr, uid, ids):
if (len(i.related_ids)<1):
return False
return True
_constraints = [
(_check_related, 'You need to set at least one related object.', ['related_ids']),
]
But when creating a new parent object, and inline creating new related sub objects, the constraint is checked before the sub objects are stored and therefore returns an error, as i.related_ids is still empty.
Constraint checking should be applied to the content that would be
stored to the database if all is ok, not to an intermediate state
somewhere in between.
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/1030864/+subscriptions
References