diff --git a/tailbone/views/customers.py b/tailbone/views/customers.py index 7132a767..f2e5f2dd 100644 --- a/tailbone/views/customers.py +++ b/tailbone/views/customers.py @@ -221,7 +221,7 @@ class CustomerView(MasterView): if self.viewing: if use_buefy: f.set_renderer('people', self.render_people_buefy) - elif self.has_perm('detach_person'): + elif self.people_detachable and self.has_perm('detach_person'): f.set_renderer('people', self.render_people_removable) else: f.set_renderer('people', self.render_people) @@ -257,7 +257,7 @@ class CustomerView(MasterView): customer = kwargs['instance'] people = [] for person in customer.people: - people.append({ + data = { 'uuid': person.uuid, 'full_name': person.display_name, 'first_name': person.first_name, @@ -266,10 +266,13 @@ class CustomerView(MasterView): uuid=person.uuid), '_action_url_edit': self.request.route_url('people.edit', uuid=person.uuid), - '_action_url_detach': self.request.route_url('customers.detach_person', - uuid=customer.uuid, - person_uuid=person.uuid), - }) + } + if self.people_detachable and self.has_perm('detach_person'): + data['_action_url_detach'] = self.request.route_url( + 'customers.detach_person', + uuid=customer.uuid, + person_uuid=person.uuid) + people.append(data) kwargs['people_data'] = people return kwargs @@ -365,7 +368,7 @@ class CustomerView(MasterView): g.main_actions.append(self.make_action('view', icon='eye')) if self.request.has_perm('people.edit'): g.main_actions.append(self.make_action('edit', icon='edit')) - if self.has_perm('detach_person'): + if self.people_detachable and self.has_perm('detach_person'): g.main_actions.append(self.make_action('detach', icon='minus-circle', link_class='has-text-warning', click_handler="$emit('detach-person', props.row._action_url_detach)"))