Replaces Enterprise's hr_payroll_account with a Fusion-native bridge: - Adds account_debit / account_credit / fusion_analytic_account_id / not_computed_in_net to hr.salary.rule (company-dependent GL mapping) - Adds move_id + move_state + journal_id + _fusion_create_account_move to hr.payslip (validated payslip -> balanced account.move) - Adds move_id + move_state + action_open_move to hr.payslip.run - Adds journal_id (company-dependent) to hr.payroll.structure - Adds is_payroll_journal flag to account.journal - Adds payslip_ids / payslip_count + action_open_payslip on account.move - Adds payslip_id reverse link on account.move.line - Adds move_line_id reverse link on hr.payslip.line - Adds fusion_payroll_journal_id + fusion_payroll_auto_post to res.company (with res.config.settings exposure) Coexistence: detects Enterprise hr_payroll_account at runtime via ir.module.module and yields move creation to it while both modules are installed, so payslips do not get duplicate entries. Once the Enterprise module is uninstalled, this module owns the bridge. Auto-installs whenever both hr_payroll and fusion_accounting_core are present on the database. 10 smoke tests verifying field surface + bridge entrypoints all pass on westin-v19. Full payslip-to-move integration test deferred (needs seeded payroll structure). Removes Westin's last payroll-accounting dependency on Enterprise's accountant umbrella module (Phase 6b of the Fusion Accounting suite). Made-with: Cursor
27 lines
949 B
Python
27 lines
949 B
Python
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.",
|
|
))
|