Commit 3a835067 authored by Robert Rübner's avatar Robert Rübner Committed by Pedro M. Baeza

[ADD] delete_template_translations: New method for deleting translations of...

[ADD] delete_template_translations: New method for deleting translations of changed templates with noupdate true (#87)
parent 9642400f
......@@ -160,6 +160,7 @@ __all__ = [
......@@ -1668,3 +1669,24 @@ def rename_property(cr, model, old_name, new_name):
"update ir_property set name=%s where fields_id in %s",
(new_name, field_ids))
def delete_record_translations(cr, module, xml_ids):
"""Cleanup translations of specific records in a module.
:param module: module name
:param xml_ids: a tuple or list of xml record IDs
if not isinstance(xml_ids, (list, tuple)):
do_raise("XML IDs %s must be a tuple or list!" % (xml_ids))
SELECT model, res_id
FROM ir_model_data
WHERE module = %s AND name in %s
""", (module, tuple(xml_ids),))
for row in cr.fetchall():
query = ("""
DELETE FROM ir_translation
WHERE module = %s AND name LIKE %s AND res_id = %s;
logged_query(cr, query, (module, row[0] + ',%', row[1],))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment