Open crgb001 opened 5 years ago
Error still not corrected: KeyError: 'product.price.type'
i had the same issues and i managed to fix it by changing the price_set function like this : def price_set(self, product_template, new_price): """ Set the price of the product in current pricelist if different from price through pricerules :param product_template: product_template object :param new_price: new price :return: """ if new_price:
items = self.env['product.pricelist.item'].search(
[
('product_tmpl_id', '=', product_template.id),
('pricelist_id', '=', self.id)
]
)
product_price_type_ids = self.env['product.pricelist.item'].search(
[
('base', '=', 'list_price')
]
)
if not items:
self.env['product.pricelist.item'].create(
{
'base': 'list_price',#product_price_type_ids and product_price_type_ids[0].id,
'sequence': 1,
'name': product_template.name,
'product_tmpl_id': product_template.id,
'pricelist_id': self.id,
'fixed_price': new_price,
'price_discount':-1
}
)
else:
for item in items:
item.write(
{
'base': 'list_price',#product_price_type_ids and product_price_type_ids[0].id,
'sequence': 1,
'name': product_template.name,
'product_tmpl_id': product_template.id,
'pricelist_id': self.id,
'fixed_price': new_price,
'price_discount':-1
}
)
return True
Error while trying to save changes made to a pricelist item:
KeyError: 'product.price.type'