Update fields_default_value doc to Active Record
This commit is contained in:
@@ -7,7 +7,7 @@ Default value of fields
|
||||
When a record is created, each field, which doesn't have a value specified,
|
||||
is set with the default value if exists.
|
||||
|
||||
The following method::
|
||||
The following class method::
|
||||
|
||||
Model.default_<field name>()
|
||||
|
||||
@@ -21,14 +21,11 @@ This example defines an ``Item`` model which has a default ``since``::
|
||||
|
||||
class Item(ModelSQL, ModelView):
|
||||
"Item"
|
||||
_description = __doc__
|
||||
_name = "item.item"
|
||||
__name__ = 'item'
|
||||
since = fields.Date('since')
|
||||
|
||||
def default_since(self):
|
||||
@classmethod
|
||||
def default_since(cls):
|
||||
return datetime.date.today()
|
||||
|
||||
Item()
|
||||
|
||||
See also method ``Model.default_get``: :attr:`~trytond.model.Model.default_get`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user