2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00

feat: set and update directly in update method

This commit is contained in:
Faris Ansari 2019-12-27 12:08:06 +05:30
parent 8378319b1b
commit d66501968f

View File

@ -529,7 +529,10 @@ module.exports = class BaseDocument extends Observable {
return this;
}
async update() {
async update(...args) {
if (args.length) {
await this.set(...args);
}
await this.compareWithCurrentDoc();
await this.commit();
await this.trigger('beforeUpdate');
@ -612,7 +615,8 @@ module.exports = class BaseDocument extends Observable {
}
let systemPrecision = frappe.SystemSettings.floatPrecision;
let defaultPrecision = systemPrecision != null ? systemPrecision : 2;
let precision = df && df.precision != null ? df.precision : defaultPrecision;
let precision =
df && df.precision != null ? df.precision : defaultPrecision;
return round(value, precision);
}