fix error during import
This commit is contained in:
parent
3f8630bd7f
commit
a73fa2c66e
|
|
@ -310,14 +310,9 @@ class Recipe_Selection(Widget):
|
|||
# create recipe or update existing one in DB
|
||||
try:
|
||||
recipe = Recipes.get_by_id(recipe_name)
|
||||
steps = recipe.get_steps_map()
|
||||
recipe_is_new = False
|
||||
except Recipes.DoesNotExist:
|
||||
recipe = Recipes(name=recipe_name, part_number="TEMPORARY")
|
||||
steps = {}
|
||||
for step_name, step_spec in steps_specs.items():
|
||||
if step_name not in self.unsupported_steps:
|
||||
steps[step_name] = step_spec
|
||||
recipe_is_new = True
|
||||
|
||||
recipe.client = row.get("cliente", defaults["cliente"])
|
||||
|
|
@ -336,7 +331,6 @@ class Recipe_Selection(Widget):
|
|||
"leak_2": len(row.get("prova_tenuta_abilitata_2", defaults["prova_tenuta_abilitata_2"])) and "leak_2" not in self.unsupported_steps,
|
||||
"vision": len(row.get("test_visione_abilitato", defaults["test_visione_abilitato"])) and "vision" not in self.unsupported_steps,
|
||||
"print": len(row.get("stampa_etichetta_abilitata", defaults["stampa_etichetta_abilitata"])) and "print" not in self.unsupported_steps,
|
||||
"steps": steps,
|
||||
}
|
||||
if recipe_is_new:
|
||||
recipe.save(force_insert=True)
|
||||
|
|
|
|||
|
|
@ -134,10 +134,13 @@ class Recipe_Spec_And_Step_Editor(Editor):
|
|||
def render(self, data, field_name=None, row_number=None, crud=None):
|
||||
super().render(data, field_name=field_name, row_number=row_number, crud=crud)
|
||||
self.crud = crud
|
||||
steps_data = data.get("steps", {})
|
||||
|
||||
for step_name, step_def in self.steps_map.items():
|
||||
if not step_def.get("hidden", False):
|
||||
step_def["enable"].setChecked(data.get(step_name,{}) in (True,1,"x") )
|
||||
self.steps_map[step_name]["spec"]=data["steps"].get(step_name,{})
|
||||
step_enabled = data.get(step_name, {}) in (True, 1, "x")
|
||||
step_def["enable"].setChecked(step_enabled)
|
||||
step_def["spec"] = steps_data.get(step_name, {})
|
||||
|
||||
self.render_steps()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user