diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-03-27 15:47:32 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-03-27 15:47:32 +0700 |
| commit | 5f813fe3aec30873c6cbac323954f275c1eb31f7 (patch) | |
| tree | 7824707d8a28169a8924bc58fb0d3389b3da6f56 | |
| parent | b3981d40d8cc8788bcec0aaa1444f5cf5328fa56 (diff) | |
remove compute on vendor_id purchasing job
| -rw-r--r-- | indoteknik_custom/models/purchasing_job.py | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/indoteknik_custom/models/purchasing_job.py b/indoteknik_custom/models/purchasing_job.py index 1c74f0e9..06985041 100644 --- a/indoteknik_custom/models/purchasing_job.py +++ b/indoteknik_custom/models/purchasing_job.py @@ -12,7 +12,7 @@ class PurchasingJob(models.Model): id = fields.Integer() product_id = fields.Many2one('product.product', string="Product") - vendor_id = fields.Many2one('res.partner', string="Vendor", compute='compute_vendor_id') + vendor_id = fields.Many2one('res.partner', string="Vendor") brand = fields.Char(string='Brand') item_code = fields.Char(string='Item Code') product = fields.Char(string='Product Name') @@ -25,20 +25,6 @@ class PurchasingJob(models.Model): ('apo', 'APO') ], string='APO?') - def compute_vendor_id(self): - for sale in self: - domain = [ - ('product_id', '=', sale.product_id.id) - ] - sales = self.env['v.sales.outstanding'].search(domain) - - vendor_id = False - - if sales: - vendor_id = sales[0].sale_line_id.vendor_id.id - - sale.vendor_id = vendor_id - def init(self): tools.drop_view_if_exists(self.env.cr, self._table) self.env.cr.execute(""" @@ -53,9 +39,12 @@ class PurchasingJob(models.Model): pmp.incoming, pmp.outgoing, pmp.action, - pjs.status_apo AS status_apo + pjs.status_apo AS status_apo, + sol.vendor_id AS vendor_id FROM v_procurement_monitoring_by_product pmp LEFT JOIN purchasing_job_state pjs ON pjs.purchasing_job_id = pmp.product_id + LEFT JOIN v_sales_outstanding so ON so.product_id = pmp.product_id + LEFT JOIN sale_order_line sol ON so.sale_line_id = sol.id WHERE pmp.action = 'kurang' ) """ % self._table) |
