From 5be6d19f4d01548e30044f2aa7794566e788d480 Mon Sep 17 00:00:00 2001 From: Zarrar Date: Thu, 8 Nov 2018 12:16:26 +0530 Subject: [PATCH] [Minor] Display Discount Amount when Tax table is empty (#15812) * show discount amount even when tax table is empty * negate the value for discount while printing --- erpnext/controllers/accounts_controller.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index e277602f0a3..51747f67aec 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -117,6 +117,13 @@ class AccountsController(TransactionBase): if self.get("group_same_items"): self.group_similar_items() + df = self.meta.get_field("discount_amount") + if self.get("discount_amount") and hasattr(self, "taxes") and not len(self.taxes): + df.set("print_hide", 0) + self.discount_amount = -self.discount_amount + else: + df.set("print_hide", 1) + def validate_paid_amount(self): if hasattr(self, "is_pos") or hasattr(self, "is_paid"): is_paid = self.get("is_pos") or self.get("is_paid")