diff --git a/issue4727.diff b/issue4727.diff new file mode 100644 index 0000000..2d0e1a2 --- /dev/null +++ b/issue4727.diff @@ -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 diff --git a/series b/series index 18fd9f0..3f454fe 100644 --- a/series +++ b/series @@ -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