Passa al contenuto
Odoo Menu
  • Accedi
  • Provalo gratis
  • App
    Finanze
    • Contabilità
    • Fatturazione
    • Note spese
    • Fogli di calcolo (BI)
    • Documenti
    • Firma
    Vendite
    • CRM
    • Vendite
    • Punto vendita Negozio
    • Punto vendita Ristorante
    • Abbonamenti
    • Noleggi
    Siti web
    • Configuratore sito web
    • E-commerce
    • Blog
    • Forum
    • Live chat
    • E-learning
    Supply chain
    • Magazzino
    • Produzione
    • PLM
    • Acquisti
    • Manutenzione
    • Qualità
    Risorse umane
    • Dipendenti
    • Assunzioni
    • Ferie
    • Valutazioni
    • Referral dipendenti
    • Parco veicoli
    Marketing
    • Social marketing
    • E-mail marketing
    • SMS marketing
    • Eventi
    • Marketing automation
    • Sondaggi
    Servizi
    • Progetti
    • Fogli ore
    • Assistenza sul campo
    • Helpdesk
    • Pianificazione
    • Appuntamenti
    Produttività
    • Comunicazioni
    • Approvazioni
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    App di terze parti Odoo Studio Piattaforma cloud Odoo
  • Settori
    Retail
    • Libreria
    • Negozio di abbigliamento
    • Negozio di arredamento
    • Alimentari
    • Ferramenta
    • Negozio di giocattoli
    Cibo e ospitalità
    • Bar e pub
    • Ristorante
    • Fast food
    • Pensione
    • Grossista di bevande
    • Hotel
    Agenzia immobiliare
    • Agenzia immobiliare
    • Studio di architettura
    • Edilizia
    • Gestione immobiliare
    • Impresa di giardinaggio
    • Associazione di proprietari immobiliari
    Consulenza
    • Società di contabilità
    • Partner Odoo
    • Agenzia di marketing
    • Studio legale
    • Selezione del personale
    • Audit e certificazione
    Produzione
    • Tessile
    • Metallo
    • Arredamenti
    • Alimentare
    • Birrificio
    • Ditta di regalistica aziendale
    Benessere e sport
    • Club sportivo
    • Negozio di ottica
    • Centro fitness
    • Centro benessere
    • Farmacia
    • Parrucchiere
    Commercio
    • Tuttofare
    • Hardware e assistenza IT
    • Ditta di installazione di pannelli solari
    • Calzolaio
    • Servizi di pulizia
    • Servizi di climatizzazione
    Altro
    • Organizzazione non profit
    • Ente per la tutela ambientale
    • Agenzia di cartellonistica pubblicitaria
    • Studio fotografico
    • Punto noleggio di biciclette
    • Rivenditore di software
    Carica tutti i settori
  • Community
    Apprendimento
    • Tutorial
    • Documentazione
    • Certificazioni 
    • Formazione
    • Blog
    • Podcast
    Potenzia la tua formazione
    • Programma educativo
    • Scale Up! Business Game
    • Visita Odoo
    Ottieni il software
    • Scarica
    • Versioni a confronto
    • Note di versione
    Collabora
    • Github
    • Forum
    • Eventi
    • Traduzioni
    • Diventa nostro partner
    • Servizi per partner
    • Registra la tua società di contabilità
    Ottieni servizi
    • Trova un partner
    • Trova un contabile
    • Incontra un esperto
    • Servizi di implementazione
    • Testimonianze dei clienti
    • Supporto
    • Aggiornamenti
    GitHub Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Richiedi una demo
  • Prezzi
  • Aiuto

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

  • CRM
  • e-Commerce
  • Contabilità
  • Magazzino
  • PoS
  • Progetti
  • MRP
All apps
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
CRM pipeline Lead sales crm
Sul forum
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
CRM pipeline Lead sales crm
Sul forum
  1. CRM
  2. Forum

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

Iscriviti

Ricevi una notifica quando c'è un'attività per questo post

La domanda è stata contrassegnata
logisticenvironmentlogging
1 Rispondi
3189 Visualizzazioni
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
Abbandona
Avatar
Amer Wilson
Risposta migliore

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
Abbandona
Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!

Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!

Registrati
Post correlati Risposte Visualizzazioni Attività
INVENTARIO PARA ALMACÉN EMPRESA AÉREA
logistic
Avatar
Avatar
1
giu 25
1059
❗️Error "Invalid fields: Journal" when disabling automatic delivery order emails
logistic
Avatar
1
mag 25
1617
Product with automatic trigger in reordering rule is asking for Manual Order once
logistic
Avatar
Avatar
1
dic 24
1832
logistic cost
logistic
Avatar
0
set 23
1684
logistics cost
logistic
Avatar
Avatar
1
giu 22
2531
Community
  • Tutorial
  • Documentazione
  • Forum
Open source
  • Scarica
  • Github
  • Runbot
  • Traduzioni
Servizi
  • Hosting Odoo.sh
  • Supporto
  • Aggiornamenti
  • Sviluppi personalizzati
  • Formazione
  • Trova un contabile
  • Trova un partner
  • Diventa nostro partner
Chi siamo
  • La nostra azienda
  • Branding
  • Contattaci
  • Lavora con noi
  • Eventi
  • Podcast
  • Blog
  • Clienti
  • Note legali • Privacy
  • Sicurezza
الْعَرَبيّة 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 è un gestionale di applicazioni aziendali open source pensato per coprire tutte le esigenze della tua azienda: CRM, Vendite, E-commerce, Magazzino, Produzione, Fatturazione elettronica, Project Management e molto altro.

Il punto di forza di Odoo è quello di offrire un ecosistema unico di app facili da usare, intuitive e completamente integrate tra loro.

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