Upload Products with additional images
							parent
							
								
									75f4534d3b
								
							
						
					
					
						commit
						d6faa73c69
					
				|  | @ -93,16 +93,18 @@ class ProductTemplate(models.Model): | |||
|         self.check_not_specified_fields(vals) | ||||
|         vals = self.correct_values(vals) | ||||
|         product_template = self.with_context(active_test=False).search([('default_code', '=', vals['default_code'])]) | ||||
|         pid = 0 | ||||
|         if product_template: | ||||
|             # default_code may not be changed if there is already an inventory_line (in other company), so we remove it from the dict | ||||
|             vals.pop('default_code',None) | ||||
|             if product_template['manufacturing_number']: | ||||
|                 vals.pop('manufacturing_number',None) | ||||
|             product_template.write(vals) | ||||
|             pid = product_template.id | ||||
|         else: | ||||
|             if vals['active']: | ||||
|                 self.create(vals) | ||||
|         return True | ||||
|                 pid = self.create(vals) | ||||
|         return True, pid | ||||
| 
 | ||||
|     @api.model | ||||
|     def correct_values(self, vals): | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue