Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Social media Marketing
    • E-mailmarketing
    • SMS Marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

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

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

Error when clicking on menuitem of custom module

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
actionsmenuitemcustommoduleOdoo12.0
1 Beantwoorden
5107 Weergaven
Avatar
TalllPaul

Hello. 


I am creating a custom module, I have installed my module fine on Odoo 12 and I have added actions and menuitems for my module however, when I click the menu I keep getting an error and I am unsure of how to narrow down where the error is coming from.

ERROR WHEN CLICKIN ON THE MENU:

Error:
Odoo Server Error
Traceback (most recent call last):
  File "C:\Program Files (x86)\Odoo 12.0\server\odoo\api.py", line 1049, in get
    value = self._data[key][field][record._ids[0]]
KeyError: 133
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "C:\Program Files (x86)\Odoo 12.0\server\odoo\fields.py", line 1012, in __get__
    value = record.env.cache.get(record, self)
  File "C:\Program Files (x86)\Odoo 12.0\server\odoo\api.py", line 1051, in get
    raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: ('ir.actions.act_window(133,).search_view', None)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "C:\Program Files (x86)\Odoo 12.0\server\odoo\http.py", line 656, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "C:\Program Files (x86)\Odoo 12.0\server\odoo\http.py", line 314, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "C:\Program Files (x86)\Odoo 12.0\server\odoo\tools\pycompat.py", line 87, in reraise
    raise value
  File "C:\Program Files (x86)\Odoo 12.0\server\odoo\http.py", line 698, in dispatch
    result = self._call_function(**self.params)
  File "C:\Program Files (x86)\Odoo 12.0\server\odoo\http.py", line 346, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "C:\Program Files (x86)\Odoo 12.0\server\odoo\service\model.py", line 98, in wrapper
    return f(dbname, *args, **kwargs)
  File "C:\Program Files (x86)\Odoo 12.0\server\odoo\http.py", line 339, in checked_call
    result = self.endpoint(*a, **kw)
  File "C:\Program Files (x86)\Odoo 12.0\server\odoo\http.py", line 941, in __call__
    return self.method(*args, **kw)
  File "C:\Program Files (x86)\Odoo 12.0\server\odoo\http.py", line 519, in response_wrap
    response = f(*args, **kw)
  File "c:\program files (x86)\odoo 12.0\server\odoo\addons\web\controllers\main.py", line 1262, in load
    action = request.env[action_type].browse([action_id]).read()
  File "c:\program files (x86)\odoo 12.0\server\odoo\addons\base\models\ir_actions.py", line 210, in read
    result = super(IrActionsActWindow, self).read(fields, load=load)
  File "C:\Program Files (x86)\Odoo 12.0\server\odoo\models.py", line 2820, in read
    vals[name] = convert(record[name], record, use_name_get)
  File "C:\Program Files (x86)\Odoo 12.0\server\odoo\models.py", line 5148, in __getitem__
    return self._fields[key].__get__(self, type(self))
  File "C:\Program Files (x86)\Odoo 12.0\server\odoo\fields.py", line 1016, in __get__
    self.determine_value(record)
  File "C:\Program Files (x86)\Odoo 12.0\server\odoo\fields.py", line 1129, in determine_value
    self.compute_value(recs)
  File "C:\Program Files (x86)\Odoo 12.0\server\odoo\fields.py", line 1083, in compute_value
    self._compute_value(records)
  File "C:\Program Files (x86)\Odoo 12.0\server\odoo\fields.py", line 1074, in _compute_value
    getattr(records, self.compute)()
  File "c:\program files (x86)\odoo 12.0\server\odoo\addons\base\models\ir_actions.py", line 170, in _compute_search_view
    fvg = self.env[act.res_model].fields_view_get(act.search_view_id.id, 'search')
  File "C:\Program Files (x86)\Odoo 12.0\server\odoo\models.py", line 1482, in fields_view_get
    xarch, xfields = View.postprocess_and_fields(self._name, etree.fromstring(result['arch']), view_id)
  File "c:\program files (x86)\odoo 12.0\server\odoo\addons\base\models\ir_ui_view.py", line 1110, in postprocess_and_fields
    fields = Model.fields_get(None)
  File "C:\Program Files (x86)\Odoo 12.0\server\odoo\models.py", line 2713, in fields_get
    description = field.get_description(self.env)
  File "C:\Program Files (x86)\Odoo 12.0\server\odoo\fields.py", line 770, in get_description
    value = value(env)
  File "C:\Program Files (x86)\Odoo 12.0\server\odoo\fields.py", line 1985, in _description_selection
    return [(value, translate(label) if label else label) for value, label in selection]
  File "C:\Program Files (x86)\Odoo 12.0\server\odoo\fields.py", line 1985, in <listcomp>
    return [(value, translate(label) if label else label) for value, label in selection]
