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>)
|
# @author Santi Noreña (<santi@criptomart.net>)
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
import logging
|
|
||||||
|
|
||||||
from odoo import api, fields, models
|
from odoo import api, fields, models
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class ProductProduct(models.Model):
|
class ProductProduct(models.Model):
|
||||||
_inherit = "product.product"
|
_inherit = "product.product"
|
||||||
|
|
@ -24,7 +21,6 @@ class ProductProduct(models.Model):
|
||||||
"product_tmpl_id.list_price",
|
"product_tmpl_id.list_price",
|
||||||
)
|
)
|
||||||
def _compute_theoretical_multi(self):
|
def _compute_theoretical_multi(self):
|
||||||
res = super()._compute_theoretical_multi()
|
|
||||||
for product in self:
|
for product in self:
|
||||||
if product.last_purchase_price_received != 0:
|
if product.last_purchase_price_received != 0:
|
||||||
(
|
(
|
||||||
|
|
@ -38,7 +34,6 @@ class ProductProduct(models.Model):
|
||||||
product.last_purchase_price_received,
|
product.last_purchase_price_received,
|
||||||
product.lst_price,
|
product.lst_price,
|
||||||
)
|
)
|
||||||
return res
|
|
||||||
|
|
||||||
def use_theoretical_price(self):
|
def use_theoretical_price(self):
|
||||||
for product in self:
|
for product in self:
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ from odoo import api, fields, models
|
||||||
class ProductTemplate(models.Model):
|
class ProductTemplate(models.Model):
|
||||||
_inherit = "product.template"
|
_inherit = "product.template"
|
||||||
|
|
||||||
margin_state = fields.Selection(store=True)
|
margin_state = fields.Selection(store=True, compute_sudo=False)
|
||||||
|
|
||||||
last_purchase_price_received = fields.Float(
|
last_purchase_price_received = fields.Float(
|
||||||
string="Last purchase price",
|
string="Last purchase price",
|
||||||
|
|
@ -54,7 +54,6 @@ class ProductTemplate(models.Model):
|
||||||
"list_price",
|
"list_price",
|
||||||
)
|
)
|
||||||
def _onchange_standard_price(self):
|
def _onchange_standard_price(self):
|
||||||
res = super()._onchange_standard_price()
|
|
||||||
if self.last_purchase_price_received != 0:
|
if self.last_purchase_price_received != 0:
|
||||||
(
|
(
|
||||||
self.margin_state,
|
self.margin_state,
|
||||||
|
|
@ -67,4 +66,3 @@ class ProductTemplate(models.Model):
|
||||||
self.last_purchase_price_received,
|
self.last_purchase_price_received,
|
||||||
self.list_price,
|
self.list_price,
|
||||||
)
|
)
|
||||||
return res
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name="standard_price" position="after">
|
<field name="standard_price" position="after">
|
||||||
<field name="last_purchase_price_received" />
|
<field name="last_purchase_price_received" />
|
||||||
<field name="margin_state" invisible="1" />
|
|
||||||
</field>
|
</field>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue