2021-12-01 13:08:00 +00:00
|
|
|
import frappe from 'frappejs';
|
|
|
|
|
|
|
|
async function setAugmentedModel(model, regionalInfo) {
|
|
|
|
const getAugmentedModel = (
|
|
|
|
await import('./doctype/' + model + '/RegionalChanges')
|
|
|
|
).default;
|
2021-12-02 10:09:02 +00:00
|
|
|
const augmentedModel = getAugmentedModel(regionalInfo);
|
|
|
|
frappe.models[model] = augmentedModel;
|
2021-12-01 13:08:00 +00:00
|
|
|
frappe.models[model].augmented = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
export default async function regionalModelUpdates(regionalInfo) {
|
|
|
|
for (let model in frappe.models) {
|
|
|
|
const { regional, basedOn, augmented } = frappe.models[model];
|
|
|
|
if (!regional || basedOn || augmented) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
await setAugmentedModel(model, regionalInfo);
|
|
|
|
}
|
|
|
|
}
|