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

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

S'inscrire

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

Cette question a été signalée
stockscrapaction.servermultiple.scrap.ordersvalidate.scrap.orders
2 Réponses
1843 Vues
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
Ignorer
Avatar
ludivinagarcias@adhocsistemas.com.mx
Auteur Meilleure réponse

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
Ignorer
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Meilleure réponse

Hi,

Try the following code,

for rec in records:     

rec.action_validate()


Hope it helps

0
Avatar
Ignorer
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é
Inserting new record in stock.scrap Résolu
stock scrap create()
Avatar
Avatar
1
déc. 21
3433
Products for fairs, marketing purposes,..
stock stock_location scrap marketing.activity
Avatar
Avatar
1
nov. 25
1045
Scrap product new cost
stock inventory scrap Scrapping
Avatar
Avatar
1
août 20
4146
How can I configure Odoo to post Inventory Adjustments and Scrap Operations to different GL accounts? Résolu
stock accounting scrap v11 adjustment
Avatar
Avatar
1
janv. 22
11121
Inventory Valuation Odoo 15
stock
Avatar
Avatar
1
oct. 25
1801
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