From a0298be9bf11dddbd3e3683d6bef423ab060870e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 27 May 2013 18:05:46 +0200 Subject: [PATCH] Prevent modify invoiced timesheet line review879002 --- timesheet.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/timesheet.py b/timesheet.py index 67ee5cc324..39b7414208 100644 --- a/timesheet.py +++ b/timesheet.py @@ -17,6 +17,7 @@ class TimesheetLine: def __setup__(cls): super(TimesheetLine, cls).__setup__() cls._error_messages.update({ + 'modify_invoiced_line': 'You can not modify invoiced line.', 'delete_invoiced_line': 'You can not delete invoiced line.', }) @@ -28,6 +29,12 @@ class TimesheetLine: default.setdefault('invoice_line', None) return super(TimesheetLine, cls).copy(records, default=default) + @classmethod + def write(cls, records, values): + if any(r.invoice_line for r in records): + cls.raise_user_error('modify_invoiced_line') + super(TimesheetLine, cls).write(records, values) + @classmethod def delete(cls, records): if any(r.invoice_line for r in records):