odoo12-addon-pattern-import-export


Nameodoo12-addon-pattern-import-export JSON
Version 12.0.6.2.0 PyPI version JSON
download
home_pagehttps://github.com/OCA/pattern-import-export
SummaryPattern for import or export
upload_time2021-03-21 21:22:11
maintainer
docs_urlNone
authorAkretion, Odoo Community Association (OCA)
requires_python>=3.5
licenseAGPL-3
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            =====================
Pattern Import Export
=====================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   !! This file is generated by oca-gen-addon-readme !!
   !! changes will be overwritten.                   !!
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
    :target: https://odoo-community.org/page/development-status
    :alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
    :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
    :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-shopinvader%2Fpattern--import--export-lightgray.png?logo=github
    :target: https://github.com/shopinvader/pattern-import-export/tree/12.0/pattern_import_export
    :alt: shopinvader/pattern-import-export

|badge1| |badge2| |badge3| 

Overview
~~~~~~~~

This module extends the import/export capabilities of Odoo.

Patterns are simply a type of ir.exports model, so you can define them with the native Odoo widget to define export lists.

This module only create a common data structure. Other modules will be used to add specific file type support like excel and csv.


Features
--------

* Key matching: instead of always using IDs, match keys to unique-constrained fields, for example update a product by
  specifying its product_code instead of its database ID or external ID

* One2many and Many2many support: create or update for example invoice lines with a syntax that is very readable and easy to update

* As long as you respect the appropriate format and field names, you are free to add/remove/rename columns, even if they
  are not in the initial Pattern used for the export

**Table of contents**

.. contents::
   :local:

Configuration
=============

* Install another module that supports a specific file type
* Use the Patterns menu to configure your import/export formats

Usage
=====

Configuring a pattern
~~~~~~~~~~~~~~~~~~~~~
First you have to define a pattern:

1. Go on the Import/Export->Patterns menu
2. Create your pattern with fields to export

You can refer to the examples in demo data.


Exporting
---------
* Open the tree view of any model and tick some record selection boxes.
* In the sidebar, click on the "Export with Pattern" button
* Select the pattern that you wish to use, click export and download the generated file.
* A "Pattern file" is created, and its job along with it. Depending on the success or failure of the job,
  you will receive a red/green notification on your window.


Importing
---------
You have two options:

