~openerp-dev/openobject-client/6.0-validation_O2M-rha

« back to all changes in this revision

Viewing changes to bin/widget/model/field.py

  • Committer: Rifakat(OpenERP)
  • Date: 2011-07-21 09:52:05 UTC
  • Revision ID: rifakatopenerp-20110721095205-3drkot7wsasqma61
[FIX]: validation on O2M field should not remove the child models

Show diffs side-by-side

added added

removed removed

Lines of Context:
454
454
        ok = True
455
455
        for model2 in model.value[self.name].models:
456
456
            if not model2.validate():
457
 
                if not model2.is_modified():
458
 
                    model.value[self.name].models.remove(model2)
459
 
                else:
460
 
                    ok = False
 
457
                ok = False
461
458
        if not super(O2MField, self).validate(model):
462
459
            ok = False
463
460
        self.get_state_attrs(model)['valid'] = ok