From 6abe085f0ec2b8b0bfc26aec6c56bfcc29c48275 Mon Sep 17 00:00:00 2001 From: Cybrosys Technologies Date: Tue, 26 Nov 2024 10:45:11 +0530 Subject: [PATCH] Nov 26: [FIX] Bug Fixed 'hide_product_price_cost' --- hide_product_price_cost/__init__.py | 2 +- hide_product_price_cost/__manifest__.py | 8 ++++++- hide_product_price_cost/doc/RELEASE_NOTES.md | 8 ++++++- hide_product_price_cost/models/__init__.py | 20 ++++++++++++++++ .../models/product_product.py | 23 ++++++++++++++++++- .../hide_product_price_cost_groups.xml | 2 +- .../static/src/js/product_catalog.js | 19 +++++++++++++++ .../static/src/js/product_kanban_template.xml | 16 +++++++++++++ .../views/product_product_views.xml | 2 +- 9 files changed, 94 insertions(+), 6 deletions(-) create mode 100644 hide_product_price_cost/static/src/js/product_catalog.js create mode 100644 hide_product_price_cost/static/src/js/product_kanban_template.xml diff --git a/hide_product_price_cost/__init__.py b/hide_product_price_cost/__init__.py index 25647da0f..097bdb395 100644 --- a/hide_product_price_cost/__init__.py +++ b/hide_product_price_cost/__init__.py @@ -19,4 +19,4 @@ # If not, see . # ############################################################################# -from . import models \ No newline at end of file +from . import models diff --git a/hide_product_price_cost/__manifest__.py b/hide_product_price_cost/__manifest__.py index 57557f9eb..9f92de299 100644 --- a/hide_product_price_cost/__manifest__.py +++ b/hide_product_price_cost/__manifest__.py @@ -28,13 +28,19 @@ 'website': "https://www.cybrosys.com", 'maintainer': "Cybrosys Techno Solutions", 'category': 'Sales', - 'version': '17.0.1.1.0', + 'version': '17.0.2.1.0', 'depends': ['base', 'product'], 'data': [ 'security/hide_product_price_cost_groups.xml', 'views/product_product_views.xml', 'views/product_template_views.xml', ], + 'assets': { + 'web.assets_backend': [ + 'hide_product_price_cost/static/src/js/product_catalog.js', + 'hide_product_price_cost/static/src/js/product_kanban_template.xml', + ], + }, 'images': [ 'static/description/banner.jpg', ], diff --git a/hide_product_price_cost/doc/RELEASE_NOTES.md b/hide_product_price_cost/doc/RELEASE_NOTES.md index 02e4cb40f..42eee36de 100644 --- a/hide_product_price_cost/doc/RELEASE_NOTES.md +++ b/hide_product_price_cost/doc/RELEASE_NOTES.md @@ -10,4 +10,10 @@ #### Version 17.0.1.1.0 #### UPDT -- Compute the write date for the product record \ No newline at end of file +- Compute the write date for the product record + +#### 21.11.2024 +#### Version 17.0.2.1.0 +#### UPDT + +- Hide Unit Price in Kanban View template for Specific User Group \ No newline at end of file diff --git a/hide_product_price_cost/models/__init__.py b/hide_product_price_cost/models/__init__.py index b284cfc47..054611559 100644 --- a/hide_product_price_cost/models/__init__.py +++ b/hide_product_price_cost/models/__init__.py @@ -1,2 +1,22 @@ # -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# from . import product_product \ No newline at end of file diff --git a/hide_product_price_cost/models/product_product.py b/hide_product_price_cost/models/product_product.py index 014f8b8ea..4fa509547 100644 --- a/hide_product_price_cost/models/product_product.py +++ b/hide_product_price_cost/models/product_product.py @@ -1,4 +1,25 @@ -from odoo import models, fields, api +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import api, models from datetime import datetime class ProductProduct(models.Model): diff --git a/hide_product_price_cost/security/hide_product_price_cost_groups.xml b/hide_product_price_cost/security/hide_product_price_cost_groups.xml index 317ac6d26..ccd396307 100644 --- a/hide_product_price_cost/security/hide_product_price_cost_groups.xml +++ b/hide_product_price_cost/security/hide_product_price_cost_groups.xml @@ -8,4 +8,4 @@ Show Product Cost - + \ No newline at end of file diff --git a/hide_product_price_cost/static/src/js/product_catalog.js b/hide_product_price_cost/static/src/js/product_catalog.js new file mode 100644 index 000000000..82dd10f2d --- /dev/null +++ b/hide_product_price_cost/static/src/js/product_catalog.js @@ -0,0 +1,19 @@ +/** @odoo-module **/ +import { patch } from "@web/core/utils/patch"; +import { onWillStart ,useState} from "@odoo/owl"; +import { ProductCatalogOrderLine} from "@product/product_catalog/order_line/order_line"; +import {useService} from "@web/core/utils/hooks" + /** + * This patch extends the ProductCatalogOrderLine component to check if the current user + * belongs to a specific group ('hide_product_price_cost.hide_product_price_cost_group_user_show_product_price'). + **/ +patch(ProductCatalogOrderLine.prototype, { + setup(){ + super.setup(); + this.user = useService("user"); + onWillStart(async () => { + // Check if the user belongs to the specified group + this.userHasGroup =await this.user.hasGroup('hide_product_price_cost.hide_product_price_cost_group_user_show_product_price'); + }); + } +}); \ No newline at end of file diff --git a/hide_product_price_cost/static/src/js/product_kanban_template.xml b/hide_product_price_cost/static/src/js/product_kanban_template.xml new file mode 100644 index 000000000..d5fb63c82 --- /dev/null +++ b/hide_product_price_cost/static/src/js/product_kanban_template.xml @@ -0,0 +1,16 @@ + + + + + + + + Unit price: + + + + + + \ No newline at end of file diff --git a/hide_product_price_cost/views/product_product_views.xml b/hide_product_price_cost/views/product_product_views.xml index ac9fc43e1..456b32065 100644 --- a/hide_product_price_cost/views/product_product_views.xml +++ b/hide_product_price_cost/views/product_product_views.xml @@ -39,4 +39,4 @@ - + \ No newline at end of file