mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
14 lines
420 B
Python
14 lines
420 B
Python
from odoo import fields, models
|
|
|
|
|
|
class AnalyticLine(models.Model):
|
|
_inherit = 'account.analytic.line'
|
|
|
|
payslip_id = fields.Many2one('hr.payslip', string="Payslip", readonly=True, ondelete='set null')
|
|
|
|
def unlink(self):
|
|
ts_with_payslip = self.filtered(lambda ts: ts.payslip_id)
|
|
ts_with_payslip.write({'payslip_id': False})
|
|
return super(AnalyticLine, self - ts_with_payslip).unlink()
|
|
|