Add placeholder for add.comp. PN info

This commit is contained in:
Daniel Rojas 2023-03-27 17:56:07 +02:00 committed by KV
parent e2e04f725e
commit 5183fdaee4
2 changed files with 20 additions and 11 deletions

View File

@ -258,6 +258,10 @@ class Component:
else:
return self.amount
@property
def has_pn_info(self) -> bool:
return any([self.pn, self.manufacturer, self.mpn, self.supplier, self.spn])
@dataclass
class AdditionalComponent(Component):

View File

@ -113,17 +113,22 @@ def gv_additional_component_table(component):
rows = []
for subitem in component.additional_components:
rows.append(
Tr(
[
Td(bom_bubble(subitem.bom_id)),
Td(f"{subitem.bom_qty}", align="right"),
Td(f"{subitem.qty.unit if subitem.qty.unit else 'x'}", align="left"),
Td(f"{subitem.description}", align="left"),
Td(f"{subitem.note if subitem.note else ''}", align="left"),
]
)
)
firstline = [
Td(bom_bubble(subitem.bom_id)),
Td(f"{subitem.bom_qty}", align="right"),
Td(f"{subitem.qty.unit if subitem.qty.unit else 'x'}", align="left"),
Td(f"{subitem.description}", align="left"),
Td(f"{subitem.note if subitem.note else ''}", align="left"),
]
rows.append(Tr(firstline))
if subitem.has_pn_info:
secondline = [
Td("", colspan=3),
Td(f"# TODO PN string", align="left"), # TODO
Td(""),
]
rows.append(Tr(secondline))
return Table(rows, border=1, cellborder=0, cellpadding=3, cellspacing=0)