summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-01-24 10:34:03 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-01-24 10:34:03 +0700
commit2781fdc5b7ce06ef1a68258b96956856bae18519 (patch)
tree2cadb4e2c028147dcc952f6bc4a69fd1ef26a419
parentd86a60d49cd65bc8f83e0b89954fb1d4e23bb237 (diff)
fix sale monitoring detail query
-rwxr-xr-xindoteknik_custom/models/sale_monitoring_detail.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/indoteknik_custom/models/sale_monitoring_detail.py b/indoteknik_custom/models/sale_monitoring_detail.py
index ef2c832f..8c35b1cc 100755
--- a/indoteknik_custom/models/sale_monitoring_detail.py
+++ b/indoteknik_custom/models/sale_monitoring_detail.py
@@ -25,6 +25,16 @@ class SaleMonitoringDetail(models.Model):
note = fields.Char(string="Note")
vendor_id = fields.Many2one('res.partner', string='Vendor')
+ def _compute_vendor(self):
+ for r in self:
+ sale_lines = self.env['sale.order.line'].search([
+ ('order_id', '=', r.sale_order_id.id),
+ ('product_id', '=', r.product_id.id),
+ ])
+
+ for line in sale_lines:
+ r.vendor_id = line.vendor_id.id
+
def init(self):
tools.drop_view_if_exists(self.env.cr, self._table)
self.env.cr.execute("""
@@ -55,8 +65,8 @@ class SaleMonitoringDetail(models.Model):
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_reserved(so.id, sol.product_id) as qty_reserved,
- get_vendor_id(so.id, sol.product_id) as vendor_id,
- sol.note_procurement as note
+ sol.note_procurement as note,
+ sol.vendor_id as vendor_id
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