2
0
mirror of https://github.com/frappe/books.git synced 2024-11-09 23:30:56 +00:00

Fixed auto updation of rate and tax on changing item

This commit is contained in:
Piyush Singhania 2021-10-14 23:58:27 +05:30 committed by 18alantom
parent be97d722b7
commit f0bdc4e669

View File

@ -25,14 +25,15 @@ module.exports = {
label: 'Description',
fieldtype: 'Text',
formula: (row, doc) => doc.getFrom('Item', row.item, 'description'),
hidden: 1
hidden: 1,
formulaDependsOn: ['item']
},
{
fieldname: 'quantity',
label: 'Quantity',
fieldtype: 'Float',
required: 1,
formula: () => 1
formula: row => row.quantity || 1
},
{
fieldname: 'rate',
@ -43,7 +44,8 @@ module.exports = {
let baseRate = await doc.getFrom('Item', row.item, 'rate');
return baseRate / doc.exchangeRate;
},
getCurrency: (row, doc) => doc.currency
getCurrency: (row, doc) => doc.currency,
formulaDependsOn: ['item']
},
{
fieldname: 'baseRate',
@ -67,9 +69,10 @@ module.exports = {
fieldtype: 'Link',
target: 'Tax',
formula: (row, doc) => {
if (row.tax) return row.tax;
// if (row.tax) return row.tax;
return doc.getFrom('Item', row.item, 'tax');
}
},
formulaDependsOn: ['item']
},
{
fieldname: 'amount',