Contributors mailing list archives
contributors@odoo-community.org
Browse archives
Re: Prevent to delete product imported by a module
byBonne journée
David BEAL - Akretion
Odoo Development / Integration
Hello,
I think checking in ir.model.data is the best way.Some ideas to check :- XML ids can be created through data import : Allow to delete those data ?- Maybe prevent deletion only if noupdate=true ?- A module can create XML IDs for "another module" (ie. use "random_name.xml_id" in a module named "some_module" is valid), so checking only installed module names is not good.- Maybe create a mixin (with the unlink method overriden), and make the models you want to protect inherit this mixin ? This is better than monkey patching,but less generic/global, it depends on what you need.Regards,
--2016-05-19 15:38 GMT+02:00 Moises Lopez <moylop260@vauxoo.com>: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" <david.beal@akretion.com> 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 unlinkWhat do you think ?
Thanks for your suggestions
David BEAL - Akretion
Odoo Development / Integration_______________________________________________
Mailing-List: http://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: http://odoo-community.org/groups?unsubscribe_______________________________________________
Mailing-List: http://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: http://odoo-community.org/groups?unsubscribe******************************************************************************** Ce message et toutes les pièces jointes (ci-après le "message") sont établis à l'intention exclusive de ses destinataires et sont confidentiels. Si vous recevez ce message par erreur, merci de le détruire et d'en avertir immédiatement l'expéditeur. Toute utilisation de ce message non conforme à sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. L'internet ne permettant pas d'assurer l'intégrité de ce message, SYLEAM décline toute responsabilité au titre de ce message, dans l'hypothèse où il aurait été modifié. This message and any attachments (the "message") is intended solely for the addressees and is confidential. If you receive this message in error, please delete it and immediately notify the sender. Any use not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except after formal approval. The internet can not guarantee the integrity of this message. SYLEAM cannot therefore be liable for the message if modified. ********************************************************************************_______________________________________________
Mailing-List: http://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: http://odoo-community.org/groups?unsubscribe
Reference
-
Prevent to delete product imported by a module
byAkretion France., David BEAL-
Re: Prevent to delete product imported by a module
byAkretion France., David BEAL -
Re: Prevent to delete product imported by a module
bySYLEAM SARL, Sylvain Garancher -
Re: Prevent to delete product imported by a module
byVauxoo, Moisés López Calderón -
Re: Prevent to delete product imported by a module
byElico Corp, Eric Caudal -
Re: Prevent to delete product imported by a module
byClosingAp Open Source Integrators Europe, LDA, Daniel Reis
-