diff options
| -rw-r--r-- | indoteknik_custom/models/automatic_purchase.py | 12 |
1 files 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: |
