mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 03:09:09 +00:00
Merge pull request #43316 from ruthra-kumar/fix_incorrect_outstanding_on_non_pos_with_write_off_account
fix: incorrect outstanding on non-pos invoice with write_off_account
This commit is contained in:
@@ -338,6 +338,7 @@ class SalesInvoice(SellingController):
|
|||||||
if self.redeem_loyalty_points and self.loyalty_points and not self.is_consolidated:
|
if self.redeem_loyalty_points and self.loyalty_points and not self.is_consolidated:
|
||||||
validate_loyalty_points(self, self.loyalty_points)
|
validate_loyalty_points(self, self.loyalty_points)
|
||||||
|
|
||||||
|
self.allow_write_off_only_on_pos()
|
||||||
self.reset_default_field_value("set_warehouse", "items", "warehouse")
|
self.reset_default_field_value("set_warehouse", "items", "warehouse")
|
||||||
|
|
||||||
def validate_accounts(self):
|
def validate_accounts(self):
|
||||||
@@ -1031,6 +1032,10 @@ class SalesInvoice(SellingController):
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
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):
|
def validate_write_off_account(self):
|
||||||
if flt(self.write_off_amount) and not self.write_off_account:
|
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")
|
self.write_off_account = frappe.get_cached_value("Company", self.company, "write_off_account")
|
||||||
|
|||||||
Reference in New Issue
Block a user