From f94b09dbf2ed32ead42962c52ddc97199793b03d Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Thu, 11 Jul 2019 09:41:13 +0000 Subject: [PATCH] [FIX] point_of_sale: payment method journal in wrong currency Steps to reproduce the bug: - Install point_of_sale and account_accountant - Create a company C in USD - Create a cash journal CJ with no currency set - Activate Multicurrency - Create a pricelist P in EUR - Create a sales journal SJ with currency = EUR - Create pos.config in company C - Assign SJ in the Sales Journal field - Set P as default pricelist - Set the cash journal CJ as payment method and save Bug: As CJ is implicitly in USD, it was wrong to set CJ as payment method in a pos.config in EUR. With courtesy of opw:2031883 closes odoo/odoo#34790 Signed-off-by: Simon Goffin (sig) --- addons/point_of_sale/models/pos_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/models/pos_config.py b/addons/point_of_sale/models/pos_config.py index 8411e864faa..dfaf7121f38 100644 --- a/addons/point_of_sale/models/pos_config.py +++ b/addons/point_of_sale/models/pos_config.py @@ -246,7 +246,7 @@ class PosConfig(models.Model): " the Accounting application.")) if self.invoice_journal_id.currency_id and self.invoice_journal_id.currency_id != self.currency_id: raise ValidationError(_("The invoice journal must be in the same currency as the Sales Journal or the company currency if that is not set.")) - if any(self.journal_ids.mapped(lambda journal: journal.currency_id and journal.currency_id != self.currency_id)): + if any(self.journal_ids.mapped(lambda journal: self.currency_id not in (journal.company_id.currency_id, journal.currency_id))): raise ValidationError(_("All payment methods must be in the same currency as the Sales Journal or the company currency if that is not set.")) @api.constrains('company_id', 'available_pricelist_ids')