Show "View This" button when cloning a record

This commit is contained in:
Lance Edgar 2024-04-28 20:12:49 -05:00
parent 9ee6521d6a
commit 6ce65badeb

View file

@ -911,7 +911,7 @@
</%def> </%def>
<%def name="render_crud_header_buttons()"> <%def name="render_crud_header_buttons()">
% if master and master.viewing: % if master and master.viewing and not master.cloning:
## TODO: is there a better way to check if viewing parent? ## TODO: is there a better way to check if viewing parent?
% if parent_instance is Undefined: % if parent_instance is Undefined:
% if master.editable and instance_editable and master.has_perm('edit'): % if master.editable and instance_editable and master.has_perm('edit'):
@ -920,7 +920,7 @@
text="Edit This"> text="Edit This">
</once-button> </once-button>
% endif % endif
% if master.cloneable and master.has_perm('clone'): % if not master.cloning and master.cloneable and master.has_perm('clone'):
<once-button tag="a" href="${action_url('clone', instance)}" <once-button tag="a" href="${action_url('clone', instance)}"
icon-left="object-ungroup" icon-left="object-ungroup"
text="Clone This"> text="Clone This">
@ -970,6 +970,13 @@
text="Edit This"> text="Edit This">
</once-button> </once-button>
% endif % endif
% elif master and master.cloning:
% if master.viewable and master.has_perm('view'):
<once-button tag="a" href="${action_url('view', instance)}"
icon-left="eye"
text="View This">
</once-button>
% endif
% endif % endif
</%def> </%def>