From ae2dcf170e30653418a2026f215768015b19eb21 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Sat, 25 May 2024 11:59:33 +0700 Subject: fix bug purchasing job --- indoteknik_custom/models/purchasing_job_multi_update.py | 14 +++++++------- indoteknik_custom/views/purchasing_job.xml | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/indoteknik_custom/models/purchasing_job_multi_update.py b/indoteknik_custom/models/purchasing_job_multi_update.py index 0145b112..deba960a 100644 --- a/indoteknik_custom/models/purchasing_job_multi_update.py +++ b/indoteknik_custom/models/purchasing_job_multi_update.py @@ -15,15 +15,15 @@ class PurchasingJobMultiUpdate(models.TransientModel): # if product.status_apo == 'apo': # raise UserError('Ada Purchase Order yang statusnya APO, proses dulu') purchasing_job_state = self.env['purchasing.job.state'].search([ - ('purchasing_job_id', '=', product.id), - ('status_apo', '=', 'apo') + ('purchasing_job_id', '=', product.id) ]) - if not purchasing_job_state: - purchasing_job_state.create({ - 'purchasing_job_id': product.id, - 'status_apo': 'apo', - }) + purchasing_job_state.unlink() + + purchasing_job_state.create({ + 'purchasing_job_id': product.id, + 'status_apo': 'apo', + }) apo = self.env['automatic.purchase'].generate_regular_purchase(products) return { diff --git a/indoteknik_custom/views/purchasing_job.xml b/indoteknik_custom/views/purchasing_job.xml index 290955cf..16f1bedd 100644 --- a/indoteknik_custom/views/purchasing_job.xml +++ b/indoteknik_custom/views/purchasing_job.xml @@ -14,7 +14,7 @@ - + -- cgit v1.2.3