summaryrefslogtreecommitdiff
path: root/odoo
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-10-31 15:25:01 +0100
committerChristophe Simonis <chs@odoo.com>2017-10-31 15:25:01 +0100
commit810b6aa7600bad6bba4d0fc67f04ecf4975193d5 (patch)
tree3ae5238cdb4aa22f056c1869fb5766b2b3fe45e8 /odoo
parent3c55407f111dcf44fdc0258b2352d208bdc71a0a (diff)
parentd1fcca1504a8a745775487bfd7740505894d2f5f (diff)
[MERGE] forward port branch saas-15 up to d1fcca1504a
Diffstat (limited to 'odoo')
-rw-r--r--odoo/addons/base/module/module.py9
-rw-r--r--odoo/addons/test_impex/tests/test_export.py54
-rw-r--r--odoo/models.py10
3 files changed, 41 insertions, 32 deletions
diff --git a/odoo/addons/base/module/module.py b/odoo/addons/base/module/module.py
index fde49e72885..3e5e5af2f88 100644
--- a/odoo/addons/base/module/module.py
+++ b/odoo/addons/base/module/module.py
@@ -30,6 +30,7 @@ import odoo
from odoo import api, fields, models, modules, tools, _
from odoo.exceptions import AccessDenied, UserError
from odoo.tools.parse_version import parse_version
+from odoo.tools.misc import topological_sort
from odoo.http import request
_logger = logging.getLogger(__name__)
@@ -814,7 +815,13 @@ class Module(models.Model):
filter_lang = [lang.code for lang in langs]
elif not isinstance(filter_lang, (list, tuple)):
filter_lang = [filter_lang]
- mod_names = [mod.name for mod in self if mod.state in ('installed', 'to install', 'to upgrade')]
+
+ update_mods = self.filtered(lambda r: r.state in ('installed', 'to install', 'to upgrade'))
+ mod_dict = {
+ mod.name: mod.dependencies_id.mapped('name')
+ for mod in update_mods
+ }
+ mod_names = topological_sort(mod_dict)
self.env['ir.translation'].load_module_terms(mod_names, filter_lang)
@api.multi
diff --git a/odoo/addons/test_impex/tests/test_export.py b/odoo/addons/test_impex/tests/test_export.py
index 226ba9943f6..861e7dd1661 100644
--- a/odoo/addons/test_impex/tests/test_export.py
+++ b/odoo/addons/test_impex/tests/test_export.py
@@ -304,13 +304,12 @@ class test_m2o(CreatorCase):
[[False]])
def test_basic(self):
- """ Exported value is the name_get of the related object
+ """ Exported value is empty
"""
record = self.env['export.integer'].create({'value': 42})
- name = dict(record.name_get())[record.id]
self.assertEqual(
self.export(record.id),
- [[name]])
+ [['']])
def test_path(self):
""" Can recursively export fields of m2o via path
@@ -352,14 +351,13 @@ class test_o2m(CreatorCase):
def test_single(self):
self.assertEqual(
self.export([(0, False, {'value': 42})]),
- # name_get result
- [[u'export.one2many.child:42']])
+ [['']])
def test_single_subfield(self):
self.assertEqual(
self.export([(0, False, {'value': 42})],
fields=['value', 'value/value']),
- [[u'export.one2many.child:42', u'42']])
+ [['', u'42']])
def test_integrate_one_in_parent(self):
self.assertEqual(
@@ -381,9 +379,13 @@ class test_o2m(CreatorCase):
def test_multiple_records_name(self):
self.assertEqual(
self.export(self.commands, fields=['const', 'value']),
- [[
- u'4', u','.join(self.names)
- ]])
+ [
+ [u'4', ''],
+ ['', ''],
+ ['', ''],
+ ['', ''],
+ ['', ''],
+ ])
def test_multiple_records_id(self):
export = self.export(self.commands, fields=['const', 'value/.id'])
@@ -401,14 +403,18 @@ class test_o2m(CreatorCase):
def test_multiple_records_with_name_before(self):
self.assertEqual(
self.export(self.commands, fields=['const', 'value', 'value/value']),
- [[ # exports sub-fields of very first o2m
- u'4', u','.join(self.names), u'4'
- ]])
+ [
+ [u'4', '', u'4'],
+ ['', '', u'42'],
+ ['', '', u'36'],
+ ['', '', u'4'],
+ ['', '', u'13'],
+ ])
def test_multiple_records_with_name_after(self):
self.assertEqual(
self.export(self.commands, fields=['const', 'value/value', 'value']),
- [ # completely ignores name_get request
+ [
[u'4', u'4', ''],
['', u'42', ''],
['', u'36', ''],
@@ -459,16 +465,16 @@ class test_o2m_multiple(CreatorCase):
def test_single_per_side(self):
self.assertEqual(
self.export(child1=False, child2=[(0, False, {'value': 42})]),
- [[False, u'export.one2many.child.2:42']])
+ [[False, '']])
self.assertEqual(
self.export(child1=[(0, False, {'value': 43})], child2=False),
- [[u'export.one2many.child.1:43', False]])
+ [['', False]])
self.assertEqual(
self.export(child1=[(0, False, {'value': 43})],
child2=[(0, False, {'value': 42})]),
- [[u'export.one2many.child.1:43', u'export.one2many.child.2:42']])
+ [['', '']])
def test_single_integrate_subfield(self):
fields = ['const', 'child1/value', 'child2/value']
@@ -555,14 +561,13 @@ class test_m2m(CreatorCase):
def test_single(self):
self.assertEqual(
self.export([(0, False, {'value': 42})]),
- # name_get result
- [[u'export.many2many.other:42']])
+ [['']])
def test_single_subfield(self):
self.assertEqual(
self.export([(0, False, {'value': 42})],
fields=['value', 'value/value']),
- [[u'export.many2many.other:42', u'42']])
+ [['', u'42']])
def test_integrate_one_in_parent(self):
self.assertEqual(
@@ -584,10 +589,13 @@ class test_m2m(CreatorCase):
def test_multiple_records_name(self):
self.assertEqual(
self.export(self.commands, fields=['const', 'value']),
- [[ # FIXME: hardcoded comma, import uses config.csv_internal_sep
- # resolution: remove configurable csv_internal_sep
- u'4', u','.join(self.names)
- ]])
+ [
+ [u'4', ''],
+ ['', ''],
+ ['', ''],
+ ['', ''],
+ ['', ''],
+ ])
# essentially same as o2m, so boring
diff --git a/odoo/models.py b/odoo/models.py
index 8ce1f01eb6b..f32a4e1276a 100644
--- a/odoo/models.py
+++ b/odoo/models.py
@@ -693,14 +693,8 @@ class BaseModel(object):
for j, val in enumerate(lines2[0]):
if val or isinstance(val, bool):
current[j] = val
- # check value of current field
- if not current[i] and not isinstance(current[i], bool):
- # assign xml_ids, and forget about remaining lines
- xml_ids = [item[1] for item in value.name_get()]
- current[i] = ','.join(xml_ids)
- else:
- # append the other lines at the end
- lines += lines2[1:]
+ # append the other lines at the end
+ lines += lines2[1:]
else:
current[i] = False