aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2019-10-24 13:22:21 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2019-10-24 13:22:21 +0200
commit0105fe08b6de35148c9455af443ca1d0c9437e18 (patch)
tree0a7a91329c7c8ab6f98a6260b9d356cf90fa8b5f /src
parent79faff5275cbe50445ebe90233ea03e34c4a12ca (diff)
downloadee-python-0105fe08b6de35148c9455af443ca1d0c9437e18.tar.gz
ee-python-0105fe08b6de35148c9455af443ca1d0c9437e18.tar.bz2
ee-python-0105fe08b6de35148c9455af443ca1d0c9437e18.tar.xz
ee-python-0105fe08b6de35148c9455af443ca1d0c9437e18.zip
bom report: Drop list with unresolved parts, mark it in the table instead.
Diffstat (limited to 'src')
-rw-r--r--src/ee/templates/bom.rst.j257
1 files 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 }} <ref-{{ 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="`{} <part-{}_>`_".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}} <part-{{pn.valueProp}}_>`_
-{% else %}
-MANY
-{% endif %}
-{%- endfor %}
-#}
Part details
============