Avoid "detach person" logic if not supported by view class
This commit is contained in:
parent
a6c89d7998
commit
03a569d9a3
|
@ -221,7 +221,7 @@ class CustomerView(MasterView):
|
||||||
if self.viewing:
|
if self.viewing:
|
||||||
if use_buefy:
|
if use_buefy:
|
||||||
f.set_renderer('people', self.render_people_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)
|
f.set_renderer('people', self.render_people_removable)
|
||||||
else:
|
else:
|
||||||
f.set_renderer('people', self.render_people)
|
f.set_renderer('people', self.render_people)
|
||||||
|
@ -257,7 +257,7 @@ class CustomerView(MasterView):
|
||||||
customer = kwargs['instance']
|
customer = kwargs['instance']
|
||||||
people = []
|
people = []
|
||||||
for person in customer.people:
|
for person in customer.people:
|
||||||
people.append({
|
data = {
|
||||||
'uuid': person.uuid,
|
'uuid': person.uuid,
|
||||||
'full_name': person.display_name,
|
'full_name': person.display_name,
|
||||||
'first_name': person.first_name,
|
'first_name': person.first_name,
|
||||||
|
@ -266,10 +266,13 @@ class CustomerView(MasterView):
|
||||||
uuid=person.uuid),
|
uuid=person.uuid),
|
||||||
'_action_url_edit': self.request.route_url('people.edit',
|
'_action_url_edit': self.request.route_url('people.edit',
|
||||||
uuid=person.uuid),
|
uuid=person.uuid),
|
||||||
'_action_url_detach': self.request.route_url('customers.detach_person',
|
}
|
||||||
uuid=customer.uuid,
|
if self.people_detachable and self.has_perm('detach_person'):
|
||||||
person_uuid=person.uuid),
|
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
|
kwargs['people_data'] = people
|
||||||
|
|
||||||
return kwargs
|
return kwargs
|
||||||
|
@ -365,7 +368,7 @@ class CustomerView(MasterView):
|
||||||
g.main_actions.append(self.make_action('view', icon='eye'))
|
g.main_actions.append(self.make_action('view', icon='eye'))
|
||||||
if self.request.has_perm('people.edit'):
|
if self.request.has_perm('people.edit'):
|
||||||
g.main_actions.append(self.make_action('edit', icon='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',
|
g.main_actions.append(self.make_action('detach', icon='minus-circle',
|
||||||
link_class='has-text-warning',
|
link_class='has-text-warning',
|
||||||
click_handler="$emit('detach-person', props.row._action_url_detach)"))
|
click_handler="$emit('detach-person', props.row._action_url_detach)"))
|
||||||
|
|
Loading…
Reference in a new issue