[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 <jcb@odoo.com>

opw:2031883

closes odoo/odoo#34790

Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
Goffin Simon
2019-07-11 11:13:44 +00:00
parent 8271be23cf
commit f94b09dbf2
+1 -1
View File
@@ -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')