I add extra depends on the three account_bank_statements modules to

ensure that when the cancel/delete order is coming from there is allowed
even if the account move is posted.

Task: #159291
This commit is contained in:
Bernat Brunet 2023-06-02 10:15:11 +02:00
parent 43245fd3df
commit e0cc8f03c6
2 changed files with 14 additions and 7 deletions

View File

@ -8,6 +8,7 @@ from trytond.pyson import Eval, Bool
from trytond.i18n import gettext from trytond.i18n import gettext
from trytond.exceptions import UserError from trytond.exceptions import UserError
from trytond.model.exceptions import AccessError from trytond.model.exceptions import AccessError
from trytond.transaction import Transaction
__all__ = ['Configuration', 'Account', 'Move', 'MoveLine'] __all__ = ['Configuration', 'Account', 'Move', 'MoveLine']
@ -257,13 +258,16 @@ class MoveLine(metaclass=PoolMeta):
'state': 'draft', 'state': 'draft',
}) })
for line in lines: from_statement = Transaction().context.get(
if line.move.state == 'posted': 'from_account_bank_statement_line', False)
raise AccessError(gettext( if not from_statement:
'account.msg_modify_line_posted_move', for line in lines:
line=line.rec_name, if line.move.state == 'posted':
move=line.move.rec_name, raise AccessError(gettext(
)) 'account.msg_modify_line_posted_move',
line=line.rec_name,
move=line.move.rec_name,
))
super(MoveLine, cls).delete(lines) super(MoveLine, cls).delete(lines)
@dualmethod @dualmethod

View File

@ -8,6 +8,9 @@ extras_depend:
account_invoice account_invoice
analytic_invoice analytic_invoice
analytic_account_move analytic_account_move
account_bank_statement
account_bank_statement_counterpart
account_bank_statement_account
xml: xml:
account.xml account.xml
analytic.xml analytic.xml