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

KeyError despite adding dependency.

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
keyerrorodoo16features
1 Beantwoorden
2130 Weergaven
Avatar
Kml

Hello everyone,

I've recently installed the Insurance Management module (great work on it!) and I'm trying to enhance its functionality. My goal is to add a page in the CRM lead notebook to display insurances created for each lead.

However, I'm encountering an error every time I try to upgrade the CRM or the Insurance Management module. Below is the code I've added:

class Lead(models.Model): _name = "crm.lead" _description = "Lead/Opportunity" _order = "priority desc, id desc" _inherit = ['mail.thread.cc', 'mail.thread.blacklist', 'mail.thread.phone', 'mail.activity.mixin', 'utm.mixin', 'format.address.mixin', ]

insurance_ids = fields.One2many('insurance.details', 'crm_lead_ref', string='Insurances', required=True, store=True)


def create_insurance_action(self): return { 'name': 'Create Insurance', 'type': 'ir.actions.act_window', 'res_model': 'insurance.details', 'view_mode': 'form', 'target': 'new', 'context': { 'default_partner_id': self.partner_id.id, 'default_lead_id': self.id }, 'views': [(False, 'form')], 'view_id': False, }



class InsuranceDetails(models.Model): _name = 'insurance.details' _inherit = ["mail.thread"]

crm_lead_ref = fields.Many2one('crm.lead', string='CRM Lead Reference', help="Reference to the CRM lead from which this insurance was created.", required=True, store=True)

def create(self, vals): if vals.get('name', 'New') == 'New': vals['name'] = self.env['ir.sequence'].next_by_code('insurance.details') or 'New'
crm_lead_ref = self.env.context.get('default_crm_lead_ref') if crm_lead_ref: vals['crm_lead_ref'] = crm_lead_ref
new_record = super(InsuranceDetails, self).create(vals) return new_record

__manifest.py__ in insurance module:

'name': 'Insurance Management', 'version': '16.0.1.1.1', 'summary': """Insurance Management & Operations""", 'description': """Insurance Management""", 'author': 'Cybrosys Techno Solutions', 'company': 'Cybrosys Techno Solutions', 'category': 'Industries', 'depends': ['crm','account', 'base'], 'license': 'AGPL-3', 'data': [ 'security/ir.model.access.csv', 'data/insurance_management_data.xml', 'views/claim_details_views.xml', 'views/employee_details_views.xml', 'views/insurance_details_views.xml', 'views/policy_details_views.xml', 'views/insurance_management_menus.xml' ],



crm_lead_views.xml: 



I have extended the crm.lead model with a One2many field to insurance.details, and also have a corresponding Many2one field in insurance.details. Despite these configurations, I keep getting an error during the module upgrade.

Any insights or suggestions on what might be causing this issue or how to resolve it would be greatly appreciated

0
Avatar
Annuleer
Avatar
Mily Shajan
Beste antwoord

Hi 

Try the following code to add the field of insurance_ids in crm.lead

class Lead(models.Model): 
_inherit = ['crm.lead']

insurance_ids = fields.One2many('insurance.details', 'crm_lead_ref', string='Insurances', required=True, store=True)

and add this one2many in the inherited view of crm.crm_lead_view_form 

Regards

0
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
Odoo 16: error socket when config worker greater than 0 Opgelost
keyerror socket.io odoo16features
Avatar
Avatar
Avatar
2
apr. 24
18944
DeprecationWarning: The longpolling-port is a deprecated alias to the gevent-port option, please use the latter Opgelost
odoo16features
Avatar
Avatar
Avatar
Avatar
Avatar
5
sep. 25
24570
KeyError: line_ids after removing a One2many from a custom model (want to cleanly remove without uninstall)
keyerror
Avatar
0
aug. 25
1005
How to Add wizard under print button inside the form view.
odoo16features
Avatar
Avatar
Avatar
Avatar
3
aug. 25
3752
How to add @api.onchange in _get_view() method odoo 16
odoo16features
Avatar
Avatar
1
mei 25
3648
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