From dc6913e2e0e901ec9e577afbb52997389a97e103 Mon Sep 17 00:00:00 2001 From: Yannick Tivisse Date: Mon, 26 Feb 2018 14:07:47 +0100 Subject: [PATCH] [FIX] payment: Avoid to reset journal_id on acquirer edition Coming from https://github.com/odoo/odoo/pull/17067 Don't reset the journal but make it required on the form view instead. --- addons/payment/models/payment_acquirer.py | 9 --------- addons/payment/views/payment_views.xml | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/addons/payment/models/payment_acquirer.py b/addons/payment/models/payment_acquirer.py index 9edd843fba7..05958214210 100644 --- a/addons/payment/models/payment_acquirer.py +++ b/addons/payment/models/payment_acquirer.py @@ -199,22 +199,13 @@ class PaymentAcquirer(models.Model): @api.model def create(self, vals): image_resize_images(vals) - vals = self._check_journal_id(vals) return super(PaymentAcquirer, self).create(vals) @api.multi def write(self, vals): image_resize_images(vals) - vals = self._check_journal_id(vals) return super(PaymentAcquirer, self).write(vals) - def _check_journal_id(self, vals): - if not vals.get('journal_id', False): - default_journal = self.env['account.journal'].search([('type', '=', 'bank')], limit=1) - if default_journal: - vals.update({'journal_id': default_journal.id}) - return vals - @api.multi def toggle_website_published(self): self.write({'website_published': not self.website_published}) diff --git a/addons/payment/views/payment_views.xml b/addons/payment/views/payment_views.xml index 6f536f270d5..e5b29fb7b75 100644 --- a/addons/payment/views/payment_views.xml +++ b/addons/payment/views/payment_views.xml @@ -81,7 +81,7 @@ - +