
from odoo import api, models

class HrPayslipEmployees(models.TransientModel):
    _inherit = 'hr.payslip.employees'

    @api.multi
    def compute_sheet(self):
        journal_id = False
        if self.env.context.get('active_id'):
            journal_id = self.env['hr.payslip.run'].browse(self.env.context.get('active_id')).journal_id.id
        return super(HrPayslipEmployees, self.with_context(journal_id=journal_id)).compute_sheet()


from odoo import api, models

class HrPayslipEmployees(models.TransientModel):
    _inherit = 'hr.payslip.employees'

    @api.multi
    def compute_sheet(self):
        if self.env.context.get('active_id'):
            journal_id = self.env['hr.payslip.run'].browse(self.env.context.get('active_id')).journal_id.id
            return super(HrPayslipEmployees, self.with_context(journal_id=journal_id)).compute_sheet()
        return super(HrPayslipEmployees, self).compute_sheet()

Remove journal_id: False in context
[FIX] hr_payroll_account: Remove journal_id: False in context

If the wizard to generate payslip was launched without an ´active_id´ in the context.
A ´journal_id´ entry was set to False in the context later leading to a crash at payslip creation.
The crash happens because, at creation time, the journal_id of a ´hr.payslip´ is set to the journal_id
in the context if its present. Since this context entry is False and the journal_id field is required,
creation crashes.

  
  from odoo import api, models
  
  class HrPayslipEmployees(models.TransientModel):
      _inherit = 'hr.payslip.employees'
  
      @api.multi
      def compute_sheet(self):
-         journal_id = False
          if self.env.context.get('active_id'):
              journal_id = self.env['hr.payslip.run'].browse(self.env.context.get('active_id')).journal_id.id
-         return super(HrPayslipEmployees, self.with_context(journal_id=journal_id)).compute_sheet()
+             return super(HrPayslipEmployees, self.with_context(journal_id=journal_id)).compute_sheet()
+         return super(HrPayslipEmployees, self).compute_sheet()
  
Remove journal_id: False in context
## Code Before:

from odoo import api, models

class HrPayslipEmployees(models.TransientModel):
    _inherit = 'hr.payslip.employees'

    @api.multi
    def compute_sheet(self):
        journal_id = False
        if self.env.context.get('active_id'):
            journal_id = self.env['hr.payslip.run'].browse(self.env.context.get('active_id')).journal_id.id
        return super(HrPayslipEmployees, self.with_context(journal_id=journal_id)).compute_sheet()

## Instruction:
Remove journal_id: False in context
## Code After:

from odoo import api, models

class HrPayslipEmployees(models.TransientModel):
    _inherit = 'hr.payslip.employees'

    @api.multi
    def compute_sheet(self):
        if self.env.context.get('active_id'):
            journal_id = self.env['hr.payslip.run'].browse(self.env.context.get('active_id')).journal_id.id
            return super(HrPayslipEmployees, self.with_context(journal_id=journal_id)).compute_sheet()
        return super(HrPayslipEmployees, self).compute_sheet()
