summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-11-18 17:25:56 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-11-18 17:25:56 +0700
commit5d29ddf74f982a686b6dfec2381162a0c5ed4c7c (patch)
treee8b635a44eeca69501610cd55d30724b73f07eb9 /indoteknik_custom/models
parentd15f7df65c95f41f12fb72795f0b1360bde115c0 (diff)
add qty available in po line
Diffstat (limited to 'indoteknik_custom/models')
-rwxr-xr-xindoteknik_custom/models/purchase_order_line.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/indoteknik_custom/models/purchase_order_line.py b/indoteknik_custom/models/purchase_order_line.py
index 60e4c8b0..621373f4 100755
--- a/indoteknik_custom/models/purchase_order_line.py
+++ b/indoteknik_custom/models/purchase_order_line.py
@@ -22,6 +22,15 @@ class PurchaseOrderLine(models.Model):
help="Total % Margin in Sales Order Header")
delivery_amt_line = fields.Float('DeliveryAmtLine', compute='compute_delivery_amt_line')
line_no = fields.Integer('No', default=0)
+ qty_available = fields.Float('Qty Available', compute='compute_qty_available')
+
+ def compute_qty_available(self):
+ for line in self:
+ line.qty_available = line.product_id.virtual_available
+
+ @api.onchange('product_id')
+ def _onchange_product_custom(self):
+ self.compute_qty_available()
# Override method from addons/purchase/models/purchase.py
@api.onchange('product_qty', 'product_uom')