summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorPierre Masereel <pim@odoo.com>2018-09-11 14:01:57 +0200
committerMartin Trigaux <mat@odoo.com>2018-09-18 14:30:03 +0200
commit7288b4779a83a04617d4f22a22bdd8edfd22e04f (patch)
treea0747ad701df602aeb0a79b149e504260b29ce21 /addons
parent83e460b8daf4b3d0a9e05ba93aa57f32d74b5f4f (diff)
[IMP] base, tools, web_edeitor: improve ir_translation insertion
The ir_translations were pretty slow to load, this was mainly caused by the condition in variable 'find_expr' and the import of po values in the temporary table. To improve the load performance, we made two improvement: 1. Insert the row in the temporary table by batch instead of making an insertion for each record. 2. Replacing the condition in the variable 'find_expr' by partial unique index. To perform such a thing, we had to separate the type model in two types, 'model' and 'model_terms' because it wasn't possible to create a partial unique index on type 'model' because the type was used for two different use cases. The type model is now used for fields that have have a value not callable for the attribute translate, these field can only have one record for the same field, model, res_id and language. And the type 'model_terms' is used for the fields callable, because they can have multiple sources for the same res_id. We also removed the deprecated types 'report', 'help', 'view', 'field'. Thanks to @rco-odoo for the improvement of the first point.
Diffstat (limited to 'addons')
-rw-r--r--addons/web_editor/models/ir_translation.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/web_editor/models/ir_translation.py b/addons/web_editor/models/ir_translation.py
index 0dedc93cc84..1afaebe9d39 100644
--- a/addons/web_editor/models/ir_translation.py
+++ b/addons/web_editor/models/ir_translation.py
@@ -27,7 +27,7 @@ class IrTranslation(models.Model):
""" Convert the HTML fragment ``value`` to XML if necessary, and write
it as the value of translation ``self``.
"""
- assert len(self) == 1 and self.type == 'model'
+ assert len(self) == 1 and self.type == 'model_terms'
mname, fname = self.name.split(',')
field = self.env[mname]._fields[fname]
if field.translate == xml_translate: