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
  • Industries
    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
    Výroba
    • 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
  • 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
  • Help

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

Select multiple rows and perform one action - Odoo 11

Odoberať

Get notified when there's activity on this post

This question has been flagged
treeviewodoo11
2 Replies
20225 Zobrazenia
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
Zrušiť
Avatar
Dennis Ochse
Best Answer

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
Zrušiť
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.

Avatar
subbarao
Best Answer

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
Zrušiť
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!

Registrácia
Related Posts Replies Zobrazenia Aktivita
Why this action menu voice appears only in the sale order view? Solved
action treeview odoo11
Avatar
Avatar
1
nov 18
5226
Editable tree view inside a form view is not saving.
treeview formview odoo11
Avatar
Avatar
Avatar
2
okt 18
8415
filter records on an embedded tree view
treeview embed odoo11
Avatar
Avatar
2
aug 18
8045
create backorder odoo after validate purchase shipment ? Solved
odoo11
Avatar
Avatar
1
okt 25
11825
How to Align Left [float, integer] Fields in Tree View in Odoo
treeview
Avatar
Avatar
Avatar
Avatar
3
apr 25
5894
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