{% extends "page.html" %} {% macro bom_row(bom, depth=0, relation_quantity=None, visited=[]) %} {% set child_id = 'bom-public-children-' ~ bom.id ~ '-' ~ depth %} {% set can_expand = bom.children and bom.id not in visited %}
{% if can_expand %} {% else %} {% endif %}
{% if bom.number %}{{ bom.number }}{% endif %} {{ bom.name }} {% if bom.is_part_wrapper %}{{ _('Part') }}{% else %}{{ _('BOM') }}{% endif %}
{% if relation_quantity is not none %}{{ relation_quantity.normalize() }}{% else %}-{% endif %}
{{ format_bom_cost(bom) }}
{% if bom.is_part_wrapper and bom.component %} {% elif not bom.is_part_wrapper %} {% if depth == 0 %} {% endif %} {% endif %}
{% if can_expand %}
{% set next_visited = visited + [bom.id] %} {% for item in bom.children|sort(attribute='position') %} {{ bom_row(item.child_bom, depth + 1, item.quantity, next_visited) }} {% endfor %}
{% endif %}
{% endmacro %} {% block style %} {% endblock style %} {% block main_view_content %}

{{ _('Bill of Materials') }}

{{ ngettext('%(num)s BOM was found.', '%(num)s BOMs were found.', boms|length) }}

{{ _('Name') }} {{ _('Quantity') }} {{ _('Total cost') }} {{ _('Actions') }}
{% for bom in boms %} {{ bom_row(bom)|safe }} {% else %}
{{ _('No BOMs have been created yet.') }}
{% endfor %}
{% endblock main_view_content %} {% block script %} {% endblock script %}