ValueError: too many values to unpack (expected 2)

My XML:

<record model="ir.ui.view" id="alumnos_fp_tree">
      <field name="name">alumnos.fp.tree</field>
      <field name="model">alumnos.fp</field>
      <field name="arch" type="xml">
        <tree>
          <field name="nombre"/>
          <field name="apellidos"/>
          <field name="fecha"/>
          <field name="ciclo"/>
          <field name="nota"/>
        </tree>
        </field>
    </record>

    <record model="ir.ui.view" id="alumnos_fp_form">
      <field name="name">alumnos.fp.form</field>
      <field name="model">alumnos.fp</field>
      <field name="arch" type="xml">
        <form>
        <group colspan="2" col="2">
            <field name="nombre"/>
            <field name="apellidos"/>
            <field name="fecha"/>
            <field name="ciclo"/>
            <field name="nota"/>
          </group>
        </form>
      </field>
    </record>

    <record model="ir.ui.view" id="alumnos_practicas_tree">
      <field name="name">alumnos.practicas.tree</field>
      <field name="model">alumnos.practicas</field>
      <field name="arch" type="xml">
        <tree>
          <field name="nombre"/>
          <field name="direccion"/>
        </tree>
        </field>
    </record>

    <record model="ir.ui.view" id="alumnos_practicas_form">
      <field name="name">alumnos.practicas.form</field>
      <field name="model">alumnos.practicas</field>
      <field name="arch" type="xml">
        <form>
        <group colspan="2" col="2">
            <field name="nombre"/>
            <field name="direccion"/>
          </group>
        </form>
      </field>
    </record>

    <record model="ir.actions.act_window" id="alumnos_fp_action_window">
      <field name="name">Alumnos.fp.action_window</field>
      <field name="res_model">alumnos.fp</field>
      <field name="view_mode">tree,form</field>
    </record>

     <record model="ir.actions.act_window" id="alumnos_practicas_action_window">
      <field name="name">Alumnos.practicas.action_window</field>
      <field name="res_model">alumnos.practicas</field>
      <field name="view_mode">tree, form</field>
    </record>

    <menuitem name="Alumnos" id="alumnos_menu_root"/>

    <menuitem name="Alumnos FP" id="alumnos_fp_menu" parent="alumnos_menu_root" action="alumnos_fp_action_window"/>
    <menuitem name="Practicas" id="alumnos_practicas_menu" parent="alumnos_menu_root" action="alumnos_practicas_action_window"/>

I have checked the views, models and actions in Odoo and it seems they are all created.
0
Avatar
Annuleer
Jack Dane

Hello Paul,

I can see an error in the code but am unsure whether this produces that error code in V12.

The error I see is the space in "tree, form" for the view_mode of the "alumnos_practicas_action_window" window action.

If this isn't the case, I think there may be an error with a selection field on one of the Python models. Is there any chance you could share the Python code?

Thanks,

Niyas Raphy (Walnut Software Solutions)

If you are new to odoo development see this: https://www.youtube.com/watch?v=3JMEroi4DIk&list=PLqRRLx0cl0hoJhjFWkFYowveq2Zn55dhM&index=6

Avatar
TalllPaul
Auteur Beste antwoord

Hi, Thanks for your help. As suggested Jack, I decided to remove a few fields from model.py and when I remove these three:

    fecha = fields.Date(string="Fecha de nacimiento", help="Elegir tu fecha de nacimiento")
    ciclo = fields.Selection([('DAM'),('DAW'),('ASIR')], string="Ciclo Formativo",default="0")
    nota = fields.Float(string="Nota", help="Introducir tu nota")

The menus load fine, so somewhere in these fields is the error. 


EDIT: Narrowing it down further is seems it was my fields.Selection that was causing the error, if I remove the field it loads. Not sure what the error is though.


EDIT AGAIN: Looks like it is because I wasn't putting the indexes in the selection field. I'm giving it a try now.


SOLUTION: That was the error, I hadn't put the indexes in. Because the error was only shown when I added the actions I was convinced it was the action that was wrong.


Thanks a lot for you help.

0
Avatar
Annuleer
Jack Dane

Glad you managed to solve this

Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
Identify the action for the print button on Inventory application Opgelost
actions Odoo12.0
Avatar
Avatar
1
nov. 19
6456
Server actions in menuItem Opgelost
domain actions menuitem
Avatar
Avatar
Avatar
2
sep. 23
6655
Odoo 12 new menu not shown. What's wrong with this code? Opgelost
menu menuitem Odoo12.0
Avatar
Avatar
Avatar
2
aug. 23
29798
How does Odoo's action manager work? Opgelost
actions menuitem architecture
Avatar
Avatar
1
apr. 23
4033
KeyError: u'ir.actions.menu'
actions menuitem parent
Avatar
Avatar
Avatar
Avatar
3
mrt. 22
10203
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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