diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2023-06-19 12:01:42 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2023-06-19 12:01:42 +0700 |
| commit | 70dbe185533615aaedb7f05c75a7c5530be6eb42 (patch) | |
| tree | 908e3bca71f939214cc7d201f8b0d3da5a69501a | |
| parent | b7c98087933cde132a741d5676e1309a0d5ab445 (diff) | |
add available qty while create po from requisition
| -rw-r--r-- | indoteknik_custom/models/requisition.py | 10 | ||||
| -rw-r--r-- | indoteknik_custom/views/requisition.xml | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/indoteknik_custom/models/requisition.py b/indoteknik_custom/models/requisition.py index 5bb3272e..c1af4784 100644 --- a/indoteknik_custom/models/requisition.py +++ b/indoteknik_custom/models/requisition.py @@ -127,6 +127,12 @@ class Requisition(models.Model): # new_po = self.env['purchase.order'].create([param_header]) brand_id = product.brand_id.id count += 10 + + qty_available = product.product_id.qty_onhand_bandengan + product.product_id.qty_incoming_bandengan - product.product_id.outgoing_qty + suggest = 'harus beli' + if qty_available > product.qty_purchase: + suggest = 'masih cukup' + param_line = { 'order_id': new_po.id, 'sequence': count, @@ -134,7 +140,9 @@ class Requisition(models.Model): 'product_qty': product.qty_purchase, 'product_uom_qty': product.qty_purchase, 'price_unit': product.last_price, - 'taxes_id': product.tax_id + 'taxes_id': product.tax_id, + 'qty_available_store': qty_available, + 'suggest': suggest, } new_line = self.env['purchase.order.line'].create([param_line]) product.current_po_id = new_po.id diff --git a/indoteknik_custom/views/requisition.xml b/indoteknik_custom/views/requisition.xml index 6e61ce1e..29b3a852 100644 --- a/indoteknik_custom/views/requisition.xml +++ b/indoteknik_custom/views/requisition.xml @@ -96,6 +96,6 @@ <menuitem id="menu_requisition" name="Requisition" action="requisition_action" - parent="menu_monitoring_in_purchase" + parent="purchase.menu_procurement_management" sequence="300"/> </odoo>
\ No newline at end of file |
