From cfb27532b63727a18ae5ddc0676a38bfc3808531 Mon Sep 17 00:00:00 2001 From: "Adrien Peiffer (ACSONE)" Date: Tue, 31 Mar 2015 15:55:02 +0200 Subject: [PATCH] [IMP][account_banking_payment_export] Use payment mode type instead of check if modules are installed --- .../wizard/payment_order_create.py | 24 +++++-------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/account_banking_payment_export/wizard/payment_order_create.py b/account_banking_payment_export/wizard/payment_order_create.py index b991a04d9..33eaaebc3 100644 --- a/account_banking_payment_export/wizard/payment_order_create.py +++ b/account_banking_payment_export/wizard/payment_order_create.py @@ -86,22 +86,6 @@ class PaymentOrderCreate(models.TransientModel): to_exclude = set([l.move_line_id.id for l in payment_lines]) return [l.id for l in lines if l.id not in to_exclude] - @api.model - def display_credit(self): - ir_module = self.env['ir.module.module'] - res = ir_module\ - .search([('name', '=', 'account_banking_sepa_credit_transfer'), - ('state', '=', 'installed')]) - return len(res) > 0 - - @api.model - def display_debit(self): - ir_module = self.env['ir.module.module'] - res = ir_module\ - .search([('name', '=', 'account_banking_sepa_direct_debit'), - ('state', '=', 'installed')]) - return len(res) > 0 - @api.multi def search_entries(self): """This method taken from account_payment module. @@ -125,8 +109,12 @@ class PaymentOrderCreate(models.TransientModel): context = self.env.context.copy() context['line_ids'] = self.filter_lines(lines) context['populate_results'] = self.populate_results - context['display_credit'] = self.display_credit() - context['display_debit'] = self.display_debit() + if payment.payment_order_type == 'payment': + context['display_credit'] = True + context['display_debit'] = False + else: + context['display_credit'] = False + context['display_debit'] = True model_datas = model_data_obj.search( [('model', '=', 'ir.ui.view'), ('name', '=', 'view_create_payment_order_lines')])