mirror of
https://github.com/frappe/books.git
synced 2024-12-25 12:10:06 +00:00
Function for doctype list
This commit is contained in:
parent
79b99055e0
commit
a531450033
24
index.js
24
index.js
@ -46,6 +46,30 @@ module.exports = {
|
||||
Object.assign(this.models, toAdd);
|
||||
},
|
||||
|
||||
getDoctypeList(filters) {
|
||||
let doctypeList = [];
|
||||
if (filters && Object.keys(filters).length) {
|
||||
for (let model in this.models) {
|
||||
let doctypeName = model;
|
||||
let doctype = this.models[doctypeName];
|
||||
let matchedFields = 0;
|
||||
for (let key in filters) {
|
||||
let field = key;
|
||||
let value = filters[field];
|
||||
|
||||
if (Boolean(doctype[field]) === Boolean(value)) {
|
||||
matchedFields++;
|
||||
}
|
||||
}
|
||||
|
||||
if (matchedFields === Object.keys(filters).length)
|
||||
doctypeList.push(doctypeName);
|
||||
}
|
||||
}
|
||||
|
||||
return doctypeList;
|
||||
},
|
||||
|
||||
registerView(view, name, module) {
|
||||
if (!this.views[view]) this.views[view] = {};
|
||||
this.views[view][name] = module;
|
||||
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="page-header px-4 py-3 d-flex align-items-center border-bottom bg-white">
|
||||
<div class="page-header pr-4 ml-0 pl-0 py-2 d-flex align-items-center border-bottom bg-white">
|
||||
<div class="text-right ml-2" v-for="link of links" :key="link.label">
|
||||
<f-button secondary @click="link.handler">{{ link.label }}</f-button>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user