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):
|
for st in self.browse(cr, uid, ids, context=context):
|
||||||
super(account_bank_statement, self).button_confirm_bank(cr, uid, ids,
|
super(account_bank_statement, self).button_confirm_bank(cr, uid, ids,
|
||||||
context=context)
|
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']
|
move_id = context['move_id']
|
||||||
self._valid_move(cr, uid, move_id, context=context)
|
self._valid_move(cr, uid, move_id, context=context)
|
||||||
lines_ids = [x.id for x in st.line_ids]
|
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):
|
def button_cancel(self, cr, uid, ids, context=None):
|
||||||
done = []
|
done = []
|
||||||
for st in self.browse(cr, uid, ids, context=context):
|
for st in self.browse(cr, uid, ids, context=context):
|
||||||
if st.profile_id.one_move:
|
if st.profile_id.one_move and st.line_ids:
|
||||||
assert st.line_ids, "This statement does not contain any lines"
|
|
||||||
for move in st.line_ids[0].move_ids:
|
for move in st.line_ids[0].move_ids:
|
||||||
if move.state != 'draft':
|
if move.state != 'draft':
|
||||||
move.button_cancel(context=context)
|
move.button_cancel(context=context)
|
||||||
|
|||||||
Reference in New Issue
Block a user