Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Odoo v13 @api decoration Error

Subscriure's

Get notified when there's activity on this post

This question has been flagged
buttonserrrordecoratorsodooV13@api.multi
6 Respostes
7545 Vistes
Avatar
Kirill

Is anyone stumble over situation when in module you start put any @api decorator and it crashes odoo?

I have module with states. I'm trying to signed button function to change state. But when i writing any @api decorator
and restart server, reload web page, it pushes me to form of choosing database or shows continious messages about connection lost and retrieve.

When i comment @api it works fine up to moment of button click.

Here is my simple model:

from odoo import models, fields, api

class la_shipping(models.Model):
_name = 'tralalal'
_description = 'Tralala'
@api.multi
def button_done(self):
for rec in self:
rec.write({'state', 'done'})
state = fields.Selection([('sent', 'Sent'),('done','Done')],
required =True, default='sent')
<header>
    <button name="button_done" string="Done" states="sent" class="oe_highlight" type="object"></button>
    <button name="button_sent" string="Sent" states="sent,done" class="oe_highlight" type="object"></button>
    <field name="state" widget="statusbar"></field>
</header>
0
Avatar
Descartar
Niyas Raphy (Walnut Software Solutions)

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

Midhun

Hi Kirill,

We no need to use any @api decorators for handling multiple records it's by default handling in Odoo 13.

Avatar
Paresh Wagh
Best Answer

Hi Kirill: 

@api.multi has been deprecated in odoo13. 

Are you facing these issues with any of the other @api values ?

EDIT:

In your case, use ​@api.model  if the action will be performed on a record. If the action is not on a specific record, you don't need a decorator.

If you still encounter issues, another way of doing this would be to configure a Server Action using the UI (​Settings > Technical > Server Actions) and link it to the button using the server action id in the XML.

You may find the following video helpful. Even though it's based on v12, the concepts are applicable to v13.

Odoo V12 - Creating Buttons & Server Actions

2
Avatar
Descartar
Avatar
Kirill
Autor Best Answer

Hi Paresh:

Yes, doesn't matter which @api I use as far as " @api " written in model odoo stop working. By the way is it any other ways to assign function to button?

0
Avatar
Descartar
Midhun

You face issues in handling onchange @api?

Paresh Wagh

Hi Kirill: I've edited my original response based on your clarification.

Avatar
Reema Rajput
Best Answer

Hello!!!

From 0doo-13 @api.multi is deprecated. For making any function to button you don't need to use any @api, but if you want to pass any args or values in that funtion than you have to use @api.model for that..


0
Avatar
Descartar
Enjoying the discussion? Don't just read, join in!

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

Registrar-se
Related Posts Respostes Vistes Activitat
How i can remove edit function on my page?I need do this from python. Solved
python buttons edit odoo odooV13
Avatar
Avatar
Avatar
4
de març 21
5060
Odoov13 UI suddenly stop working
odooV13
Avatar
Avatar
1
de nov. 24
2169
i have a new develop enviorment in odoo 13 but when i try to fet in give me this error please Help
odooV13
Avatar
Avatar
1
d’abr. 23
3493
Custom stat button (eo_stat_button) for a custom field on a partner
buttons
Avatar
Avatar
Avatar
2
de març 23
11333
Cacher le bouton "créer" d'une liste Solved
buttons
Avatar
Avatar
2
de març 23
3360
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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