diff --git a/hide_product_price_cost/__init__.py b/hide_product_price_cost/__init__.py index 6f9eebeeb..25647da0f 100644 --- a/hide_product_price_cost/__init__.py +++ b/hide_product_price_cost/__init__.py @@ -19,3 +19,4 @@ # If not, see . # ############################################################################# +from . import models \ No newline at end of file diff --git a/hide_product_price_cost/__manifest__.py b/hide_product_price_cost/__manifest__.py index 2ddb774a8..57557f9eb 100644 --- a/hide_product_price_cost/__manifest__.py +++ b/hide_product_price_cost/__manifest__.py @@ -28,7 +28,7 @@ 'website': "https://www.cybrosys.com", 'maintainer': "Cybrosys Techno Solutions", 'category': 'Sales', - 'version': '17.0.1.0.0', + 'version': '17.0.1.1.0', 'depends': ['base', 'product'], 'data': [ 'security/hide_product_price_cost_groups.xml', diff --git a/hide_product_price_cost/doc/RELEASE_NOTES.md b/hide_product_price_cost/doc/RELEASE_NOTES.md index 5887cbb0d..02e4cb40f 100644 --- a/hide_product_price_cost/doc/RELEASE_NOTES.md +++ b/hide_product_price_cost/doc/RELEASE_NOTES.md @@ -5,3 +5,9 @@ #### ADD - 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 \ No newline at end of file diff --git a/hide_product_price_cost/models/__init__.py b/hide_product_price_cost/models/__init__.py new file mode 100644 index 000000000..b284cfc47 --- /dev/null +++ b/hide_product_price_cost/models/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +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 new file mode 100644 index 000000000..014f8b8ea --- /dev/null +++ b/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) diff --git a/hide_product_price_cost/views/product_product_views.xml b/hide_product_price_cost/views/product_product_views.xml index 332dbb416..ac9fc43e1 100644 --- a/hide_product_price_cost/views/product_product_views.xml +++ b/hide_product_price_cost/views/product_product_views.xml @@ -6,12 +6,12 @@ product.product - - hide_product_price_cost.hide_product_price_cost_group_user_show_product_price - hide_product_price_cost.hide_product_price_cost_group_user_show_product_cost + + hide_product_price_cost.hide_product_price_cost_group_user_show_product_price +