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

How to validate multiple scrap orders at the same time, and change status from draft to done, with a server action

Odoberať

Get notified when there's activity on this post

This question has been flagged
stockscrapaction.servermultiple.scrap.ordersvalidate.scrap.orders
2 Replies
1849 Zobrazenia
Avatar
ludivinagarcias@adhocsistemas.com.mx

Hello! 
I hope someone could help me .. 

I'd like to find the best way to validate multiple scrap orders at the same time. 

Thanks in advance...! 

v16E
There are a large number of scrap orders (previously imported with Excel),  so we need to validate them and change their status from draft to done, en masse and not one by one.






To validate all the orders at the same time, I created an Action Server, 


When one scrap order is selected, sometimes works (it is validated and change from draft to done) and other times doesn't work, and got this error:

 


When multiple scrap orders are selected, never works. 



and got this error: 

RPC_ERROR

Odoo Server Error

Traceback (most recent call last):

  File "/home/odoo/src/odoo/odoo/models.py", line 5174, in ensure_one

    _id, = self._ids

ValueError: too many values to unpack (expected 1)


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/home/odoo/src/odoo/odoo/tools/safe_eval.py", line 383, in safe_eval

    return unsafe_eval(c, globals_dict, locals_dict)

  File "ir.actions.server(901,)", line 1, in

  File "/home/odoo/src/odoo/addons/stock/models/stock_scrap.py", line 187, in action_validate

    self.ensure_one()

  File "/home/odoo/src/odoo/odoo/models.py", line 5177, in ensure_one

    raise ValueError("Expected singleton: %s" % self)

ValueError: Expected singleton: stock.scrap(5, 4)


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/home/odoo/src/odoo/odoo/http.py", line 1638, in _serve_db

    return service_model.retrying(self._serve_ir_http, self.env)

  File "/home/odoo/src/odoo/odoo/service/model.py", line 133, in retrying

    result = func()

  File "/home/odoo/src/odoo/odoo/http.py", line 1665, in _serve_ir_http

    response = self.dispatcher.dispatch(rule.endpoint, args)

  File "/home/odoo/src/odoo/odoo/http.py", line 1869, in dispatch

    result = self.request.registry['ir.http']._dispatch(endpoint)

  File "/home/odoo/src/odoo/addons/website/models/ir_http.py", line 237, in _dispatch

    response = super()._dispatch(endpoint)

  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_http.py", line 154, in _dispatch

    result = endpoint(**request.params)

  File "/home/odoo/src/odoo/odoo/http.py", line 700, in route_wrapper

    result = endpoint(self, *args, **params_ok)

  File "/home/odoo/src/odoo/addons/web/controllers/action.py", line 42, in run

    result = action.run()

  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_actions.py", line 674, in run

    res = runner(run_self, eval_context=eval_context)

  File "/home/odoo/src/odoo/addons/website/models/ir_actions_server.py", line 61, in _run_action_code_multi

    res = super(ServerAction, self)._run_action_code_multi(eval_context)

  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_actions.py", line 544, in _run_action_code_multi

    safe_eval(self.code.strip(), eval_context, mode="exec", nocopy=True, filename=str(self))  # nocopy allows to return 'action'

  File "/home/odoo/src/odoo/odoo/tools/safe_eval.py", line 397, in safe_eval

    raise ValueError('%s: "%s" while evaluating\n%r' % (ustr(type(e)), ustr(e), expr))

ValueError: : "Expected singleton: stock.scrap(5, 4)" while evaluating

'records.action_validate()'


The above server error caused the following client error:

RPC_ERROR: Odoo Server Error

    at makeErrorFromResponse (https://mybd-test-12773407.dev.odoo.com/web/assets/42953-a4ee3f4/web.assets_backend.min.js:993:163)

    at XMLHttpRequest. (https://mybd-test-12773407.dev.odoo.com/web/assets/42953-a4ee3f4/web.assets_backend.min.js:1001:13)

I appreciate a lot your help to find the best way to validate multiple scrap orders. 

Thank you!!!

LG

0
Avatar
Zrušiť
Avatar
ludivinagarcias@adhocsistemas.com.mx
Autor Best Answer

Hello! Thank you... 
I made the change 
from records.action_validate() -> rec.action_validate()


but doesn't work, I get this error: 
RPC_ERROR

Odoo Server Error

Traceback (most recent call last):

  File "/home/odoo/src/odoo/odoo/tools/https://test-12773407.dev.odoo.com/web/assets/43048-2a8d7a1/web.assets_backend.min.js:1002:13)

0
Avatar
Zrušiť
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Best Answer

Hi,

Try the following code,

for rec in records:     

rec.action_validate()


Hope it helps

0
Avatar
Zrušiť
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
Inserting new record in stock.scrap Solved
stock scrap create()
Avatar
Avatar
1
dec 21
3436
Products for fairs, marketing purposes,..
stock stock_location scrap marketing.activity
Avatar
Avatar
1
nov 25
1046
Scrap product new cost
stock inventory scrap Scrapping
Avatar
Avatar
1
aug 20
4146
How can I configure Odoo to post Inventory Adjustments and Scrap Operations to different GL accounts? Solved
stock accounting scrap v11 adjustment
Avatar
Avatar
1
jan 22
11126
Inventory Valuation Odoo 15
stock
Avatar
Avatar
1
okt 25
1802
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