diff --git a/addons/account/account.py b/addons/account/account.py index da19fcf7197..0c32aea78f5 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1339,7 +1339,7 @@ class account_move(osv.osv): 'SET state=%s '\ 'WHERE id IN %s', ('posted', tuple(valid_moves),)) - self.invalidate_cache(cr, uid, context=context) + self.invalidate_cache(cr, uid, ['state', ], valid_moves, context=context) return True def button_validate(self, cursor, user, ids, context=None): diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 7a0d737d847..17ccfb3bd86 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -629,9 +629,9 @@ class account_invoice(models.Model): line_ids = self.move_line_id_payment_get() if not line_ids: return False - query = "SELECT reconcile_id FROM account_move_line WHERE id IN %s" + query = "SELECT count(*) FROM account_move_line WHERE reconcile_id IS NULL AND id IN %s" self._cr.execute(query, (tuple(line_ids),)) - return all(row[0] for row in self._cr.fetchall()) + return self._cr.fetchone()[0] == 0 @api.multi def button_reset_taxes(self): diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 2ace8acc7ee..e7509edecdc 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -1074,11 +1074,9 @@ class account_move_line(osv.osv): # marking the lines as reconciled does not change their validity, so there is no need # to revalidate their moves completely. reconcile_context = dict(context, novalidate=True) - r_id = move_rec_obj.create(cr, uid, { - 'type': type, - 'line_id': map(lambda x: (4, x, False), ids), - 'line_partial_ids': map(lambda x: (3, x, False), ids) - }, context=reconcile_context) + r_id = move_rec_obj.create(cr, uid, {'type': type}, context=reconcile_context) + self.write(cr, uid, ids, {'reconcile_id': r_id, 'reconcile_partial_id': False}, context=reconcile_context) + # the id of the move.reconcile is written in the move.line (self) by the create method above # because of the way the line_id are defined: (4, x, False) for id in ids: