From e3f19d9d1b218dae3bd9a9c2486d1c9b2e73feef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul=20=28ACSONE=29?= Date: Tue, 19 Jul 2016 13:56:36 +0200 Subject: [PATCH] [FIX+IMP] account_payment_order: 2 more things: * IMP: extensibility of _prepare_move Pass the list of bank lines to _prepare_move so it is possible to customize the move (eg it's name) based on the lines being paid. * FIX: payment order: add missing onchange dependencies in move selection wizard --- account_payment_order/models/account_payment_order.py | 4 ++-- account_payment_order/wizard/account_payment_line_create.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/account_payment_order/models/account_payment_order.py b/account_payment_order/models/account_payment_order.py index e1d95f68d..dd0dce252 100644 --- a/account_payment_order/models/account_payment_order.py +++ b/account_payment_order/models/account_payment_order.py @@ -330,7 +330,7 @@ class AccountPaymentOrder(models.Model): return True @api.multi - def _prepare_move(self): + def _prepare_move(self, bank_lines=None): if self.payment_type == 'outbound': ref = _('Payment order %s') % self.name else: @@ -433,7 +433,7 @@ class AccountPaymentOrder(models.Model): trfmoves[hashcode] = bline for hashcode, blines in trfmoves.iteritems(): - mvals = self._prepare_move() + mvals = self._prepare_move(blines) total_company_currency = total_payment_currency = 0 for bline in blines: total_company_currency += bline.amount_company_currency diff --git a/account_payment_order/wizard/account_payment_line_create.py b/account_payment_order/wizard/account_payment_line_create.py index 16fe79cbd..0737b022e 100644 --- a/account_payment_order/wizard/account_payment_line_create.py +++ b/account_payment_order/wizard/account_payment_line_create.py @@ -140,7 +140,8 @@ class AccountPaymentLineCreate(models.TransientModel): return action @api.onchange( - 'date_type', 'move_date', 'due_date', 'journal_ids', 'invoice') + 'date_type', 'move_date', 'due_date', 'journal_ids', 'invoice', + 'target_move', 'allow_blocked', 'payment_mode') def move_line_filters_change(self): domain = self._prepare_move_line_domain() res = {'domain': {'move_line_ids': domain}}