* Open the tree view of any model and tick some record selection boxes (for this step, these don't matter, we only just want to show the sidebar).
* In the sidebar, click on the "Import with Pattern" button
* Select the pattern that you used to generate the export, upload your file and click import.
* A "Pattern file" is created, and its job along with it. Depending on the success or failure of the job, you
  will receive a red/green notification on your window. You can check the details in the appropriate Import/Export menu.

Or:

* Access the Import wizard through the Import/Export menu
* Select the Pattern that you want to use
* Click on the "Import" button

Example
-------

Here is an example of a simple update on ``product.product``:
Existing record:

- id: 10
- name: "Product 1"
- default_code: "PRD1"

The generated export will look like:

+---------------------+-----------+--------------+
| id                  | name      | default_code |
+=====================+===========+==============+
| 10                  | Product 1 | PRD1         |
+---------------------+-----------+--------------+

Updated file

+---------------------+---------------+--------------+
| id                  | name          | default_code |
+=====================+===============+==============+
| 10                  | Product 1-bis | PRD1B        |
+---------------------+---------------+--------------+

After import, our record will have been updated:

- xml id: "__export__.product1"
- name: "Product 1-bis"
- default_code: "PRD1B"

Now, let's update some relational fields. Here is some more of our starting data:

- seller_ids:

 - id (of the seller_id which is a res.partner): 22
 - name (seller): Partner 1
 - price: 10

The generated export should be like

+---------------------+-----------+--------------+----------------------+--------------------+
| id                  | name      | default_code | seller_ids|1|id      | seller_ids|1|price |
+=====================+===========+==============+======================+====================+
| 10                  | Product 1 | PRD1         | 22                   | 10                 |
+---------------------+-----------+--------------+----------------------+--------------------+

Let's say "ref" is a unique-constrained Char field. For the seller, instead of using its id, let's use its ref.

+---------------------+-----------+--------------+---------------------------+--------------------+
| id                  | name      | default_code | seller_ids|1|ref#key      | seller_ids|1|price |
+=====================+===========+==============+===========================+====================+
| 10                  | Product 1 | PRD1         | partner1-ref              | 10                 |
+---------------------+-----------+--------------+---------------------------+--------------------+

So this ``#key`` means that Odoo should search for a ``res.partner`` where the ref matches the cell value.

Lets take another example, instead of using the id, we want to use the product's default_code as key.

+---------------------+-----------+------------------+---------------------------+--------------------+
| id                  | name      | default_code#key | seller_ids|1|ref#key      | seller_ids|1|price |
+=====================+===========+==================+===========================+====================+
|                     | Product 1 | PRD1             | partner1-ref              | 10                 |
+---------------------+-----------+------------------+---------------------------+--------------------+

Odoo will search the product with the matching ``default_code`` and update it.


Technically
~~~~~~~~~~~
Add a new export format
-----------------------
1. Inherit the ``ir.exports`` model.
2. Add your new file format in the selection field ``export_format``;
3. Implements functions ``_export_with_record_<format>`` and ``_read_import_data_<format>``.

Please take care of iterators (``yield``) to avoid loading full file into the system memory.

Known issues / Roadmap
======================

* Unticking the "Use tab" boolean should clear the previously selected tab_filter_id
* Changing a line's field should clear the previously selected tab_filter_id

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/shopinvader/pattern-import-export/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/shopinvader/pattern-import-export/issues/new?body=module:%20pattern_import_export%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Akretion

Contributors
~~~~~~~~~~~~

* Chafique Delli <chafique.delli@akretion.com>
* Sébastien Beau <sebastien.beau@akretion.com>
* François Honoré (ACSONE SA/NV) <francois.honore@acsone.eu>
* Kevin Khao <kevin.khao@akretion.com>

Maintainers
~~~~~~~~~~~

This module is part of the `shopinvader/pattern-import-export <https://github.com/shopinvader/pattern-import-export/tree/12.0/pattern_import_export>`_ project on GitHub.

You are welcome to contribute.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/OCA/pattern-import-export",
    "name": "odoo12-addon-pattern-import-export",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.5",
    "maintainer_email": "",
    "keywords": "",
    "author": "Akretion, Odoo Community Association (OCA)",
    "author_email": "support@odoo-community.org",
    "download_url": "",
    "platform": "",
    "description": "=====================\nPattern Import Export\n=====================\n\n.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n   !! This file is generated by oca-gen-addon-readme !!\n   !! changes will be overwritten.                   !!\n   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png\n    :target: https://odoo-community.org/page/development-status\n    :alt: Beta\n.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png\n    :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html\n    :alt: License: AGPL-3\n.. |badge3| image:: https://img.shields.io/badge/github-shopinvader%2Fpattern--import--export-lightgray.png?logo=github\n    :target: https://github.com/shopinvader/pattern-import-export/tree/12.0/pattern_import_export\n    :alt: shopinvader/pattern-import-export\n\n|badge1| |badge2| |badge3| \n\nOverview\n~~~~~~~~\n\nThis module extends the import/export capabilities of Odoo.\n\nPatterns are simply a type of ir.exports model, so you can define them with the native Odoo widget to define export lists.\n\nThis module only create a common data structure. Other modules will be used to add specific file type support like excel and csv.\n\n\nFeatures\n--------\n\n* Key matching: instead of always using IDs, match keys to unique-constrained fields, for example update a product by\n  specifying its product_code instead of its database ID or external ID\n\n* One2many and Many2many support: create or update for example invoice lines with a syntax that is very readable and easy to update\n\n* As long as you respect the appropriate format and field names, you are free to add/remove/rename columns, even if they\n  are not in the initial Pattern used for the export\n\n**Table of contents**\n\n.. contents::\n   :local:\n\nConfiguration\n=============\n\n* Install another module that supports a specific file type\n* Use the Patterns menu to configure your import/export formats\n\nUsage\n=====\n\nConfiguring a pattern\n~~~~~~~~~~~~~~~~~~~~~\nFirst you have to define a pattern:\n\n1. Go on the Import/Export->Patterns menu\n2. Create your pattern with fields to export\n\nYou can refer to the examples in demo data.\n\n\nExporting\n---------\n* Open the tree view of any model and tick some record selection boxes.\n* In the sidebar, click on the \"Export with Pattern\" button\n* Select the pattern that you wish to use, click export and download the generated file.\n* A \"Pattern file\" is created, and its job along with it. Depending on the success or failure of the job,\n  you will receive a red/green notification on your window.\n\n\nImporting\n---------\nYou have two options:\n\n* Open the tree view of any model and tick some record selection boxes (for this step, these don't matter, we only just want to show the sidebar).\n* In the sidebar, click on the \"Import with Pattern\" button\n* Select the pattern that you used to generate the export, upload your file and click import.\n* A \"Pattern file\" is created, and its job along with it. Depending on the success or failure of the job, you\n  will receive a red/green notification on your window. You can check the details in the appropriate Import/Export menu.\n\nOr:\n\n* Access the Import wizard through the Import/Export menu\n* Select the Pattern that you want to use\n* Click on the \"Import\" button\n\nExample\n-------\n\nHere is an example of a simple update on ``product.product``:\nExisting record:\n\n- id: 10\n- name: \"Product 1\"\n- default_code: \"PRD1\"\n\nThe generated export will look like:\n\n+---------------------+-----------+--------------+\n| id                  | name      | default_code |\n+=====================+===========+==============+\n| 10                  | Product 1 | PRD1         |\n+---------------------+-----------+--------------+\n\nUpdated file\n\n+---------------------+---------------+--------------+\n| id                  | name          | default_code |\n+=====================+===============+==============+\n| 10                  | Product 1-bis | PRD1B        |\n+---------------------+---------------+--------------+\n\nAfter import, our record will have been updated:\n\n- xml id: \"__export__.product1\"\n- name: \"Product 1-bis\"\n- default_code: \"PRD1B\"\n\nNow, let's update some relational fields. Here is some more of our starting data:\n\n- seller_ids:\n\n - id (of the seller_id which is a res.partner): 22\n - name (seller): Partner 1\n - price: 10\n\nThe generated export should be like\n\n+---------------------+-----------+--------------+----------------------+--------------------+\n| id                  | name      | default_code | seller_ids|1|id      | seller_ids|1|price |\n+=====================+===========+==============+======================+====================+\n| 10                  | Product 1 | PRD1         | 22                   | 10                 |\n+---------------------+-----------+--------------+----------------------+--------------------+\n\nLet's say \"ref\" is a unique-constrained Char field. For the seller, instead of using its id, let's use its ref.\n\n+---------------------+-----------+--------------+---------------------------+--------------------+\n| id                  | name      | default_code | seller_ids|1|ref#key      | seller_ids|1|price |\n+=====================+===========+==============+===========================+====================+\n| 10                  | Product 1 | PRD1         | partner1-ref              | 10                 |\n+---------------------+-----------+--------------+---------------------------+--------------------+\n\nSo this ``#key`` means that Odoo should search for a ``res.partner`` where the ref matches the cell value.\n\nLets take another example, instead of using the id, we want to use the product's default_code as key.\n\n+---------------------+-----------+------------------+---------------------------+--------------------+\n| id                  | name      | default_code#key | seller_ids|1|ref#key      | seller_ids|1|price |\n+=====================+===========+==================+===========================+====================+\n|                     | Product 1 | PRD1             | partner1-ref              | 10                 |\n+---------------------+-----------+------------------+---------------------------+--------------------+\n\nOdoo will search the product with the matching ``default_code`` and update it.\n\n\nTechnically\n~~~~~~~~~~~\nAdd a new export format\n-----------------------\n1. Inherit the ``ir.exports`` model.\n2. Add your new file format in the selection field ``export_format``;\n3. Implements functions ``_export_with_record_<format>`` and ``_read_import_data_<format>``.\n\nPlease take care of iterators (``yield``) to avoid loading full file into the system memory.\n\nKnown issues / Roadmap\n======================\n\n* Unticking the \"Use tab\" boolean should clear the previously selected tab_filter_id\n* Changing a line's field should clear the previously selected tab_filter_id\n\nBug Tracker\n===========\n\nBugs are tracked on `GitHub Issues <https://github.com/shopinvader/pattern-import-export/issues>`_.\nIn case of trouble, please check there if your issue has already been reported.\nIf you spotted it first, help us smashing it by providing a detailed and welcomed\n`feedback <https://github.com/shopinvader/pattern-import-export/issues/new?body=module:%20pattern_import_export%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.\n\nDo not contact contributors directly about support or help with technical issues.\n\nCredits\n=======\n\nAuthors\n~~~~~~~\n\n* Akretion\n\nContributors\n~~~~~~~~~~~~\n\n* Chafique Delli <chafique.delli@akretion.com>\n* S\u00e9bastien Beau <sebastien.beau@akretion.com>\n* Fran\u00e7ois Honor\u00e9 (ACSONE SA/NV) <francois.honore@acsone.eu>\n* Kevin Khao <kevin.khao@akretion.com>\n\nMaintainers\n~~~~~~~~~~~\n\nThis module is part of the `shopinvader/pattern-import-export <https://github.com/shopinvader/pattern-import-export/tree/12.0/pattern_import_export>`_ project on GitHub.\n\nYou are welcome to contribute.\n\n\n",
    "bugtrack_url": null,
    "license": "AGPL-3",
    "summary": "Pattern for import or export",
    "version": "12.0.6.2.0",
    "project_urls": {
        "Homepage": "https://github.com/OCA/pattern-import-export"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9b6985695c1590e2de348770d1cee813ad2efa8f456a6dd8192b272661cc6b3a",
                "md5": "840c09ca36fdf00343563d157f3b317a",
                "sha256": "533a7d265a679ea6851682da35b97825cfc4d8bd8f968c7fe687456a9b89a0a7"
            },
            "downloads": -1,
            "filename": "odoo12_addon_pattern_import_export-12.0.6.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "840c09ca36fdf00343563d157f3b317a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.5",
            "size": 54131,
            "upload_time": "2021-03-21T21:22:11",
            "upload_time_iso_8601": "2021-03-21T21:22:11.992837Z",
            "url": "https://files.pythonhosted.org/packages/9b/69/85695c1590e2de348770d1cee813ad2efa8f456a6dd8192b272661cc6b3a/odoo12_addon_pattern_import_export-12.0.6.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-03-21 21:22:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "OCA",
    "github_project": "pattern-import-export",
    "github_not_found": true,
    "lcname": "odoo12-addon-pattern-import-export"
}
        
Elapsed time: 0.72043s