Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
14790 Представления

Sometimes I find myself looping through a browse() call and needing to delete a related object. Is it better to append the id to delete to a list and, after the loop, call unlink using the list? Or is just calling unlink each time, deleting a single record at a time, good enough?

Аватар
Отменить

The unlink function used in openerp can be apply in the case of a list of records, Only thing is you have to pass the record ids you wish to delete as arguements in unlink method.

Лучший ответ

The unlink function used in openerp can be apply in the case of a list of records, Only thing is you have to pass the record ids you wish to delete as arguements in unlink method. But Be careful, once a record deleted cannot be retrieved.

self.pool.get('your.model.name').unlink(cr, uid, list_ids, context=context)

The above piece of code will help you to unlink your records. Thanks

Аватар
Отменить
Автор

Yes I know. I was asking if unlinking them all at once is better than one at a time.

Related Posts Ответы Просмотры Активность
1
июл. 18
4460
0
сент. 15
4339
6
апр. 15
7722
1
мар. 15
6311
1
мар. 15
364