From 0738a192409687790c16c757f85fe440cb1f377d Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 12 Feb 2024 08:27:42 +0700 Subject: change request purchasing job --- indoteknik_custom/models/automatic_purchase.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py index 713853e9..da845645 100644 --- a/indoteknik_custom/models/automatic_purchase.py +++ b/indoteknik_custom/models/automatic_purchase.py @@ -63,13 +63,6 @@ class AutomaticPurchase(models.Model): def create_po_from_automatic_purchase(self): - po = self.env['purchase.order'].search([ - ('state', '=', 'draft') - ]) - - if po: - raise UserError('Ada PO yang statusnya draft, proses dulu') - if not self.purchase_lines: raise UserError('Tidak ada Lines, belum bisa create PO') if self.is_po: @@ -270,6 +263,11 @@ class AutomaticPurchase(models.Model): sales_order_purchase_match = self.env['sales.order.purchase.match'].create([matches_po_line]) def generate_regular_purchase(self): + po = self.env['purchase.order'].search([ + ('state', '=', 'draft') + ]) + if po: + raise UserError('Ada PO yang statusnya draft, proses dulu') if self.apo_type == 'reordering': raise UserError('Tombol ini hanya untuk Regular Fulfill SO') if self.vendor_id: -- cgit v1.2.3