test_import_vendor_bill.py 1.1 KB

12345678910111213141516171819202122
  1. # -*- coding: utf-8 -*-
  2. from odoo.addons.account.tests.common import AccountTestInvoicingCommon
  3. from odoo.tests import tagged
  4. @tagged('post_install', '-at_install')
  5. class TestImportVendorBill(AccountTestInvoicingCommon):
  6. def test_retrieve_partner(self):
  7. def retrieve_partner(vat, import_vat):
  8. self.partner_a.with_context(no_vat_validation=True).vat = vat
  9. return self.env['account.edi.format']._retrieve_partner(vat=import_vat)
  10. self.assertEqual(self.partner_a, retrieve_partner('BE0477472701', 'BE0477472701'))
  11. self.assertEqual(self.partner_a, retrieve_partner('BE0477472701', '0477472701'))
  12. self.assertEqual(self.partner_a, retrieve_partner('BE0477472701', '477472701'))
  13. self.assertEqual(self.partner_a, retrieve_partner('0477472701', 'BE0477472701'))
  14. self.assertEqual(self.partner_a, retrieve_partner('477472701', 'BE0477472701'))
  15. self.assertEqual(self.env['res.partner'], retrieve_partner('DE0477472701', 'BE0477472701'))
  16. self.assertEqual(self.partner_a, retrieve_partner('CHE-107.787.577 IVA', 'CHE-107.787.577 IVA')) # note that base_vat forces the space