summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-08-22 14:10:16 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-08-22 14:10:16 +0700
commit77abcebaa3c7532107c4dd3ba3854b25a3dc03e3 (patch)
tree0b44420c9936d2c9455a6f17bc53b09d5d4b1841
parenta8ea5407be21c56fb29b63de08b40b92a887fa26 (diff)
add customer and salesperson in sale order monitoring
-rwxr-xr-xindoteknik_custom/models/sale_monitoring.py8
-rwxr-xr-xindoteknik_custom/models/sale_monitoring_detail.py6
-rwxr-xr-xindoteknik_custom/views/sale_monitoring.xml4
-rwxr-xr-xindoteknik_custom/views/sale_monitoring_detail.xml4
4 files changed, 19 insertions, 3 deletions
diff --git a/indoteknik_custom/models/sale_monitoring.py b/indoteknik_custom/models/sale_monitoring.py
index 70c51132..97e96e72 100755
--- a/indoteknik_custom/models/sale_monitoring.py
+++ b/indoteknik_custom/models/sale_monitoring.py
@@ -8,6 +8,8 @@ class SaleMonitoring(models.Model):
id = fields.Integer()
sale_order_id = fields.Many2one("sale.order", string="Sale Order")
+ partner_id = fields.Many2one("res.partner", string="Customer")
+ user_id = fields.Many2one("res.users", string="Salesperson")
qty_so = fields.Integer(string="Qty SO")
qty_po = fields.Integer(string="Qty PO")
qty_po_received = fields.Integer(string="Qty PO Received")
@@ -23,7 +25,9 @@ class SaleMonitoring(models.Model):
SELECT
smd.sale_order_id AS id,
smd.date_order,
- smd.sale_order_id,
+ smd.sale_order_id,
+ smd.partner_id,
+ smd.user_id,
SUM(smd.qty_so) AS qty_so,
SUM(smd.qty_po) AS qty_po,
SUM(smd.qty_po_received) AS qty_po_received,
@@ -39,6 +43,6 @@ class SaleMonitoring(models.Model):
ELSE 'Belum Invoiced'
END AS status
FROM sale_monitoring_detail smd
- GROUP BY smd.date_order, smd.sale_order_id
+ GROUP BY smd.date_order, smd.sale_order_id, smd.partner_id, smd.user_id
)
""" % self._table)
diff --git a/indoteknik_custom/models/sale_monitoring_detail.py b/indoteknik_custom/models/sale_monitoring_detail.py
index ec9fe222..cb412c98 100755
--- a/indoteknik_custom/models/sale_monitoring_detail.py
+++ b/indoteknik_custom/models/sale_monitoring_detail.py
@@ -8,6 +8,8 @@ class SaleMonitoringDetail(models.Model):
id = fields.Integer()
sale_order_id = fields.Many2one("sale.order", string="Sale Order")
+ partner_id = fields.Many2one("res.partner", string="Customer")
+ user_id = fields.Many2one("res.users", string="Salesperson")
product_id = fields.Many2one("product.product", string="Product")
qty_so = fields.Integer(string="Qty SO")
qty_po = fields.Integer(string="Qty PO")
@@ -36,7 +38,9 @@ class SaleMonitoringDetail(models.Model):
(
SELECT
p.id AS id,
- so.id AS sale_order_id,
+ so.id AS sale_order_id,
+ so.partner_id as partner_id,
+ so.user_id,
p.id AS product_id,
sol.product_uom_qty AS qty_so,
sol.qty_delivered AS qty_so_delivered,
diff --git a/indoteknik_custom/views/sale_monitoring.xml b/indoteknik_custom/views/sale_monitoring.xml
index 15b55e2e..e4139677 100755
--- a/indoteknik_custom/views/sale_monitoring.xml
+++ b/indoteknik_custom/views/sale_monitoring.xml
@@ -7,6 +7,8 @@
<tree create="false">
<field name="date_order"/>
<field name="sale_order_id"/>
+ <field name="partner_id"/>
+ <field name="user_id"/>
<field name="qty_so"/>
<field name="qty_po"/>
<field name="qty_po_received"/>
@@ -32,6 +34,8 @@
<group>
<group>
<field name="sale_order_id"/>
+ <field name="partner_id"/>
+ <field name="user_id"/>
<field name="status"
widget="badge"
decoration-danger="status == 'Belum PO sama sekali' or status == 'Belum PO full'"
diff --git a/indoteknik_custom/views/sale_monitoring_detail.xml b/indoteknik_custom/views/sale_monitoring_detail.xml
index 3a3ea787..9e4734d3 100755
--- a/indoteknik_custom/views/sale_monitoring_detail.xml
+++ b/indoteknik_custom/views/sale_monitoring_detail.xml
@@ -7,6 +7,8 @@
<tree create="false">
<field name="date_order"/>
<field name="sale_order_id"/>
+ <field name="partner_id"/>
+ <field name="user_id"/>
<field name="product_id"/>
<field name="qty_so"/>
<field name="qty_po"/>
@@ -33,6 +35,8 @@
<group>
<group>
<field name="sale_order_id"/>
+ <field name="partner_id"/>
+ <field name="user_id"/>
<field name="product_id"/>
<field name="status"
widget="badge"