2
0
mirror of https://github.com/frappe/books.git synced 2024-12-23 19:39:07 +00:00
books/models/regionalModelUpdates.js
2022-01-21 02:27:29 +05:30

21 lines
623 B
JavaScript

import frappe from 'frappe';
async function setAugmentedModel(model, regionalInfo) {
const getAugmentedModel = (
await import('./doctype/' + model + '/RegionalChanges')
).default;
const augmentedModel = getAugmentedModel(regionalInfo);
frappe.models[model] = augmentedModel;
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);
}
}