Allow to pass field values to new

review1771002
This commit is contained in:
Cédric Krier committed 2013-11-25 12:21:51 +01:00
1 parent 9c2f15ae53
commit 7e2e92b505
3 files changed
+4 -3

No files matched your search

+1
View File
@@ -1,3 +1,4 @@
* Allow to pass field values to new method
* Add click method for buttons
Version 3.0.0 - 2013-10-21
+1 -1
View File
@@ -75,7 +75,7 @@ Creating an address for the party
Addresses are store on party with a `One2Many` field. So the new address just
needs to be appended to the list `addresses`.
>>> address = party.addresses.new()
>>> address = party.addresses.new(zip='42')
>>> party.save()
>>> party.addresses #doctest: +ELLIPSIS
[proteus.Model.get('party.address')(...)]
+2 -2
View File
@@ -530,11 +530,11 @@ class ModelList(list):
raise NotImplementedError
sort.__doc__ = list.sort.__doc__
def new(self):
def new(self, **kwargs):
'Adds a new record to the ModelList and returns it'
Relation = Model.get(self.model_name, self.parent._config)
with Relation._config.set_context(self._get_context()):
new_record = Relation()
new_record = Relation(**kwargs)
self.append(new_record)
return new_record