diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-05-02 13:16:27 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-05-02 13:16:27 +0200 |
| commit | 3ca58705c98f5976efecfdcd20ae603dc9ecbbe1 (patch) | |
| tree | b4503ca7b2612ff8dafa761dc824452ce1de020a /odoo/addons | |
| parent | 848a1b970bd493363b29883c0c20c55c820d04ee (diff) | |
| parent | 2c68df0ab43cb42e6762d7a1929471bf3f3df920 (diff) | |
[MERGE] forward port branch saas-11.3 up to 2c68df0ab43
Diffstat (limited to 'odoo/addons')
| -rw-r--r-- | odoo/addons/base/models/ir_qweb_fields.py | 4 | ||||
| -rw-r--r-- | odoo/addons/test_new_api/tests/test_one2many.py | 19 |
2 files changed, 22 insertions, 1 deletions
diff --git a/odoo/addons/base/models/ir_qweb_fields.py b/odoo/addons/base/models/ir_qweb_fields.py index d0df08603e1..01df37e85e5 100644 --- a/odoo/addons/base/models/ir_qweb_fields.py +++ b/odoo/addons/base/models/ir_qweb_fields.py @@ -479,6 +479,10 @@ class FloatTimeConverter(models.AbstractModel): def value_to_html(self, value, options): sign = math.copysign(1.0, value) hours, minutes = divmod(abs(value) * 60, 60) + minutes = round(minutes) + if minutes == 60: + minutes = 0 + hours += 1 return '%02d:%02d' % (sign * hours, minutes) diff --git a/odoo/addons/test_new_api/tests/test_one2many.py b/odoo/addons/test_new_api/tests/test_one2many.py index 62de71c07fc..5c810c3835f 100644 --- a/odoo/addons/test_new_api/tests/test_one2many.py +++ b/odoo/addons/test_new_api/tests/test_one2many.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from openerp.tests.common import TransactionCase +from odoo.tests.common import TransactionCase class One2manyCase(TransactionCase): @@ -51,6 +51,8 @@ class One2manyCase(TransactionCase): self.multi.lines = self.multi.lines[:-1] self.assertEqual(len(self.multi.lines), 9) self.assertIn("hello", self.multi.lines.mapped('name')) + if not self.multi.id: + return # Invalidate the cache and check again; this crashes if the value # of self.multi.lines in cache contains new records self.multi.invalidate_cache() @@ -89,11 +91,26 @@ class One2manyCase(TransactionCase): self.multi.lines = [(0, 0, {"name": str(name)})] self.operations() + def test_rpcstyle_one_by_one_on_new(self): + self.multi = self.env["test_new_api.multi"].new({ + "name": "What is up?" + }) + for name in range(10): + self.multi.lines = [(0, 0, {"name": str(name)})] + self.operations() + def test_rpcstyle_single(self): """Check lines created with RPC style and added in one step""" self.multi.lines = [(0, 0, {'name': str(name)}) for name in range(10)] self.operations() + def test_rpcstyle_single_on_new(self): + self.multi = self.env["test_new_api.multi"].new({ + "name": "What is up?" + }) + self.multi.lines = [(0, 0, {'name': str(name)}) for name in range(10)] + self.operations() + def test_many2one_integer(self): """Test several models one2many with same inverse Integer field""" # utility function to convert records to tuples with id,name |
