Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

Odoo-v14.0 | AttributeError: 'super' object has no attribute 'home'

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
objectattributeerrorhomecustomer_portal
1 Răspunde
11416 Vizualizări
Imagine profil
Mateo Nunez

Hi,

I'm creating a new module. I've inherited the home method using `CustomerPortal` class in portal controller.

But when I try to visit the route i received the following error: `AttributeError: 'super' object has no attribute 'home'`


Any ideas? Thanks


This is my code 


# -*- coding: utf-8 -*-
import datetime
import logging

import werkzeug
from odoo import http
from odoo.addons.portal.controllers.portal import CustomerPortal
from odoo.http import request

_logger = logging.getLogger(__name__)


class CreateCustomerCode(CustomerPortal):
    @http.route(['/my', '/my/home'], type='http', auth="user", website=True)
    def home(self, **kw):
        partner = request.env.user.partner_id

        easy_connector_customer = request.env['easy_connector.customer'].search(
            [('partner_id', '=', partner.id)])

        if not easy_connector_customer or (easy_connector_customer and easy_connector_customer.code is None):
            last_customer = request.env['easy_connector.customer'].search([
            ])

            if last_customer:
                numeric_code = int(last_customer[-1].numeric_code) + 1
            else:
                numeric_code = 0

            prefix_code = 'W'
            numeric_code = str(numeric_code).zfill(14)
            code = prefix_code + numeric_code

            easy_connector_customer = request.env['easy_connector.customer'].sudo().create({
                'prefix_code': prefix_code,
                'numeric_code': numeric_code,
                'code': code,
                'partner_id': partner.id
            })

            easy_connector_log_message = request.env['easy_connector.log'].compose_message({
                'email': partner.email,
                'customer_code': code,
                'display_name': partner.display_name,
                'vat': partner.vat,
                'city': partner.city,
                'street': partner.street
            })

            easy_connector_log = request.env['easy_connector.log'].sudo().create({
                'easy_connector_customer_id': easy_connector_customer.id,
                'method': 'CUSTOMER_REGISTRATION',
                'message': easy_connector_log_message,
            })

            _logger.info('Added new customer code: %s',
                         code)

        return super(CustomerPortal, self).home(**kw)

0
Imagine profil
Abandonează
Ermin Trevisan

It may be helpful to add your Odoo version.

Mateo Nunez
Autor

You're right. I'm using Odoo 14.0

Mateo Nunez
Autor

It works! Thanks a lot. 

Imagine profil
Cybrosys Techno Solutions Pvt.Ltd
Cel mai bun răspuns

Hi,
Use your class name while supering a function. In your code your class name is “CreateCustomerCode'', but you are using “CustomerPortal” in super. Replace your return statement with following line

return super(CreateCustomerCode, self).home(**kw)

I think this will solve your problem.To know more you can refer the following blog

https://www.cybrosys.com/blog/web-controllers-in-odoo

Regards

3
Imagine profil
Abandonează
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
How can I solve this AttributeError?
object attributeerror
Imagine profil
0
mar. 15
6468
How to solve "AttributeError: 'sale.order.line' object has no attribute 'product'" Rezolvat
object attributeerror odoo9.0 v9.0
Imagine profil
2
mar. 16
7577
list object has no attribute get, Migrating web/binary/saveas to v10 api need HELP
list object attributeerror get attribute
Imagine profil
0
ian. 17
8354
Customer Portal - Website Module Required? OE12+
customer_portal
Imagine profil
Imagine profil
Imagine profil
Imagine profil
4
aug. 25
3560
How to add button to customer portal: Odoo17
customer_portal
Imagine profil
3
iul. 25
1379
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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