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

fix: allow multiple rows of same item in invoice

- this is to allow for different rates
This commit is contained in:
18alantom 2023-08-28 12:03:37 +05:30
parent ad05ca7466
commit 6bbee25dd5

View File

@ -478,23 +478,12 @@ export abstract class InvoiceItem extends Doc {
static filters: FiltersMap = {
item: (doc: Doc) => {
const itemList = doc.parentdoc!.items as Doc[];
const items = itemList.map((d) => d.item as string).filter(Boolean);
let itemNotFor = 'Sales';
if (doc.isSales) {
itemNotFor = 'Purchases';
}
const baseFilter = { for: ['not in', [itemNotFor]] };
if (items.length <= 0) {
return baseFilter;
}
return {
name: ['not in', items],
...baseFilter,
};
return { for: ['not in', [itemNotFor]] };
},
};