mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-13 06:31:48 +00:00
fix: apply default accounting dimensions reliably on new documents
Default accounting dimensions were applied from the `company` client trigger, which reads dimension data fetched asynchronously in `setup_dimension_filters`. When the trigger fired before that fetch returned, new documents were left without their default dimensions, and Sales Order never called `update_dimension` at all. - Apply defaults from the fetch callback in dimension_tree_filter.js so they no longer depend on `company`-trigger timing. This fixes the race for Sales Invoice, Purchase Invoice and Payment Entry, and populates defaults on new Sales Orders. - Add a `company()` override on SalesOrderController so the default is re-applied when the company changes, matching the sibling doctypes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -22,6 +22,7 @@ erpnext.accounts.dimensions = {
|
||||
});
|
||||
me.default_dimensions = r.message[1];
|
||||
me.setup_filters(frm, doctype);
|
||||
me.update_dimension(frm, doctype);
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
@@ -589,6 +589,11 @@ erpnext.selling.SalesOrderController = class SalesOrderController extends erpnex
|
||||
super.onload(doc, dt, dn);
|
||||
}
|
||||
|
||||
company() {
|
||||
super.company();
|
||||
erpnext.accounts.dimensions.update_dimension(this.frm, this.frm.doctype);
|
||||
}
|
||||
|
||||
refresh(doc, dt, dn) {
|
||||
var me = this;
|
||||
super.refresh();
|
||||
|
||||
Reference in New Issue
Block a user