2
0
mirror of https://github.com/frappe/books.git synced 2025-01-26 00:28:25 +00:00
books/models/regionalModelUpdates.js

21 lines
625 B
JavaScript
Raw Normal View History

2021-12-01 18:38:00 +05:30
import frappe from 'frappejs';
async function setAugmentedModel(model, regionalInfo) {
const getAugmentedModel = (
await import('./doctype/' + model + '/RegionalChanges')
).default;
const augmentedModel = getAugmentedModel(regionalInfo);
frappe.models[model] = augmentedModel;
2021-12-01 18:38:00 +05:30
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);
}
}