Commit Graph

95 Commits

Author SHA1 Message Date
Martin Trigaux 1f07b9429c [FIX] base: update translations should not duplicate the terms
When a translated term is modified (e.g. content of an email.template),
reloading the translations of the module (e.g. when updating the module) used to
recreate a new, duplicare translation for the modified term (instead of ignoring
the existing one).

This was due to the fact the matching expression (find_expr), when loading
translations, used the field 'src' (source term) as criteria for (almost) all
ir.translation records.

While this is true for type 'code' or 'selection', this is not true for 'model'
where the source content may have been changed.
In case of translation of type 'model', matching on the name and res_id should be
enough for the matching expression and then, avoid creating duplicated
translations.

Note: this patch must NOT be present in 9.0 due to the xml_translate
attribute that splits an xml content into small parts.

opw 654031
2015-11-30 16:41:56 +01:00
Martin Trigaux a70287d42c [FIX] base: set module when creating translation
When creating missing translations on an object (e.g. using blue flag icon on a
field), the value of the module was not set.
This was problematic as could create a duplicated translation when the module
was updated or the translation reloaded (as the module is used in find_expr).

opw 654036
2015-11-30 16:41:56 +01:00
Olivier Dony 5a41a3011a [FIX] ir_translation: undo asymmetric change of set_ids/get_ids
Partial revert of commit 39d17c2580
of PR #4617, that broke translations by introducing a different
set of criterions for filtering translations in `_set_ids()` and
`_get_ids()`, adding the `module` column in `_set_ids`.

This meant `_get_ids` would see translations that `_set_ids`
would never update: the translation interface did not appear to
be working anymore as soon as a translation entry existed with
no `module` value.
This is likely for manual entries and for entries bootstrapped
by `translate_fields()`, as they do not belong to any module.

The situation described in PR #4617 probably requires an extra
fix in the translation import system instead.
2015-08-05 16:29:16 +02:00
Raf Ven 39d17c2580 [FIX] base: avoid deleting translations
When updating a translation, the previous one is deleted and a new one is
recreated (with no module and state). When the source module is updated, the
previous term is inserted again to the lsit of terms.
Instead of dropping and recreating terms during update, simply update the
existing term and create one only if there were no previous translation.
Fixes #4617
2015-07-16 15:14:30 +02:00
Christophe Simonis b5e1e14c5d [MERGE] forward port of branch saas-3 up to 59d82e6 2015-04-07 14:08:15 +02:00
Christophe Simonis 59d82e6fe7 [MERGE] forward port of branch 7.0 up to 5042d91 2015-04-07 13:36:01 +02:00
Christophe Simonis 5042d91330 [FIX] base: translation update
When updating translations, the source (`src`) is irrelevant for
`field` and `help` translations. Theses translation types are only
matched through their `name`.
2015-04-07 12:37:11 +02:00
Raphael Collet f2930c548e [IMP] ir_translation: improve usage of `ormcache` by method `_get_source`
Convert the arguments to avoid a cache error when the method is called with a
list of ids.
2015-03-31 10:12:14 +02:00
Robert Rübner ff902f62e2 [FIX] base: update of source value in translation
Make sure pass a list of ids instead of a single id to write calls.
Some models (e.g. blog.post, fixed at 12fc5ea) are assuming that it got a list
of ids and is not checking the type.
Always pass a list of ids as it's the expected format for the orm.
2015-03-27 16:39:26 +01:00
Goffin Simon cbb51610ee [FIX] ir.ui.view: qweb translations: allow looking up translation in parent template
- Translations lookup normally uses the namespace of the current
QWeb template, after merging all inherited views.
But when a QWeb template is "cloned" by a child view using
inheritance with `primary` mode, the translations are more
likely to exist for the original (parent) template, and would not
be found when using only the "child" namespace.
This patch adds support for looking up each translation
also in the parent namespace in this case, if none was found
for the child template in the first place.

- ir.translation's _get_source() now supports a list of res_id
to search for, in addition to a single res_id

- Also moved the logic of routes /website/customize_template_get
and /website/get_view_translations to the ir.ui.view model where
it belongs.

opw: 615241

Closes #5325
2015-02-24 14:01:34 +01:00
Denis Ledoux 4c1908088c [MERGE] forward port of branch saas-3 up to 879fca0 2015-01-06 19:00:08 +01:00
Denis Ledoux 879fca0856 [MERGE] forward port of branch 7.0 up to 9191115 2015-01-06 18:56:10 +01:00
Martin Trigaux 96d1520a5e [FIX] base: no line feed in translations
Revert "[FIX] ir_translation: remove control characters from translations"
This reverts commit 6d4e1cc73e.

