summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/sum_sale_monitoring.py
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2022-08-16 09:48:12 +0700
committerIT Fixcomart <it@fixcomart.co.id>2022-08-16 09:48:12 +0700
commit66579ea9e7ac7e10cf1593e87669f36bc6f6d8c8 (patch)
treece095325c94ff11f8322739604347c48f815d123 /indoteknik_custom/models/sum_sale_monitoring.py
parentcbcf8d34bdc4d0ac2c47184dc46a3393d43bf145 (diff)
Restructure sale.monitoring and sale.monitoring.detail & Create view
Diffstat (limited to 'indoteknik_custom/models/sum_sale_monitoring.py')
-rwxr-xr-xindoteknik_custom/models/sum_sale_monitoring.py32
1 files changed, 0 insertions, 32 deletions
diff --git a/indoteknik_custom/models/sum_sale_monitoring.py b/indoteknik_custom/models/sum_sale_monitoring.py
deleted file mode 100755
index bb392bcf..00000000
--- a/indoteknik_custom/models/sum_sale_monitoring.py
+++ /dev/null
@@ -1,32 +0,0 @@
-from odoo import fields, models, api, tools
-
-class SumSaleMonitoring(models.Model):
- _name = 'sum.sale.monitoring'
- _auto = False
- _rec_name = 'sale_order_id'
-
- date_order = fields.Datetime(string="Date Order")
- sale_order_id = fields.Many2one("sale.order", string="Sale Order")
- qty_so = fields.Integer(string="Qty SO")
- qty_po = fields.Integer(string="Qty PO")
- qty_po_received = fields.Integer(string="Qty PO Received")
- qty_so_delivered = fields.Integer(string="Qty SO Delivered")
- qty_so_invoiced = fields.Integer(string="Qty SO Invoiced")
- status = fields.Char(string="Status")
-
- def init(self):
- tools.drop_view_if_exists(self.env.cr, self._table)
- self.env.cr.execute("""
- select sm.date_order, sm.sale_order_id, sum(sm.qty_so) as qty_so, sum(sm.qty_po) as qty_po,
- sum(sm.qty_po_received) as qty_received, sum(sm.qty_so_delivered) as qty_delivered, sum(sm.qty_so_invoiced) as qty_invoiced,
- 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_po) and sum(qty_po_received) <= 0 then 'Belum Received sama sekali'
- when sum(qty_po_received) <> sum(qty_po) then 'Belum Received full'
- when sum(qty_so_delivered) <> sum(qty_so) and sum(qty_so_delivered) <= 0 then 'SIAP KIRIM'
- when sum(qty_so_delivered) <> sum(qty_so) then 'KIRIM SISANYA'
- else 'Belum Invoiced' end as status
- from sale_monitoring sm
- group by sm.date_order, sm.sale_order_id
- """ % self._table) \ No newline at end of file