mirror of
https://github.com/bringout/oca-ocb-core.git
synced 2026-04-20 23:52:09 +02:00
19.0 vanilla
This commit is contained in:
parent
d1963a3c3a
commit
2d3ee4855a
7430 changed files with 2687981 additions and 2965473 deletions
|
|
@ -3119,6 +3119,7 @@ class BaseModel(metaclass=MetaModel):
|
|||
""" SELECT a.attname, a.attnotnull
|
||||
FROM pg_class c, pg_attribute a
|
||||
WHERE c.relname=%s
|
||||
AND c.relnamespace = current_schema::regnamespace
|
||||
AND c.oid=a.attrelid
|
||||
AND a.attisdropped=%s
|
||||
AND pg_catalog.format_type(a.atttypid, a.atttypmod) NOT IN ('cid', 'tid', 'oid', 'xid')
|
||||
|
|
@ -3409,6 +3410,8 @@ class BaseModel(metaclass=MetaModel):
|
|||
if self.env.user._has_group('base.group_no_one'):
|
||||
if field.groups == NO_ACCESS:
|
||||
allowed_groups_msg = _("always forbidden")
|
||||
elif not field.groups:
|
||||
allowed_groups_msg = _("custom field access rules")
|
||||
else:
|
||||
groups_list = [self.env.ref(g) for g in field.groups.split(',')]
|
||||
groups = self.env['res.groups'].union(*groups_list).sorted('id')
|
||||
|
|
@ -3648,7 +3651,7 @@ class BaseModel(metaclass=MetaModel):
|
|||
for lang, _translations in translations.items():
|
||||
_old_translations = {src: values[lang] for src, values in old_translation_dictionary.items() if lang in values}
|
||||
_new_translations = {**_old_translations, **_translations}
|
||||
new_values[lang] = field.translate(_new_translations.get, old_source_lang_value)
|
||||
new_values[lang] = field.convert_to_cache(field.translate(_new_translations.get, old_source_lang_value), self)
|
||||
field._update_cache(self.with_context(prefetch_langs=True), new_values, dirty=True)
|
||||
|
||||
# the following write is incharge of
|
||||
|
|
@ -4149,7 +4152,7 @@ class BaseModel(metaclass=MetaModel):
|
|||
if any(self._ids):
|
||||
Rule = self.env['ir.rule']
|
||||
domain = Rule._compute_domain(self._name, operation)
|
||||
if domain and (forbidden := self - self.sudo().filtered_domain(domain)):
|
||||
if domain and (forbidden := self - self.sudo().with_context(active_test=False).filtered_domain(domain)):
|
||||
return forbidden, functools.partial(Rule._make_access_error, operation, forbidden)
|
||||
|
||||
return None
|
||||
|
|
@ -5378,7 +5381,10 @@ class BaseModel(metaclass=MetaModel):
|
|||
# add order and limits
|
||||
if order:
|
||||
query.order = self._order_to_sql(order, query)
|
||||
if limit is not None:
|
||||
|
||||
# In RPC, None is not available; False is used instead to mean "no limit"
|
||||
# Note: True is kept for backward-compatibility (treated as 1)
|
||||
if limit is not None and limit is not False:
|
||||
query.limit = limit
|
||||
if offset is not None:
|
||||
query.offset = offset
|
||||
|
|
@ -7115,6 +7121,7 @@ def get_columns_from_sql_diagnostics(cr, diagnostics, *, check_registry=False) -
|
|||
JOIN pg_class t ON t.oid = conrelid
|
||||
WHERE conname = %s
|
||||
AND t.relname = %s
|
||||
AND t.relnamespace = current_schema::regnamespace
|
||||
""", diagnostics.constraint_name, diagnostics.table_name))
|
||||
columns = cr.fetchone()
|
||||
return columns[0] if columns else []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue