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
    • Artificial Intelligence
    • 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
    • Property Management
    • 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
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

Update all record

Odoberať

Get notified when there's activity on this post

This question has been flagged
updaterecords
5 Replies
14695 Zobrazenia
Avatar
Pamungkas Sugihartoko

Hi all,


i'm new in odoo and python programming. i have a situation. i want to update all record in a table. here's my code

def button_posting(self):

self.write({'state':'active'})

return True

that code only update one record. from 'draft' to 'active' in state field. 

when i clicked a 'Posting' button, i want update all record to 'draft' and only one record become 'active'

how can i do that..?

thanks before.


PS: i'm sorry for my terrible english.. :)


0
Avatar
Zrušiť
Axel Mendoza

i got this error:

Traceback (most recent call last):
  File "C:\Program Files (x86)\Odoo 8.0-20150723\server\.\openerp\http.py", line 537, in _handle_exception
  File "C:\Program Files (x86)\Odoo 8.0-20150723\server\.\openerp\http.py", line 574, in dispatch
  File "C:\Program Files (x86)\Odoo 8.0-20150723\server\.\openerp\http.py", line 310, in _call_function
  File "C:\Program Files (x86)\Odoo 8.0-20150723\server\.\openerp\service\model.py", line 113, in wrapper
  File "C:\Program Files (x86)\Odoo 8.0-20150723\server\.\openerp\http.py", line 307, in checked_call
  File "C:\Program Files (x86)\Odoo 8.0-20150723\server\.\openerp\http.py", line 803, in __call__
  File "C:\Program Files (x86)\Odoo 8.0-20150723\server\.\openerp\http.py", line 403, in response_wrap
  File "C:\Program Files (x86)\Odoo 8.0-20150723\server\openerp\addons\web\controllers\main.py", line 948, in call_button
  File "C:\Program Files (x86)\Odoo 8.0-20150723\server\openerp\addons\web\controllers\main.py", line 936, in _call_kw
  File "C:\Program Files (x86)\Odoo 8.0-20150723\server\.\openerp\api.py", line 241, in wrapper
  File "C:\Program Files (x86)\Odoo 8.0-20150723\server\.\openerp\api.py", line 363, in old_api
  File "D:\koulu\mdi_ta\models.py", line 31, in button_posting
  File "C:\Program Files (x86)\Odoo 8.0-20150723\server\.\openerp\api.py", line 239, in wrapper
  File "C:\Program Files (x86)\Odoo 8.0-20150723\server\.\openerp\api.py", line 463, in new_api
  File "C:\Program Files (x86)\Odoo 8.0-20150723\server\.\openerp\models.py", line 1644, in search
  File "C:\Program Files (x86)\Odoo 8.0-20150723\server\.\openerp\api.py", line 241, in wrapper
  File "C:\Program Files (x86)\Odoo 8.0-20150723\server\.\openerp\models.py", line 4640, in _search
  File "C:\Program Files (x86)\Odoo 8.0-20150723\server\.\openerp\api.py", line 241, in wrapper
  File "C:\Program Files (x86)\Odoo 8.0-20150723\server\.\openerp\models.py", line 4463, in _where_calc
  File "C:\Program Files (x86)\Odoo 8.0-20150723\server\.\openerp\osv\expression.py", line 646, in __init__
  File "C:\Program Files (x86)\Odoo 8.0-20150723\server\.\openerp\osv\expression.py", line 749, in parse
  File "C:\Program Files (x86)\Odoo 8.0-20150723\server\.\openerp\osv\expression.py", line 532, in __init__
  File "C:\Program Files (x86)\Odoo 8.0-20150723\server\.\openerp\osv\expression.py", line 588, in check_leaf
ValueError: Invalid leaf id

here is my code:

@api.multi

def button_posting(self):

self.search(['id', '!=', self.id]).write({'state':'draft'})

self.write({'state':'active'})

return True


what should i do? i use win 10

thanks.


Axel Mendoza

Solve it?

Avatar
Pamungkas Sugihartoko
Autor Best Answer

un done sir..

i still get error... T__T

0
Avatar
Zrušiť
Avatar
Axel Mendoza
Best Answer

You can do it like:

@api.multi

def button_posting(self):

self.search([('id', '!=', self.id)]).write({'state':'draft'})

self.write({'state':'active'})

return True

Hope that helps

0
Avatar
Zrušiť
Axel Mendoza

Sorry I omit some parenthesis on the domain, I update it on the anwer, copy and check it again

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
Odoo auto updates for on-premises Enterprise version (cloud/ in-house server) - v10 v11 v12 Solved
update
Avatar
Avatar
Avatar
2
máj 24
9148
Cannot Update missing Report
accounting update records error_updating
Avatar
Avatar
1
sep 23
4073
Record rules not working for specific group of users in Odoo 16 - Need an Urgent Resolution
records
Avatar
Avatar
2
aug 23
5718
Count Related Records Solved
records
Avatar
Avatar
1
jan 21
6394
odoo module update error Solved
update
Avatar
Avatar
1
jan 20
8539
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 Svenska ภาษาไทย 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