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

TypeError: <lambda>() takes exactly 4 arguments (1 given)

Odoberať

Get notified when there's activity on this post

This question has been flagged
lambdatypeError
1 Odpoveď
7380 Zobrazenia
Avatar
Koffi KPONOUGLO

I am trying to migrate my custom module from v9 to v10. Here is a part of code : 

 

class hr_payslip(models.Model):

    _inherit = 'hr.payslip'

 

    seniority_rate = fields.Float(compute=lambda self, *args, **kwargs:

                                                     self._calculate_seniority_rate(*args, **kwargs),

                                                     type='float',

                                                     string='Seniority rate',

                                                     store=True),

              

    def _calculate_seniority_rate(self, cr, uid, ids, field_name, args, context=None):

        res = dict.fromkeys(ids, 0.0)

        for slip_id in ids:

            payslip = self.browse(cr, uid, slip_id, context=None)

            employee = payslip.employee_id

            # Yes, assuming all years have 365 days.

            # Also assuming the seniority is calculated w.r.t. the start date for the payslip, not the end date.

            years = (datetime.strptime(payslip.date_from, DEFAULT_SERVER_DATE_FORMAT) - \

                datetime.strptime(employee.start_date, DEFAULT_SERVER_DATE_FORMAT)).days / 365

            rate = 0.03 if years >= 3 else 0.02 if years >= 2 else 0.0

            res.update({slip_id: rate})

        return res


And I get this error : 

Traceback (most recent call last):
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\http.py", line 640, in _handle_exception
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\http.py", line 677, in dispatch
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\http.py", line 333, in _call_function
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\service\model.py", line 101, in wrapper
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\http.py", line 326, in checked_call
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\http.py", line 935, in __call__
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\http.py", line 506, in response_wrap
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\addons\web\controllers\main.py", line 889, in call_button
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\addons\web\controllers\main.py", line 877, in _call_kw
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\api.py", line 689, in call_kw
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\api.py", line 680, in call_kw_multi
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\addons\base\module\module.py", line 411, in button_immediate_install
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\addons\base\module\module.py", line 485, in _button_immediate_function
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\modules\registry.py", line 82, in new
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\modules\loading.py", line 339, in load_modules
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\modules\loading.py", line 237, in load_marked_modules
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\modules\loading.py", line 136, in load_module_graph
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\modules\registry.py", line 313, in init_models
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\models.py", line 2508, in _auto_init
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\models.py", line 2278, in _init_column
TypeError: <lambda>() takes exactly 4 arguments (1 given)

Please i need a help.

0
Avatar
Zrušiť
Avatar
Palkesh Baraiya
Best Answer

hello Koffi KPONOUGLO, 

Try this.

seniority_rate = fields.Float(compute=lambda self : self._calculate_seniority_rate(), type='float', 
                                    string='Seniority rate',  store=True),



0
Avatar
Zrušiť
Koffi KPONOUGLO
Autor

Hi Palkesh,

thanks for your answer but it isn't working.

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
TypeError: populate_statement() takes at least 4 arguments (2 given) Solved
typeError
Avatar
Avatar
1
júl 18
6589
How to use lambda expression in RML report
lambda
Avatar
Avatar
1
mar 15
7379
Database Manager unresponsive Solved
typeError JS
Avatar
Avatar
Avatar
2
feb 25
2068
TypeError: can't access property "classList"
typeError v15
Avatar
0
mar 23
3734
what is lambda in OpenERP? Solved
python lambda
Avatar
Avatar
3
jan 21
25711
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