mirror of
https://github.com/frappe/books.git
synced 2025-01-23 07:08:36 +00:00
added integer control
This commit is contained in:
parent
92355be627
commit
55dca13824
@ -4,6 +4,7 @@ const control_classes = {
|
|||||||
Select: require('./select'),
|
Select: require('./select'),
|
||||||
Link: require('./link'),
|
Link: require('./link'),
|
||||||
Float: require('./float'),
|
Float: require('./float'),
|
||||||
|
Int: require('./int'),
|
||||||
Currency: require('./currency'),
|
Currency: require('./currency'),
|
||||||
Password: require('./password'),
|
Password: require('./password'),
|
||||||
Table: require('./table')
|
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() {
|
async setName() {
|
||||||
|
if (this.name) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// name === doctype for Single
|
// name === doctype for Single
|
||||||
if (this.meta.isSingle) {
|
if (this.meta.isSingle) {
|
||||||
this.name = this.meta.name;
|
this.name = this.meta.name;
|
||||||
@ -62,10 +66,8 @@ module.exports = class BaseDocument {
|
|||||||
|
|
||||||
if (this.meta.settings) {
|
if (this.meta.settings) {
|
||||||
const number_series = (await this.getSettings()).number_series;
|
const number_series = (await this.getSettings()).number_series;
|
||||||
console.log(1, number_series);
|
|
||||||
if(number_series) {
|
if(number_series) {
|
||||||
this.name = await frappe.model.getSeriesNext(number_series);
|
this.name = await frappe.model.getSeriesNext(number_series);
|
||||||
console.log(2, this.name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user