Contributors mailing list archives


Re: Prevent to delete product imported by a module

Vauxoo, Moisés López Calderón
- 19/05/2016 15:31:10

What is your use case?

Odoo in old version had 100 issues by this situation and It many xml_ids used in methods was removed.

I dont have the real cases now.
But I remember restriction rules problems (e.g. multi-companies)

What about use a param field?

if you can't avoid it be careful with the exceptions when this record is not achievable or when the configuration should be different by context (e.g. multi-company).

El 19/05/2016 04:23 a.m., "David Beal" <> escribió:
Hi all,

I need a generic way to prevent the user to delete product or any other record created by a module.

What are the best options ?

I suggest:
- a base module
- which override unlink() by monkey patching
- check if in this record a boolean field named 'protected' or other convention exist and is True
- then prevent unlink

What do you think ?

Thanks for your suggestions

David BEAL - Akretion
Odoo Development / Integration

Post to: