summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/sale_monitoring_detail.py
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-06-15 15:47:05 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-06-15 15:47:05 +0700
commit55c67c71b04fce80c635b3a58d91c8bcb02e17c8 (patch)
treeed8833b969800e36b887b4134c14dab89d3b91c7 /indoteknik_custom/models/sale_monitoring_detail.py
parent1f2995a85428ac4335123bd33d48ae17d3c9f36f (diff)
parent24649f8e939484759ef34e5e68f251d951f63c02 (diff)
Merge commit '24649f8e939484759ef34e5e68f251d951f63c02'
Conflicts: indoteknik_custom/__manifest__.py indoteknik_custom/security/ir.model.access.csv
Diffstat (limited to 'indoteknik_custom/models/sale_monitoring_detail.py')
-rwxr-xr-xindoteknik_custom/models/sale_monitoring_detail.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/indoteknik_custom/models/sale_monitoring_detail.py b/indoteknik_custom/models/sale_monitoring_detail.py
index a578f67b..2bcda50c 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,14 +30,12 @@ class SaleMonitoringDetail(models.Model):
SELECT
*,
CASE
- 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_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
(
@@ -52,7 +51,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