Skip to content

Instantly share code, notes, and snippets.

@weiserman
Last active November 27, 2022 12:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weiserman/78e70fcd10132896159787076d38b920 to your computer and use it in GitHub Desktop.
Save weiserman/78e70fcd10132896159787076d38b920 to your computer and use it in GitHub Desktop.
Frappe Client Script
// This script was created so that we can select web users for gym membership
// only allow active plans to be selected
// Once a plan is selected we default the values for price
frappe.ui.form.on('Gym Membership', {
plan: function(frm) {
frm.set_value('length', 99);
frm.set_value('price', 101.11);
frm.set_value('status', "Awaiting Payment");
},
refresh: function(frm) {
frm.set_query("member", (frm) =>{
return {
filters: {
"ignore_user_type": 1
}
};
});
frm.set_query('plan', function(){
return {
filters: {
active: 1
}
};
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment