Files
odoo_source/addons/website/tests/test_grid_layout.py
T
Soukéina Bojabza c75f5d11f0 [FIX] web_editor: reallow the grid images to be replaced
In commit [1], a check was added to see if a media is editable in order
to prevent its edition if it is not the case. However, this also had as
effect to block the edition of some grid images. Indeed, as the columns
in grid mode containing only an image have their `contenteditable`
property set to `false`, the images don't pass the check because their
parent is therefore not editable.

This commit removes the `contenteditable` property from these columns
in order to make their images pass the check and therefore allow their
edition.

Tests are also added, ensuring that these grid images can be correctly
replaced.

[1]: https://github.com/odoo/odoo/commit/ddade4346347266b7f699d05865578dc96e2bf98

opw-3028116

Fixes #103234

closes odoo/odoo#104899

X-original-commit: d8c374e3e6b31bf88aa42952aadf3379936f7600
Related: odoo/design-themes#617
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-11-03 23:35:10 +01:00

25 lines
897 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import base64
import odoo.tests
from odoo.tests.common import HOST
from odoo.tools import config
@odoo.tests.common.tagged('post_install', '-at_install')
class TestWebsiteGridLayout(odoo.tests.HttpCase):
def test_01_replace_grid_image(self):
IrAttachment = self.env['ir.attachment']
base = "http://%s:%s" % (HOST, config['http_port'])
req = self.opener.get(base + '/web/image/website.s_banner_default_image')
IrAttachment.create({
'public': True,
'name': 's_banner_default_image.jpg',
'type': 'binary',
'res_model': 'ir_ui_view',
'datas': base64.b64encode(req.content),
})
self.start_tour(self.env['website'].get_client_action_url('/'), 'website_replace_grid_image', login="admin")