Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Služby pro partnery
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

Odoo Community Assistance Request: Critical Payroll Failure: Odoo 19 Payroll: Custom Rules Not Executing

Odebírat

Get notified when there's activity on this post

This question has been flagged
1 Odpovědět
208 Zobrazení
Avatar
Carlton Passley

Problem Summary

We have successfully installed a custom Jamaican Payroll module (cp_jamaican_payroll) on Odoo 19.0 (Odoo.sh Enterprise), but the payslip calculation fails because the custom rules are not running, despite numerous fixes.

The final issue is a database execution problem where the core system fails to see the necessary links, resulting in a Net Salary = Gross Salary output.

1. Environment and Final Status

ItemStatus / ValueNotes
Odoo Version19.0 (Odoo.sh Enterprise)


Module Namecp_jamaican_payroll


Failing Elementhr.salary.rule computation


Payslip OutputBasic Salary ($200k) = Net Salary ($200k)Rules are not being executed.

2. Technical Symptoms and Code Failures

All code logic for the Jamaican deductions (PAYE, NHT, NIS) has been verified and is correct. The failure is a structural database issue.

A. The Core Error (Prevents Calculation)

When the payslip is computed, the rules fail because the context variable for the contract is not passed correctly:

NameError: name 'contract' is not defined

B. The Structural Problem (Prevents Module Load)

The attempt to fix the NameError by inserting the struct_id into the XML failed repeatedly, proving that the External ID is incorrect or corrupted in the database:

ValueError: External ID not found in the system: hr_payroll.structure_employee

This occurred across multiple attempts, including variations like hr_payroll.basic_structure.

C. The Code Solution Attempted

To fix both issues, we deleted the custom structure definition and instead tried to override the default "Regular Pay" structure using its default ID (hr_payroll.structure_employee) and the rules' XML IDs (jm_salary_rule_nht_employee, etc.).

Final Configuration (Code is Clean):

XML

<record id="jm_salary_rule_nht_employee" model="hr.salary.rule">
    <field name="struct_id" ref="hr_payroll.structure_employee"/>
    <field name="condition_python">result = employee.contract_id and employee.contract_id.wage > 0</field> 
</record>

<record id="hr_payroll_structure_employee" model="hr.payroll.structure">
    <field name="rule_ids" eval="[
        (4, ref('jm_salary_rule_nht_employee')),
        (4, ref('jm_salary_rule_nis_employee')),
        ... (etc.) ...
    ]"/>
</record>

What is the definitive, working XML ID for the base Employee Salary Structure in Odoo 19, or is there a required inheritance missing in the module's Python that prevents the contract object from loading?
0
Avatar
Zrušit
Carlton Passley
Autor

Thank you that was very helpful, matter resolve.

Avatar
Cybrosys Techno Solutions Pvt.Ltd
Nejlepší odpověď

Hi,


Odoo 19 no longer uses the old salary structure XML IDs found in earlier versions, such as hr_payroll.structure_employee or hr_payroll.basic_structure. These IDs simply do not exist in this version, which is why your module fails to load them and your salary rules never attach to a valid structure. As a result, the payslip has no active rules, and the rule context never includes a contract object—leading to errors like “NameError: contract is not defined” and a net salary equal to the gross salary.

In Odoo 19, the correct base structure is hr_payroll.structure_base, and the employee structure type is hr_payroll.structure_type_employee. Your custom Jamaican payroll rules must be linked to this new base structure, and your module should extend it through inheritance. Once the rules are properly attached to the Odoo 19 payroll structure hierarchy, the system will correctly pass the contract object to rule evaluation and execute all deductions (PAYE, NHT, NIS) normally.

The solution involves updating your XML to reference the new structure IDs, attaching your rules to structure_base, and extending that structure to include all Jamaican rules. After that, setting the proper default structure type ensures contracts and payslips use the updated structure correctly, resolving both the loading issue and the rule execution failure.

Hope it helps

1
Avatar
Zrušit
Enjoying the discussion? Don't just read, join in!

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

Přihlásit se
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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