Improve form support for view supplements

this seems a bit hacky yet but works for now..

cf. field logic for Vendor -> Quickbooks Bank Accounts, which requires this
This commit is contained in:
Lance Edgar 2024-04-16 18:21:59 -05:00
parent c35c0f8b61
commit 0d9c5a078b
3 changed files with 55 additions and 7 deletions

View file

@ -3,8 +3,14 @@
<%def name="modify_this_page_vars()">
${parent.modify_this_page_vars()}
% if master.deletable and instance_deletable and request.has_perm('{}.delete'.format(permission_prefix)) and master.delete_confirm == 'simple':
<script type="text/javascript">
<script type="text/javascript">
## declare extra data needed by form
% for key, value in form.json_data.items():
${form.component_studly}Data.${key} = ${json.dumps(value)|n}
% endfor
% if master.deletable and instance_deletable and master.has_perm('delete') and master.delete_confirm == 'simple':
ThisPage.methods.deleteObject = function() {
if (confirm("Are you sure you wish to delete this ${model_title}?")) {
@ -12,8 +18,11 @@
}
}
</script>
% endif
% endif
</script>
${form.render_included_templates()}
</%def>