diff --git a/product_deletion/README.rst b/product_deletion/README.rst new file mode 100644 index 000000000..c70042ae4 --- /dev/null +++ b/product_deletion/README.rst @@ -0,0 +1,12 @@ +Product Removal Authorisation v11 +================================= +User in the group "Product Deletion" can only delete the products. Those who are not in the +group cant delete the product. Odoo will raise a warning if the user in not in the group + +Credits +======= +Cybrosys Techno Solutions + +Contributors +------------ +* Niyas Raphy, Cybrosys \ No newline at end of file diff --git a/product_deletion/__init__.py b/product_deletion/__init__.py new file mode 100644 index 000000000..735946add --- /dev/null +++ b/product_deletion/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Niyas Raphy() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +import models diff --git a/product_deletion/__manifest__.py b/product_deletion/__manifest__.py new file mode 100644 index 000000000..b335abd5b --- /dev/null +++ b/product_deletion/__manifest__.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Niyas Raphy() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +{ + 'name': 'Product Removal Authorisation', + 'summary': """Users in the Group "Product Deletion" Can Only Delete the Products""", + 'version': '11.0.1.0', + 'description': """Permission to delete the product""", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'category': 'Warehouse', + 'depends': ['base', 'product'], + 'license': 'LGPL-3', + 'data': [ + 'views/product_deletion_group.xml', + ], + 'demo': [], + 'images': ['static/description/banner.jpg'], + 'installable': True, + 'auto_install': False, +} diff --git a/product_deletion/models/__init__.py b/product_deletion/models/__init__.py new file mode 100644 index 000000000..88318663a --- /dev/null +++ b/product_deletion/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Niyas Raphy() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +import product_deletion diff --git a/product_deletion/models/product_deletion.py b/product_deletion/models/product_deletion.py new file mode 100644 index 000000000..7322c258d --- /dev/null +++ b/product_deletion/models/product_deletion.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Niyas Raphy() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +from odoo import models, api, _ +from odoo.exceptions import Warning + + +class ProductDeletion(models.Model): + _inherit = 'product.template' + + @api.multi + @api.model + def unlink(self, default=None): + res_user = self.env['res.users'].search([('id', '=', self._uid)]) + if not res_user.has_group('product_deletion.product_deletion_group'): + raise Warning(_( + "You cannot delete the product(s). Please contact the System Administrator")) + + diff --git a/product_deletion/static/description/banner.jpg b/product_deletion/static/description/banner.jpg new file mode 100644 index 000000000..1b584bfda Binary files /dev/null and b/product_deletion/static/description/banner.jpg differ diff --git a/product_deletion/static/description/cybro_logo.png b/product_deletion/static/description/cybro_logo.png new file mode 100644 index 000000000..bb309114c Binary files /dev/null and b/product_deletion/static/description/cybro_logo.png differ diff --git a/product_deletion/static/description/deletion_warning.png b/product_deletion/static/description/deletion_warning.png new file mode 100644 index 000000000..7a56f304e Binary files /dev/null and b/product_deletion/static/description/deletion_warning.png differ diff --git a/product_deletion/static/description/icon.png b/product_deletion/static/description/icon.png new file mode 100644 index 000000000..08b687c4b Binary files /dev/null and b/product_deletion/static/description/icon.png differ diff --git a/product_deletion/static/description/index.html b/product_deletion/static/description/index.html new file mode 100644 index 000000000..6d3ca5ea7 --- /dev/null +++ b/product_deletion/static/description/index.html @@ -0,0 +1,48 @@ +
+
+

Product Removal Authorisation

+

Users having the permission can only delete the products

+

Cybrosys Technologies

+
+
+ +
+
+

Product Form

+
+

+ ☛ Only users in the group Product Deletion can delete the product.
+ ☛ If user is not in the group Odoo will raise a warning message.
+

+
+ +
+
+
+
+ +
+

Need Any Help?

+ +
diff --git a/product_deletion/views/product_deletion_group.xml b/product_deletion/views/product_deletion_group.xml new file mode 100644 index 000000000..2e03d7674 --- /dev/null +++ b/product_deletion/views/product_deletion_group.xml @@ -0,0 +1,10 @@ + + + + + + Product Deletion + + + + \ No newline at end of file