diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2023-06-20 15:20:05 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2023-06-20 15:20:05 +0700 |
| commit | 7b5e3a665220ebdc1f4c680df2202dc4eb12f4e3 (patch) | |
| tree | ca12a439790acf0191457ac591dd33d6628f5f7b /indoteknik_custom/models/requisition.py | |
| parent | aa59f0f8f3edfc0aa1e257b35d5c6e83b8f6978c (diff) | |
| parent | 45583fb16a83602bea6c02711bfd947f7a402265 (diff) | |
Merge branch 'release' into receipt-approval
Diffstat (limited to 'indoteknik_custom/models/requisition.py')
| -rw-r--r-- | indoteknik_custom/models/requisition.py | 12 |
1 files changed, 11 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' |
