{% extends 'creme_core/bricks/base/paginated-table.html' %} {% load i18n creme_widgets creme_bricks creme_ctype %} {% load and_op has_perm_to url from creme_core_tags %} {% block brick_extra_class %}{{block.super}} commercial-opportunities-brick{% endblock %} {% block brick_header_title %} {% brick_header_title title=_('{count} Related opportunity') plural=_('{count} Related opportunities') empty=_('Opportunities') icon='opportunity' %} {% endblock %} {% block brick_header_actions %} {% if relation_type.enabled %} {% ctype_for_swappable 'OPPORTUNITIES_OPPORTUNITY_MODEL' as opp_ct %} {% has_perm_to link object as link_perm %}{% has_perm_to create opp_ct as opp_creation_perm %}{% has_perm_to link opp_ct.model_class as opp_link_perm %} {% brick_header_action id='add' url='commercial__create_opportunity'|url:object.id label=_('Create a linked opportunity') enabled=link_perm|and_op:opp_creation_perm|and_op:opp_link_perm %} {% brick_header_action id='add-relationships' label=_('Link to an existing opportunity') icon='link' enabled=link_perm __subject_id=object.id __rtype_id=relation_type.id __ctype_id=opp_ct.id __multiple=True %} {% endif %} {% endblock %} {% block brick_before_content %} {% if not relation_type.enabled %}