diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2023-04-27 11:24:08 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2023-04-27 11:24:08 +0700 |
| commit | 0de73173e682928c11949fe40babeb64e1a7b2f8 (patch) | |
| tree | 8b55a5c976f4c2b1fe12736f2acb9ddc6e59e553 | |
| parent | 04216fb6fc1ecc1bba78b7f0ed50195d3876b287 (diff) | |
fix procurement monitoring
| -rw-r--r-- | indoteknik_custom/models/procurement_monitoring_detail.py | 7 | ||||
| -rw-r--r-- | indoteknik_custom/views/procurement_monitoring_detail.xml | 1 |
2 files changed, 6 insertions, 2 deletions
diff --git a/indoteknik_custom/models/procurement_monitoring_detail.py b/indoteknik_custom/models/procurement_monitoring_detail.py index 348fce68..97d35faf 100644 --- a/indoteknik_custom/models/procurement_monitoring_detail.py +++ b/indoteknik_custom/models/procurement_monitoring_detail.py @@ -17,7 +17,8 @@ class SaleMonitoringDetail(models.Model): qty_so = fields.Integer(string="Qty SO") qty_reserved = fields.Integer(string="Qty Reserved") qty_available = fields.Integer(string="Qty Available") - qty_po = fields.Integer(string="Qty PO") + qty_suggest = fields.Integer(string="Qty Suggest") + qty_po = fields.Integer(string='Qty PO') date_order = fields.Datetime(string="Date Order") status = fields.Char(string="Status") @@ -27,7 +28,7 @@ class SaleMonitoringDetail(models.Model): CREATE OR REPLACE VIEW %s AS ( SELECT *, - a.qty_so-a.qty_reserved as qty_po, + a.qty_so-a.qty_reserved as qty_suggest, case when a.qty_so-a.qty_reserved > 0 then 'harus beli' else 'cukup' end as status FROM @@ -41,6 +42,7 @@ class SaleMonitoringDetail(models.Model): sol.product_uom_qty AS qty_so, get_qty_available(sol.product_id) as qty_available, get_qty_reserved(so.id, sol.product_id) as qty_reserved, + get_qty_po(so.id, sol.product_id) AS qty_po, so.date_order AS date_order FROM sale_order so JOIN sale_order_line sol ON sol.order_id = so.id @@ -51,5 +53,6 @@ class SaleMonitoringDetail(models.Model): AND so.create_date >= '2022-08-10' and so.so_status not in ('terproses') ) a + where a.qty_po < a.qty_so ) """ % self._table) diff --git a/indoteknik_custom/views/procurement_monitoring_detail.xml b/indoteknik_custom/views/procurement_monitoring_detail.xml index 4819fccd..b3785d14 100644 --- a/indoteknik_custom/views/procurement_monitoring_detail.xml +++ b/indoteknik_custom/views/procurement_monitoring_detail.xml @@ -13,6 +13,7 @@ <field name="qty_so"/> <field name="qty_reserved"/> <field name="qty_available"/> + <field name="qty_suggest"/> <field name="qty_po"/> <field name="status" widget="badge" |
