2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00

nested set wip

This commit is contained in:
Faris Ansari 2018-04-18 12:18:24 +05:30
parent 6fb782b300
commit 769c9e86bd
5 changed files with 19 additions and 4 deletions

View File

@ -206,7 +206,7 @@ module.exports = class BaseForm extends Observable {
}
refreshLinks(links) {
if (!this.container) return;
if (!(this.container && this.container.clearLinks)) return;
this.container.clearLinks();
for(let link of links) {

View File

@ -7,8 +7,6 @@ async function getHTML(doctype, name) {
let doc = await frappe.getDoc(doctype, name);
let context = {doc: doc, frappe: frappe};
console.log(context);
let html;
try {
html = nunjucks.renderString(printFormat.template, context);

View File

@ -34,5 +34,13 @@ module.exports = {
{
fieldname: 'parentfield', fieldtype: 'Data', required: 1
}
],
treeFields: [
{
fieldname: 'lft', fieldtype: 'Int', required: 1
},
{
fieldname: 'rgt', fieldtype: 'Int', required: 1
}
]
};
};

View File

@ -112,6 +112,15 @@ module.exports = class BaseMeta extends BaseDocument {
}
}
if (this.isTree) {
// tree fields
for (let field of model.treeFields) {
if (frappe.db.typeMap[field.fieldtype] && !doctype_fields.includes(field.fieldname)) {
_add(field);
}
}
}
// doctype fields
for (let field of this.fields) {
let include = frappe.db.typeMap[field.fieldtype];

0
model/nestedset.js Normal file
View File