Compare commits
2 Commits
14.0-copie
...
14.0-fix_s
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1a69567fdf | ||
|
|
4204c43beb |
@@ -71,12 +71,22 @@ class SaleOrderLine(models.Model):
|
|||||||
# When the user has manually set a custom price
|
# When the user has manually set a custom price
|
||||||
# he is often upset when Odoo changes it when he changes the qty
|
# he is often upset when Odoo changes it when he changes the qty
|
||||||
# So we add a warning in which we recall the old price.
|
# So we add a warning in which we recall the old price.
|
||||||
|
PricelistItem = self.env['product.pricelist.item']
|
||||||
res = {}
|
res = {}
|
||||||
old_price = self.price_unit
|
old_price = self.price_unit
|
||||||
super().product_uom_change()
|
super().product_uom_change()
|
||||||
new_price = self.price_unit
|
new_price = self.price_unit
|
||||||
|
pricelist_item = PricelistItem.browse(False)
|
||||||
|
if self.product_id:
|
||||||
|
product_context = dict(self.env.context,
|
||||||
|
partner_id=self.order_id.partner_id.id,
|
||||||
|
date=self.order_id.date_order,
|
||||||
|
uom=self.product_uom.id)
|
||||||
|
price, rule_id = self.order_id.pricelist_id.with_context(
|
||||||
|
product_context).get_product_price_rule(self.product_id, self.product_uom_qty or 1.0, self.order_id.partner_id)
|
||||||
|
pricelist_item = PricelistItem.browse(rule_id)
|
||||||
prec = self.env['decimal.precision'].precision_get('Product Price')
|
prec = self.env['decimal.precision'].precision_get('Product Price')
|
||||||
if float_compare(old_price, new_price, precision_digits=prec):
|
if pricelist_item.base != 'supplierinfo' and float_compare(old_price, new_price, precision_digits=prec):
|
||||||
pricelist = self.order_id.pricelist_id
|
pricelist = self.order_id.pricelist_id
|
||||||
res['warning'] = {
|
res['warning'] = {
|
||||||
'title': _('Price updated'),
|
'title': _('Price updated'),
|
||||||
|
|||||||
Reference in New Issue
Block a user