2
0
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:
Rushabh Mehta 2018-02-12 17:54:53 +05:30
parent 92355be627
commit 55dca13824
3 changed files with 15 additions and 2 deletions

View File

@ -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')

View 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;

View File

@ -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);
}
}