diff --git a/product_configurator/models/product_attribute.py b/product_configurator/models/product_attribute.py index 84032154..356c164e 100644 --- a/product_configurator/models/product_attribute.py +++ b/product_configurator/models/product_attribute.py @@ -109,7 +109,7 @@ def validate_custom_val(self, val): if self.custom_type in ('int', 'float'): minv = self.min_val maxv = self.max_val - val = literal_eval(val) + val = literal_eval(str(val)) if minv and maxv and (val < minv or val > maxv): raise ValidationError( _("Selected custom value '%s' must be between %s and %s" diff --git a/product_configurator/models/product_config.py b/product_configurator/models/product_config.py index b3780c19..7e8f00e3 100644 --- a/product_configurator/models/product_config.py +++ b/product_configurator/models/product_config.py @@ -309,7 +309,7 @@ def _get_custom_vals_dict(self): if val.attribute_id.custom_type in ['float', 'int']: custom_vals[val.attribute_id.id] = literal_eval(val.value) else: - custom_vals[val.attribute_id.id] = val.value + custom_vals[val.attribute_id.id] = val.attachment_ids return custom_vals @api.multi @@ -460,6 +460,7 @@ def update_config(self, attr_val_dict=None, custom_val_dict=None): if attr_id in binary_field_ids: attachments = [(0, 0, { 'name': val.get('name'), + 'datas_fname': val.get('name'), 'datas': val.get('datas') }) for val in vals] custom_vals.update({'attachment_ids': attachments})