Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

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

Odoberať

Get notified when there's activity on this post

This question has been flagged
actiondevelopmentsever_action
1 Odpoveď
50 Zobrazenia
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
Zrušiť
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
Autor

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

Avatar
Kunjan Patel
Best Answer
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
Zrušiť
Parker D
Autor

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'".

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

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

Registrácia
Related Posts Replies Zobrazenia Aktivita
¿Cómo llamar a BoA desde celular?
action development
Avatar
0
nov 25
2
Convert Consumable Product to Storable Product تحويل حالة المنتجات الى قابل للتخزين Solved
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. Solved
action development configuration
Avatar
1
sep 25
5507
Button without odoo access via Email Template
action development mail
Avatar
Avatar
1
sep 25
968
Missing products in zpl report from wizard
action development wizard
Avatar
0
júl 25
1002
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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