From 32168400a4de15c25425470435c08cfebe1dc10d Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Fri, 25 Nov 2016 13:13:37 +0100 Subject: [PATCH] [FIX] account.move.line: restore compatibility with RPC calls Rev. d6e1d41128c126071d697220f1c83495d6cabc71 removed old API compatibility layer, but failed to preserve the ability to call certain public methods from the RPC layer, when extra browse_record parameters were required. In particular the @api.v7 version of `prepare_move_lines_for_reconciliation_widget` was dropped and there was no way to call it with a `target_currency` RPC parameter anymore. --- addons/account/models/account_move.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index d05a71946c9..69cbf424a7c 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -640,12 +640,16 @@ class AccountMoveLine(models.Model): def prepare_move_lines_for_reconciliation_widget(self, target_currency=False, target_date=False): """ Returns move lines formatted for the manual/bank reconciliation widget - :param target_currency: curreny you want the move line debit/credit converted into + :param target_currency: currency (browse_record or ID) you want the move line debit/credit converted into :param target_date: date to use for the monetary conversion """ context = dict(self._context or {}) ret = [] + if target_currency: + # re-browse in case we were passed a currency ID via RPC call + target_currency = self.env['res.currency'].browse(int(target_currency)) + for line in self: company_currency = line.account_id.company_id.currency_id ret_line = {