fix: Write Off section visibility for non POS Invoices

This commit is contained in:
Deepesh Garg 2022-11-15 09:45:39 +05:30
parent 5f1b226362
commit 9f5d613c78
2 changed files with 7 additions and 3 deletions

View File

@ -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",

View File

@ -1393,7 +1393,11 @@ class SalesInvoice(SellingController):
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")