diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2023-06-20 14:06:29 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2023-06-20 14:06:29 +0700 |
| commit | a3e6d8b8fa284f8f07d815c14c8e547321161261 (patch) | |
| tree | 96278fc00d75b452ad64f43ae715f75c8a8cf984 | |
| parent | 5006bd2c6cbf09d9f46624b6087cb72702f1ac52 (diff) | |
add qty available bandengan and suggest in requisition
| -rw-r--r-- | indoteknik_custom/models/requisition.py | 12 | ||||
| -rw-r--r-- | indoteknik_custom/views/requisition.xml | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/indoteknik_custom/models/requisition.py b/indoteknik_custom/models/requisition.py index c1af4784..9ae6fb3e 100644 --- a/indoteknik_custom/models/requisition.py +++ b/indoteknik_custom/models/requisition.py @@ -44,6 +44,12 @@ class Requisition(models.Model): purchase_price = 0 vendor_id = 0 + # get qty available bandengan + qty_available = order_line.product_id.qty_onhand_bandengan + order_line.product_id.qty_incoming_bandengan - order_line.product_id.outgoing_qty + suggest = 'harus beli' + if qty_available > order_line.product_qty: + suggest = 'masih cukup' + purchase_pricelist = self.env['purchase.pricelist'].search([ ('product_id.id', '=', order_line.product_id.id), ('vendor_id.id', '=', 5571) @@ -78,7 +84,9 @@ class Requisition(models.Model): 'tax_id': order_line.purchase_tax_id.id, 'price_unit': purchase_price, 'subtotal': purchase_price * order_line.product_uom_qty, - 'source': source + 'source': source, + 'qty_available_store': qty_available, + 'suggest': suggest, }]) count+=1 _logger.info('Create Requisition %s' % order_line.product_id.name) @@ -171,6 +179,8 @@ class RequisitionLine(models.Model): current_po_id = fields.Many2one('purchase.order', string='Current') current_po_line_id = fields.Many2one('purchase.order.line', string='Current Line') source = fields.Char(string='Source', help='data harga diambil darimana') + qty_available_store = fields.Float(string='Available') + suggest = fields.Char(string='Suggest') class RequisitionPurchaseMatch(models.Model): _name = 'requisition.purchase.match' diff --git a/indoteknik_custom/views/requisition.xml b/indoteknik_custom/views/requisition.xml index 29b3a852..9e9440d8 100644 --- a/indoteknik_custom/views/requisition.xml +++ b/indoteknik_custom/views/requisition.xml @@ -27,6 +27,8 @@ <field name="tax_id"/> <field name="subtotal"/> <field name="source"/> + <field name="qty_available_store"/> + <field name="suggest"/> </tree> </field> </record> |
