summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xindoteknik_custom/models/purchase_order.py6
-rwxr-xr-xindoteknik_custom/models/purchase_order_line.py2
-rwxr-xr-xindoteknik_custom/views/purchase_order.xml6
3 files changed, 10 insertions, 4 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index 0ef6a9f2..8809d048 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -139,11 +139,17 @@ class PurchaseOrder(models.Model):
self.order_line.unlink()
for order_line in self.sale_order_id.order_line:
if order_line.product_id.id and order_line.product_id.id not in products_exception:
+ qty_available = order_line.product_id.virtual_available
+ suggest = 'harus beli'
+ if order_line.product_id.virtual_available > order_line.product_qty:
+ suggest = 'masih cukup'
values = {
'order_id': self.id,
'product_id': order_line.product_id.id,
'name': order_line.product_id.display_name,
'product_qty': order_line.product_qty,
+ 'qty_available_store': qty_available,
+ 'suggest': suggest,
}
self.env['purchase.order.line'].sudo().create(values)
diff --git a/indoteknik_custom/models/purchase_order_line.py b/indoteknik_custom/models/purchase_order_line.py
index 8439df5d..f255095f 100755
--- a/indoteknik_custom/models/purchase_order_line.py
+++ b/indoteknik_custom/models/purchase_order_line.py
@@ -26,6 +26,8 @@ class PurchaseOrderLine(models.Model):
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')
+ qty_available_store = fields.Float(string='Available')
+ suggest = fields.Char(string='Suggest')
def compute_qty_stock(self):
for line in self:
diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml
index fb85f4c1..eb5267e0 100755
--- a/indoteknik_custom/views/purchase_order.xml
+++ b/indoteknik_custom/views/purchase_order.xml
@@ -46,10 +46,8 @@
<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 name="qty_available_store"/>
+ <field name="suggest"/>
</field>
<page name="purchase_delivery_invoice" position="after">
<page name="purchase_vendor_bills" string="Vendor Bills" groups="indoteknik_custom.technical_administrator">