[REF] Cleanup of delete tag.

bzr revid: jth@openerp.com-20100402080855-8pvhqcspi9mhojpa
This commit is contained in:
Julien Thewys 2010-04-02 10:08:55 +02:00
parent 2f70003d7e
commit 336f0e40a4
2 changed files with 6 additions and 8 deletions

View File

@ -148,8 +148,10 @@
<rng:define name="delete">
<rng:element name="delete">
<rng:attribute name="model" />
<rng:optional><rng:attribute name="id" /> </rng:optional>
<rng:optional><rng:attribute name="search" /></rng:optional>
<rng:choice>
<rng:attribute name="id" />
<rng:attribute name="search" />
</rng:choice>
</rng:element>
</rng:define>

View File

@ -535,14 +535,10 @@ class YamlInterpreter(object):
# TODO add remove ir.model.data
def process_delete(self, node):
ids = []
if len(node.search):
ids = self.pool.get(node.model).search(self.cr, self.uid, eval(node.search, self.eval_context))
if len(node.id):
try:
ids.append(self.get_id(node.id))
except:
pass
else:
ids = [self.get_id(node.id)]
if len(ids):
self.pool.get(node.model).unlink(self.cr, self.uid, ids)
self.pool.get('ir.model.data')._unlink(self.cr, self.uid, node.model, ids, direct=True)