Commit 02591311 by Yvon

handle case of current vendor sharing min sequence with at least another vendor…

handle case of current vendor sharing min sequence with at least another vendor to make sure that current vendor base_price is used to update product template price
parent 9153baf5
...@@ -35,10 +35,10 @@ class PurchaseOrderLine(models.Model): ...@@ -35,10 +35,10 @@ class PurchaseOrderLine(models.Model):
current_sequence = vendor_price_line.sequence current_sequence = vendor_price_line.sequence
# No update if the current vendor is the main one # No update if the current vendor is the main one
if vendor_price_line.sequence != min_sequence: if vendor_price_line.sequence != min_sequence or product.seller_ids.mapped('sequence').count(min_sequence) > 1:
for seller in product.seller_ids: for seller in product.seller_ids:
if seller.id != vendor_price_line.id and \ if seller.id != vendor_price_line.id and \
seller.sequence < current_sequence: seller.sequence <= current_sequence:
seller.write({'sequence': seller.sequence + 1}) seller.write({'sequence': seller.sequence + 1})
main_vendor = vendor_price_line.name main_vendor = vendor_price_line.name
vendor_price_line.write({'sequence': min_sequence}) vendor_price_line.write({'sequence': min_sequence})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment