Add inactive patch issue4727

This commit is contained in:
Guillem Barba 2016-01-07 13:17:49 +01:00
parent bc2a1d2ceb
commit 49bcbc77c6
2 changed files with 52 additions and 0 deletions

51
issue4727.diff Normal file
View File

@ -0,0 +1,51 @@
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

1
series
View File

@ -76,6 +76,7 @@ account_chart_speedup.diff
# Ignore next patches
#incremental_wait_in_retries.diff
# Uncomment in calfruitos
#issue4727.diff
#fix_rounding_in_sync_inventory_to_outgoing.patch
#chart_not_translatable.diff
#024726_account_bank_remove_company.diff