Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • 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 Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & 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
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

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

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

leaves and salary calculation.

Subscribe

Get notified when there's activity on this post

This question has been flagged
hr_payrollpayslipleavespython2.7
21 Replies
35879 Views
Avatar
charlesraj

hi. Any one please tell me how to reduce the salary of an employee who take leave.

eg: salary=5000

he/she take one leave in a month , then reduce rs.100 from his salary. Ie then remaining salary is 4900.How to configure this in openerp v7.0.

i assigned a salary rule (Deduction Towards Leave Availed) to salary structure.

there is a field for adding python code in this rule. how to implement my need through python code. please help..

0
Avatar
Discard
Avatar
Maath
Best Answer

Hi

You need to add salary rule to salary structure to deduct (add python code)

result=-(contract.wage/30)*worked_days.Unpaid.number_of_days

then you can deduct from salary depending on number of Unpaid leave taken by employee

and you need to put the condition for this rule (Not Always True )

result=worked_days.Unpaid and worked_days.Unpaid.number_of_days or False

Regards

3
Avatar
Discard
Remya

I have 4 types of leaves(Sick,legal,casual,unpaid). how can i generalize this? Did i want to create 4 separate salary rule?

Maath

@Remya you can use unpaid for unpaid leave and put salary rule for it (you can put more than one salary rule as you want)

Maath

@charlesaj first you should installed holiday model and have leave (named unpaid )

charlesraj
Author

hi.. that error conditions occured at i calculate the payslip for employee who did n't take leave. The error is like. Error!

Wrong python code defined for salary rule Deduction Towards Leave Availed (DLA).

Maath

OK , But when Employee have unpaid leave will work successfully ,you just need condition to the salary rule (Not Always True ) (the condition will check if employee have leave then apply salary rule else don't do anything ) -I have edit my answer vote up and select as correct answer if solved your problem -

Remya

yes employess with unpaid leave run succesfully..

Maath

then add condition I have Edit my answer

charlesraj
Author

ok now the problem is ok.. for employees without have leaves.. inorder to calculate the salary deduction(for leave days) from it i use "result= (contract.wage)*worked_days.Unpaid and worked_days.Unpaid.number_of_days or False". This will return the error. any way to implement it..

charlesraj
Author

sorry i use result= (contract.wage/30)*worked_days.Unpaid and worked_days.Unpaid.number_of_days or False

Raminder Pal Singh

Same thing can be done for Half Day leaves also. You have to create leave type as half day and use the same code (replace unpaid with half day) and divide by 2

Maath

@charlesraj use the code in my answer please and tell me what the problem you need 1- salary rule 2- condition for this salary rule

charlesraj
Author

sir i need to calculate the deduction for the leave days..ie. Now for one unpaid leave 1 is reduced from the net salary . But i want to deduce the total salary of particular leave day from the net salary..

charlesraj
Author

condition for the salary rule.. Deduct the salary(days which employee take leaves) from the net salary .

Maath

do not understand , the deduction should be from Basic salary my dear , other deduction you can put it as input (by value or do code for it) hope that help you

charlesraj
Author

i want to put code in the salary rule. now i applied your code. it make the deduction of salary for the number of leave taken. ie: what i say is If He/She take one leave ONE will be deduced from the net salary..

charlesraj
Author

Thank sir it work for me....i will add like this....result=-(worked_days.Unpaid and worked_days.Unpaid.number_of_days*(contract.wage/30)) or False ...

Vaibhav

I added same rule and condition but it will not affecting on calculation of payslip amounts and so on....even that rule is not appearing on Payslip form view after clicked on compute sheet

Avatar
moh
Best Answer

its worked but if leave less than day in payslip compute as 1 day

0
Avatar
Discard
Avatar
Aby
Best Answer

Half pay leave this worked 

result=(worked_days.Halfpaidsickleave and worked_days.Halfpaidsickleave.number_of_days*(contract.wage/30)/2) or False

0
Avatar
Discard
Avatar
trinath
Best Answer

S MY SELF TOO NO EFECT OVER IT.. IN COMPUTATIO FOLKS!!

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

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

Sign up
Related Posts Replies Views Activity
leaves, salary and generating payslip
hr_payroll payslip leaves python2.7
Avatar
Avatar
1
Mar 15
6599
Unpaid Leaves Deduction not working Solved
python code hr_payroll payslip leaves
Avatar
Avatar
Avatar
Avatar
16
Nov 23
24315
How to calculate Pay Slip automatically Solved
hr_payroll payslip
Avatar
Avatar
Avatar
Avatar
Avatar
12
Dec 23
33474
How to change PaySlip Format?
hr_payroll payslip
Avatar
0
Jul 15
8089
HR manager cannot edit payslip for employee
hr_payroll payslip
Avatar
0
Mar 15
4835
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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