8 changed files with 74 additions and 4 deletions
@ -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() |
|
@ -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> |
Loading…
Reference in new issue