mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[FIX] replace assert by a simple check in cancel method + add a check on the context in the button_confirm_bank method
This commit is contained in:
@@ -132,7 +132,7 @@ class account_bank_statement(orm.Model):
|
||||
for st in self.browse(cr, uid, ids, context=context):
|
||||
super(account_bank_statement, self).button_confirm_bank(cr, uid, ids,
|
||||
context=context)
|
||||
if st.profile_id.one_move:
|
||||
if st.profile_id.one_move and context.get('move_id', False):
|
||||
move_id = context['move_id']
|
||||
self._valid_move(cr, uid, move_id, context=context)
|
||||
lines_ids = [x.id for x in st.line_ids]
|
||||
@@ -144,8 +144,7 @@ class account_bank_statement(orm.Model):
|
||||
def button_cancel(self, cr, uid, ids, context=None):
|
||||
done = []
|
||||
for st in self.browse(cr, uid, ids, context=context):
|
||||
if st.profile_id.one_move:
|
||||
assert st.line_ids, "This statement does not contain any lines"
|
||||
if st.profile_id.one_move and st.line_ids:
|
||||
for move in st.line_ids[0].move_ids:
|
||||
if move.state != 'draft':
|
||||
move.button_cancel(context=context)
|
||||
|
||||
Reference in New Issue
Block a user