summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-06-19 16:08:47 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-06-19 16:08:47 +0700
commit9187e2c22d9a537196c05c092762814fe362f8c0 (patch)
tree47a8d9c137426228719fc332128cae27cf6328e7
parent70dbe185533615aaedb7f05c75a7c5530be6eb42 (diff)
Bug fix synchronize order line on purchase
-rwxr-xr-xindoteknik_custom/models/purchase_order.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index 5aedb07b..df1ecf14 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -152,9 +152,10 @@ class PurchaseOrder(models.Model):
for order_line in self.sale_order_id.order_line:
if order_line.product_id.id and order_line.product_id.id not in products_exception:
for order_line in self.sale_order_id.order_line:
-
+ if not order_line.product_id:
+ continue
qty_available = order_line.product_id.qty_onhand_bandengan + order_line.product_id.qty_incoming_bandengan - order_line.product_id.outgoing_qty
-
+
suggest = 'harus beli'
if qty_available > order_line.product_qty:
suggest = 'masih cukup'
@@ -166,7 +167,7 @@ class PurchaseOrder(models.Model):
'qty_available_store': qty_available,
'suggest': suggest,
}
- self.order_line.create(values)
+ self.env['purchase.order.line'].create(values)
def compute_count_line_product(self):
for order in self: