mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-07 07:02:54 +00:00
fix: validate expense account for items linked to sales invoice
This commit is contained in:
committed by
kavin-114
parent
78993c1ebe
commit
9ff3e28f5d
@@ -480,22 +480,26 @@ class DeliveryNote(SellingController):
|
||||
|
||||
for item in self.items:
|
||||
if item.get("against_sales_invoice"):
|
||||
continue
|
||||
if sdbnb_account and item.expense_account == sdbnb_account:
|
||||
frappe.throw(
|
||||
_(
|
||||
"Row #{0}: Stock Delivered But Not Billed account cannot be used for items linked to a Sales Invoice"
|
||||
).format(item.idx)
|
||||
)
|
||||
else:
|
||||
is_stock_item = frappe.get_cached_value("Item", item.item_code, "is_stock_item")
|
||||
# Only stock items
|
||||
if not is_stock_item or item.get("is_fixed_asset") or item.get("is_subcontracted"):
|
||||
continue
|
||||
if is_stock_item and not item.get("is_fixed_asset") and not item.get("is_subcontracted"):
|
||||
# Sales Return handling
|
||||
if self.is_return and disable_sdbnb_in_sr:
|
||||
if default_expense_account and (
|
||||
not item.expense_account or item.expense_account == sdbnb_account
|
||||
):
|
||||
item.expense_account = default_expense_account
|
||||
continue
|
||||
|
||||
if sdbnb_account:
|
||||
elif sdbnb_account:
|
||||
item.expense_account = sdbnb_account
|
||||
elif not item.expense_account and default_expense_account:
|
||||
if not item.expense_account and default_expense_account:
|
||||
item.expense_account = default_expense_account
|
||||
|
||||
def on_submit(self):
|
||||
|
||||
Reference in New Issue
Block a user