From 0105fe08b6de35148c9455af443ca1d0c9437e18 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Thu, 24 Oct 2019 13:22:21 +0200 Subject: bom report: Drop list with unresolved parts, mark it in the table instead. --- src/ee/templates/bom.rst.j2 | 57 +++++++++++---------------------------------- 1 file changed, 13 insertions(+), 44 deletions(-) diff --git a/src/ee/templates/bom.rst.j2 b/src/ee/templates/bom.rst.j2 index 454d3f1..b9c8b6a 100644 --- a/src/ee/templates/bom.rst.j2 +++ b/src/ee/templates/bom.rst.j2 @@ -2,68 +2,37 @@ BOM === -{%- if unresolved_parts %} +{#- +{% if unresolved_parts -%} Unresolved Parts ---------------- -{{- unresolved_parts|length }} unresolved parts: {% for bp in unresolved_parts %} -* `{{ bp.ref }} `_ +* `{{ bp.ref }} <{{ bp.ref }}_>`_ {%- endfor %} {%- endif %} +#} + +{% if unresolved_parts -%} +There are {{ unresolved_parts|length }} unresolved parts. +{%- endif %} +-{{ "-"*30 }}-+-{{ "-"*60 }}-+-{{ "-"*60 }}-+ | {{ "%-30s" | format("Reference") }} | {{ "%-60s" | format("MPN") }} | {{ "%-60s" | format("MPN") }} | +={{ "="*30 }}=+={{ "="*60 }}=+={{ "="*60 }}=+ {%- for bp in bom_parts %} {%- set ref="_`{}`".format(bp.ref, bp.ref) %} +{%- if bp.selected_part %} {%- set mpn=bp.selected_part.get_only_mpn().valueProp %} {%- set spn=bp.selected_part.get_only_spn().valueProp %} {%- set spn="`{} `_".format(spn, spn) %} +{%- else %} +{%- set mpn="Unresolved" %} +{%- set spn="" %} +{%- endif %} | {{ "%-30s" | format(ref) }} | {{ "%-60s" | format(mpn) }} | {{ "%-60s" | format(spn) }} | +-{{ "-"*30 }}-+-{{ "-"*60 }}-+-{{ "-"*60 }}-+ {%- endfor %} -{# -Parts for BOM -=============== -{% for bp in bom_parts %} -.. _ref-{{ bp.ref }}: - -{{ bp.ref | subsection }} -{% if not bp.selected_part %} -Could not find part. - -{% if bp.part.get_mpns()|length == 1 -%} -MPN: {{ bp.part.get_mpns()[0].valueProp }} -{% elif bp.part.get_mpns()|length > 1 -%} -{%- for mpn in bp.part.get_mpns() %} -MPNs: -* {{ mpn.valuePrbp }} -{%- endfor %} -{%- endif -%} -#} -{# #}{# - -{% if bp.part.get_spns()|length == 1 -%} -SPN: {{ bp.part.get_spns()[0].valueProp }} -{% elif bp.part.get_spns()|length > 1 -%} -{%- for spn in bp.part.get_spns() %} -SPNs: -* {{ spn.valueProp }} -{%- endfor %} -{%- endif -%} - -{% elif bp.selected_part %} -{%- set part=bp.selected_part %} -{%- set pn=part|first_pn %} -{%- set spn=part|first_spn %} -Selected supplier: {{ part.supplier }}{{ (", pn: " + pn.valueProp) if pn else "" }}{{ (", spn: " + spn.valueProp) if spn else "" }}. -Part: `{{pn.valueProp}} `_ -{% else %} -MANY -{% endif %} -{%- endfor %} -#} Part details ============ -- cgit v1.2.3