summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2023-04-29 10:37:22 +0700
committerstephanchrst <stephanchrst@gmail.com>2023-04-29 10:37:22 +0700
commit3285da702db176851e78db9d8afe7af866c31b94 (patch)
tree2aec0d860263a5ccebebdf2b1eb16afb904dc591
parentf704fbd43aac910fb5b2023ad2d61eac918acebc (diff)
add po id in procurement monitoring
-rw-r--r--indoteknik_custom/models/procurement_monitoring_detail.py16
-rw-r--r--indoteknik_custom/views/procurement_monitoring_detail.xml1
2 files changed, 16 insertions, 1 deletions
diff --git a/indoteknik_custom/models/procurement_monitoring_detail.py b/indoteknik_custom/models/procurement_monitoring_detail.py
index 97d35faf..e9da8147 100644
--- a/indoteknik_custom/models/procurement_monitoring_detail.py
+++ b/indoteknik_custom/models/procurement_monitoring_detail.py
@@ -21,6 +21,20 @@ class SaleMonitoringDetail(models.Model):
qty_po = fields.Integer(string='Qty PO')
date_order = fields.Datetime(string="Date Order")
status = fields.Char(string="Status")
+ po_ids = fields.Many2many('purchase.order', string='PO', compute='_compute_po')
+
+ def _compute_po(self):
+ for line in self:
+ query = [
+ ('order_id.sale_order_id', '=', line.sale_order_id.id),
+ ('order_id.approval_status', '=', 'approved'),
+ ('product_id', '=', line.product_id.id),
+ ]
+ pos = self.env['purchase.order.line'].search(query)
+ po_ids = []
+ for po in pos:
+ po_ids.append(po.order_id.id)
+ line.po_ids = po_ids
def init(self):
tools.drop_view_if_exists(self.env.cr, self._table)
@@ -53,6 +67,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
+ --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 b3785d14..8f3827c1 100644
--- a/indoteknik_custom/views/procurement_monitoring_detail.xml
+++ b/indoteknik_custom/views/procurement_monitoring_detail.xml
@@ -14,6 +14,7 @@
<field name="qty_reserved"/>
<field name="qty_available"/>
<field name="qty_suggest"/>
+ <field name="po_ids" widget="many2many_tags"/>
<field name="qty_po"/>
<field name="status"
widget="badge"