From 72b6d34df5606cf2be49bb66936be092b86c9d15 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 3 Apr 2024 14:30:17 +0700 Subject: Change request automatic purchase and bug fixing --- indoteknik_custom/models/automatic_purchase.py | 2 +- indoteknik_custom/models/purchase_order.py | 9 +++++---- indoteknik_custom/views/automatic_purchase.xml | 7 ------- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py index 4a892b05..485f7a45 100644 --- a/indoteknik_custom/models/automatic_purchase.py +++ b/indoteknik_custom/models/automatic_purchase.py @@ -187,7 +187,7 @@ class AutomaticPurchase(models.Model): # i start from zero (0) for i in range(page): new_po = self.env['purchase.order'].create([param_header]) - new_po.name = new_po.name + "/A/" + str(i + 1) + new_po.name = new_po.name + "/B/" + str(i + 1) self.env['automatic.purchase.match'].create([{ 'automatic_purchase_id': self.id, diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 8f107de1..35fefbe2 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -458,10 +458,11 @@ class PurchaseOrder(models.Model): return res def compute_total_margin(self): - if self.from_apo: - self.compute_total_margin_from_apo() - return - + for rec in self: + if rec.from_apo: + rec.compute_total_margin_from_apo() + return + sum_so_margin = sum_sales_price = sum_margin = 0 for line in self.order_line: sale_order_line = line.so_line_id diff --git a/indoteknik_custom/views/automatic_purchase.xml b/indoteknik_custom/views/automatic_purchase.xml index 17abd888..360fdd16 100644 --- a/indoteknik_custom/views/automatic_purchase.xml +++ b/indoteknik_custom/views/automatic_purchase.xml @@ -113,13 +113,6 @@ />
-
-