fix: actualizando precios al importar productos.
This commit is contained in:
@@ -59,13 +59,13 @@ def handle_import_products_file(csv_file):
|
||||
data = io.StringIO(csv_file.read().decode('utf-8'))
|
||||
reader = csv.DictReader(data, quotechar='"')
|
||||
for row in reader:
|
||||
product, _ = Product.objects.get_or_create(
|
||||
product, created = Product.objects.update_or_create(
|
||||
name=row['producto'],
|
||||
defaults={'price': row['precio']}
|
||||
defaults={
|
||||
'price': row['precio'],
|
||||
'measuring_unit': row['unidad'],
|
||||
}
|
||||
)
|
||||
product.price = row['precio']
|
||||
product.measuring_unit = row['unidad']
|
||||
product.save()
|
||||
|
||||
categories = [n.strip() for n in row["categorias"].split("&")]
|
||||
for category in categories:
|
||||
|
||||
Reference in New Issue
Block a user