summaryrefslogtreecommitdiff
path: root/odoo
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-08-21 18:48:13 +0200
committerChristophe Simonis <chs@odoo.com>2018-08-21 18:48:13 +0200
commitef6b574eda3c3c5c8e911f2e8923e24ea8b50b50 (patch)
treea7f41d2feb24bf87a80ed67e529ed25a105b6416 /odoo
parent0c34698c478ab3adc7d768ad140fa4a4dd3d0969 (diff)
parent6cc7d3f9451eb41a472053dc3c04da0bbd3c7d1e (diff)
[MERGE] forward port branch saas-11.3 up to 6cc7d3f9451
Diffstat (limited to 'odoo')
-rw-r--r--odoo/addons/base/tests/test_orm.py24
-rw-r--r--odoo/models.py3
-rw-r--r--odoo/tools/mail.py1
3 files changed, 26 insertions, 2 deletions
diff --git a/odoo/addons/base/tests/test_orm.py b/odoo/addons/base/tests/test_orm.py
index d9a358d3c1e..bbb52f8c80a 100644
--- a/odoo/addons/base/tests/test_orm.py
+++ b/odoo/addons/base/tests/test_orm.py
@@ -202,6 +202,30 @@ class TestORM(TransactionCase):
group_user.write({'users': [(3, user.id)]})
self.assertTrue(user.share)
+ @mute_logger('odoo.models')
+ def test_unlink_with_property(self):
+ """ Verify that unlink removes the related ir.property as unprivileged user """
+ user = self.env['res.users'].create({
+ 'name': 'Justine Bridou',
+ 'login': 'saucisson',
+ 'groups_id': [4, self.ref('base.group_partner_manager')],
+ })
+ p1 = self.env['res.partner'].sudo(user).create({'name': 'Zorro'})
+ p1_prop = self.env['ir.property'].sudo(user).create({
+ 'name': 'Slip en laine',
+ 'res_id': 'res.partner,{}'.format(p1.id),
+ 'fields_id': self.env['ir.model.fields'].search([
+ ('model', '=', 'res.partner'), ('name', '=', 'ref')], limit=1).id,
+ 'value_text': 'Nain poilu',
+ 'type': 'char',
+ })
+
+ # Unlink with unprivileged user
+ p1.unlink()
+
+ # ir.property is deleted
+ self.assertEqual(
+ p1_prop.exists(), self.env['ir.property'], 'p1_prop should have been deleted')
class TestInherits(TransactionCase):
""" test the behavior of the orm for models that use _inherits;
diff --git a/odoo/models.py b/odoo/models.py
index 943a4356d58..c891d73f901 100644
--- a/odoo/models.py
+++ b/odoo/models.py
@@ -2948,9 +2948,8 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})):
# Delete the records' properties.
with self.env.norecompute():
- self.env['ir.property'].search([('res_id', 'in', refs)]).unlink()
-
self.check_access_rule('unlink')
+ self.env['ir.property'].search([('res_id', 'in', refs)]).sudo().unlink()
cr = self._cr
Data = self.env['ir.model.data'].sudo().with_context({})
diff --git a/odoo/tools/mail.py b/odoo/tools/mail.py
index 2067f3373d7..668d0678f88 100644
--- a/odoo/tools/mail.py
+++ b/odoo/tools/mail.py
@@ -48,6 +48,7 @@ class _Cleaner(clean.Cleaner):
'float', 'vertical-align', 'display',
'padding', 'padding-top', 'padding-left', 'padding-bottom', 'padding-right',
'margin', 'margin-top', 'margin-left', 'margin-bottom', 'margin-right',
+ 'white-space',
# box model
'border', 'border-color', 'border-radius', 'border-style', 'border-width', 'border-top',
'height', 'width', 'max-width', 'min-width', 'min-height',