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.

96 lines
3.5 KiB

8 years ago
8 years ago
8 years ago
8 years ago
  1. .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
  2. :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
  3. :alt: License: AGPL-3
  4. ===========================================
  5. Import data from SQL and ODBC data sources.
  6. ===========================================
  7. This module allows import data directly from other databases.
  8. Usage
  9. =====
  10. Go to: Administration module, menu Configuration -> Import from SQL.
  11. Features:
  12. * Fetched data from the databases are used to build lines equivalent to
  13. regular import files. These are imported using the standard "import_data()"
  14. ORM method, benefiting from all its features, including xml_ids.
  15. * Each table import is defined by an SQL statement, used to build the
  16. equivalent for an import file. Each column's name should match the column
  17. names you would use in an import file. The first column must provide an
  18. unique identifier for the record, and will be used to build its xml_id.
  19. * SQL columns named "none" are ignored. This can be used for the first column
  20. of the SQL, so that it's used to build the XML Id but it's not imported to
  21. any OpenERP field.
  22. * The last sync date is the last successfull execution can be used in the SQL
  23. using "%(sync)s", or ":sync" in the case of Oracle.
  24. * When errors are found, only the record with the error fails import. The
  25. other correct records are commited. However, the "last sync date" will only
  26. be automaticaly updated when no errors are found.
  27. * The import execution can be scheduled to run automatically.
  28. Examples:
  29. * Importing suppliers to res.partner:
  30. ::
  31. SELECT distinct[SUPPLIER_CODE] as "ref",
  32. [SUPPLIER_NAME] as "name",
  33. 1 as "is_supplier",
  34. [INFO] as "comment"
  35. FROM T_SUPPLIERS
  36. WHERE INACTIVE_DATE IS NULL and DATE_CHANGED >= %(sync)s'
  37. * Importing products to product.product:
  38. ::
  39. SELECT
  40. PRODUCT_CODE as "ref",
  41. PRODUCT_NAME as "name",
  42. 'res_partner_id_' + SUPPLIER_ID as "partner_id/id"
  43. FROM T_PRODUCTS
  44. WHERE DATE_CHANGED >= %(sync)s'
  45. Known issues / Roadmap
  46. ======================
  47. Improvements ideas waiting for a contributor:
  48. * Allow to import many2one fields (currently not supported). Done by adding a
  49. second SQL sentence to get child record list?
  50. * Allow "import sets" that can be executed at different time intervals using
  51. different scheduler jobs.
  52. * Allow to inactivate/delete OpenERP records when not present in an SQL
  53. result set.
  54. Bug Tracker
  55. ===========
  56. Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_.
  57. In case of trouble, please check there if your issue has already been reported.
  58. If you spotted it first, help us smashing it by providing a detailed and welcomed feedback
  59. `here <https://github.com/OCA/server-tools/issues/new?body=module:%20import_odbc%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
  60. Credits
  61. =======
  62. Contributors
  63. ------------
  64. * Daniel Reis <dreis.pt@gmail.com>
  65. * Maxime Chambreuil <maxime.chambreuil@savoirfairelinux.com>
  66. Maintainer
  67. ----------
  68. .. image:: http://odoo-community.org/logo.png
  69. :alt: Odoo Community Association
  70. :target: http://odoo-community.org
  71. This module is maintained by the OCA.
  72. OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
  73. To contribute to this module, please visit http://odoo-community.org.