Browse Source

Nov 26: [FIX] Bug Fixed 'hide_product_price_cost'

pull/351/merge
Cybrosys Technologies 5 months ago
parent
commit
6abe085f0e
  1. 8
      hide_product_price_cost/__manifest__.py
  2. 6
      hide_product_price_cost/doc/RELEASE_NOTES.md
  3. 20
      hide_product_price_cost/models/__init__.py
  4. 23
      hide_product_price_cost/models/product_product.py
  5. 19
      hide_product_price_cost/static/src/js/product_catalog.js
  6. 16
      hide_product_price_cost/static/src/js/product_kanban_template.xml

8
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',
],

6
hide_product_price_cost/doc/RELEASE_NOTES.md

@ -11,3 +11,9 @@
#### UPDT
- 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

20
hide_product_price_cost/models/__init__.py

@ -1,2 +1,22 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
from . import product_product

23
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(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import api, models
from datetime import datetime
class ProductProduct(models.Model):

19
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');
});
}
});

16
hide_product_price_cost/static/src/js/product_kanban_template.xml

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">
<!-- This template extension conditionally displays the product unit price based on the user's group.
The user must belong to the 'hide_product_price_cost.hide_product_price_cost_group_user_show_product_price' group to see the product price.-->
<t t-name="hide_product_price_cost.ProductCatalogProjectOrderLine"
t-inherit="product.ProductCatalogOrderLine" t-inherit-mode="extension">
<xpath expr="//t[@t-portal]" position="replace">
<t t-portal="`#product-${props.productId}-price`">
<t t-if="userHasGroup">
<span class="o_product_catalog_price">Unit price: <t t-out="props.price"/></span>
</t>
<t t-else=""/>
</t>
</xpath>
</t>
</templates>
Loading…
Cancel
Save