mirror of
https://github.com/frappe/books.git
synced 2025-01-24 15:48:25 +00:00
fix: Dont allow adding same item in another row
This commit is contained in:
parent
3dc893f00a
commit
827ecfd809
@ -10,7 +10,15 @@ module.exports = {
|
|||||||
label: 'Item',
|
label: 'Item',
|
||||||
fieldtype: 'Link',
|
fieldtype: 'Link',
|
||||||
target: 'Item',
|
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',
|
fieldname: 'description',
|
||||||
|
@ -10,7 +10,15 @@ module.exports = {
|
|||||||
label: 'Item',
|
label: 'Item',
|
||||||
fieldtype: 'Link',
|
fieldtype: 'Link',
|
||||||
target: 'Item',
|
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',
|
fieldname: 'description',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user