Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
CRM pipeline Lead sales crm
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
CRM pipeline Lead sales crm
About this forum
  1. CRM
  2. Fórum

Why self.env.create changes aren't visible in my tree view

Odoberať

Get notified when there's activity on this post

This question has been flagged
logisticenvironmentlogging
1 Odpoveď
3187 Zobrazenia
Avatar
Justin Young

Hey guys,


I'm creating a tracking form view that should populate a model that I'm inheriting through a One2many field. The data is being created through this function:

class Groups(models.Model):
_inherit = 'res.groups'
group_log_ids = fields.One2many(string="Changes", comodel_name="res.groups.logger", inverse_name="group_id")
def create_record(self):
         self.env['res.groups.logger'].create({
'user_id' : self .env.user.id,
'date_of_creation' : datetime.today (),
'user_changed' : user.name,
'group_name' : self .name,
'log _changes' : "Removed" ,
})

Here's my res.group.logger file that will be displayed in my xml file

.class LogGroups (models.Model):

 _name = 'res.groups.logger'
_description = "Groups logger"
user_id = fields.Many2one ( string = "User" , comodel_name = "res.users" ) date_of_creation = fields.Datetime ( "Date Created" ) user_changed = fields. Char ( string = "Changed User" ) group_name = fields.Char ( string = "Group Name" ) log_changes = fields.Char ( string = "Action" )





Here's how it's called in my xml file.< page name = "tracking" string = "Tracking" groups = "base.group_no_one" >
    < Group > 
< field name = "group_log_ids" nolabel = "1" readonly = "1" >
< tree >
< field name = "user_id" />
< field name = "date_of_creation" />
< field name = "user_changed" / >
< field name = "group_name" />
< field name = "log_changes" />
</ tree >
</ field >
</ group>
</ page >

Is there any reason why the data isn't being populated in the view form when self.env.create is called?

I get this error in my log 2021-05-14 17:44:32,043 29484 ERROR testing1 odoo.sql_db: bad query: UPDATE "res_users" SET "im_status_stored"='online',"write_uid"=1,"write_date"=(now() at time zone 'UTC') WHERE id IN (2)


Please help

0
Avatar
Zrušiť
Avatar
Amer Wilson
Best Answer

Hi,

You can try using the following code:



class Groups(models.Model):
_inherit = 'res.groups'

group_log_ids = fields.One2many("res.groups.logger","group_id", string="Changes") # that "group_id" must be a many2one field in "res.groups.logger" model, and Many2one must link to 'res.groups'

def create_record(self):
self.env['res.groups.logger'].create({
'user_id': self.env.user.id,
'date_of_creation': datetime.today(),
'user_changed': self.env.user.name,
'group_name': self.name,
'log _changes': "Removed",
})

class LogGroups (models.Model):
_name = 'res.groups.logger'
_description = "Groups logger"

user_id = fields.Many2one(string = "User", comodel_name="res.users")
date_of_creation = fields.Datetime("Date Created")
user_changed = fields.Char(string="Changed User")
group_name = fields.Char(string = "Group Name")
log_changes = fields.Char( string = "Action")


You can also contact my team at support@rolustech.com for further assistance. Rolustech is an Odoo partner experienced in providing customization, integration, and support services to Odoo users across the globe. 

0
Avatar
Zrušiť
Enjoying the discussion? Don't just read, join in!

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

Registrácia
Related Posts Replies Zobrazenia Aktivita
INVENTARIO PARA ALMACÉN EMPRESA AÉREA
logistic
Avatar
Avatar
1
jún 25
1059
❗️Error "Invalid fields: Journal" when disabling automatic delivery order emails
logistic
Avatar
1
máj 25
1616
Product with automatic trigger in reordering rule is asking for Manual Order once
logistic
Avatar
Avatar
1
dec 24
1830
logistic cost
logistic
Avatar
0
sep 23
1684
logistics cost
logistic
Avatar
Avatar
1
jún 22
2530
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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