[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
This commit is contained in:
Zarrar 2018-11-08 12:16:26 +05:30 committed by Rushabh Mehta
parent 068ba191e7
commit 5be6d19f4d

View File

@ -117,6 +117,13 @@ class AccountsController(TransactionBase):
if self.get("group_same_items"): if self.get("group_same_items"):
self.group_similar_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): def validate_paid_amount(self):
if hasattr(self, "is_pos") or hasattr(self, "is_paid"): if hasattr(self, "is_pos") or hasattr(self, "is_paid"):
is_paid = self.get("is_pos") or self.get("is_paid") is_paid = self.get("is_pos") or self.get("is_paid")