from odoo import models
from odoo.http import request


class IrQWeb(models.AbstractModel):
    _inherit = "ir.qweb"

    def _prepare_environment(self, values):
        result = super()._prepare_environment(values)
        if not values.get("minimal_qcontext"):
            translate = request.session.get("translate", "") if request else ""
            values.setdefault("translate", translate)
        return result
