2
0
mirror of https://github.com/frappe/books.git synced 2024-11-13 00:46:28 +00:00
books/frappe/model/models.js
2018-01-08 18:00:14 +05:30

25 lines
498 B
JavaScript

const process = require('process');
const frappe = require('frappe-core');
class Models {
constructor() {
this.data = {doctype: {}};
this.controllers = {};
this.meta_classes = {};
}
get(doctype, name) {
return this.data[frappe.slug(doctype)][frappe.slug(name)];
}
get_controller(doctype) {
return this.controllers[frappe.slug(doctype)];
}
get_meta_class(doctype) {
return this.meta_classes[frappe.slug(doctype)] || frappe.meta.Meta;
}
}
module.exports = { Models: Models }