Contributors mailing list archives
contributors@odoo-community.org
Browse archives
Re: Prevent to delete product imported by a module
Re: Prevent to delete product imported by a module
Re: Prevent to delete product imported by a module
by
ClosingAp Open Source Integrators Europe, LDA, Daniel Reis
Quentin's idea is good, but needs an adjustment, since you can have xml ids generated by export or added manually.
So the protection rule would be to have an xml id belonging to an installed module name.
Or maybe better, protect for xml ids from modules in a protected list, defined in a configuration entry.
--
--
Daniel
Le 19/05/2016 11:23, David Beal a écrit : > Hi all, Hi David, > > 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 ? > In the unlink() method, you can check if the ID of the unlink product is in the ir_model_data table with model = 'product.product' and res_id = ID. With this, you cannot have to add a 'protected' field on the product.product model. Regards, -- Quentin THEURET https://twitter.com/qtheuret_______________________________________________
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
-