From 0edfc3fbc953859983139f225107e553acb7c55c Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Wed, 20 Aug 2014 18:00:53 +0200 Subject: [PATCH 1/2] yaml: use selected user and not admin for onchange Fixes: #1885 --- openerp/tools/yaml_import.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/tools/yaml_import.py b/openerp/tools/yaml_import.py index b065294f7d7..96381a56372 100644 --- a/openerp/tools/yaml_import.py +++ b/openerp/tools/yaml_import.py @@ -447,7 +447,7 @@ class YamlInterpreter(object): # Evaluation args args = map(lambda x: eval(x, ctx), match.group(2).split(',')) - result = getattr(model, match.group(1))(self.cr, SUPERUSER_ID, [], *args) + result = getattr(model, match.group(1))(self.cr, self.uid, [], *args) for key, val in (result or {}).get('value', {}).items(): if key in fg: record_dict[key] = process_val(key, val) From 9b78f06e471cf5766828976cf091879c28aff4b2 Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Fri, 5 Sep 2014 17:30:15 +0200 Subject: [PATCH 2/2] yaml: use selected user and not admin for defaults --- openerp/tools/yaml_import.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/tools/yaml_import.py b/openerp/tools/yaml_import.py index 96381a56372..264ea65cba1 100644 --- a/openerp/tools/yaml_import.py +++ b/openerp/tools/yaml_import.py @@ -393,7 +393,7 @@ class YamlInterpreter(object): fg = view_info['fields'] # gather the default values on the object. (Can't use `fields´ as parameter instead of {} because we may # have references like `base.main_company´ in the yaml file and it's not compatible with the function) - defaults = default and model._add_missing_default_values(self.cr, SUPERUSER_ID, {}, context=self.context) or {} + defaults = default and model._add_missing_default_values(self.cr, self.uid, {}, context=self.context) or {} # copy the default values in record_dict, only if they are in the view (because that's what the client does) # the other default values will be added later on by the create().