diff --git a/doc/cla/individual/jbjourget-b.md b/doc/cla/individual/jbjourget-b.md new file mode 100644 index 0000000000000..e16c6a92a26ad --- /dev/null +++ b/doc/cla/individual/jbjourget-b.md @@ -0,0 +1,11 @@ +France, 2023-11-27 + +I hereby agree to the terms of the Odoo Individual Contributor License +Agreement v1.0. + +I declare that I am authorized and able to make this agreement and sign this +declaration. + +Signed, + +Jean-BenoƮt Jourget 137054756+jbjourget-b@users.noreply.github.com https://github.com/jbjourget-b diff --git a/odoo/addons/base/models/ir_property.py b/odoo/addons/base/models/ir_property.py index 525751302d26e..7a379785ac100 100644 --- a/odoo/addons/base/models/ir_property.py +++ b/odoo/addons/base/models/ir_property.py @@ -111,12 +111,7 @@ def write(self, values): # we're writing a res_id=False on any record default_set = False if self._ids: - self.env.cr.execute( - 'SELECT EXISTS (SELECT 1 FROM ir_property WHERE id in %s AND res_id IS NULL)', [self._ids]) - default_set = self.env.cr.rowcount == 1 or any( - v.get('res_id') is False - for v in values - ) + default_set = values.get('res_id') is False or any(not p.res_id for p in self) r = super(Property, self).write(self._update_values(values)) if default_set: # DLE P44: test `test_27_company_dependent` @@ -139,13 +134,7 @@ def create(self, vals_list): return r def unlink(self): - default_deleted = False - if self._ids: - self.env.cr.execute( - 'SELECT EXISTS (SELECT 1 FROM ir_property WHERE id in %s)', - [self._ids] - ) - default_deleted = self.env.cr.rowcount == 1 + default_deleted = any(not p.res_id for p in self) r = super().unlink() if default_deleted: self.clear_caches()