diff --git a/product_update_price_last_purchase/models/product_product.py b/product_update_price_last_purchase/models/product_product.py index e7cb35f..e9e6968 100644 --- a/product_update_price_last_purchase/models/product_product.py +++ b/product_update_price_last_purchase/models/product_product.py @@ -2,12 +2,9 @@ # @author Santi NoreƱa () # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -import logging from odoo import api, fields, models -_logger = logging.getLogger(__name__) - class ProductProduct(models.Model): _inherit = "product.product" @@ -24,7 +21,6 @@ class ProductProduct(models.Model): "product_tmpl_id.list_price", ) def _compute_theoretical_multi(self): - res = super()._compute_theoretical_multi() for product in self: if product.last_purchase_price_received != 0: ( @@ -38,7 +34,6 @@ class ProductProduct(models.Model): product.last_purchase_price_received, product.lst_price, ) - return res def use_theoretical_price(self): for product in self: diff --git a/product_update_price_last_purchase/models/product_template.py b/product_update_price_last_purchase/models/product_template.py index ffa50df..af93c48 100644 --- a/product_update_price_last_purchase/models/product_template.py +++ b/product_update_price_last_purchase/models/product_template.py @@ -8,7 +8,7 @@ from odoo import api, fields, models class ProductTemplate(models.Model): _inherit = "product.template" - margin_state = fields.Selection(store=True) + margin_state = fields.Selection(store=True, compute_sudo=False) last_purchase_price_received = fields.Float( string="Last purchase price", @@ -54,7 +54,6 @@ class ProductTemplate(models.Model): "list_price", ) def _onchange_standard_price(self): - res = super()._onchange_standard_price() if self.last_purchase_price_received != 0: ( self.margin_state, @@ -67,4 +66,3 @@ class ProductTemplate(models.Model): self.last_purchase_price_received, self.list_price, ) - return res diff --git a/product_update_price_last_purchase/views/product_view.xml b/product_update_price_last_purchase/views/product_view.xml index 6a5d192..9a189c9 100644 --- a/product_update_price_last_purchase/views/product_view.xml +++ b/product_update_price_last_purchase/views/product_view.xml @@ -23,7 +23,6 @@ -