Merge pull request #43335 from frappe/mergify/bp/version-14-hotfix/pr-43316

fix: incorrect outstanding on non-pos invoice with write_off_account (backport #43316)
This commit is contained in:
ruthra kumar
2024-09-23 18:22:39 +05:30
committed by GitHub

View File

@@ -170,6 +170,7 @@ class SalesInvoice(SellingController):
):
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):
@@ -850,6 +851,10 @@ class SalesInvoice(SellingController):
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")