mirror of
https://github.com/frappe/books.git
synced 2024-12-23 03:19:01 +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`,
|
||||
fieldtype: 'Currency',
|
||||
validate(value) {
|
||||
if (value.lte(0)) {
|
||||
throw new frappe.errors.ValidationError(
|
||||
'Rate must be greater than 0'
|
||||
);
|
||||
if (value.isNegative()) {
|
||||
throw new frappe.errors.ValidationError(t`Rate can't be negative.`);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
@ -46,6 +46,18 @@ export default {
|
||||
return baseRate.div(doc.exchangeRate);
|
||||
},
|
||||
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',
|
||||
|
Loading…
Reference in New Issue
Block a user