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

Select multiple rows and perform one action - Odoo 11

S'inscrire

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

Cette question a été signalée
treeviewodoo11
2 Réponses
20249 Vues
Avatar
VENI V R

Hi,

I have tree view of submitted timesheets,and if the manager needs to select some of them and need to approve it,how could it be done in a tree view?how can I insert a button in a tree view?

The need is,I have to approve multiple timesheet in a single click.

1
Avatar
Ignorer
Avatar
Dennis Ochse
Meilleure réponse

Best way to do this is to create a 'Server Action'.


1. Activate developer mode

2. Go to settings menu 'Technical - Actions - Server Actions'

3. Create action, this is pretty self explanatory when you open it, if not I can help

4. Save action

5. Click on 'Create contextual action' and this action will appear under the action button of the tree view . 

2
Avatar
Ignorer
VENI V R
Auteur

'list' object has no attribute 'setdefault'

It shows this error

Dennis Ochse

Can you share the action that you've created?

VENI V R
Auteur

<record id="leave_approve_action_server" model="ir.actions.server">

<field name="name">Leave Approve</field>

<field name="type">ir.actions.server</field>

<field name="model_id" ref="leave_management_ft.model_hr_holidays"/>

<field name="binding_model_id" ref="leave_management_ft.model_hr_holidays"/>

<field name="state">code</field>

<field name="code">

if records:

for rec in records:

action = rec.batch_approve_leave()

</field>

</record>

Dennis Ochse

Okay, I don't have a complete overview of the fields you have a on your model but I'll try to help.

records: recordset of all records on which the action is triggered in multi-mode; may be void

So there is no need to check if records is filled, remove this line.

There is also no need to create a loop, remove this line.

And replace it with:

records.batch_approve_leave()

Go to your records in Odoo in the list view, select multiple records and click on 'Action -> <action_name>'.

let me know if that worked

VENI V R
Auteur

OK thank you I'll try

VENI V R
Auteur

same error occurs

Dennis Ochse

There there is a problem in the method batch_approve_leave

VENI V R
Auteur

@api.one

def batch_approve_leave(self):

if self.state == 'confirm':

if self.holiday_status_id.double_validation:

self.sudo().update({

'state': 'approved'

})

else:

self.sudo().update({

'state': 'hr_approval'

})

mail_values_leave_request = {

'email_from': self.employee_id.work_email,

'email_to': self.employee_id.work_email,

'subject': ' Leave request approved ',

'body_html': 'Dear ' +self.employee_id.name+', <br><br> Your request for ' + self.holiday_status_id.name+ ' from ' + self.from_date +

' to '+ self.to_date + ' has been approved. <br>',

# 'notification': True,

}

mail = self.env['mail.mail'].create(mail_values_leave_request)

mail.send()

This is the function

Dennis Ochse

Can you copy/paste the full error message

VENI V R
Auteur

Error:

Odoo Server Error

Traceback (most recent call last):

File "/home/devuser/Odoo/odoo-11C/odoo/http.py", line 650, in _handle_exception

return super(JsonRequest, self)._handle_exception(exception)

File "/home/devuser/Odoo/odoo-11C/odoo/http.py", line 310, in _handle_exception

raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])

File "/home/devuser/Odoo/odoo-11C/odoo/tools/pycompat.py", line 87, in reraise

raise value

File "/home/devuser/Odoo/odoo-11C/odoo/http.py", line 692, in dispatch

result = self._call_function(**self.params)

File "/home/devuser/Odoo/odoo-11C/odoo/http.py", line 342, in _call_function

return checked_call(self.db, *args, **kwargs)

File "/home/devuser/Odoo/odoo-11C/odoo/service/model.py", line 97, in wrapper

return f(dbname, *args, **kwargs)

File "/home/devuser/Odoo/odoo-11C/odoo/http.py", line 335, in checked_call

result = self.endpoint(*a, **kw)

File "/home/devuser/Odoo/odoo-11C/odoo/http.py", line 936, in __call__

return self.method(*args, **kw)

File "/home/devuser/Odoo/odoo-11C/odoo/http.py", line 515, in response_wrap

response = f(*args, **kw)

File "/home/devuser/Odoo/odoo-11C/odoo/addons/web/controllers/main.py", line 1229, in run

return clean_action(result) if result else False

File "/home/devuser/Odoo/odoo-11C/odoo/addons/web/controllers/main.py", line 308, in clean_action

action.setdefault('flags', {})

AttributeError: 'list' object has no attribute 'setdefault'

Dennis Ochse

Can you change @api.one to @api.multi, see if that makes a difference

VENI V R
Auteur

Thank you..It works

Dennis Ochse

You're welcome, good luck.

Avatar
subbarao
Meilleure réponse

You can see the example code of Journal Entries posting

goto Journal Entries menu select few and check in action have Post selected entries.

0
Avatar
Ignorer
Syed Arsalan Haider

I am unable to select multiple records in post journal entries its give me singleton error.

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

ValueError: Expected singleton: hr.expense.sheet(4, 3)

my code

from odoo import api, fields, models, _

class Multi_Expense_Inherit(models.TransientModel):

_inherit = "hr.expense.sheet.register.payment.wizard"

_name= 'multi.expense'

@api.multi

def multi_expense(self):

payslip_ids = self.env['hr.expense.sheet'].browse(self._context.get(

'active_ids'))

payslip_idsss = self.env['hr.expense'].search([])

for payslip in payslip_ids:

for abc in payslip_idsss:

if payslip.state == 'post':

abc.hr_expense_sheet_register_payment_wizard_action()

xml:

<act_window id="wizard_multi_payslip_approve" name="Multi Expenses Approve"

src_model="hr.expense.sheet" res_model="hr.expense.sheet.register.payment.wizard"

view_mode="form,tree" target="new" key2="client_action_multi"/>

​

Juan Sebastián Ocampo Ospina

i found this answer useful. Please locate this two files:

account_validate_account_move.py
account_validate_move_view.xml

At the following link:

https://github.com/odoo/odoo/blob/14.0/addons/account/wizard/

-

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é
Why this action menu voice appears only in the sale order view? Résolu
action treeview odoo11
Avatar
Avatar
1
nov. 18
5232
Editable tree view inside a form view is not saving.
treeview formview odoo11
Avatar
Avatar
Avatar
2
oct. 18
8424
filter records on an embedded tree view
treeview embed odoo11
Avatar
Avatar
2
août 18
8053
create backorder odoo after validate purchase shipment ? Résolu
odoo11
Avatar
Avatar
1
oct. 25
11843
How to Align Left [float, integer] Fields in Tree View in Odoo
treeview
Avatar
Avatar
Avatar
Avatar
3
avr. 25
5900
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