summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2023-06-19 12:01:42 +0700
committerstephanchrst <stephanchrst@gmail.com>2023-06-19 12:01:42 +0700
commit70dbe185533615aaedb7f05c75a7c5530be6eb42 (patch)
tree908e3bca71f939214cc7d201f8b0d3da5a69501a /indoteknik_custom/models
parentb7c98087933cde132a741d5676e1309a0d5ab445 (diff)
add available qty while create po from requisition
Diffstat (limited to 'indoteknik_custom/models')
-rw-r--r--indoteknik_custom/models/requisition.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/indoteknik_custom/models/requisition.py b/indoteknik_custom/models/requisition.py
index 5bb3272e..c1af4784 100644
--- a/indoteknik_custom/models/requisition.py
+++ b/indoteknik_custom/models/requisition.py
@@ -127,6 +127,12 @@ class Requisition(models.Model):
# new_po = self.env['purchase.order'].create([param_header])
brand_id = product.brand_id.id
count += 10
+
+ qty_available = product.product_id.qty_onhand_bandengan + product.product_id.qty_incoming_bandengan - product.product_id.outgoing_qty
+ suggest = 'harus beli'
+ if qty_available > product.qty_purchase:
+ suggest = 'masih cukup'
+
param_line = {
'order_id': new_po.id,
'sequence': count,
@@ -134,7 +140,9 @@ class Requisition(models.Model):
'product_qty': product.qty_purchase,
'product_uom_qty': product.qty_purchase,
'price_unit': product.last_price,
- 'taxes_id': product.tax_id
+ 'taxes_id': product.tax_id,
+ 'qty_available_store': qty_available,
+ 'suggest': suggest,
}
new_line = self.env['purchase.order.line'].create([param_line])
product.current_po_id = new_po.id