Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Discuss
    • Kecerdasan Buatan
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Manajemen Properti
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Konsultasi
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

Configure PAYE tax in Salary Structure - Payroll App

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
pythonpayrollstructuresalary_rule
3 Replies
1396 Tampilan
Avatar
Patrick MANDENGUE

Hi Fam,

I am configuring payroll for my company, but I have a "small" issue with the setup for the PAYE Tax in the salary structure. the calculation for PAYE is defined by the Gross Salary as such:


def calculate_paye('GROSS'):
    """
    Calculate PAYE (Pay As You Earn) tax based on gross salary.
    :param gross: float or int - gross salary amount
    :return: float - calculated PAYE
    """
    if ['GROSS'].amount <= 490:
        return 0.0  # No tax for salaries <= 490
    else:
        return -25.0  # Flat tax amount (example)


Can someone help me to fix this as I keep getting an error:

Wrong python code defined for: - Employee: Ireana Gomesh - 

Version: False - 

Payslip: Salary Slip - Ireana Gomesh - February 2026 - 

Salary rule: PAYE Tax (PAYE) - 

Error: invalid syntax (, line 1)

0
Avatar
Buang
Sujata

Try this instead:
result = 0.0
# Access GROSS using its code
gross = payslip.get_rule_value('GROSS')
if gross <= 490:
result = 0.0 # No tax for salaries <= 490
else:
result = -25.0 # Flat tax amount

Alternative (if above doesn't work):
result = 0.0
# Direct calculation using same formula as GROSS
gross = categories.BASIC + categories.ALW
if gross <= 490:
result = 0.0
else:
result = -25.0

Also verify:
1. Your GROSS rule code field is exactly GROSS (case-sensitive)
2. PAYE rule sequence number is higher than GROSS rule
3. Both rules are in the same salary structure

Avatar
Cybrosys Techno Solutions Pvt.Ltd
Jawaban Terbai

Hi,


Try the following code,


# Get Gross Salary from salary categories

gross = categories.GROSS or 0.0


# PAYE calculation

if gross <= 490:

    result = 0.0

else:

    result = -25.0


Hope it helps


0
Avatar
Buang
Patrick MANDENGUE
Penulis

when Conditions based on: Always true

Computation
# Get Gross Salary from salary categories
gross = categories.GROSS or 0.0
# PAYE calculation
if gross <= 490:
result = 0.0
else:
result = -25.0

Feeback: Error: AttributeError("'DefaultDictPayroll' object has no attribute 'GROSS'") while evaluating
'# Get Gross Salary from salary categories\r\ngross = categories.GROSS or 0.0\r\n\r\n# PAYE calculation\r\nif gross <= 490:\r\n result = 0.0\r\nelse:\r\n result = -25.0'

When the conditions are based on python Expression
result = 'BASIC' in inputs
result = 'ALW' in inputs

Computation
# Direct calculation using same formula as GROSS
gross = categories.BASIC + categories.ALW # Access the GROSS salary rule
if gross <= 490:
result = 0.0 # No tax for salaries <= 490
else:
result = -25.0 # Flat tax amount

There is no Error, but PAYE Tax doesn't appear when we compute sheet in the Employee payslip (Strange)

Patrick MANDENGUE
Penulis

please do you have a whatsapp number?

Avatar
Sujata
Jawaban Terbai

Hi Patrick,

Thanks for the details! Since GROSS is a salary rule (not a category), here's the code that can help:

result = 0.0
gross = rules.GROSS.amount  # Access the GROSS salary rule
if gross <= 490:
    result = 0.0  # No tax for salaries <= 490
else:
    result = -25.0  # Flat tax amount

Changes Required:

  • Use rules.GROSS.amount to get the value from your GROSS salary rule
  • Assign to result variable (required in Odoo)
  • Remove the function definition (def) as Odoo automatically wraps your code in a function context

Important: Make sure your PAYE rule has a higher sequence number than the GROSS rule so it calculates after GROSS is computed.

0
Avatar
Buang
Patrick MANDENGUE
Penulis

- Error: AttributeError("'DefaultDictPayroll' object has no attribute 'GROSS'") while evaluating
'result = 0.0\r\ngross = rules.GROSS.amount # Access the GROSS salary rule\r\nif gross <= 490:\r\n result = 0.0 # No tax for salaries <= 490\r\nelse:\r\n result = -25.0 # Flat tax amount'

Avatar
Patrick MANDENGUE
Penulis Jawaban Terbai
version: Odoo 19.0+e (Enterprise Edition)


Taxable Salary (code = GROSS) is Salary Rule

python code

result = categories['BASIC'] + categories['ALW'] 

0
Avatar
Buang
Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Post Terkait Replies Tampilan Aktivitas
Payroll > Salary_rule > Python condition
python payroll condition salary_rule
Avatar
1
Sep 17
7777
Attendance allownce
payroll salary_rule
Avatar
0
Jan 20
4293
Payroll Module
python payroll
Avatar
0
Des 17
4633
Compute Salary Rule from other Rules
payroll payslip salary_rule
Avatar
Avatar
Avatar
Avatar
4
Sep 25
8299
How can I call a function from a salary rule of type python code? Diselesaikan
python calculation salary_rule
Avatar
Avatar
2
Des 24
14139
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Karir
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 Svenska ภาษาไทย Türkçe українська Tiếng Việt

Odoo adalah software terintegrasi dengan 70+ aplikasi seperti CRM, Akuntansi, Inventaris, Sales, eCommerce, Marketing, POS; plus fitur lokal Indonesia!

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik Odoo.

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