diff options
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 2 | ||||
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 6b038e69..d51115f8 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -179,7 +179,7 @@ class PurchaseOrder(models.Model): real_item_margin = sales_price - purchase_price sum_margin += real_item_margin - if sum_so_margin > 0 and sum_sales_price > 0 and sum_margin > 0: + if sum_so_margin != 0 and sum_sales_price != 0 and sum_margin != 0: self.total_so_margin = sum_so_margin self.total_so_percent_margin = round((sum_so_margin / sum_sales_price), 2) * 100 self.total_margin = sum_margin diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 4ab8aa17..f1f281a8 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -76,15 +76,15 @@ class SaleOrder(models.Model): raise UserError("Tax di Header harus diisi") approval1 = approval2 = 0 for line in order.order_line: + if not line.product_id or line.product_id.type == 'service': + continue if line.product_id.id == 232383: raise UserError(_('Tidak bisa Confirm menggunakan Produk Sementara')) if not line.vendor_id or not line.purchase_price or not line.purchase_tax_id: raise UserError(_('Isi Vendor, Harga Beli, dan Tax sebelum Request Approval')) - if not line.product_id or line.product_id.type == 'service': - continue - if line.item_percent_margin <= 15 and not self.env.user.is_pimpinan: + if line.item_percent_margin <= 15 and not self.env.user.is_leader: approval2 += 1 - elif line.item_percent_margin <= 25 and not self.env.user.is_pimpinan and not self.env.user.is_sales_manager: + elif line.item_percent_margin <= 25 and not self.env.user.is_leader and not self.env.user.is_sales_manager: approval1 += 1 if approval2 > 0: raise UserError("Harus diapprove oleh Pimpinan") |
