Make description for additional components a property
This commit is contained in:
parent
20622e0346
commit
a450c82e72
@ -57,6 +57,7 @@ class AdditionalComponent:
|
||||
unit: Optional[str] = None
|
||||
qty_multiplier: Union[ConnectorMultiplier, CableMultiplier, None] = None
|
||||
|
||||
@property
|
||||
def description(self) -> str:
|
||||
name_subtype = f', {self.subtype}' if self.subtype else ''
|
||||
return f'{self.type.capitalize()}{name_subtype}'
|
||||
|
||||
@ -108,10 +108,10 @@ class Harness:
|
||||
for extra in connector.additional_components:
|
||||
qty = extra.qty * connector.get_qty_multiplier(extra.qty_multiplier)
|
||||
if(self.mini_bom_mode):
|
||||
id = self.get_bom_index(extra.description(), extra.unit, extra.manufacturer, extra.mpn, extra.pn)
|
||||
id = self.get_bom_index(extra.description, extra.unit, extra.manufacturer, extra.mpn, extra.pn)
|
||||
rows.append(component_table_entry(f'{id} ({extra.type.capitalize()})', qty, extra.unit))
|
||||
else:
|
||||
rows.append(component_table_entry(extra.description(), qty, extra.unit, extra.pn, extra.manufacturer, extra.mpn))
|
||||
rows.append(component_table_entry(extra.description, qty, extra.unit, extra.pn, extra.manufacturer, extra.mpn))
|
||||
rows.append([html_line_breaks(connector.notes)])
|
||||
html.extend(nested_html_table(rows))
|
||||
|
||||
@ -191,10 +191,10 @@ class Harness:
|
||||
for extra in cable.additional_components:
|
||||
qty = extra.qty * cable.get_qty_multiplier(extra.qty_multiplier)
|
||||
if(self.mini_bom_mode):
|
||||
id = self.get_bom_index(extra.description(), extra.unit, extra.manufacturer, extra.mpn, extra.pn)
|
||||
id = self.get_bom_index(extra.description, extra.unit, extra.manufacturer, extra.mpn, extra.pn)
|
||||
rows.append(component_table_entry(f'{id} ({extra.type.capitalize()})', qty, extra.unit))
|
||||
else:
|
||||
rows.append(component_table_entry(extra.description(), qty, extra.unit, extra.pn, extra.manufacturer, extra.mpn))
|
||||
rows.append(component_table_entry(extra.description, qty, extra.unit, extra.pn, extra.manufacturer, extra.mpn))
|
||||
rows.append([html_line_breaks(cable.notes)])
|
||||
html.extend(nested_html_table(rows))
|
||||
|
||||
@ -373,7 +373,7 @@ class Harness:
|
||||
qty = part.qty * connector.get_qty_multiplier(part.qty_multiplier)
|
||||
bom_items.append(
|
||||
{
|
||||
'item': part.description(),
|
||||
'item': part.description,
|
||||
'qty': qty,
|
||||
'unit': part.unit,
|
||||
'manufacturer': part.manufacturer,
|
||||
@ -411,7 +411,7 @@ class Harness:
|
||||
qty = part.qty * cable.get_qty_multiplier(part.qty_multiplier)
|
||||
bom_items.append(
|
||||
{
|
||||
'item': part.description(),
|
||||
'item': part.description,
|
||||
'qty': qty,
|
||||
'unit': part.unit,
|
||||
'manufacturer': part.manufacturer,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user