Hello!
is there any way to stop the native function that assign to an item’s row added in child doctype, sales invoice item, the default income account from company doctype?
i’m trying by a custom script to adding a specific income account when a row is added, but it’s always replaced by that default account. i used a “setTimeout” js function to apply the specific account after that native function is called. it works but if there is another smarter way , it would be cool.
You can set an Income Account even at the Item level. This way you can override the company default without customization. You will find it under “Sales,Purchase,Accounting Defaults” in the “Item” master.
Poor design. It is general practice to collect local sales income and export sales income in different accounts. That is possibly coming from the Customer itself. It is a pain to change that as per different customers.
Any suggestions?
Yep, got stuck for the same problem for this very simple scenario.
Because in the real world, selling the same item should record in different account, i.e., oversea income and domestic income. I can’t find any where to configure this.
Except coding like following in server script in Sales Invoice to change of account code on save.
customer = frappe.get_doc("Customer", doc.customer)
customer_group = frappe.get_doc("Customer Group", customer.customer_group)
rules = [
{
"customer_group": "Oversea",
"orign_account": "40100 - Income Domestic",
"new_account": "40001 - Income Oversea"
}
]
for rule in rules:
if customer_group.name == rule["customer_group"]:
for item in doc.items:
if item.income_account == rule["orign_account"]:
item.income_account = rule["new_account"]