summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2023-06-15 11:50:08 +0700
committerstephanchrst <stephanchrst@gmail.com>2023-06-15 11:50:08 +0700
commit1edd55b85c24b8f9a36349fa34793cb65a554851 (patch)
treebb68fafa733d4cdaa4ea61fa6f37267d72691911
parent66acad265bbb7edcc20bfe1cb5ee34dad53f28d9 (diff)
add qty reserved in sale monitoring and sale monitoring detail
-rwxr-xr-xindoteknik_custom/models/sale_monitoring.py9
-rwxr-xr-xindoteknik_custom/models/sale_monitoring_detail.py10
-rwxr-xr-xindoteknik_custom/views/sale_monitoring.xml6
-rwxr-xr-xindoteknik_custom/views/sale_monitoring_detail.xml6
4 files changed, 22 insertions, 9 deletions
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 @@
<field name="partner_id"/>
<field name="user_id"/>
<field name="qty_so"/>
+ <field name="qty_reserved"/>
<field name="qty_po"/>
<field name="qty_po_received"/>
<field name="qty_so_delivered"/>
@@ -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'"
/>
</tree>
</field>
@@ -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'"
/>
<field name="po_number"/>
</group>
<group>
<field name="qty_so"/>
+ <field name="qty_reserved"/>
<field name="qty_po"/>
<field name="qty_po_received"/>
<field name="qty_so_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 @@
<field name="user_id"/>
<field name="product_id"/>
<field name="qty_so"/>
+ <field name="qty_reserved"/>
<field name="qty_po"/>
<field name="qty_po_received"/>
<field name="qty_so_delivered"/>
@@ -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'"
/>
</tree>
</field>
@@ -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'"
/>
</group>
<group>
<field name="qty_so"/>
+ <field name="qty_reserved"/>
<field name="qty_po"/>
<field name="qty_po_received"/>
<field name="qty_so_delivered"/>