mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-08 07:32:50 +00:00
refactor: make_gle_for_change_amount
This commit is contained in:
@@ -1492,12 +1492,16 @@ class SalesInvoice(SellingController):
|
||||
)
|
||||
|
||||
if not skip_change_gl_entries:
|
||||
self.make_gle_for_change_amount(gl_entries)
|
||||
gl_entries.extend(self.get_gle_for_change_amount())
|
||||
|
||||
def make_gle_for_change_amount(self, gl_entries):
|
||||
if self.change_amount:
|
||||
if self.account_for_change_amount:
|
||||
gl_entries.append(
|
||||
def get_gle_for_change_amount(self) -> list[dict]:
|
||||
if not self.change_amount:
|
||||
return []
|
||||
|
||||
if not self.account_for_change_amount:
|
||||
frappe.throw(_("Please set Account for Change Amount"), title=_("Mandatory Field"))
|
||||
|
||||
return [
|
||||
self.get_gl_dict(
|
||||
{
|
||||
"account": self.debit_to,
|
||||
@@ -1517,10 +1521,7 @@ class SalesInvoice(SellingController):
|
||||
},
|
||||
self.party_account_currency,
|
||||
item=self,
|
||||
)
|
||||
)
|
||||
|
||||
gl_entries.append(
|
||||
),
|
||||
self.get_gl_dict(
|
||||
{
|
||||
"account": self.account_for_change_amount,
|
||||
@@ -1529,10 +1530,8 @@ class SalesInvoice(SellingController):
|
||||
"cost_center": self.cost_center,
|
||||
},
|
||||
item=self,
|
||||
)
|
||||
)
|
||||
else:
|
||||
frappe.throw(_("Select change amount account"), title=_("Mandatory Field"))
|
||||
),
|
||||
]
|
||||
|
||||
def make_write_off_gl_entry(self, gl_entries):
|
||||
# write off entries, applicable if only pos
|
||||
|
||||
Reference in New Issue
Block a user