Passa al contenuto
Odoo Menu
  • Accedi
  • Provalo gratis
  • App
    Finanze
    • Contabilità
    • Fatturazione
    • Note spese
    • Fogli di calcolo (BI)
    • Documenti
    • Firma
    Vendite
    • CRM
    • Vendite
    • Punto vendita Negozio
    • Punto vendita Ristorante
    • Abbonamenti
    • Noleggi
    Siti web
    • Configuratore sito web
    • E-commerce
    • Blog
    • Forum
    • Live chat
    • E-learning
    Supply chain
    • Magazzino
    • Produzione
    • PLM
    • Acquisti
    • Manutenzione
    • Qualità
    Risorse umane
    • Dipendenti
    • Assunzioni
    • Ferie
    • Valutazioni
    • Referral dipendenti
    • Parco veicoli
    Marketing
    • Social marketing
    • E-mail marketing
    • SMS marketing
    • Eventi
    • Marketing automation
    • Sondaggi
    Servizi
    • Progetti
    • Fogli ore
    • Assistenza sul campo
    • Helpdesk
    • Pianificazione
    • Appuntamenti
    Produttività
    • Comunicazioni
    • Approvazioni
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    App di terze parti Odoo Studio Piattaforma cloud Odoo
  • Settori
    Retail
    • Libreria
    • Negozio di abbigliamento
    • Negozio di arredamento
    • Alimentari
    • Ferramenta
    • Negozio di giocattoli
    Cibo e ospitalità
    • Bar e pub
    • Ristorante
    • Fast food
    • Pensione
    • Grossista di bevande
    • Hotel
    Agenzia immobiliare
    • Agenzia immobiliare
    • Studio di architettura
    • Edilizia
    • Gestione immobiliare
    • Impresa di giardinaggio
    • Associazione di proprietari immobiliari
    Consulenza
    • Società di contabilità
    • Partner Odoo
    • Agenzia di marketing
    • Studio legale
    • Selezione del personale
    • Audit e certificazione
    Produzione
    • Tessile
    • Metallo
    • Arredamenti
    • Alimentare
    • Birrificio
    • Ditta di regalistica aziendale
    Benessere e sport
    • Club sportivo
    • Negozio di ottica
    • Centro fitness
    • Centro benessere
    • Farmacia
    • Parrucchiere
    Commercio
    • Tuttofare
    • Hardware e assistenza IT
    • Ditta di installazione di pannelli solari
    • Calzolaio
    • Servizi di pulizia
    • Servizi di climatizzazione
    Altro
    • Organizzazione non profit
    • Ente per la tutela ambientale
    • Agenzia di cartellonistica pubblicitaria
    • Studio fotografico
    • Punto noleggio di biciclette
    • Rivenditore di software
    Carica tutti i settori
  • Community
    Apprendimento
    • Tutorial
    • Documentazione
    • Certificazioni 
    • Formazione
    • Blog
    • Podcast
    Potenzia la tua formazione
    • Programma educativo
    • Scale Up! Business Game
    • Visita Odoo
    Ottieni il software
    • Scarica
    • Versioni a confronto
    • Note di versione
    Collabora
    • Github
    • Forum
    • Eventi
    • Traduzioni
    • Diventa nostro partner
    • Servizi per partner
    • Registra la tua società di contabilità
    Ottieni servizi
    • Trova un partner
    • Trova un contabile
    • Incontra un esperto
    • Servizi di implementazione
    • Testimonianze dei clienti
    • Supporto
    • Aggiornamenti
    GitHub Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Richiedi una demo
  • Prezzi
  • Aiuto

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

  • CRM
  • e-Commerce
  • Contabilità
  • Magazzino
  • PoS
  • Progetti
  • MRP
All apps
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
Assistenza

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

Iscriviti

Ricevi una notifica quando c'è un'attività per questo post

La domanda è stata contrassegnata
1 Rispondi
212 Visualizzazioni
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
Abbandona
Carlton Passley
Autore

Thank you that was very helpful, matter resolve.

Avatar
Cybrosys Techno Solutions Pvt.Ltd
Risposta migliore

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
Abbandona
Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!

Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!

Registrati
Community
  • Tutorial
  • Documentazione
  • Forum
Open source
  • Scarica
  • Github
  • Runbot
  • Traduzioni
Servizi
  • Hosting Odoo.sh
  • Supporto
  • Aggiornamenti
  • Sviluppi personalizzati
  • Formazione
  • Trova un contabile
  • Trova un partner
  • Diventa nostro partner
Chi siamo
  • La nostra azienda
  • Branding
  • Contattaci
  • Lavora con noi
  • Eventi
  • Podcast
  • Blog
  • Clienti
  • Note legali • Privacy
  • Sicurezza
الْعَرَبيّة 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 è un gestionale di applicazioni aziendali open source pensato per coprire tutte le esigenze della tua azienda: CRM, Vendite, E-commerce, Magazzino, Produzione, Fatturazione elettronica, Project Management e molto altro.

Il punto di forza di Odoo è quello di offrire un ecosistema unico di app facili da usare, intuitive e completamente integrate tra loro.

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