mirror of
https://github.com/frappe/books.git
synced 2024-11-09 23:30:56 +00:00
added integer control
This commit is contained in:
parent
92355be627
commit
55dca13824
@ -4,6 +4,7 @@ const control_classes = {
|
||||
Select: require('./select'),
|
||||
Link: require('./link'),
|
||||
Float: require('./float'),
|
||||
Int: require('./int'),
|
||||
Currency: require('./currency'),
|
||||
Password: require('./password'),
|
||||
Table: require('./table')
|
||||
|
10
client/view/controls/int.js
Normal file
10
client/view/controls/int.js
Normal file
@ -0,0 +1,10 @@
|
||||
const FloatControl = require('./float');
|
||||
|
||||
class IntControl extends FloatControl {
|
||||
parse(value) {
|
||||
value = parseInt(value);
|
||||
return value===NaN ? 0 : value;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = IntControl;
|
@ -54,6 +54,10 @@ module.exports = class BaseDocument {
|
||||
}
|
||||
|
||||
async setName() {
|
||||
if (this.name) {
|
||||
return;
|
||||
}
|
||||
|
||||
// name === doctype for Single
|
||||
if (this.meta.isSingle) {
|
||||
this.name = this.meta.name;
|
||||
@ -62,10 +66,8 @@ module.exports = class BaseDocument {
|
||||
|
||||
if (this.meta.settings) {
|
||||
const number_series = (await this.getSettings()).number_series;
|
||||
console.log(1, number_series);
|
||||
if(number_series) {
|
||||
this.name = await frappe.model.getSeriesNext(number_series);
|
||||
console.log(2, this.name);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user