From 8b681ddd7cf2823bdf7cd276500bb6ded9a5ab1e Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Wed, 21 Dec 2022 10:55:53 +0700 Subject: add qty onhand, incoming, and outgoing --- indoteknik_custom/models/purchase_order_line.py | 12 +++++++++--- indoteknik_custom/views/purchase_order.xml | 3 +++ 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 @@ + + + -- cgit v1.2.3