2
0
mirror of https://github.com/frappe/books.git synced 2024-12-23 19:39:07 +00:00
books/client/view/index.js

23 lines
713 B
JavaScript
Raw Normal View History

2018-01-30 12:03:04 +00:00
const BaseList = require('frappejs/client/view/list');
const BaseForm = require('frappejs/client/view/form');
module.exports = {
get_form_class(doctype) {
return this.get_view_class(doctype, 'Form', BaseForm);
},
get_list_class(doctype) {
return this.get_view_class(doctype, 'List', BaseList);
},
get_view_class(doctype, class_name, default_class) {
let client_module = this.get_client_module(doctype);
if (client_module && client_module[class_name]) {
return client_module[class_name];
} else {
return default_class;
}
},
get_client_module(doctype) {
return frappe.modules[`${doctype}_client`];
}
}