From 5e17b82779de729e1152852e6212588b5a6d1973 Mon Sep 17 00:00:00 2001 From: Frappe PR Bot Date: Tue, 17 Aug 2021 20:34:35 +0530 Subject: [PATCH] fix: set account for change amount even if pos profile not found (#26986) (#26989) (cherry picked from commit 5fec44446eed481021f5ec9c187b6558e790501e) Co-authored-by: Afshan <33727827+AfshanKhan@users.noreply.github.com> --- erpnext/accounts/doctype/sales_invoice/sales_invoice.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index c0941c56b6a..6e643db8d72 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -478,6 +478,9 @@ class SalesInvoice(SellingController): if cint(self.is_pos) != 1: return + if not self.account_for_change_amount: + self.account_for_change_amount = frappe.get_cached_value('Company', self.company, 'default_cash_account') + from erpnext.stock.get_item_details import get_pos_profile_item_details, get_pos_profile if not self.pos_profile: pos_profile = get_pos_profile(self.company) or {} @@ -492,9 +495,6 @@ class SalesInvoice(SellingController): if not self.get('payments') and not for_validate: update_multi_mode_option(self, pos) - if not self.account_for_change_amount: - self.account_for_change_amount = frappe.get_cached_value('Company', self.company, 'default_cash_account') - if pos: if not for_validate: self.tax_category = pos.get("tax_category")