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.py | 9 +++++++-- indoteknik_custom/models/sale_monitoring_detail.py | 10 +++++++--- indoteknik_custom/views/sale_monitoring.xml | 6 ++++-- indoteknik_custom/views/sale_monitoring_detail.xml | 6 ++++-- 4 files changed, 22 insertions(+), 9 deletions(-) (limited to 'indoteknik_custom') diff --git a/indoteknik_custom/models/sale_monitoring.py b/indoteknik_custom/models/sale_monitoring.py index a3265a8b..ea1e490c 100755 --- a/indoteknik_custom/models/sale_monitoring.py +++ b/indoteknik_custom/models/sale_monitoring.py @@ -20,6 +20,7 @@ class SaleMonitoring(models.Model): date_order = fields.Datetime(string="Date Order") status = fields.Char(string="Status") po_number = fields.Char(string="PO Number") + qty_reserved = fields.Integer(string="Qty Reserved") def init(self): tools.drop_view_if_exists(self.env.cr, self._table) @@ -36,9 +37,13 @@ class SaleMonitoring(models.Model): SUM(smd.qty_po_received) AS qty_po_received, SUM(smd.qty_so_delivered) AS qty_so_delivered, SUM(smd.qty_so_invoiced) AS qty_so_invoiced, + sum(smd.qty_reserved) as qty_reserved, CASE - WHEN SUM(qty_po) < SUM(qty_so) AND SUM(qty_po) <= 0 THEN 'Belum PO sama sekali' - WHEN SUM(qty_po) < SUM(qty_so) THEN 'Belum PO full' + WHEN SUM(qty_so) = SUM(qty_reserved) then 'SIAP KIRIM' + WHEN SUM(qty_so) = SUM(qty_so_delivered) then 'Delivered' + WHEN SUM(qty_so) = SUM(qty_so_invoiced) then 'Done' + WHEN SUM(qty_reserved) < SUM(qty_so) and SUM(qty_reserved) > 0 THEN 'Belum PO full' + WHEN SUM(qty_reserved) = SUM(qty_so) THEN 'Belum PO sama sekali' WHEN SUM(qty_po_received) < SUM(qty_so) AND SUM(qty_po_received) <= 0 THEN 'Belum Received sama sekali' WHEN SUM(qty_po_received) < SUM(qty_so) THEN 'Belum Received full' WHEN SUM(qty_to_delivered) = SUM(qty_so) THEN 'SIAP KIRIM' 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 diff --git a/indoteknik_custom/views/sale_monitoring.xml b/indoteknik_custom/views/sale_monitoring.xml index b3b186e9..fffd140f 100755 --- a/indoteknik_custom/views/sale_monitoring.xml +++ b/indoteknik_custom/views/sale_monitoring.xml @@ -13,6 +13,7 @@ + @@ -22,7 +23,7 @@ decoration-danger="status == 'Belum PO sama sekali' or status == 'Belum PO full'" decoration-warning="status == 'Belum Received sama sekali' or status == 'Belum Received full'" decoration-success="status == 'SIAP KIRIM' or status == 'KIRIM SISANYA'" - decoration-info="status == 'Belum Invoiced'" + decoration-info="status == 'Belum Invoiced' or status == 'Done' or status == 'Delivered'" /> @@ -44,12 +45,13 @@ decoration-danger="status == 'Belum PO sama sekali' or status == 'Belum PO full'" decoration-warning="status == 'Belum Received sama sekali' or status == 'Belum Received full'" decoration-success="status == 'SIAP KIRIM' or status == 'KIRIM SISANYA'" - decoration-info="status == 'Belum Invoiced'" + decoration-info="status == 'Belum Invoiced' or status == 'Done' or status == 'Delivered'" /> + diff --git a/indoteknik_custom/views/sale_monitoring_detail.xml b/indoteknik_custom/views/sale_monitoring_detail.xml index b9602abd..78bb92c7 100755 --- a/indoteknik_custom/views/sale_monitoring_detail.xml +++ b/indoteknik_custom/views/sale_monitoring_detail.xml @@ -11,6 +11,7 @@ + @@ -20,7 +21,7 @@ decoration-danger="status == 'Belum PO sama sekali' or status == 'Belum PO full'" decoration-warning="status == 'Belum Received sama sekali' or status == 'Belum Received full'" decoration-success="status == 'SIAP KIRIM' or status == 'KIRIM SISANYA'" - decoration-info="status == 'Belum Invoiced' or status == 'Done'" + decoration-info="status == 'Belum Invoiced' or status == 'Done' or status == 'Delivered'" /> @@ -43,11 +44,12 @@ decoration-danger="status == 'Belum PO sama sekali' or status == 'Belum PO full'" decoration-warning="status == 'Belum Received sama sekali' or status == 'Belum Received full'" decoration-success="status == 'SIAP KIRIM' or status == 'KIRIM SISANYA'" - decoration-info="status == 'Belum Invoiced'" + decoration-info="status == 'Belum Invoiced' or status == 'Done' or status == 'Delivered'" /> + -- cgit v1.2.3 From 64507a0c199721fee5e3fc8c808adec5a3ee6a5d Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Thu, 15 Jun 2023 11:54:20 +0700 Subject: revert code nathan --- indoteknik_custom/models/purchase_order.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'indoteknik_custom') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index ea75539a..7e18bd8f 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -151,10 +151,11 @@ class PurchaseOrder(models.Model): self.order_line.unlink() for order_line in self.sale_order_id.order_line: if order_line.product_id.id and order_line.product_id.id not in products_exception: - qty_available = self.env['stock.quant'].search([ - ('product_id', '=', order_line.product_id.id), - ('location_id', '=', "BU/Stock") - ], limit=1) + # qty_available = self.env['stock.quant'].search([ + # ('product_id', '=', order_line.product_id.id), + # ('location_id', '=', "BU/Stock") + # ], limit=1) + qty_available = order_line.product_id.virtual_available suggest = 'harus beli' if order_line.product_id.virtual_available > order_line.product_qty: suggest = 'masih cukup' @@ -163,10 +164,10 @@ class PurchaseOrder(models.Model): 'product_id': order_line.product_id.id, 'name': order_line.product_id.display_name, 'product_qty': order_line.product_qty, - 'qty_available_store': qty_available.available_quantity, + 'qty_available_store': qty_available, 'suggest': suggest, } - self.order_line.create(values) + self.env['purchase.order.line'].sudo().create(values) def compute_count_line_product(self): for order in self: -- 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.py | 16 ++++++---------- indoteknik_custom/models/sale_monitoring_detail.py | 16 ++++++---------- indoteknik_custom/views/sale_monitoring.xml | 16 ++++++++-------- indoteknik_custom/views/sale_monitoring_detail.xml | 16 ++++++++-------- 4 files changed, 28 insertions(+), 36 deletions(-) (limited to 'indoteknik_custom') diff --git a/indoteknik_custom/models/sale_monitoring.py b/indoteknik_custom/models/sale_monitoring.py index ea1e490c..e79ff9ab 100755 --- a/indoteknik_custom/models/sale_monitoring.py +++ b/indoteknik_custom/models/sale_monitoring.py @@ -39,16 +39,12 @@ class SaleMonitoring(models.Model): SUM(smd.qty_so_invoiced) AS qty_so_invoiced, sum(smd.qty_reserved) as qty_reserved, CASE - WHEN SUM(qty_so) = SUM(qty_reserved) then 'SIAP KIRIM' - WHEN SUM(qty_so) = SUM(qty_so_delivered) then 'Delivered' - WHEN SUM(qty_so) = SUM(qty_so_invoiced) then 'Done' - WHEN SUM(qty_reserved) < SUM(qty_so) and SUM(qty_reserved) > 0 THEN 'Belum PO full' - WHEN SUM(qty_reserved) = SUM(qty_so) THEN 'Belum PO sama sekali' - WHEN SUM(qty_po_received) < SUM(qty_so) AND SUM(qty_po_received) <= 0 THEN 'Belum Received sama sekali' - WHEN SUM(qty_po_received) < SUM(qty_so) THEN 'Belum Received full' - WHEN SUM(qty_to_delivered) = SUM(qty_so) THEN 'SIAP KIRIM' - WHEN SUM(qty_to_delivered) < SUM(qty_so) and SUM(qty_to_delivered) > 0 THEN 'KIRIM SISANYA' - ELSE 'Belum Invoiced' + when sum(qty_so_invoiced) = sum(qty_so) then 'Invoiced' + when sum(qty_so_delivered) = sum(qty_so) then 'Delivered' + when sum(qty_reserved) >= sum(qty_so) then 'Siap kirim' + when sum(qty_po) + sum(qty_reserved) - sum(qty_po_received) < sum(qty_so) then 'Belum/Kurang PO' + when sum(qty_po_received) = 0 then 'Belum terima' + when sum(qty_po_received) < sum(qty_po) then 'Terima sebagian' END AS status, get_po_number(smd.sale_order_id) as po_number FROM sale_monitoring_detail smd 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 ( diff --git a/indoteknik_custom/views/sale_monitoring.xml b/indoteknik_custom/views/sale_monitoring.xml index fffd140f..956e4a24 100755 --- a/indoteknik_custom/views/sale_monitoring.xml +++ b/indoteknik_custom/views/sale_monitoring.xml @@ -20,10 +20,10 @@ @@ -42,10 +42,10 @@ diff --git a/indoteknik_custom/views/sale_monitoring_detail.xml b/indoteknik_custom/views/sale_monitoring_detail.xml index 78bb92c7..736920b3 100755 --- a/indoteknik_custom/views/sale_monitoring_detail.xml +++ b/indoteknik_custom/views/sale_monitoring_detail.xml @@ -18,10 +18,10 @@ @@ -41,10 +41,10 @@ -- cgit v1.2.3 From 92fae861a362ad49bb299ceeac62d517108880de Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Fri, 16 Jun 2023 08:52:48 +0700 Subject: Update sale_order shipping paid by and shipping cost covered required when create_date > 2023-06-15 --- indoteknik_custom/views/sale_order.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom') diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index ea13c954..53740dd5 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -19,8 +19,9 @@ type="action" attrs="{'invisible': [('approval_status', '!=', 'approved')]}"/> - - + + + -- cgit v1.2.3 From d22fb25a88cacabd470780588c200c065e0633cd Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Fri, 16 Jun 2023 09:28:11 +0700 Subject: add filter sale monitoring --- indoteknik_custom/views/sale_monitoring.xml | 15 +++++++++++++++ indoteknik_custom/views/sale_monitoring_detail.xml | 16 ++++++++++++++++ 2 files changed, 31 insertions(+) (limited to 'indoteknik_custom') diff --git a/indoteknik_custom/views/sale_monitoring.xml b/indoteknik_custom/views/sale_monitoring.xml index 956e4a24..0a9a5aa5 100755 --- a/indoteknik_custom/views/sale_monitoring.xml +++ b/indoteknik_custom/views/sale_monitoring.xml @@ -63,10 +63,25 @@ + + sale.monitoring.list.select + sale.monitoring + + + + + + + + + + + Sale Monitoring ir.actions.act_window sale.monitoring + tree,form diff --git a/indoteknik_custom/views/sale_monitoring_detail.xml b/indoteknik_custom/views/sale_monitoring_detail.xml index 736920b3..824e65e8 100755 --- a/indoteknik_custom/views/sale_monitoring_detail.xml +++ b/indoteknik_custom/views/sale_monitoring_detail.xml @@ -61,10 +61,26 @@ + + sale.monitoring.detail.list.select + sale.monitoring.detail + + + + + + + + + + + + Sale Monitoring Detail ir.actions.act_window sale.monitoring.detail + tree,form -- cgit v1.2.3 From ad2e6cc9d119e0b72ccdb353eb8a2e0fa304e359 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Fri, 16 Jun 2023 10:35:48 +0700 Subject: comment temporary validation --- indoteknik_custom/models/sale_order.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom') diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index cbc6a60a..52b959db 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -336,8 +336,8 @@ class SaleOrder(models.Model): raise UserError("Invoice harus di Cancel dahulu") elif self.have_outstanding_picking: raise UserError("DO harus di Cancel dahulu") - elif self.have_outstanding_po: - raise UserError("PO harus di Cancel dahulu") + # elif self.have_outstanding_po: + # raise UserError("PO harus di Cancel dahulu") self.approval_status = False return super(SaleOrder, self).action_cancel() -- cgit v1.2.3 From fd63ff133764477f39c9dd32c5177dd67f293abb Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Fri, 16 Jun 2023 11:36:00 +0700 Subject: optional hide for line no in sale and purchase --- indoteknik_custom/views/purchase_order.xml | 2 +- indoteknik_custom/views/sale_order.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom') diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml index a4c77c58..7a397ff6 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -43,7 +43,7 @@ - + diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index 53740dd5..94073fd7 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -63,7 +63,7 @@ - + -- cgit v1.2.3 From e2ccd5719de9cf03a422e93fbef9a7f035b854a5 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Fri, 16 Jun 2023 15:59:46 +0700 Subject: Fix shipping cost and paid by required when create_date false or greater than 15 Juni 2023 --- indoteknik_custom/views/sale_order.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom') diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index 94073fd7..b160d9b1 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -20,8 +20,8 @@ - - + + -- cgit v1.2.3