summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2023-07-11 05:00:34 +0000
committerIT Fixcomart <it@fixcomart.co.id>2023-07-11 05:00:34 +0000
commitba2bd3f91857cf6085eb760451ec695182dd1a3a (patch)
tree015635e568e487b83d058559aeb23b66e6064ff0
parentcba2c1e87932fead4800391c1a4e2fea550ef1bc (diff)
parent0c60b3eb92bcae1e5170d17d4d5cc66ae14d6451 (diff)
Merged in hotfix/auto-purchase (pull request #49)
Hotfix/auto purchase
-rw-r--r--indoteknik_custom/models/automatic_purchase.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py
index 87319bf6..e21b411d 100644
--- a/indoteknik_custom/models/automatic_purchase.py
+++ b/indoteknik_custom/models/automatic_purchase.py
@@ -59,11 +59,18 @@ class AutomaticPurchase(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,
'product_id': product.product_id.id,
'product_qty': product.qty_purchase,
+ 'qty_available_store': qty_available,
+ 'suggest': suggest,
'product_uom_qty': product.qty_purchase,
'price_unit': product.last_price,
}