Browse Source

Nov 06: [FIX] Bug Fixed 'hide_product_price_cost'

pull/347/head
Cybrosys Technologies 6 months ago
parent
commit
4fe0986934
  1. 1
      hide_product_price_cost/__init__.py
  2. 2
      hide_product_price_cost/__manifest__.py
  3. 6
      hide_product_price_cost/doc/RELEASE_NOTES.md
  4. 2
      hide_product_price_cost/models/__init__.py
  5. 20
      hide_product_price_cost/models/product_product.py
  6. 6
      hide_product_price_cost/views/product_product_views.xml

1
hide_product_price_cost/__init__.py

@ -19,3 +19,4 @@
# If not, see <http://www.gnu.org/licenses/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################# #############################################################################
from . import models

2
hide_product_price_cost/__manifest__.py

@ -28,7 +28,7 @@
'website': "https://www.cybrosys.com", 'website': "https://www.cybrosys.com",
'maintainer': "Cybrosys Techno Solutions", 'maintainer': "Cybrosys Techno Solutions",
'category': 'Sales', 'category': 'Sales',
'version': '17.0.1.0.0', 'version': '17.0.1.1.0',
'depends': ['base', 'product'], 'depends': ['base', 'product'],
'data': [ 'data': [
'security/hide_product_price_cost_groups.xml', 'security/hide_product_price_cost_groups.xml',

6
hide_product_price_cost/doc/RELEASE_NOTES.md

@ -5,3 +5,9 @@
#### ADD #### ADD
- Initial commit for Hide Product Price and Cost - Initial commit for Hide Product Price and Cost
#### 05.11.2024
#### Version 17.0.1.1.0
#### UPDT
- Compute the write date for the product record

2
hide_product_price_cost/models/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import product_product

20
hide_product_price_cost/models/product_product.py

@ -0,0 +1,20 @@
from odoo import models, fields, api
from datetime import datetime
class ProductProduct(models.Model):
"""This class extends the 'product.product' model to enhance its functionality."""
_inherit = 'product.product'
@api.depends('product_tmpl_id.write_date')
def _compute_write_date(self):
"""Compute the write date for the product record.
This method computes the write date for each product record by taking the maximum of the current
write date of the product and the write date of the related product template. If the product's write
date is not set, the current date and time are used. If the product template's write date is not set,
a minimum datetime value (datetime.min) is used.
This ensures that the write date reflects the most recent modification date between the product and
its template."""
for record in self:
record_write_date = record.write_date or self.env.cr.now()
tmpl_write_date = record.product_tmpl_id.write_date or datetime.min
record.write_date = max(record_write_date, tmpl_write_date)

6
hide_product_price_cost/views/product_product_views.xml

@ -6,12 +6,12 @@
<field name="model">product.product</field> <field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/> <field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="lst_price" position="attributes">
<attribute name="groups">hide_product_price_cost.hide_product_price_cost_group_user_show_product_price</attribute>
</field>
<field name="standard_price" position="attributes"> <field name="standard_price" position="attributes">
<attribute name="groups">hide_product_price_cost.hide_product_price_cost_group_user_show_product_cost</attribute> <attribute name="groups">hide_product_price_cost.hide_product_price_cost_group_user_show_product_cost</attribute>
</field> </field>
<field name="lst_price" position="attributes">
<attribute name="groups">hide_product_price_cost.hide_product_price_cost_group_user_show_product_price</attribute>
</field>
</field> </field>
</record> </record>
<!-- Hide product cost and price in product kanban view--> <!-- Hide product cost and price in product kanban view-->

Loading…
Cancel
Save