summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/sale_monitoring.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.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.py')
-rwxr-xr-xindoteknik_custom/models/sale_monitoring.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/indoteknik_custom/models/sale_monitoring.py b/indoteknik_custom/models/sale_monitoring.py
index a3265a8b..e79ff9ab 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,14 +37,14 @@ 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_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