diff --git a/tryton/gui/window/preference.py b/tryton/gui/window/preference.py index d9584b1af9..b8728c440b 100644 --- a/tryton/gui/window/preference.py +++ b/tryton/gui/window/preference.py @@ -80,7 +80,7 @@ class Preference(NoModal): def response(self, win, response_id): if response_id == gtk.RESPONSE_OK: if self.screen.current_record.validate(): - vals = copy.copy(self.screen.get(get_modifiedonly=True)) + vals = copy.copy(self.screen.get()) if 'password' in vals: password = common.ask(_('Current Password:'), visibility=False) diff --git a/tryton/gui/window/view_form/model/field.py b/tryton/gui/window/view_form/model/field.py index 80bf8ffe48..37be18e693 100644 --- a/tryton/gui/window/view_form/model/field.py +++ b/tryton/gui/window/view_form/model/field.py @@ -132,12 +132,11 @@ class CharField(object): record.signal('record-changed') return True - def get(self, record, check_load=True, readonly=True, modified=False): + def get(self, record, check_load=True): return record.value.get(self.name) or self._default def get_eval(self, record, check_load=True): - return self.get(record, check_load=check_load, readonly=True, - modified=False) + return self.get(record, check_load=check_load) def get_on_change_value(self, record, check_load=True): return self.get_eval(record, check_load=check_load) @@ -285,7 +284,7 @@ class NumberField(CharField): return False return True - def get(self, record, check_load=True, readonly=True, modified=False): + def get(self, record, check_load=True): return record.value.get(self.name, self._default) def digits(self, record): @@ -364,7 +363,7 @@ class BooleanField(CharField): super(BooleanField, self).set_client(record, value, force_change=force_change) - def get(self, record, check_load=True, readonly=True, modified=False): + def get(self, record, check_load=True): return bool(record.value.get(self.name)) def get_client(self, record): @@ -378,7 +377,7 @@ class M2OField(CharField): _default = None - def get(self, record, check_load=True, readonly=True, modified=False): + def get(self, record, check_load=True): value = record.value.get(self.name) if (record.parent_name == self.name and self.attrs['relation'] == record.group.parent.model_name): @@ -526,7 +525,7 @@ class O2MField(CharField): self._set_default_value(record) return record.value.get(self.name) - def get(self, record, check_load=True, readonly=True, modified=False): + def get(self, record, check_load=True): if record.value.get(self.name) is None: return [] record_removed = record.value[self.name].record_removed @@ -537,15 +536,13 @@ class O2MField(CharField): if record2 in record_removed or record2 in record_deleted: continue if record2.id >= 0: - values = record2.get(check_load=check_load, - get_readonly=readonly, get_modifiedonly=modified) + values = record2.get(check_load=check_load) values.pop(parent_name, None) if record2.modified and values: result.append(('write', [record2.id], values)) result[0][1].append(record2.id) else: - values = record2.get(check_load=check_load, - get_readonly=readonly) + values = record2.get(check_load=check_load) values.pop(parent_name, None) result.append(('create', values)) if not result[0][1]: @@ -809,7 +806,7 @@ class ReferenceField(CharField): else: return None - def get(self, record, check_load=True, readonly=True, modified=False): + def get(self, record, check_load=True): if (record.value.get(self.name) and record.value[self.name][0] and record.value[self.name][1] >= 0): @@ -872,7 +869,7 @@ class BinaryField(CharField): _default = None - def get(self, record, check_load=True, readonly=True, modified=False): + def get(self, record, check_load=True): result = record.value.get(self.name) or self._default if isinstance(result, basestring): try: diff --git a/tryton/gui/window/view_form/model/record.py b/tryton/gui/window/view_form/model/record.py index b46bfc5984..871d846d41 100644 --- a/tryton/gui/window/view_form/model/record.py +++ b/tryton/gui/window/view_form/model/record.py @@ -218,24 +218,16 @@ class Record(SignalEvent): loaded = property(get_loaded) - def get(self, get_readonly=True, includeid=False, check_load=True, - get_modifiedonly=False): + def get(self, check_load=True): if check_load: self._check_load() value = {} for name, field in self.group.fields.iteritems(): if field.attrs.get('readonly'): continue - if (field.get_state_attrs(self).get('readonly', False) - and not get_readonly): + if field.name not in self.modified_fields and self.id >= 0: continue - if (field.name not in self.modified_fields - and get_modifiedonly): - continue - value[name] = field.get(self, check_load=check_load, - readonly=get_readonly, modified=get_modifiedonly) - if includeid: - value['id'] = self.id + value[name] = field.get(self, check_load=check_load) return value def get_eval(self, check_load=True): @@ -281,7 +273,7 @@ class Record(SignalEvent): def save(self, force_reload=True): if self.id < 0 or self.modified: if self.id < 0: - value = self.get(get_readonly=True) + value = self.get() try: res = RPCExecute('model', self.model_name, 'create', value, context=self.context_get()) @@ -292,8 +284,7 @@ class Record(SignalEvent): self.group.id_changed(old_id) elif self.modified: self._check_load() - value = self.get(get_readonly=True, get_modifiedonly=True, - check_load=False) + value = self.get(check_load=False) if value: context = self.context_get() context = context.copy() diff --git a/tryton/gui/window/view_form/screen/screen.py b/tryton/gui/window/view_form/screen/screen.py index e2b4c12a30..291478326c 100644 --- a/tryton/gui/window/view_form/screen/screen.py +++ b/tryton/gui/window/view_form/screen/screen.py @@ -505,14 +505,11 @@ class Screen(SignalEvent): elif current_view.view_type in ('tree', 'form'): current_view.set_cursor(new=new, reset_view=reset_view) - def get(self, get_readonly=True, includeid=False, check_load=True, - get_modifiedonly=False): + def get(self, check_load=True): if not self.current_record: return None self.current_view.set_value() - return self.current_record.get(get_readonly=get_readonly, - includeid=includeid, check_load=check_load, - get_modifiedonly=get_modifiedonly) + return self.current_record.get(check_load=check_load) def get_on_change_value(self, check_load=True): if not self.current_record: