Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Managament
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Producție
    • Textile
    • Metal
    • Furnitures
    • Food
    • 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
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

Select multiple rows and perform one action - Odoo 11

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
treeviewodoo11
2 Răspunsuri
20233 Vizualizări
Imagine profil
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
Imagine profil
Abandonează
Imagine profil
Dennis Ochse
Cel mai bun răspuns

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
Imagine profil
Abandonează
VENI V R
Autor

'list' object has no attribute 'setdefault'

It shows this error

Dennis Ochse

Can you share the action that you've created?

VENI V R
Autor

<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
Autor

OK thank you I'll try

VENI V R
Autor

same error occurs

Dennis Ochse

There there is a problem in the method batch_approve_leave

VENI V R
Autor

@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
Autor

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
Autor

Thank you..It works

Dennis Ochse

You're welcome, good luck.

Imagine profil
subbarao
Cel mai bun răspuns

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
Imagine profil
Abandonează
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/

-

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

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

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
Why this action menu voice appears only in the sale order view? Rezolvat
action treeview odoo11
Imagine profil
Imagine profil
1
nov. 18
5227
Editable tree view inside a form view is not saving.
treeview formview odoo11
Imagine profil
Imagine profil
Imagine profil
2
oct. 18
8419
filter records on an embedded tree view
treeview embed odoo11
Imagine profil
Imagine profil
2
aug. 18
8049
create backorder odoo after validate purchase shipment ? Rezolvat
odoo11
Imagine profil
Imagine profil
1
oct. 25
11828
How to Align Left [float, integer] Fields in Tree View in Odoo
treeview
Imagine profil
Imagine profil
Imagine profil
Imagine profil
3
apr. 25
5896
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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