Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] dont disply price change qty if price based on supplierinfo #142

Open
wants to merge 2 commits into
base: 14.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion sale_usability/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,22 @@ def product_uom_change(self):
# When the user has manually set a custom price
# 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.
PricelistItem = self.env['product.pricelist.item']
res = {}
old_price = self.price_unit
super().product_uom_change()
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')
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
res['warning'] = {
'title': _('Price updated'),
Expand Down