diff --git a/product_approval_management/__manifest__.py b/product_approval_management/__manifest__.py index aa57a2bcb..5f48940b3 100644 --- a/product_approval_management/__manifest__.py +++ b/product_approval_management/__manifest__.py @@ -20,7 +20,7 @@ ############################################################################### { 'name': "Product Approval", - 'version': '18.0.1.0.0', + 'version': '18.0.1.0.1', 'category': "Extra tools", 'summary': 'Product approval allow you to control the product creation', 'description': "Using this module a user can create product which" @@ -35,6 +35,7 @@ 'data': ['security/product_approval_management_groups.xml', 'security/ir.model.access.csv', 'views/product_template_views.xml', + 'views/product_product_views.xml', 'views/sale_order_views.xml'], 'images': ['static/description/banner.png'], 'post_init_hook': '_default_product_confirm', diff --git a/product_approval_management/doc/RELEASE_NOTES.md b/product_approval_management/doc/RELEASE_NOTES.md index 2f690a688..908204875 100644 --- a/product_approval_management/doc/RELEASE_NOTES.md +++ b/product_approval_management/doc/RELEASE_NOTES.md @@ -5,3 +5,9 @@ ##### ADD - Initial Commit for Product Approval + +#### 05.06.2025 +#### Version 18.0.1.0.1 +#### UPDT +- Fixed a bug in the confirm action of the module, implemented the functionality for Product Variants, and added a corresponding server action. + diff --git a/product_approval_management/models/__init__.py b/product_approval_management/models/__init__.py index 7ad6ac9b3..b1297c275 100644 --- a/product_approval_management/models/__init__.py +++ b/product_approval_management/models/__init__.py @@ -20,3 +20,4 @@ ############################################################################### from . import product_template from . import sale_order_line +from . import product_product diff --git a/product_approval_management/models/product_product.py b/product_approval_management/models/product_product.py new file mode 100644 index 000000000..cea2e693f --- /dev/null +++ b/product_approval_management/models/product_product.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Saneen K (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# +############################################################################### +from odoo import fields, models + + +class ProductTemplate(models.Model): + """The module is used to add the approval state in the product form page""" + _inherit = 'product.product' + + approve_state = fields.Selection([('draft', 'Draft'), + ('confirmed', 'Confirmed')], + default='draft', string='State', + help='State to approve') + + def action_confirm_product_approval(self): + """Confirm button on the product form page""" + for rec in self: + rec.approve_state = 'confirmed' + + def action_reset_product_approval(self): + """Reset to draft state button on the product form page""" + for rec in self: + rec.approve_state = 'draft' + + def action_confirm_products(self): + """Bulk product approval button on the product form page""" + active_ids = self.env.context.get('active_ids') + products = self.env['product.product'].browse(active_ids) + products.action_confirm_product_approval() diff --git a/product_approval_management/models/product_template.py b/product_approval_management/models/product_template.py index c695fd8f6..6d7c623f2 100644 --- a/product_approval_management/models/product_template.py +++ b/product_approval_management/models/product_template.py @@ -44,4 +44,4 @@ class ProductTemplate(models.Model): """Bulk product approval button on the product form page""" active_ids = self.env.context.get('active_ids') products = self.env['product.template'].browse(active_ids) - products.confirm_product_approval() + products.action_confirm_product_approval() diff --git a/product_approval_management/security/ir.model.access.csv b/product_approval_management/security/ir.model.access.csv index 6b8596eff..ebf7a0626 100644 --- a/product_approval_management/security/ir.model.access.csv +++ b/product_approval_management/security/ir.model.access.csv @@ -1,2 +1,3 @@ id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink access_product_approval_management_manager,access.product.approval.management.manager,model_product_template,product_approval_management_group_manager,1,1,1,1 +access_product_approval_management_manager,access.product.approval.management.manager,model_product_product,product_approval_management_group_manager,1,1,1,1 diff --git a/product_approval_management/views/product_product_views.xml b/product_approval_management/views/product_product_views.xml new file mode 100644 index 000000000..e86701541 --- /dev/null +++ b/product_approval_management/views/product_product_views.xml @@ -0,0 +1,13 @@ + + + + + Confirm + + code + model.action_confirm_products() + + + + diff --git a/product_approval_management/views/product_template_views.xml b/product_approval_management/views/product_template_views.xml index aeda68780..8c3ee4895 100644 --- a/product_approval_management/views/product_template_views.xml +++ b/product_approval_management/views/product_template_views.xml @@ -36,8 +36,9 @@ Confirm code - model.confirm_products() + model.action_confirm_products() - +