52 lines
1.8 KiB
Diff
52 lines
1.8 KiB
Diff
diff -r 5b250b63a721 invoice.py
|
|
--- a/trytond/trytond/modules/account_invoice/invoice.py Thu Jan 07 12:11:44 2016 +0100
|
|
+++ b/trytond/trytond/modules/account_invoice/invoice.py Thu Jan 07 12:55:36 2016 +0100
|
|
@@ -1649,6 +1649,8 @@
|
|
'uses the same account (%(account)s).'),
|
|
})
|
|
|
|
+ cls._check_modify_exclude = {'note', 'origin'}
|
|
+
|
|
@classmethod
|
|
def __register__(cls, module_name):
|
|
pool = Pool()
|
|
@@ -1957,17 +1959,18 @@
|
|
return [(None, '')] + [(m.model, m.name) for m in models]
|
|
|
|
@classmethod
|
|
- def check_modify(cls, lines):
|
|
+ def check_modify(cls, lines, fields=None):
|
|
'''
|
|
Check if the lines can be modified
|
|
'''
|
|
- for line in lines:
|
|
- if (line.invoice
|
|
- and line.invoice.state in ('posted', 'paid')):
|
|
- cls.raise_user_error('modify', {
|
|
- 'line': line.rec_name,
|
|
- 'invoice': line.invoice.rec_name
|
|
- })
|
|
+ if fields is None or fields - cls._check_modify_exclude:
|
|
+ for line in lines:
|
|
+ if (line.invoice
|
|
+ and line.invoice.state in ('posted', 'paid')):
|
|
+ cls.raise_user_error('modify', {
|
|
+ 'line': line.rec_name,
|
|
+ 'invoice': line.invoice.rec_name
|
|
+ })
|
|
|
|
@classmethod
|
|
def delete(cls, lines):
|
|
@@ -1976,8 +1979,9 @@
|
|
|
|
@classmethod
|
|
def write(cls, *args):
|
|
- lines = sum(args[0::2], [])
|
|
- cls.check_modify(lines)
|
|
+ actions = iter(args)
|
|
+ for lines, values in zip(actions, actions):
|
|
+ cls.check_modify(lines, set(values))
|
|
super(InvoiceLine, cls).write(*args)
|
|
|
|
@classmethod
|