From 095e0a6815bcc64d638d64f72f5f392aa92ec7b6 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Wed, 31 May 2023 11:10:48 +0700 Subject: bug fix sale monitoring detail --- indoteknik_custom/models/sale_monitoring_detail.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models/sale_monitoring_detail.py') diff --git a/indoteknik_custom/models/sale_monitoring_detail.py b/indoteknik_custom/models/sale_monitoring_detail.py index a578f67b..6c609ac2 100755 --- a/indoteknik_custom/models/sale_monitoring_detail.py +++ b/indoteknik_custom/models/sale_monitoring_detail.py @@ -60,7 +60,7 @@ class SaleMonitoringDetail(models.Model): WHERE pt.type IN ('consu','product') AND so.state IN ('sale','done') AND so.create_date >= '2022-08-10' - and so.so_status not in('terproses') + and (so.so_status not in('terproses') or so.invoice_status not in('invoiced')) ) a ) """ % self._table) -- cgit v1.2.3 From 21f7c7a9b5ad175994b0824f82f9459feed3ca90 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Wed, 31 May 2023 14:09:59 +0700 Subject: add calculate all so status function --- indoteknik_custom/models/sale_monitoring_detail.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models/sale_monitoring_detail.py') diff --git a/indoteknik_custom/models/sale_monitoring_detail.py b/indoteknik_custom/models/sale_monitoring_detail.py index 6c609ac2..a578f67b 100755 --- a/indoteknik_custom/models/sale_monitoring_detail.py +++ b/indoteknik_custom/models/sale_monitoring_detail.py @@ -60,7 +60,7 @@ class SaleMonitoringDetail(models.Model): WHERE pt.type IN ('consu','product') AND so.state IN ('sale','done') AND so.create_date >= '2022-08-10' - and (so.so_status not in('terproses') or so.invoice_status not in('invoiced')) + and so.so_status not in('terproses') ) a ) """ % self._table) -- cgit v1.2.3 From 1edd55b85c24b8f9a36349fa34793cb65a554851 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Thu, 15 Jun 2023 11:50:08 +0700 Subject: add qty reserved in sale monitoring and sale monitoring detail --- indoteknik_custom/models/sale_monitoring_detail.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'indoteknik_custom/models/sale_monitoring_detail.py') diff --git a/indoteknik_custom/models/sale_monitoring_detail.py b/indoteknik_custom/models/sale_monitoring_detail.py index a578f67b..908ccb68 100755 --- a/indoteknik_custom/models/sale_monitoring_detail.py +++ b/indoteknik_custom/models/sale_monitoring_detail.py @@ -21,6 +21,7 @@ class SaleMonitoringDetail(models.Model): qty_so_invoiced = fields.Integer(string="Qty SO Invoiced") date_order = fields.Datetime(string="Date Order") status = fields.Char(string="Status") + qty_reserved = fields.Integer(string="Qty Reserved") def init(self): tools.drop_view_if_exists(self.env.cr, self._table) @@ -29,9 +30,11 @@ class SaleMonitoringDetail(models.Model): SELECT *, CASE + WHEN qty_so = qty_reserved then 'SIAP KIRIM' + WHEN qty_so = qty_so_delivered then 'Delivered' WHEN qty_so = qty_so_invoiced then 'Done' - WHEN qty_po < qty_so AND qty_po <= 0 THEN 'Belum PO sama sekali' - WHEN qty_po < qty_so THEN 'Belum PO full' + WHEN qty_reserved < qty_so and qty_reserved > 0 THEN 'Belum PO full' + WHEN qty_reserved = qty_so THEN 'Belum PO sama sekali' WHEN qty_po_received < qty_so and qty_po_received <= 0 THEN 'Belum Received sama sekali' WHEN qty_po_received < qty_so THEN 'Belum Received full' WHEN qty_to_delivered = qty_so THEN 'SIAP KIRIM' @@ -52,7 +55,8 @@ class SaleMonitoringDetail(models.Model): sol.qty_invoiced AS qty_so_invoiced, so.date_order AS date_order, get_qty_po(so.id, sol.product_id) AS qty_po, - get_qty_received(so.id, sol.product_id) AS qty_po_received + get_qty_received(so.id, sol.product_id) AS qty_po_received, + get_qty_reserved(so.id, sol.product_id) as qty_reserved FROM sale_order so JOIN sale_order_line sol ON sol.order_id = so.id JOIN product_product p ON p.id = sol.product_id -- cgit v1.2.3 From d32accf86a2baffcf7ce90554d1f8868ab518cf4 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Thu, 15 Jun 2023 15:07:24 +0700 Subject: change logic of sales monitoring --- indoteknik_custom/models/sale_monitoring_detail.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'indoteknik_custom/models/sale_monitoring_detail.py') diff --git a/indoteknik_custom/models/sale_monitoring_detail.py b/indoteknik_custom/models/sale_monitoring_detail.py index 908ccb68..2bcda50c 100755 --- a/indoteknik_custom/models/sale_monitoring_detail.py +++ b/indoteknik_custom/models/sale_monitoring_detail.py @@ -30,16 +30,12 @@ class SaleMonitoringDetail(models.Model): SELECT *, CASE - WHEN qty_so = qty_reserved then 'SIAP KIRIM' - WHEN qty_so = qty_so_delivered then 'Delivered' - WHEN qty_so = qty_so_invoiced then 'Done' - WHEN qty_reserved < qty_so and qty_reserved > 0 THEN 'Belum PO full' - WHEN qty_reserved = qty_so THEN 'Belum PO sama sekali' - WHEN qty_po_received < qty_so and qty_po_received <= 0 THEN 'Belum Received sama sekali' - WHEN qty_po_received < qty_so THEN 'Belum Received full' - WHEN qty_to_delivered = qty_so THEN 'SIAP KIRIM' - WHEN qty_to_delivered < qty_so and qty_to_delivered > 0 THEN 'KIRIM SISANYA' - ELSE 'Belum Invoiced' + when qty_so_invoiced = qty_so then 'Invoiced' + when qty_so_delivered = qty_so then 'Delivered' + when qty_reserved >= qty_so then 'Siap kirim' + when qty_po + qty_reserved - qty_po_received < qty_so then 'Belum/Kurang PO' + when qty_po_received = 0 then 'Belum terima' + when qty_po_received < qty_po then 'Terima sebagian' END AS status FROM ( -- cgit v1.2.3