[IMP] orm: cosmetics (and the runbot will build this branch again).
bzr revid: vmt@openerp.com-20120110153448-ot1vpcmwjbeykx9t
This commit is contained in:
parent
74fbbc36e1
commit
013794b978
|
@ -3658,20 +3658,19 @@ class BaseModel(object):
|
||||||
|
|
||||||
self.check_unlink(cr, uid)
|
self.check_unlink(cr, uid)
|
||||||
|
|
||||||
properties = self.pool.get('ir.property')
|
ir_property = self.pool.get('ir.property')
|
||||||
##search if there are properties created with resource that is about to be deleted
|
|
||||||
## if found delete the properties too.
|
|
||||||
unlink_properties = properties.search(cr, uid, [('res_id', 'in', ['%s,%s' % (self._name, i) for i in ids])], context=context)
|
|
||||||
if unlink_properties:
|
|
||||||
properties.unlink(cr, uid, unlink_properties, context=context)
|
|
||||||
|
|
||||||
## check if the model is used as a default property
|
# Check if the records are used as default properties.
|
||||||
domain = [('res_id', '=', False),
|
domain = [('res_id', '=', False),
|
||||||
('value_reference', 'in', ['%s,%s' % (self._name, i) for i in ids]),
|
('value_reference', 'in', ['%s,%s' % (self._name, i) for i in ids]),
|
||||||
]
|
]
|
||||||
if properties.search(cr, uid, domain, context=context):
|
if ir_property.search(cr, uid, domain, context=context):
|
||||||
raise except_orm(_('Error'), _('Unable to delete this document because it is used as a default property'))
|
raise except_orm(_('Error'), _('Unable to delete this document because it is used as a default property'))
|
||||||
|
|
||||||
|
# Delete the records' properties.
|
||||||
|
property_ids = ir_property.search(cr, uid, [('res_id', 'in', ['%s,%s' % (self._name, i) for i in ids])], context=context)
|
||||||
|
ir_property.unlink(cr, uid, property_ids, context=context)
|
||||||
|
|
||||||
wf_service = netsvc.LocalService("workflow")
|
wf_service = netsvc.LocalService("workflow")
|
||||||
for oid in ids:
|
for oid in ids:
|
||||||
wf_service.trg_delete(uid, self._name, oid, cr)
|
wf_service.trg_delete(uid, self._name, oid, cr)
|
||||||
|
|
Loading…
Reference in New Issue