mirror of
https://github.com/NaN-tic/trytond-analytic_line_state.git
synced 2023-12-14 03:33:02 +01:00
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:
parent
43245fd3df
commit
e0cc8f03c6
2 changed files with 14 additions and 7 deletions
18
account.py
18
account.py
|
@ -8,6 +8,7 @@ from trytond.pyson import Eval, Bool
|
|||
from trytond.i18n import gettext
|
||||
from trytond.exceptions import UserError
|
||||
from trytond.model.exceptions import AccessError
|
||||
from trytond.transaction import Transaction
|
||||
|
||||
__all__ = ['Configuration', 'Account', 'Move', 'MoveLine']
|
||||
|
||||
|
@ -257,13 +258,16 @@ class MoveLine(metaclass=PoolMeta):
|
|||
'state': 'draft',
|
||||
})
|
||||
|
||||
for line in lines:
|
||||
if line.move.state == 'posted':
|
||||
raise AccessError(gettext(
|
||||
'account.msg_modify_line_posted_move',
|
||||
line=line.rec_name,
|
||||
move=line.move.rec_name,
|
||||
))
|
||||
from_statement = Transaction().context.get(
|
||||
'from_account_bank_statement_line', False)
|
||||
if not from_statement:
|
||||
for line in lines:
|
||||
if line.move.state == 'posted':
|
||||
raise AccessError(gettext(
|
||||
'account.msg_modify_line_posted_move',
|
||||
line=line.rec_name,
|
||||
move=line.move.rec_name,
|
||||
))
|
||||
super(MoveLine, cls).delete(lines)
|
||||
|
||||
@dualmethod
|
||||
|
|
|
@ -8,6 +8,9 @@ extras_depend:
|
|||
account_invoice
|
||||
analytic_invoice
|
||||
analytic_account_move
|
||||
account_bank_statement
|
||||
account_bank_statement_counterpart
|
||||
account_bank_statement_account
|
||||
xml:
|
||||
account.xml
|
||||
analytic.xml
|
||||
|
|
Loading…
Reference in a new issue