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

Mail.Activity Creation Error

Odebírat

Get notified when there's activity on this post

This question has been flagged
customoeemail.activity
1 Odpovědět
3836 Zobrazení
Avatar
Hayden McCarthy

Hello, I cannot seem to create a mail.activity and evaluate for the user_id value. Please see my code below:

def _create_activity(self):
---"""Create an Odoo activity for the record on creation."""
---self.env['mail.activity'].create({
------'summary': 'Overall Equipment Efficiency',
------'user_id':self.env['res.users'].browse(self.env['ir.config_parameter'].sudo().get_param('oee.responsible_user')),'date_deadline': fields.Datetime.now() +relativedelta(months=1),
------'res_id': self.id,
------'res_model_id': self.env['ir.model']._get_id('oee.log'),
------'note': "Record machine hours from last month. Reference the previous month's record to see that starting hours for that month.",     
})


I am trying to gather the user_id from oee.responsible_user but it keeps giving me an error (Full Traceback)
ERROR: null value in column "user_id" of relation "mail_activity" violates not-null constraint
DETAIL: Failing row contains (15, 624, null, 0, null, null, Overall Equipment Efficiency,

Record machine hours from last month. Reference the previous ..., 2023-08-11, null, null, null, null, null, 2, 2023-07-11 17:52:38.94198, 2, 2023-07-11 17:52:38.94198).
2023-07-11 17:52:38,992 51 ERROR ******-odoo-sh-testing-8932533 odoo.http: Exception during JSON request handling.
Traceback (most recent call last):
File "/home/odoo/src/odoo/odoo/tools/safe_eval.py", line 332, in safe_eval
return unsafe_eval(c, globals_dict, locals_dict)
File "", line 1, in
File "/home/odoo/src/user/nxc_oee/models/oee.py", line 61, in _create_activity
self.env['mail.activity'].create({
File "", line 2, in create
File "/home/odoo/src/odoo/odoo/api.py", line 412, in _model_create_multi
return create(self, [arg])
File "/home/odoo/src/odoo/addons/mail/models/mail_activity.py", line 263, in create
activities = super(MailActivity, self).create(vals_list)
File "", line 2, in create
File "/home/odoo/src/odoo/odoo/api.py", line 413, in _model_create_multi
return create(self, arg)
File "/home/odoo/src/odoo/odoo/addons/base/models/ir_fields.py", line 613, in create
recs = super().create(vals_list)
File "", line 2, in create
File "/home/odoo/src/odoo/odoo/api.py", line 413, in _model_create_multi
return create(self, arg)
File "/home/odoo/src/odoo/odoo/models.py", line 4081, in create
records = self._create(data_list)
File "/home/odoo/src/odoo/odoo/models.py", line 4179, in _create
cr.execute(query, params)
File "", line 2, in execute
File "/home/odoo/src/odoo/odoo/sql_db.py", line 90, in check
return f(self, *args, **kwargs)
File "/home/odoo/src/odoo/odoo/sql_db.py", line 311, in execute
res = self._obj.execute(query, params)
psycopg2.errors.NotNullViolation: null value in column "user_id" of relation "mail_activity" violates not-null constraint
DETAIL: Failing row contains (15, 624, null, 0, null, null, Overall Equipment Efficiency,

Record machine hours from last month. Reference the previous ..., 2023-08-11, null, null, null, null, null, 2, 2023-07-11 17:52:38.94198, 2, 2023-07-11 17:52:38.94198).


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/odoo/src/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/home/odoo/src/odoo/odoo/http.py", line 698, in dispatch
result = self._call_function(**self.params)
File "/home/odoo/src/odoo/odoo/http.py", line 368, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/odoo/src/odoo/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/home/odoo/src/odoo/odoo/http.py", line 357, in checked_call
result = self.endpoint(*a, **kw)
File "/home/odoo/src/odoo/odoo/http.py", line 921, in __call__
return self.method(*args, **kw)
File "/home/odoo/src/odoo/odoo/http.py", line 546, in response_wrap
response = f(*args, **kw)
File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1324, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1316, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/home/odoo/src/odoo/odoo/api.py", line 462, in call_kw
result = _call_kw_model_create(method, model, args, kwargs)
File "/home/odoo/src/odoo/odoo/api.py", line 442, in _call_kw_model_create
result = method(recs, *args, **kwargs)
File "", line 2, in create
File "/home/odoo/src/odoo/odoo/api.py", line 412, in _model_create_multi
return create(self, [arg])
File "/home/odoo/src/odoo/addons/base_automation/models/base_automation.py", line 324, in create
action._process(action._filter_post(records))
File "/home/odoo/src/odoo/addons/base_automation/models/base_automation.py", line 274, in _process
raise e
File "/home/odoo/src/odoo/addons/base_automation/models/base_automation.py", line 271, in _process
action_server.sudo().with_context(**ctx).run()
File "/home/odoo/src/odoo/odoo/addons/base/models/ir_actions.py", line 643, in run
res = runner(run_self, eval_context=eval_context)
File "/home/odoo/src/odoo/odoo/addons/base/models/ir_actions.py", line 512, in _run_action_code_multi
safe_eval(self.code.strip(), eval_context, mode="exec", nocopy=True) # nocopy allows to return 'action'
File "/home/odoo/src/odoo/odoo/tools/safe_eval.py", line 348, in safe_eval
raise ValueError('%s: "%s" while evaluating\n%r' % (ustr(type(e)), ustr(e), expr))
Exceptiond

:


The responsible_user field is many2one on the res.users model. Might anyone here know this can be resolved? Am I retrieving the value improperly?

0
Avatar
Zrušit
Hayden McCarthy
Autor

Neha Kakkar, thank you for the reply. I printed the value of the config parameter (oee.responsible_user) using the logger. It is showing a null value, even though the value has been set in the UI. When I leave odoo settings and come back the value I set is still stored. I am not quite sure why this is happening but I will post here when I find the solution.

Avatar
Neha Kakkar
Nejlepší odpověď

The value for user_id seems to be None, which is causing the error.
Check the value of oee.responsible_user.  The value returned by self.env['ir.config_parameter'].sudo().get_param('oee.responsible_user') is a valid user ID.
You can print the value to check its correctness.

0
Avatar
Zrušit
Neha Kakkar

Thank you for providing the additional information. If the oee.responsible_user configuration parameter is showing a null value despite being set in the UI and saved, it suggestsThat there might be an issue with the retrieval of the configuration parameter.

Check the code where the oee.responsible_user configuration parameter is set.
Might be typos or inconsistencies in the code that might be causing this issue.

Also Check if there are any other parts of your codebase that might be modifying or overriding the oee.responsible_user configuration parameter. Look for any customizations or other modules that might affect its value.
Verify if there are any access restrictions or permissions in place that could prevent the retrieval of the configuration parameter.
One more Important things that you can do restarting the Odoo server or refreshing the environment to ensure that the latest changes are reflected in the system. Sometimes, changes made in the UI might require a server restart to take effect.

Please keep us updated on any progress or findings you come across,

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
Self hosting Odoo custom Vyřešeno
custom
Avatar
1
srp 24
2960
Allow follower to mark activity as done without having access to write/create on the main record
mail.activity
Avatar
0
úno 22
2100
Add a custom field (for storing domains owned) to a Customer record? Vyřešeno
custom
Avatar
Avatar
13
bře 16
6361
When i try to print a custom report i get a InternalError: current transaction is aborted, commands ignored until end of transaction block
custom
Avatar
Avatar
1
zář 15
7011
How do i utilize odoo's websocket connection ?
development custom
Avatar
Avatar
1
srp 25
3556
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