This was intended to clean malformed translations but it introduced the side
effect of removing all '\n' in translations.

Fixes #4092, opw 619175
2015-01-06 10:43:54 +01:00
Martin Trigaux d6b26c6890 [FIX] base: almost-duplicated translations ignored during import
Translations are not transfered from temporary table tmp_ir_translation_import
to ir_translation if translation already exists (using `find_expr`).
In case of import of QWeb terms (name = 'website'), the criteria was too weak,
finding already present terms in translations for different modules.
e.g. term "Quantity" is already present in a QWeb view from sale module and was
not imported for the translations of the website_sale module.
Fixed by adding the filter criteria 'irt.module = ti.module'

In case QWeb translations for the same term in the same modules were added in
two imports (second term added in the future), the second was still ignored.
Changed condition to check the res_id for views as well.

Fixes #4239
2014-12-16 14:34:43 +01:00
Somesh Khare f317fedc4b [Fix] ir_translation: fix the problem of base_field object has no attribute model (Maintenance Case:618054)
Fixes #3859
2014-11-26 12:25:58 +01:00
Raphael Collet 54140331f3 [FIX] fields: fix the translations of the labels of inherited fields 2014-11-06 16:42:41 +01:00
Raphael Collet f2e4a10e1a [IMP] use model._fields instead of model._all_columns to cover all fields
The old-api model._all_columns contains information about model._columns and
inherited columns.  This dictionary is missing new-api computed non-stored
fields, and the new field objects provide a more readable api...

This commit contains the following changes:

 - adapt several methods of BaseModel to use fields instead of columns and
   _all_columns

 - copy all semantic-free attributes of related fields from their source

 - add attribute 'group_operator' on integer and float fields

 - base, base_action_rule, crm, edi, hr, mail, mass_mailing, pad,
   payment_acquirer, share, website, website_crm, website_mail: simply use
   _fields instead of _all_columns

 - base, decimal_precision, website: adapt qweb rendering methods to use fields
   instead of columns
2014-11-04 13:47:57 +01:00
Martin Trigaux 8843974d04 Forward port of branch saas-3 up to fc9fc3e 2014-10-06 15:52:23 +02:00
Denis Ledoux cd6dba5257 [MERGE] forward port of branch 7.0 up to 9066da3 2014-10-03 12:13:07 +02:00
Denis Ledoux 7cbd524448 [FIX] ir_translation: apply tools.ustr on the trad itself
tools.ustr(None) returns u'None', res[0] can be None.
2014-10-03 12:08:49 +02:00
Denis Ledoux 76fdbec3bb [MERGE] forward port of branch 7.0 up to 6d4e1cc 2014-10-03 11:22:47 +02:00
Denis Ledoux 6d4e1cc73e [FIX] ir_translation: remove control characters from translations
This is possible that control characters (such as line returns) are inserted wrongly in translations
These should not influence on the web interface
2014-10-03 11:20:19 +02:00
Olivier Dony b7a2cc13ba [FIX] ir.translation: translated terms within view definitions were not loaded
The changes for QWeb template translation have introduced
res_id values in PO comments for all `#: view:` terms, as
the real database id needs to be resolved when loading them.

For non-QWeb views this is not necessary and actually caused
the terms to be dropped when the res_id could not be resolved.

Rather than having a different PO comment format for QWeb and
non-QWeb views, we can extend the QWeb hack to force the
res_id to 0 for non-QWeb views.

Fixes issue #1755
2014-09-16 17:46:25 +02:00
Olivier Dony 868a77616d [FIX] ir.translation: export/import of QWeb terms
Fixes the translation term import/export logic to
support terms inside QWeb templates.

Refactored a bit the export code so the babel-based
QWeb terms extractor for ./static/src/*.xml files
uses the same logic as the regular extractor for
ir.ui.views with type QWeb.

Server-side QWeb rendering uses a mix of the native
 view inheritance mechanism and the template inclusion
(t-call) mechanism. During rendering the translations
are only applied at "template" level, *after* the
view inheritance has already been resolved.
As a result translations are local to a template,
not to the inherited view in which they are actually
written.
In terms of exporting PO[T] files, this is done by
resolving the "root" QWeb template a view belongs
to, and using it as the location of the translated term.

During import there is one extra quirk for QWeb
terms: they need to be linked to the `website` model
rather than the actual `ir.ui.view` model they
are really pointing to, so the rendering phase can
properly recognize them.
2014-08-13 11:08:02 +02:00
Raphael Collet cbe2dbb672 [MERGE] new v8 api by rco
A squashed merge is required as the conversion of the apiculture branch from
bzr to git was not correctly done. The git history contains irrelevant blobs
and commits. This branch brings a lot of changes and fixes, too many to list
exhaustively.

- New orm api, objects are now used instead of ids
- Environements to encapsulates cr uid context while maintaining backward compatibility
- Field compute attribute is a new object oriented way to define function fields
- Shared browse record cache
- New onchange protocol
- Optional copy flag on fields
- Documentation update
- Dead code cleanup
- Lots of fixes
2014-07-06 17:05:41 +02:00
Jeremy Kersten 18bb52ee88 [FIX] Gengo - Update modoel ir_translation for gengo and make it working. Works with order and not job, because when you send a batch to translate, you don't know all the job but only the order. 2014-06-20 17:33:09 +02:00
Fabien Meghazi 1895d8bd76 [FIX] clear ir.ui.view cache on translation write/create
bzr revid: fme@openerp.com-20140122151327-keaozhwa7rx4qj73
2014-01-22 16:13:27 +01:00
Thibault Delavallée 7a72d858cb [MERGE] Sync with trunk
bzr revid: tde@openerp.com-20140103151324-jk0u8vmrxxomy5vx
2014-01-03 16:13:24 +01:00
Martin Trigaux 216303c2fa [FIX] ir_translation: rename method load to load_module_terms to avoid name clash with load call from base_import
bzr revid: mat@openerp.com-20131230125307-kald7ir36bvq3o7c
2013-12-30 13:53:07 +01:00
Christophe Matthieu 8460122209 [MERGE] sync with trunk
bzr revid: chm@openerp.com-20131202150856-fzrfcoa8pmsjutau
2013-12-02 16:08:56 +01:00
Denis Ledoux 6fd552c3ce [MERGE] Forward-port of latest 7.0 bugfixes, up to rev. 5139 rev-id: dle@openerp.com-20131121132305-qjlclgz5v9tze1fr
bzr revid: odo@openerp.com-20131120102545-2tlp031yib6viz35
bzr revid: chs@openerp.com-20131120161708-c8sbom592moukwxw
bzr revid: dle@openerp.com-20131121155457-lh7fzouk2upeiu16
2013-11-21 16:54:57 +01:00
Denis Ledoux 58080c6569 [FIX] ir, ir_translation: it was not possible to empty the source of a translation, or this is sometime something that we want
bzr revid: dle@openerp.com-20131121132305-qjlclgz5v9tze1fr
2013-11-21 14:23:05 +01:00
Thibault Delavallée 97f164ba99 [MERGE] Sync with trunk
bzr revid: tde@openerp.com-20131028163325-2hpks3hp23zop40n
2013-10-28 17:33:25 +01:00
Xavier Morel a622a5ad55 [FIX] remove handling of parameters in ormcache clearing
It's completely broken in case of optional parameters
e.g. (ir.translation)._get_source, as a call with the optional
parameter won't be matched by a clear without, and the other way
around. This becomes even more problematic in the website branch as
_get_source now has *two* optional parameters (source and res_id).

After discussion with odo and discovery that in multiprocess only the
current node will use any granularity (other nodes not only clear all
of the current method cache, but all caches of all models), simplify
cache clearing, ignore parameters and just blow the current method's
cache entirely.

bzr revid: xmo@openerp.com-20131024132956-4tl3prum8za47igy
2013-10-24 15:29:56 +02:00
Olivier Dony 54f740960e [MERGE] Forward-port of latest saas-1 bugfixes, up to rev. 4912 rev-id: odo@openerp.com-20131016110621-36vvlpn8dgsabyt1
bzr revid: odo@openerp.com-20131016111800-jjybreg62bwz61zn
2013-10-16 13:18:00 +02:00
Olivier Dony 8ac110c4dd [MERGE] Forward-port of latest 7.0 bugfixes, up to rev. 5098 rev-id: odo@openerp.com-20131011123914-7zuvd9mch21yxgj8
bzr revid: dle@openerp.com-20131009131902-a93nsbou4w8y0vlx
bzr revid: chs@openerp.com-20131009175454-j06y1ngylfbqyrpj
bzr revid: dle@openerp.com-20130918160049-fo88fl7uyhfoofkv
bzr revid: dle@openerp.com-20130924130544-kmkyr0d73cusvdav
bzr revid: odo@openerp.com-20131011134433-nyfjipvlql4xu127
2013-10-11 15:44:33 +02:00
Denis Ledoux 447dec696b [FIX]base, ir_translation: in _get_src, if model or record id does not exist anymore, do not apptempt to read it
bzr revid: dle@openerp.com-20130924124654-9lz76t6hx0cmxnx5
2013-09-24 14:46:54 +02:00
Fabien Meghazi 31af948f59 [ADD] Add res_id parameter to ir.translation#_get_source()
bzr revid: fme@openerp.com-20130923114454-soquy5fkp1npjl40
2013-09-23 13:44:54 +02:00
Olivier Dony fbd0758cb5 [MERGE] Forward-port of latest 7.0 bugfixes, up to rev. 5054 rev-id: odo@openerp.com-20130820091157-e5brwlxuhujf8rrd
bzr revid: chs@openerp.com-20130724085026-525l9apggc9yzx0h
bzr revid: odo@openerp.com-20130730140644-1xih0as5jsks4pub
bzr revid: dle@openerp.com-20130801130723-khgwjkglgsdn34fj
bzr revid: odo@openerp.com-20130820091638-jpbcmh653bpa29em
2013-08-20 11:16:38 +02:00
Martin Trigaux 1fc7e4d532 [IMP] ir_translation: better log message
bzr revid: mat@openerp.com-20130813130109-yhvgipdy9m63jcqy
2013-08-13 15:01:09 +02:00
Martin Trigaux 2bac9b3353 [ADD] ir_translation: allow extra translations in folder i18n_extra
bzr revid: mat@openerp.com-20130813121258-q9y4kudhavndlod6
2013-08-13 14:12:58 +02:00
Olivier Dony a4589a84cc [FIX] ir.translation: backport of trunk fix to allow editing master english source terms
Original trunk commits rev-ids:
 - 4855 qdp-launchpad@openerp.com-20130416091501-sgm3gdm80oxajahz
 - 4856 qdp-launchpad@openerp.com-20130417121718-jfwi2f3gn0tum9xa
 - 4857 qdp-launchpad@openerp.com-20130418114627-unmfdu6010hyc8xx

bzr revid: odo@openerp.com-20130703161520-mk0g187rpmmw6bdx
2013-07-03 18:15:20 +02:00
Quentin (OpenERP) 9a21f819b6 [FIX] ir_translation: fixed erro 'context_wo_lang is not defined'
bzr revid: qdp-launchpad@openerp.com-20130418114627-unmfdu6010hyc8xx
2013-04-18 13:46:27 +02:00
Quentin (OpenERP) 96a60e42c6 [FIX] ir_translation: fix in new methods made to improve the usability, see previous commit
bzr revid: qdp-launchpad@openerp.com-20130417121718-jfwi2f3gn0tum9xa
2013-04-17 14:17:18 +02:00
Quentin (OpenERP) d2e71a65e1 [IMP] ir_translation: GUI improve in order to be able to change the english value of a model field (eg: a product name) directly in the translation window + small refactoring in order to test 'if context is None' rather than 'if not context' (see lp bug 525808)
bzr revid: qdp-launchpad@openerp.com-20130416091501-sgm3gdm80oxajahz
2013-04-16 11:15:01 +02:00
Cedric Snauwaert 56badfcb46 [REF]ir_translation: improve _get_src and _set_src function
bzr revid: csn@openerp.com-20130415100914-wm0wqhgg5mou2wxs
2013-04-15 12:09:14 +02:00
Cedric Snauwaert 2455ef9463 [FIX]ir_translation: replace source field to show value of the term stored in db and reflect change directly
in db when changing source value

bzr revid: csn@openerp.com-20130412124914-8epmco1z37ge1oui
2013-04-12 14:49:14 +02:00
Raphael Collet 09be864f1d [IMP] replace all tests like 'registry.get(X)' by 'X in registry' where X is non static
bzr revid: rco@openerp.com-20130329140723-dnrl02saky570xg0
2013-03-29 15:07:23 +01:00
Cecile Tonglet ad8b76de53 [MERGE] From trunk (second time)
bzr revid: cto@openerp.com-20121217144753-1rboqdw01h8yrehj
2012-12-17 15:47:53 +01:00
Xavier Morel 3ee178ab2c [FIX] unnecessary backslashes
bzr revid: xmo@openerp.com-20121214132113-1ofmm5x0ua3l2q5d
2012-12-14 14:21:13 +01:00