diff --git a/kibot/bom/xlsx_writer.py b/kibot/bom/xlsx_writer.py index 3a7f25a16..fa20241f4 100644 --- a/kibot/bom/xlsx_writer.py +++ b/kibot/bom/xlsx_writer.py @@ -567,6 +567,8 @@ def copy_specs_to_components(parts, groups): for p in parts: for c in p.kibot_group.components: c.kicost_part = p + if hasattr(c, 'original_copy'): + c.original_copy.kicost_part = p def _create_kicost_sheet(workbook, groups, image_data, fmt_title, fmt_info, fmt_subtitle, fmt_head, fmt_cols, cfg): diff --git a/kibot/fil_spec_to_field.py b/kibot/fil_spec_to_field.py index 8746f4e31..b7749ec68 100644 --- a/kibot/fil_spec_to_field.py +++ b/kibot/fil_spec_to_field.py @@ -176,7 +176,7 @@ def update_extra_info(self, res, attr, ei, dattr, pattern="{}", units=""): ei[dattr] = pattern.format(value) def check_coherent(self, c): - if not self.check_dist_coherence: + if not self.check_dist_coherence or not hasattr(c, 'kicost_part'): return extra_info = {} for d, dd in c.kicost_part.dd.items(): diff --git a/kibot/kiplot.py b/kibot/kiplot.py index 791cf7462..5944e623d 100644 --- a/kibot/kiplot.py +++ b/kibot/kiplot.py @@ -349,7 +349,9 @@ def expand_comp_fields(c, env): def expand_fields(comps, dont_copy=False): if not dont_copy: - comps = deepcopy(comps) + new_comps = deepcopy(comps) + for n_c, c in zip(new_comps, comps): + n_c.original_copy = c env = KiConf.kicad_env env.update(GS.load_pro_variables()) for c in comps: