Skip to content

Commit

Permalink
fix: incorrect outstanding on non-pos invoice with write_off_account
Browse files Browse the repository at this point in the history
(cherry picked from commit d5e2906)
  • Loading branch information
ruthra-kumar authored and mergify[bot] committed Sep 23, 2024
1 parent 250a1c9 commit f89a3db
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions erpnext/accounts/doctype/sales_invoice/sales_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ def validate(self):
):
validate_loyalty_points(self, self.loyalty_points)

self.allow_write_off_only_on_pos()
self.reset_default_field_value("set_warehouse", "items", "warehouse")

def validate_accounts(self):
Expand Down Expand Up @@ -1021,6 +1022,10 @@ def validate_delivery_note(self):
raise_exception=1,
)

def allow_write_off_only_on_pos(self):
if not self.is_pos and self.write_off_account:
self.write_off_account = None

def validate_write_off_account(self):
if flt(self.write_off_amount) and not self.write_off_account:
self.write_off_account = frappe.get_cached_value("Company", self.company, "write_off_account")
Expand Down

0 comments on commit f89a3db

Please sign in to comment.