Prevent modify invoiced timesheet line

review879002
This commit is contained in:
Cédric Krier committed 2013-05-27 18:05:46 +02:00
1 parent 472ab8d158
commit a0298be9bf
1 file changed
+7
+7
View File
@@ -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):