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
    Rantai Pasokan
    • 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
    • Approval
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri-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
    • Estate Management
    • 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
    • Temui penasihat
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan

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

  • CRM
  • e-Commerce
  • Akuntansi
  • Inventaris
  • PoS
  • Project
  • MRP
All apps
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

Payroll: How to reference a 'Salary Rule Parameter'

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
2 Replies
4500 Tampilan
Avatar
Koos Kaspers

Since v15 its possible to create 'Salary Rule Parameters'. I'm trying to reference such a rule in a python code.

I'm aware of how to reference to, for example, an input parameter:



                    # Available variables:

                    #----------------------

                    # payslip: object containing the payslips

                    # employee: hr.employee object

                    # contract: hr.contract object

                    # rules: object containing the rules code (previously computed)

                    # categories: object containing the computed salary rule categories (sum of amount of all rules belonging to that category).

                    # worked_days: object containing the computed worked days.

                    # inputs: object containing the computed inputs.


                    # Note: returned value have to be set in the variable 'result'


So in order to reference an input variable, this is the syntax:

                    result = inputs.variable_name.amount * 0.10


But the documentation is not showing how to reference the newly introduced 'Salary Rule Parameter'. I already tried:

rule_parameter.variable_name.amount

and some other combinations of the word rule and parameter, but to no avail. Anybody knows how to reference it?

1
Avatar
Buang
Avatar
Rana Abdelsattar (abr)
Jawaban Terbai

In v17, you can reference a rule parameter using the code payslip._rule_parameter('parameter_code')

0
Avatar
Buang
Koos Kaspers
Penulis

are you sure to include the "_" before rule?

Rana Abdelsattar (abr)

In v16 it would be payslip.rule_parameter('code') but in 17 you need to include "_" before.

Which version are you using?

Koos Kaspers
Penulis

I'm on 17.0.

I just tried:

result = payslip._rule_parameter('abc')

And it's working as expected. Thank you so much!

Avatar
Renaud Desarzens
Jawaban Terbai

I was able to use a rule parameter in v16 like this:

result = payslip.rule_parameter('NameOfRuleParameter')

It returns the parameter value of it respecting the valid from date specified in the rule parameter.

0
Avatar
Buang
Sergey Vernyayev

argh. It gives me a nervous tick
- Error: <class 'AttributeError'>: "'hr.payslip' object has no attribute 'rule_parameter'" while evaluating

Koos Kaspers
Penulis

Hmm, same problem here:

Fout: <class 'AttributeError'>: "'hr.payslip' object has no attribute 'rule_parameter'" while evaluating

Are you really sure, the synax is payslip.rule_parameter('<code-of-rule-paramter?') ?

Waleed Ali Mohsen

You can use
payslip.rule_parameter('code_of_parameter').

The below is details from Odoo 15.0 commit.

In a salary rule, you can directly use `payslip.rule_parameter(code)`.
The version valid at the payslip end date is automatically chosen.

To retrieve a parameter value at a particular date,
use `self.env['hr.rule.parameter']._get_parameter_from_code(code, date)`.
The date is optional and set to today by default.

Koos Kaspers
Penulis

@Waleed, thanks for helping out. The first option you gave is already given by other people and is not working. I've tried the 2nd option you gave (retrieve a parameter value at a particular date) and this isn't working neither:

<class 'NameError'>: "name 'self' is not defined" while evaluating
"result = self.env['hr.rule.parameter']._get_parameter_from_code('abc', '2024-01-01')"

I'd say: please try it yourself. Create a "salary rule parameter" with code 'abc' and value '1'. Then create a "salary rule", choose 'python code' at 'amount type' and try to reference to the newly created salary rule parameter by entering:

result = payslip.rule_parameter('abc')

I'm pretty sure you will end up with the same error:

<class 'AttributeError'>: "'hr.payslip' object has no attribute 'rule_parameter'" while evaluating
"result = payslip.rule_parameter('abc')"

Menikmati diskusi? Jangan hanya membaca, ikuti!

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

Daftar
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
  • Tugas
  • 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 ภาษาไทย Türkçe українська Tiếng Việt

Odoo adalah rangkaian aplikasi bisnis open source yang mencakup semua kebutuhan perusahaan Anda: CRM, eCommerce, akuntansi, inventaris, point of sale, manajemen project, dan seterusnya.

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