You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Demo data can put the freight account under the wrong expense group #261
Since #221 the demo data uses the company's own currency and chart of accounts. Three gaps are left.
If the chart of accounts has no Stock Expenses group, the demo creates Freight and Forwarding Charges under whichever expense group comes last in the account tree. The Cash on Delivery Charges account goes under the same group. ERPNext's standard chart keeps freight under Indirect Expenses.
Clicking Install demo data looks up the USD exchange rate online in the click itself. When there is no Currency Exchange record and the lookup fails, the user sees two error messages, ERPNext's and ours, and an Error Log is written.
No test covers the freight fallback or a full install leaving the company's currency and accounts unchanged.
Expected
The freight account goes next to an existing chargeable account, otherwise under the top-level Expense group, otherwise the install stops with one clear message. A missing rate shows one message.
Technical details
commera/install_summer_demo.py, get_freight_account: the fallback uses order_by="lft desc", which takes the last Expense group, not the most specific one. Prefer the parent of an existing account_type = "Chargeable" leaf, then the root Expense group, then frappe.throw. Filter the existing-account lookup on is_group: 0. On a child company the insert throws "Please add the account to root level Company".
The freight and COD account inserts are almost the same code. One helper should create both.
commera_settings.py: the button calls get_exchange_rate, which makes an HTTP request with no timeout (erpnext/setup/utils.py) and repeats it in the job. Check only that a company exists in the request, and leave the rate lookup to the job.
Tests use the Standard chart, which already has the account, so the fallback branch never runs. Add a company without Stock Expenses.
Checked on a Russian company (RUB, Standard chart): currency, accounts and price lists stay RUB, and the fallback picked Indirect Expenses only because it sorts last.
Activity