You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
1007 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright (C) 2017-TODAY Camptocamp SA (<http://www.camptocamp.com>).
  3. # @author: Simone Orsi (https://twitter.com/simahawk)
  4. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  5. import odoo
  6. @odoo.tests.common.at_install(False)
  7. @odoo.tests.common.post_install(True)
  8. class TestPOS(odoo.tests.TransactionCase):
  9. def test_check_default_payment_method_id(self):
  10. journal_ok = self.env['account.journal'].create({
  11. 'name': 'Ok',
  12. 'code': 'OK',
  13. 'type': 'cash',
  14. })
  15. journal_ko = self.env['account.journal'].create({
  16. 'name': 'Ko',
  17. 'code': 'KO',
  18. 'type': 'cash',
  19. })
  20. config = self.env.ref('point_of_sale.pos_config_main')
  21. config.write({'journal_ids': [(6, 0, journal_ok.ids)]})
  22. config.default_payment_method_id = journal_ok
  23. with self.assertRaises(odoo.exceptions.ValidationError):
  24. config.default_payment_method_id = journal_ko