summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-12-21 10:55:53 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-12-21 10:55:53 +0700
commit8b681ddd7cf2823bdf7cd276500bb6ded9a5ab1e (patch)
treeb26cb0d76c24956c53949bdea44202d7974f772b
parent6f46bca1d6483d2d95c95a2d34b0dc9a5e6061f5 (diff)
add qty onhand, incoming, and outgoing
-rwxr-xr-xindoteknik_custom/models/purchase_order_line.py12
-rwxr-xr-xindoteknik_custom/views/purchase_order.xml3
2 files changed, 12 insertions, 3 deletions
diff --git a/indoteknik_custom/models/purchase_order_line.py b/indoteknik_custom/models/purchase_order_line.py
index 621373f4..8439df5d 100755
--- a/indoteknik_custom/models/purchase_order_line.py
+++ b/indoteknik_custom/models/purchase_order_line.py
@@ -22,15 +22,21 @@ 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')
+ qty_available = fields.Float('Qty Available', compute='compute_qty_stock')
+ qty_onhand = fields.Float('Qty On Hand', compute='compute_qty_stock')
+ qty_incoming = fields.Float('Qty Incoming', compute='compute_qty_stock')
+ qty_outgoing = fields.Float('Qty Outgoing', compute='compute_qty_stock')
- def compute_qty_available(self):
+ def compute_qty_stock(self):
for line in self:
line.qty_available = line.product_id.virtual_available
+ line.qty_onhand = line.product_id.qty_available
+ line.qty_incoming = line.product_id.incoming_qty
+ line.qty_outgoing = line.product_id.outgoing_qty
@api.onchange('product_id')
def _onchange_product_custom(self):
- self.compute_qty_available()
+ self.compute_qty_stock()
# 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 f1a13615..fcd38677 100755
--- a/indoteknik_custom/views/purchase_order.xml
+++ b/indoteknik_custom/views/purchase_order.xml
@@ -44,6 +44,9 @@
<field name="line_no" attrs="{'readonly': 1}"/>
</field>
<field name="product_qty" position="before">
+ <field name="qty_onhand"/>
+ <field name="qty_incoming"/>
+ <field name="qty_outgoing"/>
<field name="qty_available"/>
</field>
</field>