# HG changeset patch # User Christophe de Vienne <christophe.devienne@orus.io> # Date 1547671205 -3600 # Wed Jan 16 21:40:05 2019 +0100 # Branch 11.0 # Node ID a5d8f05027163e7e6df06007f29e03c04b7c2ec4 # Parent d525baae255df7de9fc1dcbfb7f163455bd53519 export: test export integer field diff --git a/export.py b/export.py --- a/export.py +++ b/export.py @@ -42,7 +42,8 @@ field = fields[source] value = getattr(record, source) - if value is False: + + if field["type"] == "char" and value is False: value = None output[key] = value diff --git a/tests/test_export.py b/tests/test_export.py --- a/tests/test_export.py +++ b/tests/test_export.py @@ -7,7 +7,7 @@ @odoo.tests.common.at_install(False) @odoo.tests.common.post_install(True) class Test(TestBase): - def test_export_string_field(self): + def test_export_char_field(self): record = self.env["res.partner"].create({"name": "my name"}) self.assertEqual( {"name": "my name", "company": None}, @@ -15,3 +15,9 @@ record, {"name": {}, "company": {"source": "company_name"}} ), ) + + def test_export_integer_field(self): + record = self.env["res.partner"].create({"name": "my name"}) + self.assertEqual({"color": 0}, export(record, {"color": {}})) + record.color = 10 + self.assertEqual({"color": 10}, export(record, {"color": {}}))