fields.Function manejan default

FossilOrigin-Name: ec954ac9253429b99095fbcce443a2691f516f603282aec1ee59c4b7cbbd6c4a
This commit is contained in:
bit4bit
2021-06-25 01:56:49 +00:00
parent a9dde83e81
commit b6219bd171
4 changed files with 51 additions and 13 deletions

View File

@@ -326,6 +326,15 @@ def test_field_inserted_default_attribute():
person = Person()
assert '<Person hash="calculate"/>' == person.to_xml()
def test_field_function_inserted_default_attribute():
class Person(facho.model.Model):
__name__ = 'Person'
hash = fields.Function(fields.Attribute('hash'), default='calculate')
person = Person()
assert '<Person hash="calculate"/>' == person.to_xml()
def test_field_inserted_default_many2one():
class ID(facho.model.Model):
__name__ = 'ID'