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
    • E-learning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Sociale media-marketing
    • E-mailmarketing
    • Sms-marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Artificiële Intelligentie
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelwinkel
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Horeca & Hospitality
    • Bar en café
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van mede-eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brouwerij
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Diensten
    • Klusjesman
    • IT-hardware & ondersteuning
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Alle bedrijfstakken bekijken
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijsprogramma
    • Scale Up! Business Game
    • Odoo bezoeken
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Partner worden
    • Diensten voor 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
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

How to inherit from a Python class that isn't a model and also inherit a model

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
modulesinheritancemodelsversion14
7316 Weergaven
Avatar
Jack Dane

Hello,


I have a class in Python where I wish to inherit from a model and a custom python class which I made. 


I have done this before in Version 13 which works like this:


* base class *

class APIBase ():

    # coded ...


* model class *

from odoo import models, fields, api

from .api_base import APIBase

    

class cpq_quotes (models.Model, APIBase):

    _inherit = "crm.lead"

    # coded ... 


However, I now receive the error:

Traceback (most recent call last):

  File "/usr/local/lib/python3.8/dist-packages/werkzeug/serving.py", line 270, in run_wsgi

    execute (self.server.app)

  File "/usr/local/lib/python3.8/dist-packages/werkzeug/serving.py", line 258, in execute

    application_iter = app (approximately, start_response)

  File "/home/odoo/src/odoo/odoo/service/server.py", line 440, in app

    return self.app (e, s)

  File "/home/odoo/src/odoo/odoo/service/wsgi_server.py", line 122, in application

    return ProxyFix (application_unproxied) (environ, start_response)

  File "/usr/local/lib/python3.8/dist-packages/werkzeug/contrib/fixers.py", line 152, in __call__

    return self.app (environ, start_response)

  File "/home/odoo/src/odoo/odoo/service/wsgi_server.py", line 99, in application_unproxied

    result = odoo.http.root (approximately, start_response)

  File "/home/odoo/src/odoo/odoo/http.py", line 1294, in __call__

    return self.dispatch (approximately, start_response)

  File "/home/odoo/src/odoo/odoo/http.py", line 1262, in __call__

    return self.app (approximately, start_wrapped)

  File "/usr/local/lib/python3.8/dist-packages/werkzeug/wsgi.py", line 766, in __call__

    return self.app (environ, start_response)

  File "/home/odoo/src/odoo/odoo/http.py", line 1446, in dispatch

    odoo.registry (db) .check_signaling ()

  File "/home/odoo/src/odoo/odoo/__init__.py", line 104, in registry

    return modules.registry.Registry (database_name)

  File "/home/odoo/src/odoo/odoo/modules/registry.py", line 65, in __new__

    return cls.new (db_name)

  File "/home/odoo/src/odoo/odoo/modules/registry.py", line 89, in new

    odoo.modules.load_modules (registry._db, force_demo, status, update_module)

  File "/home/odoo/src/odoo/odoo/modules/loading.py", line 449, in load_modules

    processed_modules + = load_marked_modules (cr, graph,

  File "/home/odoo/src/odoo/odoo/modules/loading.py", line 346, in load_marked_modules

    loaded, processed = load_module_graph (

  File "/home/odoo/src/odoo/odoo/modules/loading.py", line 187, in load_module_graph

    model_names = registry.load (cr, package)

  File "/home/odoo/src/odoo/odoo/modules/registry.py", line 230, in load

    model = cls._build_model (self, cr)

  File "/home/odoo/src/odoo/odoo/models.py", line 579, in _build_model

    ModelClass .__ bases__ = tuple (bases)

TypeError: __bases__ assignment: 'cpq_quotes' object layout differs from 'Lead' - - -


There is no reference to change like this in the Version 14 documentation that I can see.


Any help would be greatly appreciated.


Thanks, 


Edit: I guess a way to get around this would be for both classes to inherit crm.lead, I think it would be better OOP for the base class to inherit both. So if anyone has a solution it would still be appreciated. 

1
Avatar
Annuleer
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
how to inherit view in existing module. Opgelost
views modules fields inheritance models
Avatar
Avatar
Avatar
3
jan. 22
57010
Inherit without changing original module
modules inheritance
Avatar
Avatar
Avatar
5
okt. 20
9370
Writing two models toghether, in the same module, shows me a key error "account.invoice" (inherited model)
development modules inheritance models class
Avatar
Avatar
12
dec. 16
10509
How to change inheritance order of models?
modules inheritance
Avatar
0
nov. 24
7526
Modifying product.template from within a module Opgelost
modules inheritance
Avatar
Avatar
1
aug. 15
12408
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
  • Partner worden
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 Svenska ภาษาไทย 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