Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Validations
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Épicerie
    • Quincaillerie
    • Magasin de jouets
    Food & Hospitality
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Maison d’hôtes
    • Distributeur de boissons
    • Hôtel
    Immobilier
    • Agence immobilière
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consultance
    • Cabinet d'expertise comptable
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Métal
    • Meubles
    • Alimentation
    • Brewery
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Trades
    • Bricoleur
    • Matériel informatique et support
    • Systèmes photovoltaïques
    • Cordonnier
    • Services de nettoyage
    • Services CVC
    Autres
    • Organisation à but non lucratif
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Browse all Industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenez partenaire
    • Services for Partners
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide

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

  • CRM
  • e-Commerce
  • Comptabilité
  • Inventaire
  • PoS
  • Projet
  • MRP
All apps
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

Server Action not found: AttributeError: 'my.model' object has no attribute 'action_create_inventory_from_selection'

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
actiondevelopmentsever_action
1 Répondre
51 Vues
Avatar
Parker D

Hello there :)

I am trying to add an action to a simple app I've made. 

Therefore I have added a method to my class:

class RollsManagement(models.Model):
_name = 'rollsmanagement.roll'
_description = 'Managing rolls'
_order = 'sequence'
_rec_name = 'name'
...

simply like this:

...
def action_create_inventory_from_selection(self):
​....

In my XML I've added the action like this:

    <record id="action_roll_inventory_import" model="ir.actions.server">
<field name="name">Create Inventory from Rolls</field>
<field name="model_id" ref="model_rollsmanagement_roll"/>
<field name="binding_model_id" ref="model_rollsmanagement_roll"/>
<field name="binding_view_types">list</field>
<field name="state">code</field>
<field name="code">
action = model.action_create_inventory_from_selection()
</field>
</record>

My action appears when I've selected one or more data entries (rolls) in the drop down button "Actions" and when I click it, it ends in this error:

File "ir.actions.server(660,)", line 1, in <module>
AttributeError: 'rollsmanagement.roll' object has no attribute 'action_create_inventory_from_selection'

I have the strong feeling, I am missing something essential, maybe simple even. The model is there and working as always but somehow it seems that I cannot call the action the right way. Two LLMs are already at the end of their knowledge, it seems. Does anyone have a hint?

PS: If you're interested, my app lists some special rolls and simple information about them. I try to make an action that sums up their square meters and put that into the inventory adjustment. 

0
Avatar
Ignorer
Codesphere Tech

Hello,
Remove binding_model_id and write with decorator as below:
@api.model
def action_create_inventory_from_selection(self):

Let me know if it is not working.

Parker D
Auteur

Hi @Codesphere Tech :) Thanks, but still the same: "AttributeError: 'rollsmanagement.roll' object has no attribute 'action_create_inventory_from_selection'".

Avatar
Kunjan Patel
Meilleure réponse
Hello Parker D,
I hope you are doing well

Solution: In server actions, you need to use records (not model) to access the selected records.
<field name="code"> action = model.action_create_inventory_from_selection()</field> #Change model to records 

I hope this information helps you.

Thanks & Regards,
Kunjan Patel
0
Avatar
Ignorer
Parker D
Auteur

Thank you Kunjan Patel, but both, records and record have the identical result: "AttributeError: 'rollsmanagement.roll' object has no attribute 'action_create_inventory_from_selection'".

Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Publications associées Réponses Vues Activité
¿Cómo llamar a BoA desde celular?
action development
Avatar
0
nov. 25
2
Convert Consumable Product to Storable Product تحويل حالة المنتجات الى قابل للتخزين Résolu
action development configuration
Avatar
Avatar
1
nov. 25
160
How can I automatically send an email to customers when their order is confirmed in Odoo? I want to make sure they receive a confirmation without doing it manually every time. Résolu
action development configuration
Avatar
1
sept. 25
5507
Button without odoo access via Email Template
action development mail
Avatar
Avatar
1
sept. 25
968
Missing products in zpl report from wizard
action development wizard
Avatar
0
juil. 25
1002
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenez partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة 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 est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

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