[IMP] hr_expense : prevent removing entries linked to expenses

Once it is deleted, the expense is blocked in the "posted" state.
Accounting entries should rarely be removed but never when linked to expenses

Closes #15704
This commit is contained in:
Florent de Labarre
2017-03-03 10:35:43 +01:00
committed by Martin Trigaux
parent 68176d80ad
commit 09de7be22c
+1 -1
View File
@@ -391,7 +391,7 @@ class HrExpenseSheet(models.Model):
help="The journal used when the expense is done.")
bank_journal_id = fields.Many2one('account.journal', string='Bank Journal', states={'done': [('readonly', True)], 'post': [('readonly', True)]}, default=lambda self: self.env['account.journal'].search([('type', 'in', ['case', 'bank'])], limit=1), help="The payment method used when the expense is paid by the company.")
accounting_date = fields.Date(string="Accounting Date")
account_move_id = fields.Many2one('account.move', string='Journal Entry', copy=False)
account_move_id = fields.Many2one('account.move', string='Journal Entry', ondelete='restrict', copy=False)
department_id = fields.Many2one('hr.department', string='Department', states={'post': [('readonly', True)], 'done': [('readonly', True)]})
@api.multi