Skip to content

Commit a5ef219

Browse files
committed
fonction update or not
1 parent 60a7af1 commit a5ef219

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

import_helper_generic/wizards/import_helper_generic.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def product_import_generic(self):
234234
else:
235235
colonnes.append("empty")
236236
continue
237-
if row[0]:
237+
if row:
238238
line += 1
239239
count += 1
240240
vals["line"] = line
@@ -428,7 +428,11 @@ def product_import_generic(self):
428428
"reset": True,
429429
}
430430
)
431-
elif vals.get("default_code") in speedy_product_template_list:
431+
continue
432+
elif (
433+
vals.get("default_code") in speedy_product_template_list
434+
and self.update_on
435+
):
432436
location_id = vals.get("location_id") or speedy.get(
433437
"default_location_id"
434438
)
@@ -502,6 +506,19 @@ def product_import_generic(self):
502506
continue
503507
else:
504508
logger.warning(f"No product found for {line}")
509+
elif (
510+
vals.get("default_code") in speedy_product_template_list
511+
and not self.update_on
512+
):
513+
speedy["logs"]["product.product"].append(
514+
{
515+
"msg": f"Product_Template with {vals['default_code']} already exist for line {line}",
516+
"value": vals["default_code"],
517+
"vals": vals,
518+
"field": "product.product,default_code",
519+
"reset": True,
520+
}
521+
)
505522
else:
506523
location_id = vals.get("location_id") or speedy.get(
507524
"default_location_id"

0 commit comments

Comments
 (0)