diff --git a/models/doctype/Invoice/Invoice.js b/models/doctype/Invoice/Invoice.js index 330baa05..a2252381 100644 --- a/models/doctype/Invoice/Invoice.js +++ b/models/doctype/Invoice/Invoice.js @@ -38,6 +38,7 @@ module.exports = { label: 'Account', fieldtype: 'Link', target: 'Account', + formula : (doc) => doc.getFrom('Party', doc.customer , 'default_account'), getFilters: (query, control) => { return { keywords: ['like', query], diff --git a/models/doctype/Party/Party.js b/models/doctype/Party/Party.js index 7be02d8a..5cf6b0a3 100644 --- a/models/doctype/Party/Party.js +++ b/models/doctype/Party/Party.js @@ -13,6 +13,19 @@ module.exports = { "fieldtype": "Data", "required": 1 }, + { + fieldname: 'default_account', + label: 'Default Account', + fieldtype: 'Link', + target: 'Account', + getFilters: (query, control) => { + return { + keywords: ['like', query], + isGroup: 0, + accountType: 'Receivable' + }; + } + }, { "fieldname": "customer", "label": "Customer",