mirror of
https://github.com/frappe/books.git
synced 2024-11-09 23:30:56 +00:00
fix: minor fixes to validation messages
- add two for SI items
This commit is contained in:
parent
ab7cffe609
commit
5a457614c3
@ -113,9 +113,7 @@ export default {
|
||||
validate(value, doc) {
|
||||
if (value.isNegative()) {
|
||||
throw new frappe.errors.ValidationError(
|
||||
frappe._(
|
||||
`Payment amount cannot be less than zero. Amount has been reset.`
|
||||
)
|
||||
frappe._(`Payment amount cannot be less than zero.`)
|
||||
);
|
||||
}
|
||||
|
||||
@ -128,16 +126,13 @@ export default {
|
||||
`Payment amount cannot exceed ${frappe.format(
|
||||
amount,
|
||||
'Currency'
|
||||
)}. Amount has been reset.`
|
||||
)}.`
|
||||
)
|
||||
);
|
||||
} else if (value.isZero()) {
|
||||
throw new frappe.errors.ValidationError(
|
||||
frappe._(
|
||||
`Payment amount cannot be ${frappe.format(
|
||||
value,
|
||||
'Currency'
|
||||
)}. Amount has been reset.`
|
||||
`Payment amount cannot be ${frappe.format(value, 'Currency')}.`
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -35,6 +35,15 @@ export default {
|
||||
fieldtype: 'Float',
|
||||
required: 1,
|
||||
default: 1,
|
||||
validate(value, doc) {
|
||||
if (value >= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw new frappe.errors.ValidationError(
|
||||
frappe._(`Quantity (${value}) cannot be less than zero.`)
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldname: 'rate',
|
||||
@ -48,6 +57,17 @@ export default {
|
||||
},
|
||||
getCurrency: (row, doc) => doc.currency,
|
||||
formulaDependsOn: ['item'],
|
||||
validate(value, doc) {
|
||||
if (value.gte(0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw new frappe.errors.ValidationError(
|
||||
frappe._(
|
||||
`Rate (${frappe.format(value, 'Currency')}) cannot be less zero.`
|
||||
)
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldname: 'baseRate',
|
||||
|
@ -152,7 +152,7 @@ export function openQuickEdit({ doctype, name, hideFields, defaults = {} }) {
|
||||
}
|
||||
|
||||
export function getErrorMessage(e, doc) {
|
||||
let errorMessage = e.message || _('An error occurred');
|
||||
let errorMessage = e.message || _('An error occurred.');
|
||||
const { doctype, name } = doc;
|
||||
const canElaborate = doctype && name;
|
||||
if (e.type === frappe.errors.LinkValidationError && canElaborate) {
|
||||
|
Loading…
Reference in New Issue
Block a user