Merge pull request #32962 from deepeshgarg007/return_write_off
fix: Write Off section visibility for non POS Invoices
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
index 15d1d25..dc2f9a9 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
@@ -2098,7 +2098,7 @@
{
"collapsible": 1,
"collapsible_depends_on": "write_off_amount",
- "depends_on": "grand_total",
+ "depends_on": "is_pos",
"fieldname": "write_off_section",
"fieldtype": "Section Break",
"hide_days": 1,
@@ -2126,7 +2126,7 @@
"link_fieldname": "consolidated_invoice"
}
],
- "modified": "2022-11-07 16:02:07.972258",
+ "modified": "2022-11-15 09:33:47.870616",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice",
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 911440f..4d7fd8e 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -1393,7 +1393,11 @@
def make_write_off_gl_entry(self, gl_entries):
# write off entries, applicable if only pos
- if self.write_off_account and flt(self.write_off_amount, self.precision("write_off_amount")):
+ if (
+ self.is_pos
+ and self.write_off_account
+ and flt(self.write_off_amount, self.precision("write_off_amount"))
+ ):
write_off_account_currency = get_account_currency(self.write_off_account)
default_cost_center = frappe.get_cached_value("Company", self.company, "cost_center")