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.

24 lines
926 B

  1. # Copyright 2018 Creu Blanca
  2. # Copyright 2018 Eficent Business and IT Consulting Services, S.L.
  3. # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
  4. from odoo.tests.common import TransactionCase
  5. class TestPartnerFind(TransactionCase):
  6. def test_partner(self):
  7. partner_obj = self.env['res.partner']
  8. ref = 'testing_partner_internal_reference'
  9. partner = partner_obj.create({
  10. 'name': 'Testing partner',
  11. 'ref': ref,
  12. })
  13. # We should find the partner when the ref is found
  14. self.assertEqual(
  15. partner.id,
  16. partner_obj.find_res_partner_by_ref_using_barcode(ref).get(
  17. 'res_id', False))
  18. # No partner is found, then there is no res_id on the result
  19. self.assertFalse(
  20. partner_obj.find_res_partner_by_ref_using_barcode(
  21. '%s-%s' % (ref, ref)).get('res_id', False))