2
0
mirror of https://github.com/frappe/books.git synced 2025-01-25 16:18:33 +00:00
books/model/boilerplate.js

29 lines
590 B
JavaScript
Raw Normal View History

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