From 0b5e250597793336aa1bec3b72e91717afe1d871 Mon Sep 17 00:00:00 2001 From: 18alantom <2.alan.tom@gmail.com> Date: Tue, 28 Dec 2021 17:33:52 +0530 Subject: [PATCH] refactor: DRY, use map keys for select --- models/doctype/PaymentFor/PaymentFor.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/models/doctype/PaymentFor/PaymentFor.js b/models/doctype/PaymentFor/PaymentFor.js index 9310d70a..7fd4153f 100644 --- a/models/doctype/PaymentFor/PaymentFor.js +++ b/models/doctype/PaymentFor/PaymentFor.js @@ -1,3 +1,9 @@ +import { _ } from 'frappejs/utils'; +const referenceTypeMap = { + SalesInvoice: _('Invoice'), + PurchaseInvoice: _('Bill'), +}; + export default { name: 'PaymentFor', label: 'Payment For', @@ -11,8 +17,8 @@ export default { label: 'Reference Type', placeholder: 'Type', fieldtype: 'Select', - options: ['SalesInvoice', 'PurchaseInvoice'], - map: { SalesInvoice: 'Invoice', PurchaseInvoice: 'Bill' }, + options: Object.keys(referenceTypeMap), + map: referenceTypeMap, required: 1, }, {