from odoo import api, fields, models, _ from odoo.exceptions import ValidationError class HrPayrollStructure(models.Model): _inherit = 'hr.payroll.structure' journal_id = fields.Many2one( 'account.journal', string='Salary Journal', company_dependent=True, domain="[('type', '=', 'general')]", help="Default journal used when generating payroll accounting " "entries for payslips that follow this structure.", ) @api.constrains('journal_id') def _check_journal_currency(self): for record in self.sudo(): journal = record.journal_id if journal and journal.currency_id and journal.company_id \ and journal.currency_id != journal.company_id.currency_id: raise ValidationError(_( "The salary journal must be in the same currency as " "the company.", ))