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.

50 lines
2.0 KiB

  1. # -*- coding: utf-8 -*-
  2. ##############################################################################
  3. #
  4. # Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
  5. # All Rights Reserved
  6. #
  7. # WARNING: This program as such is intended to be used by professional
  8. # programmers who take the whole responsibility of assessing all potential
  9. # consequences resulting from its eventual inadequacies and bugs.
  10. # End users who are looking for a ready-to-use solution with commercial
  11. # guarantees and support are strongly advised to contact a Free Software
  12. # Service Company.
  13. #
  14. # This program is free software: you can redistribute it and/or modify
  15. # it under the terms of the GNU Affero General Public License as
  16. # published by the Free Software Foundation, either version 3 of the
  17. # License, or (at your option) any later version.
  18. #
  19. # This program is distributed in the hope that it will be useful,
  20. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. # GNU Affero General Public License for more details.
  23. #
  24. # You should have received a copy of the GNU Affero General Public License
  25. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  26. #
  27. ##############################################################################
  28. from openerp import models, fields, api
  29. from openerp.tools import convert
  30. import base64
  31. from cStringIO import StringIO
  32. class ImportHelpWizard(models.TransientModel):
  33. _name = "import.help.wizard"
  34. source_file = fields.Binary('Source File')
  35. @api.one
  36. def import_help(self):
  37. source_file = base64.decodestring(self.source_file)
  38. convert.convert_xml_import(self.env.cr,
  39. self._module,
  40. StringIO(source_file),
  41. idref=None,
  42. mode='init',
  43. noupdate=False,
  44. report=None)
  45. return True