Browse Source

[FIX] base_custom_info: Avoid permission errors on restricted environments

When changing the custom info template, some recomputation triggers are launched
that can involve records that the user changing the template has not access to
(for example, a record of other company).

Putting this, we avoid the problem.
12.0-mig-module_prototyper_last
Pedro M. Baeza 5 years ago
parent
commit
fbc5895860
  1. 2
      base_custom_info/__manifest__.py
  2. 3
      base_custom_info/models/custom_info_value.py

2
base_custom_info/__manifest__.py

@ -7,7 +7,7 @@
'name': "Base Custom Info", 'name': "Base Custom Info",
'summary': "Add custom field in models", 'summary': "Add custom field in models",
'category': 'Tools', 'category': 'Tools',
'version': '12.0.1.0.1',
'version': '12.0.1.0.2',
'depends': [ 'depends': [
'base_setup', 'base_setup',
], ],

3
base_custom_info/models/custom_info_value.py

@ -20,12 +20,13 @@ class CustomInfoValue(models.Model):
model = fields.Char( model = fields.Char(
related="property_id.model", index=True, readonly=True, related="property_id.model", index=True, readonly=True,
auto_join=True, store=True,
auto_join=True, store=True, compute_sudo=True,
) )
owner_id = fields.Reference( owner_id = fields.Reference(
selection="_selection_owner_id", string="Owner", selection="_selection_owner_id", string="Owner",
compute="_compute_owner_id", inverse="_inverse_owner_id", compute="_compute_owner_id", inverse="_inverse_owner_id",
help="Record that owns this custom value.", help="Record that owns this custom value.",
compute_sudo=True,
) )
res_id = fields.Integer( res_id = fields.Integer(
string="Resource ID", required=True, index=True, store=True, string="Resource ID", required=True, index=True, store=True,

Loading…
Cancel
Save