mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-16 03:29:16 +00:00
Merge pull request #51332 from frappe/mergify/bp/version-15-hotfix/pr-50413
fix: don't duplicate default income account to Item (backport #50413)
This commit is contained in:
@@ -1004,10 +1004,19 @@ class SellingController(StockController):
|
|||||||
|
|
||||||
|
|
||||||
def set_default_income_account_for_item(obj):
|
def set_default_income_account_for_item(obj):
|
||||||
for d in obj.get("items"):
|
"""Set income account as default for items in the transaction.
|
||||||
if d.item_code:
|
|
||||||
if getattr(d, "income_account", None):
|
Updates the item default income account for each item in the transaction
|
||||||
set_item_default(d.item_code, obj.company, "income_account", d.income_account)
|
if it differs from the company's default income account.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
obj: Transaction document containing items table with income_account field
|
||||||
|
"""
|
||||||
|
company_default = frappe.get_cached_value("Company", obj.company, "default_income_account")
|
||||||
|
for d in obj.get("items", default=[]):
|
||||||
|
income_account = getattr(d, "income_account", None)
|
||||||
|
if d.item_code and income_account and income_account != company_default:
|
||||||
|
set_item_default(d.item_code, obj.company, "income_account", income_account)
|
||||||
|
|
||||||
|
|
||||||
def get_serial_and_batch_bundle(child, parent, delivery_note_child=None):
|
def get_serial_and_batch_bundle(child, parent, delivery_note_child=None):
|
||||||
|
|||||||
Reference in New Issue
Block a user