fix(datetime): add a should refresh check to avoid recursion in grid
This commit is contained in:
parent
acf798c1cd
commit
33f0781bf9
3 changed files with 5 additions and 7 deletions
|
|
@ -1,6 +1,5 @@
|
|||
frappe.ui.form.ControlDate = class ControlDate extends frappe.ui.form.ControlData {
|
||||
static trigger_change_on_input_event = false;
|
||||
on_grid = false;
|
||||
make_input() {
|
||||
super.make_input();
|
||||
this.make_picker();
|
||||
|
|
@ -69,9 +68,7 @@ frappe.ui.form.ControlDate = class ControlDate extends frappe.ui.form.ControlDat
|
|||
maxDate: this.df.max_date,
|
||||
firstDay: frappe.datetime.get_first_day_of_the_week_index(),
|
||||
onSelect: () => {
|
||||
if (!this.on_grid) {
|
||||
this.$input.trigger("change");
|
||||
}
|
||||
this.$input.trigger("change");
|
||||
},
|
||||
onShow: () => {
|
||||
this.datepicker.$datepicker
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
frappe.ui.form.ControlDatetime = class ControlDatetime extends frappe.ui.form.ControlDate {
|
||||
on_grid = false;
|
||||
set_formatted_input(value) {
|
||||
if (this.timepicker_only) return;
|
||||
if (!this.datepicker) return;
|
||||
|
|
@ -11,9 +10,12 @@ frappe.ui.form.ControlDatetime = class ControlDatetime extends frappe.ui.form.Co
|
|||
} else if (value.toLowerCase() === "now") {
|
||||
value = frappe.datetime.now_datetime();
|
||||
}
|
||||
let should_refresh = this.last_value && this.last_value !== value;
|
||||
value = this.format_for_input(value);
|
||||
this.$input && this.$input.val(value);
|
||||
this.datepicker.selectDate(frappe.datetime.user_to_obj(value));
|
||||
if (should_refresh) {
|
||||
this.datepicker.selectDate(frappe.datetime.user_to_obj(value));
|
||||
}
|
||||
}
|
||||
|
||||
get_start_date() {
|
||||
|
|
|
|||
|
|
@ -1163,7 +1163,6 @@ export default class GridRow {
|
|||
grid_row: this,
|
||||
value: this.doc[df.fieldname],
|
||||
});
|
||||
field.on_grid = true;
|
||||
// sync get_query
|
||||
field.get_query = this.grid.get_field(df.fieldname).get_query;
|
||||
// df.onchange is common for all rows in grid
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue