Skip to content
Snippets Groups Projects
Commit ca5b49de authored by Martin Trigaux's avatar Martin Trigaux
Browse files

[FIX] base: preserve context when duplicating a record


Keep the original context after duplication
This is a partial fix for this issue raised at opw-2868550

To reproduce:
- activate 2 languages (e.g. es_ES and en_US)
- set es_ES as default language
- edit an existing page (e.g. contactus) in the default language
- change a small detail (e.g. field label in form)
- save

When writing for the first time on a website page from the editor,
with the website creates a new page using copy
The copy removed the language on the record when creating the new
record but did not reset it.

>>> self.env.context
{'lang': 'es_ES'}
>>> copy = self.copy()
>>> copy.env.context
{'lang': None}

Not having the right language is an issue as the code following the
copy call bypass the translation system with a lang=None

This patch is only the server part.
The language still needs to be propagated in the context from the
editor.

closes odoo/odoo#100308

Signed-off-by: default avatarMartin Trigaux (mat) <mat@odoo.com>
parent 4fd3841b
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment