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)
odoo accounting v14 pos v15
Sul forum
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
Assistenza

How to create a new View Type from scratch in Odoo 14?

Iscriviti

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

La domanda è stata contrassegnata
javascriptmoduleviewselection
2 Risposte
12916 Visualizzazioni
Avatar
Abiatar Chaves

Hello everyone,


I was using the presentation from the Odoo Experience 2018 as basis for creating a new view type from scratch (link below), but it seems it is not compatible anymore with the current version 14.


https://www.youtube.com/watch?v=SIoljYJhTqk


I get the following error when installing the example module provided ( download from https://github.com/Polymorphe57/hello_world_view_code ):


"ValueError: ir.actions.act_window.view.view_mode: required selection fields must define an ondelete policy that implements the proper cleanup of the corresponding records upon module uninstallation. Please use one or more of the following policies: 'set default' (if the field has a default defined), 'cascade', or a single-argument callable where the argument is the recordset containing the specified option."


It seems like the code to add the new view in the available view modes is not compatible anymore, due to it being a selection field with required argument set to True, but without any ondelete argument set. When adding the new view with following code it will not work:

class ActWindowView(models.Model):
_inherit = 'ir.actions.act_window.view'

view_mode = fields.Selection(selection_add=[('hello_world', "Hello World")])

PS: I also tried adding the 'ondelete' argument together with the 'selection_add', but it also fails. I tried ondelete='set null' and ondelete='cascade'. Neither option worked.


Can anyone point me to the right direction to solve this OR show the correct way to implement a new view from scratch compatible with odoo 14?


Thanks in advance!


PS: Even in the Odoo official documentation they explain it like this, but it seems like it does not work with version 14 ( https://www.odoo.com/documentation/14.0/reference/javascript_cheatsheet.html#creating-a-new-view-from-scratch )

1
Avatar
Abbandona
Savya Sachin

Hi,

    I guess you are facing trouble while adding a selection field. Hope this video helps you,

    https://www.youtube.com/watch?v=4tlfzy-ZtMQ&vl=en

Thanks

Avatar
Dim Gunner
Risposta migliore

Please try:

view_mode = fields.Selection(selection_add=[
    ('hello_world', 'Hello World')
], ondelete={'hello_world': 'cascade'})

4
Avatar
Abbandona
BOUDEKAK MOHAMED

That worked for me, Thanks

Avatar
Jorma Nordlin
Risposta migliore

I installed the Hello World App example code and I fixed this same cascade problem. But I got other error, when I selected the Hello World App from the main menu. Do I need to set the "ControlPanel" to modelExtension in the Hello World App javascript code (hello_world_view.js)?

TypeError: Cannot read property 'modelExtension' of undefined

    at Class.init (http://localhost:8069/web/static/src/js/views/abstract_view.js:201:72)

    at Class.prototype.<computed> [as init] (http://localhost:8069/web/static/src/js/core/class.js:90:38)

    at Class.init (http://localhost:8069/hello_world_view/static/src/js/hello_world_view.js:118:21)

    at Class.prototype.<computed> [as init] (http://localhost:8069/web/static/src/js/core/class.js:90:38)

    at new Class (http://localhost:8069/web/static/src/js/core/class.js:107:33)

    at Class._createViewController (http://localhost:8069/web/static/src/js/chrome/action_manager_act_window.js:191:24)

    at http://localhost:8069/web/static/src/js/chrome/action_manager_act_window.js:306:43


abstract_view.js


 const searchModelParams = Object.assign({}, params, { action });

        if (this.withControlPanel || this.withSearchPanel) {

            const { arch, fields, favoriteFilters } = params.controlPanelFieldsView || {};

            const archInfo = ActionModel.extractArchInfo({ search: arch }, this.viewType);

            const controlPanelInfo = archInfo[this.config.ControlPanel.modelExtension]; // HERE the 'modelExtension' is undefined

            const searchPanelInfo = archInfo[this.config.SearchPanel.modelExtension];

            this.withSearchPanel = this.withSearchPanel && Boolean(searchPanelInfo);

            Object.assign(searchModelParams, {

                fields,

                favoriteFilters,

                controlPanelInfo,

                searchPanelInfo,

            });

        }


Odoo's documentation is very "poor." Therefore it is wery difficult to learn Odoo development.

0
Avatar
Abbandona
Openindustry.it SAS di Pioveasana Andrea & C.

right, i have the same problem

Yasmine Chenafa

Can't agree more ,even if you post your question you still won't find help

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à
Examples of JS Modules Risolto
javascript module
Avatar
Avatar
Avatar
2
apr 21
3134
Error inheriting javascript
javascript module
Avatar
0
set 18
3179
Pass data to Window Action to create a new product Risolto
javascript module
Avatar
Avatar
2
apr 15
7024
How to display form widget in a custom template?
javascript view
Avatar
Avatar
1
mar 15
10889
Assign value to selection field using javascript
javascript selection odoo12
Avatar
0
feb 20
4803
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