mirror of
https://github.com/frappe/books.git
synced 2025-01-23 07:08:36 +00:00
fix: prevent NaN in the invoices
This commit is contained in:
parent
04d2c4278f
commit
735bf3f830
@ -40,8 +40,9 @@ export default {
|
||||
fieldtype: 'Currency',
|
||||
required: 1,
|
||||
formula: async (row, doc) => {
|
||||
let baseRate = await doc.getFrom('Item', row.item, 'rate');
|
||||
return baseRate / doc.exchangeRate;
|
||||
const baseRate = (await doc.getFrom('Item', row.item, 'rate')) || 0;
|
||||
const exchangeRate = doc.exchangeRate ?? 1;
|
||||
return baseRate / exchangeRate;
|
||||
},
|
||||
getCurrency: (row, doc) => doc.currency
|
||||
},
|
||||
|
@ -41,8 +41,9 @@ export default {
|
||||
fieldtype: 'Currency',
|
||||
required: 1,
|
||||
formula: async (row, doc) => {
|
||||
let baseRate = await doc.getFrom('Item', row.item, 'rate');
|
||||
return baseRate / doc.exchangeRate;
|
||||
const baseRate = (await doc.getFrom('Item', row.item, 'rate')) || 0;
|
||||
const exchangeRate = doc.exchangeRate ?? 1;
|
||||
return baseRate / exchangeRate;
|
||||
},
|
||||
getCurrency: (row, doc) => doc.currency,
|
||||
formulaDependsOn: ['item']
|
||||
|
Loading…
x
Reference in New Issue
Block a user