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

fix: make Payment For not required, fix amount bug, ref mandatory only if not cash

This commit is contained in:
18alantom 2021-11-05 20:00:28 +05:30
parent c6c89c2e9f
commit 09d4b305eb
2 changed files with 5 additions and 6 deletions

View File

@ -81,7 +81,7 @@ export default {
label: 'Ref. / Cheque No.',
placeholder: 'Ref. / Cheque No.',
fieldtype: 'Data',
required: 1 // TODO: UNIQUE
required: (doc) => doc.paymentMethod !== 'Cash' // TODO: UNIQUE
},
{
fieldname: 'referenceDate',
@ -94,9 +94,7 @@ export default {
label: 'Clearance Date',
placeholder: 'Clearance Date',
fieldtype: 'Date',
hidden: doc => {
return doc.paymentMethod === 'Cash' ? 1 : 0;
}
hidden: (doc) => doc.paymentMethod === 'Cash'
},
{
fieldname: 'amount',
@ -105,6 +103,7 @@ export default {
required: 1,
formula: doc => doc.getSum('for', 'amount'),
validate(value, doc) {
if(doc.for.length === 0) return;
const amount = doc.getSum('for', 'amount');
if (value > amount) {
@ -135,7 +134,7 @@ export default {
label: 'Payment For',
fieldtype: 'Table',
childtype: 'PaymentFor',
required: 1
required: 0,
}
],

View File

@ -33,7 +33,7 @@ function getInitializedPrintWindow() {
const printWindow = new BrowserWindow({
width: 595,
height: 842,
show: true,
show: false,
webPreferences: {
contextIsolation: false,
nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION,