Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Služby pro partnery
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

Odoo 13 - Computed Fields - ORM changes?

Odebírat

Get notified when there's activity on this post

This question has been flagged
access rightscomputed-fields13.0ORM
1 Odpovědět
10129 Zobrazení
Avatar
Chris TRINGHAM

In Odoo 12 you can check whether a user is in an access group by using self.env.user.has_group. 

For example, I can set up a boolean computed field that is True if the user is in a user access group: 

for record in self:
    if self.env.user.has_group('<UserAccessGroup>'):
         record['x_studio_authorization1'] = True 

But in Odoo 13 this gives an error message for users who are not in the user access group.  It's just a dialog box with the heading "Something went wrong" followed by the Model, ID & Field.

product.template(23,).x_studio_authorization1

As noted below in the comments, this error only happens if the computed field is NOT defined as "stored", which seems to be different from Odoo 12.  The problem is that if the field is stored it doesn't work (because it doesn't get updated).

0
Avatar
Zrušit
Yenthe Van Ginneken (Mainframe Monkey)

I see self.env.user.has_group('group') in loads of default Odoo modules though. Are you sure its not your record[{x_studio_authorization1'] = True that is failing?

Chris TRINGHAM
Autor

Hi Yenthe

Quite possibly, but I don't know because the error message gives me no information! How can I check?

Hilar Andikkadavath

Here the record is an object and you are trying to get a value like dict syntax. Try to access record.field_name

Chris TRINGHAM
Autor

Has this changed in Odoo 13? The same syntax worked in Odoo 12.

Chris TRINGHAM
Autor

I think Yenthe is correct, it's not the self.env.user.has_group('group'). It's an issue with computed fields.

If the computed field is defined as "stored" there is no error. I think that's because it gets run as superuser. But it also doesn't work if it is stored.

天津迈讯科技有限公司

Same issue found of ks_chart_data field computation in upgrading ks_dashboard_ninja addon 12.0.8.0.0 to compatible with odoo 13.0

Avatar
Kanakinfosystems
Nejlepší odpověď

Hi Chris,

Check this out.

for record in self:

record['x_studio_authorization1'] = False
if self.env.user.has_group('<UserAccessGroup>'):
record['x_studio_authorization1'] = True

Thanks.


2
Avatar
Zrušit
Chris TRINGHAM
Autor

Excellent! It works. I don't know why, but it works!!

Simon Demming

My impression with the computed fields is, that the default values are not properly set. When one uses the default attribute on the field, but has a path without setting the value in the computing method, it fails to set the field to the default value...

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
[13.0] Module installation failed due to stored compute field on large database
performance installation memory computed-fields 13.0
Avatar
Avatar
1
zář 21
6626
ValueError: forbidden opcode(s) in 'lambda': STORE_ATTR
computed-fields
Avatar
Avatar
1
čvn 25
16923
Make stored compute filed recompute after changing it logic but not depedencies.
computed-fields
Avatar
Avatar
Avatar
Avatar
3
dub 25
7527
[odoo 13]Discuss template
13.0
Avatar
0
říj 24
2076
Odoo python backend question
ORM
Avatar
0
srp 24
1994
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now