From 9abad8c8ee173626b05d13a5db9e81352dce0bb6 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Fri, 22 Dec 2023 09:04:34 +0700 Subject: Add field on model - sale_automatic_id (purchase.order.line) - order_sales_match_line (sale.order) --- indoteknik_custom/models/purchase_order_line.py | 1 + 1 file changed, 1 insertion(+) (limited to 'indoteknik_custom/models/purchase_order_line.py') diff --git a/indoteknik_custom/models/purchase_order_line.py b/indoteknik_custom/models/purchase_order_line.py index f1c20106..06ffd57a 100755 --- a/indoteknik_custom/models/purchase_order_line.py +++ b/indoteknik_custom/models/purchase_order_line.py @@ -33,6 +33,7 @@ class PurchaseOrderLine(models.Model): indent = fields.Boolean(string='Indent', help='centang ini jika barang indent') is_ltc = fields.Boolean(string='Sudah di LTC', default=False, help='centang ini jika barang sudah di LTC') note = fields.Char(string='Note') + sale_automatic_id = fields.Many2one('sale.order', string='SO') def suggest_purchasing(self): for line in self: -- cgit v1.2.3 From 8a10587c8582ed68944634928c9a7c34d3321dbe Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Fri, 22 Dec 2023 13:35:26 +0700 Subject: matches so on po and matches po on so --- indoteknik_custom/models/purchase_order_line.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom/models/purchase_order_line.py') diff --git a/indoteknik_custom/models/purchase_order_line.py b/indoteknik_custom/models/purchase_order_line.py index 95813e0d..8d7d818b 100755 --- a/indoteknik_custom/models/purchase_order_line.py +++ b/indoteknik_custom/models/purchase_order_line.py @@ -34,10 +34,16 @@ class PurchaseOrderLine(models.Model): is_ltc = fields.Boolean(string='Sudah di LTC', default=False, help='centang ini jika barang sudah di LTC') note = fields.Char(string='Note') sale_automatic_id = fields.Many2one('sale.order', string='SO') + + + # so_line.qty_reserved (compute) + # so_line.qty_reserved = get from picking_ids where type outgoing and prodid = line.prodid + # po_line.qty_reserved = cek dulu apakah ada relasi ke sale order. Jika ada maka ambil sesuai yang ada di sale order (so_line.qty_reserved), + # jika tidak maka 0 def suggest_purchasing(self): - for line in self: - if line.qty_available < line.product_qty: + for line in self: + if line.product_id.qty_available_bandengan + line.qty_reserved < line.product_qty: line.suggest = 'harus beli' else: line.suggest = 'masih cukup' -- cgit v1.2.3