[6.0] constraints on one2many validated too early
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) |
Expired
|
Undecided
|
Unassigned |
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_
for i in self.browse(cr, uid, ids):
if (len(i.
return True
_constraints = [
]
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.
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!