@@ -319,30 +319,31 @@ def product_import_generic(self):
319319 )
320320 res_p = False
321321 for p in template .product_variant_ids :
322+ fullname_att = []
322323 if p .product_template_attribute_value_ids :
323- if not p . barcode :
324- for v in p . product_template_attribute_value_ids :
325- if (
326- v . product_attribute_value_id . fullname
327- in variant_att
328- ) :
329- if vals .get ("standard_price" ):
330- vals ["standard_price" ] = float (
331- vals ["standard_price" ]
332- )
333- if vals .get ("list_price" ) and hasattr (
334- p , "fix_price"
335- ):
336- vals ["fix_price" ] = vals ["list_price" ]
337- vals .pop ("list_price" )
338- elif vals .get ("list_price" ):
339- vals .pop ("list_price" )
340- res_p = p .write (vals )
341- logger .info (
342- f"product variant { p .id } has been update { v } "
343- )
344- break
345- else :
324+ for v in p . product_template_attribute_value_ids :
325+ fullname_att . append (
326+ v . product_attribute_value_id . fullname
327+ )
328+
329+ if fullname_att == variant_att and not p . barcode :
330+ if vals .get ("standard_price" ):
331+ vals ["standard_price" ] = float (
332+ vals ["standard_price" ]
333+ )
334+ if vals .get ("list_price" ) and hasattr (
335+ p , "fix_price"
336+ ):
337+ vals ["fix_price" ] = vals ["list_price" ]
338+ vals .pop ("list_price" )
339+ elif vals .get ("list_price" ):
340+ vals .pop ("list_price" )
341+ res_p = p .write (vals )
342+ logger .info (
343+ f"product variant { p .id } has been update { fullname_att } "
344+ )
345+ break
346+ elif p . barcode and fullname_att == variant_att :
346347 speedy ["logs" ]["product.product" ].append (
347348 {
348349 "msg" : f"{ p .id } product with { variant_att } already exite" ,
@@ -352,11 +353,11 @@ def product_import_generic(self):
352353 "reset" : True ,
353354 }
354355 )
355-
356+ break
356357 if not res_p :
357358 speedy ["logs" ]["product.product" ].append (
358359 {
359- "msg" : f"Not product with { variant_att } " ,
360+ "msg" : f"Not product with { variant_att } for line { line } " ,
360361 "value" : variant_att ,
361362 "vals" : vals ,
362363 "field" : "product.product,attribute_line_ids" ,
0 commit comments