mirror of
https://github.com/frappe/books.git
synced 2024-12-23 11:29:03 +00:00
fix: allow zero rate on items
This commit is contained in:
parent
a5adf7cca3
commit
900639734a
@ -105,10 +105,8 @@ export default {
|
|||||||
label: t`Rate`,
|
label: t`Rate`,
|
||||||
fieldtype: 'Currency',
|
fieldtype: 'Currency',
|
||||||
validate(value) {
|
validate(value) {
|
||||||
if (value.lte(0)) {
|
if (value.isNegative()) {
|
||||||
throw new frappe.errors.ValidationError(
|
throw new frappe.errors.ValidationError(t`Rate can't be negative.`);
|
||||||
'Rate must be greater than 0'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -46,6 +46,18 @@ export default {
|
|||||||
return baseRate.div(doc.exchangeRate);
|
return baseRate.div(doc.exchangeRate);
|
||||||
},
|
},
|
||||||
getCurrency: (row, doc) => doc.currency,
|
getCurrency: (row, doc) => doc.currency,
|
||||||
|
validate(value) {
|
||||||
|
if (value.gte(0)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new frappe.errors.ValidationError(
|
||||||
|
frappe.t`Rate (${frappe.format(
|
||||||
|
value,
|
||||||
|
'Currency'
|
||||||
|
)}) cannot be less zero.`
|
||||||
|
);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldname: 'baseRate',
|
fieldname: 'baseRate',
|
||||||
|
Loading…
Reference in New Issue
Block a user