2
0
mirror of https://github.com/frappe/books.git synced 2024-12-23 11:29:03 +00:00
books/model/boilerplate.js

29 lines
590 B
JavaScript
Raw Normal View History

2018-01-31 10:13:33 +00:00
const fs = require('fs');
module.exports = {
2018-02-19 16:41:10 +00:00
make_model_files(name) {
2018-01-31 10:13:33 +00:00
2018-02-19 16:41:10 +00:00
// [doctype].json
fs.mkdirSync(`./models/doctype/${name}`);
2018-02-20 14:11:44 +00:00
fs.writeFileSync(`./models/doctype/${name}/${name}.js`, `module.exports = {
2018-02-19 16:41:10 +00:00
name: "${name}",
2018-03-08 13:31:22 +00:00
label: "${name}",
naming: "name", // {random|autoincrement}
2018-02-19 16:41:10 +00:00
isSingle: 0,
isChild: 0,
2018-03-27 13:55:26 +00:00
isSubmittable: 0,
settings: null,
2018-02-19 16:41:10 +00:00
keywordFields: [],
fields: [
{
fieldname: "name",
label: "Name",
fieldtype: "Data",
required: 1
}
]
2018-01-31 10:13:33 +00:00
}`);
2018-02-19 16:41:10 +00:00
}
2018-01-31 10:13:33 +00:00
}