2
0
mirror of https://github.com/frappe/books.git synced 2024-11-09 23:30:56 +00:00

feat: filter items in invoices

This commit is contained in:
18alantom 2022-03-10 12:23:28 +05:30
parent fbb1c4db66
commit 17663b2dbe
2 changed files with 18 additions and 8 deletions

View File

@ -14,11 +14,16 @@ export default {
required: 1,
getFilters(_, doc) {
let items = doc.parentdoc.items.map((d) => d.item).filter(Boolean);
if (items.length > 0) {
return {
name: ['not in', items],
};
const baseFilter = { for: ['not in', ['sales']] };
if (items.length <= 0) {
return baseFilter;
}
return {
name: ['not in', items],
...baseFilter,
};
},
},
{

View File

@ -15,11 +15,16 @@ export default {
required: 1,
getFilters(_, doc) {
let items = doc.parentdoc.items.map((d) => d.item).filter(Boolean);
if (items.length > 0) {
return {
name: ['not in', items],
};
const baseFilter = { for: ['not in', ['purchases']] };
if (items.length <= 0) {
return baseFilter;
}
return {
name: ['not in', items],
...baseFilter,
};
},
},
{