This commit is contained in:
Luis 2022-03-29 12:33:04 +02:00
parent 5f4bb24894
commit f874606369
6 changed files with 23 additions and 27 deletions

View file

@ -18,7 +18,7 @@ class ProductTemplate(models.Model):
def _compute_theoritical_price(self):
partner = self.env['res.users'].browse(self.env.uid).partner_id
pricelist_obj = self.env['product.pricelist']
pricelist_id = self.env['ir.config_parameter'].sudo().get_param('product_laosa.product_pricelist_automatic') or False
pricelist_id = self.env['ir.config_parameter'].sudo().get_param('product_update_price_last_purchase.product_pricelist_automatic') or False
pricelist = pricelist_obj.browse(int(pricelist_id))
_logger.debug("Calculating price with PriceList : %s" %pricelist.name)
if pricelist:

View file

@ -1,9 +1,5 @@
#import logging
from odoo import models, fields, api
#_logger = logging.getLogger(__name__)
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
@ -19,7 +15,7 @@ class ResConfigSettings(models.TransientModel):
res = super(ResConfigSettings, self).get_values()
config_obj = self.env["ir.config_parameter"]
product_pricelist_automatic = config_obj.sudo().get_param(
"product_laosa.product_pricelist_automatic", default=0)
"product_update_price_last_purchase.product_pricelist_automatic", default=0)
return res
@api.multi
@ -27,7 +23,7 @@ class ResConfigSettings(models.TransientModel):
super(ResConfigSettings, self).set_values()
config_obj = self.env["ir.config_parameter"]
config_obj.sudo().set_param(
"product_laosa.product_pricelist_automatic",
"product_update_price_last_purchase.product_pricelist_automatic",
int(self.product_pricelist_automatic.id)
)