product_update_price_last_purchase: Fix warning compute_sudo
This commit is contained in:
parent
d1be5f8f09
commit
c314af6c26
3 changed files with 1 additions and 9 deletions
|
|
@ -2,12 +2,9 @@
|
|||
# @author Santi Noreña (<santi@criptomart.net>)
|
||||
# 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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue