Browse Source

Jun 06: [FIX] Bug Fixed 'product_approval_management'

pull/346/merge
Cybrosys Technologies 3 weeks ago
parent
commit
a558531617
  1. 3
      product_approval_management/__manifest__.py
  2. 6
      product_approval_management/doc/RELEASE_NOTES.md
  3. 1
      product_approval_management/models/__init__.py
  4. 47
      product_approval_management/models/product_product.py
  5. 2
      product_approval_management/models/product_template.py
  6. 1
      product_approval_management/security/ir.model.access.csv
  7. 13
      product_approval_management/views/product_product_views.xml
  8. 5
      product_approval_management/views/product_template_views.xml

3
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',

6
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.

1
product_approval_management/models/__init__.py

@ -20,3 +20,4 @@
###############################################################################
from . import product_template
from . import sale_order_line
from . import product_product

47
product_approval_management/models/product_product.py

@ -0,0 +1,47 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# 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()

2
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()

1
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

1 id name model_id/id group_id/id perm_read perm_write perm_create perm_unlink
2 access_product_approval_management_manager access.product.approval.management.manager model_product_template product_approval_management_group_manager 1 1 1 1
3 access_product_approval_management_manager access.product.approval.management.manager model_product_product product_approval_management_group_manager 1 1 1 1

13
product_approval_management/views/product_product_views.xml

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<!-- Bulk product confirm by client action-->
<record id="action_product_approval_management" model="ir.actions.server">
<field name="name">Confirm</field>
<field name="model_id" ref="product.model_product_product"/>
<field name="state">code</field>
<field name="code">model.action_confirm_products()</field>
<field name="binding_model_id" ref="product.model_product_product"/>
<field name="groups_id"
eval="[(4, ref('product_approval_management.product_approval_management_group_manager'))]"/>
</record>
</odoo>

5
product_approval_management/views/product_template_views.xml

@ -36,8 +36,9 @@
<field name="name">Confirm</field>
<field name="model_id" ref="product.model_product_template"/>
<field name="state">code</field>
<field name="code">model.confirm_products()</field>
<field name="code">model.action_confirm_products()</field>
<field name="binding_model_id" ref="product.model_product_template"/>
<field name="groups_id" eval="[(4, ref('product_approval_management.product_approval_management_group_manager'))]"/>
<field name="groups_id"
eval="[(4, ref('product_approval_management.product_approval_management_group_manager'))]"/>
</record>
</odoo>

Loading…
Cancel
Save