From 41680c82b0c0a2bd9df812f02105e5eadcd6dd09 Mon Sep 17 00:00:00 2001 From: sahil28297 <37302950+sahil28297@users.noreply.github.com> Date: Tue, 25 Sep 2018 17:30:10 +0530 Subject: [PATCH] Setting read only value to 1 for formula to work (#69) * Setting read only value to 1 for formula to work * Remove readOnly from tax --- models/doctype/Invoice/Invoice.js | 8 +++++--- models/doctype/InvoiceItem/InvoiceItem.js | 4 +++- models/doctype/TaxSummary/TaxSummary.js | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/models/doctype/Invoice/Invoice.js b/models/doctype/Invoice/Invoice.js index beef37c1..2187b28b 100644 --- a/models/doctype/Invoice/Invoice.js +++ b/models/doctype/Invoice/Invoice.js @@ -59,14 +59,15 @@ module.exports = { label: 'Net Total', fieldtype: 'Currency', formula: (doc) => doc.getSum('items', 'amount'), - disabled: true + disabled: true, + readOnly: 1 }, { fieldname: 'taxes', label: 'Taxes', fieldtype: 'Table', childtype: 'TaxSummary', - disabled: true, + readOnly: 1, template: (doc, row) => { return `
@@ -86,7 +87,8 @@ module.exports = { label: 'Grand Total', fieldtype: 'Currency', formula: (doc) => doc.getGrandTotal(), - disabled: true + disabled: true, + readOnly: 1 }, { fieldname: 'terms', diff --git a/models/doctype/InvoiceItem/InvoiceItem.js b/models/doctype/InvoiceItem/InvoiceItem.js index 64904db1..e5033e52 100644 --- a/models/doctype/InvoiceItem/InvoiceItem.js +++ b/models/doctype/InvoiceItem/InvoiceItem.js @@ -56,13 +56,15 @@ module.exports = { fieldname: 'amount', label: 'Amount', fieldtype: 'Currency', - disabled: 1, + readOnly: 1, + disabled: true, formula: (row, doc) => row.quantity * row.rate }, { fieldname: 'taxAmount', label: 'Tax Amount', hidden: 1, + readOnly: 1, fieldtype: 'Text', formula: (row, doc) => doc.getRowTax(row) } diff --git a/models/doctype/TaxSummary/TaxSummary.js b/models/doctype/TaxSummary/TaxSummary.js index 6f9c2878..207ee151 100644 --- a/models/doctype/TaxSummary/TaxSummary.js +++ b/models/doctype/TaxSummary/TaxSummary.js @@ -25,4 +25,4 @@ module.exports = { "required": 1 } ] -} \ No newline at end of file +}