summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2024-01-22 11:36:03 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2024-01-22 11:36:03 +0700
commitb972e53c1a1b184123327b18ef89517e3c075ad6 (patch)
treea948861a042f10a42e816489b53aefcae9fee6ff
parentc6e75269c4d3f0471e14cdf5b03f6a94aaed12d0 (diff)
Fix _get_valid_purchase_price in sale order line
-rw-r--r--indoteknik_custom/models/sale_order_line.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/indoteknik_custom/models/sale_order_line.py b/indoteknik_custom/models/sale_order_line.py
index ab20fb09..78944876 100644
--- a/indoteknik_custom/models/sale_order_line.py
+++ b/indoteknik_custom/models/sale_order_line.py
@@ -96,10 +96,12 @@ class SaleOrderLine(models.Model):
price = purchase_price.system_price or purchase_price.product_price or 0
if purchase_price.system_price > 0 and purchase_price.product_price > 0:
- if purchase_price.human_last_update == False or purchase_price.system_last_update > purchase_price.human_last_update:
+ if not purchase_price.human_last_update or not purchase_price.system_last_update:
+ return price
+
+ if purchase_price.system_last_update > purchase_price.human_last_update:
price = purchase_price.system_price
-
- if purchase_price.system_last_update == False or purchase_price.human_last_update > purchase_price.system_last_update:
+ else:
price = purchase_price.product_price
return price