2
0
mirror of https://github.com/frappe/books.git synced 2024-09-20 03:29:00 +00:00

fix: Dont allow adding same item in another row

This commit is contained in:
Faris Ansari 2020-02-03 23:25:02 +05:30
parent 3dc893f00a
commit 827ecfd809
2 changed files with 18 additions and 2 deletions

View File

@ -10,7 +10,15 @@ module.exports = {
label: 'Item',
fieldtype: 'Link',
target: 'Item',
required: 1
required: 1,
getFilters(_, doc) {
let items = doc.parentdoc.items.map(d => d.item).filter(Boolean);
if (items.length > 0) {
return {
name: ['not in', items]
};
}
}
},
{
fieldname: 'description',

View File

@ -10,7 +10,15 @@ module.exports = {
label: 'Item',
fieldtype: 'Link',
target: 'Item',
required: 1
required: 1,
getFilters(_, doc) {
let items = doc.parentdoc.items.map(d => d.item).filter(Boolean);
if (items.length > 0) {
return {
name: ['not in', items]
};
}
}
},
{
fieldname: 'description',