summaryrefslogtreecommitdiff
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
parentd15f7df65c95f41f12fb72795f0b1360bde115c0 (diff)
add qty available in po line
-rwxr-xr-xindoteknik_custom/models/purchase_order_line.py9
-rwxr-xr-xindoteknik_custom/views/purchase_order.xml3
2 files changed, 12 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')
diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml
index 128f2413..f1a13615 100755
--- a/indoteknik_custom/views/purchase_order.xml
+++ b/indoteknik_custom/views/purchase_order.xml
@@ -43,6 +43,9 @@
<field name="product_id" position="before">
<field name="line_no" attrs="{'readonly': 1}"/>
</field>
+ <field name="product_qty" position="before">
+ <field name="qty_available"/>
+ </field>
</field>
</record>
</data>