Skip to content

Commit

Permalink
fix(grid_row): check child table dependent properties whenever a row …
Browse files Browse the repository at this point in the history
…is selected

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
(cherry picked from commit 3dc568e)
  • Loading branch information
akhilnarang authored and mergify[bot] committed Apr 20, 2024
1 parent 7f11100 commit caabb79
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions frappe/public/js/frappe/form/grid_row.js
Original file line number Diff line number Diff line change
Expand Up @@ -725,20 +725,12 @@ export default class GridRow {
}

set_dependant_property(df) {
if (
!df.reqd &&
df.mandatory_depends_on &&
this.evaluate_depends_on_value(df.mandatory_depends_on)
) {
df.reqd = 1;
if (df.mandatory_depends_on) {
df.reqd = !!this.evaluate_depends_on_value(df.mandatory_depends_on);
}

if (
!df.read_only &&
df.read_only_depends_on &&
this.evaluate_depends_on_value(df.read_only_depends_on)
) {
df.read_only = 1;
if (df.read_only_depends_on) {
df.read_only = !!this.evaluate_depends_on_value(df.read_only_depends_on);
}
}

Expand Down Expand Up @@ -982,6 +974,13 @@ export default class GridRow {
if (frappe.ui.form.editable_row !== me) {
var out = me.toggle_editable_row();
}

// Set dependant property for current row
Object.keys(me.columns).forEach((column) => {
me.set_dependant_property(me.columns[column].df);
});
me.render_row(true);

var col = this;
let first_input_field = $(col).find('input[type="Text"]:first');
let input_in_focus = false;
Expand Down

0 comments on commit caabb79

Please sign in to comment.