Skip to content

9.0 mig base import match - #650

Closed
nicomacr wants to merge 16 commits into
OCA:9.0from
adhoc-dev:9.0-mig-base_import_match
Closed

9.0 mig base import match#650
nicomacr wants to merge 16 commits into
OCA:9.0from
adhoc-dev:9.0-mig-base_import_match

Conversation

@nicomacr

Copy link
Copy Markdown
Contributor

No description provided.

Jairo Llopis and others added 16 commits November 24, 2016 10:48
By default, when importing data (like CSV import) with the ``base_import``
module, Odoo follows this rule:

1. If you import the XMLID of a record, make an **update**.
2. If you do not, **create** a new record.

This module allows you to set additional rules to match if a given import is an
update or a new record.

This is useful when you need to sync heterogeneous databases, and the field you
use to match records in those databases with Odoo's is not the XMLID but the
name, VAT, email, etc.

After installing this module, the import logic will be changed to:

1. If you import the XMLID of a record, make an **update**.
2. If you do not:
   1. If there are import match rules for the model you are importing:
       1. Discard the rules that require fields you are not importing.
       2. Traverse the remaining rules one by one in order to find a match in
          the database.
          1. If one match is found:
             1. Stop traversing the rest of valid rules.
             2. **Update** that record.
          2. If zero or multiple matches are found:
             1. Continue with the next rule.
          3. If all rules are exhausted and no single match is found:
             1. **Create** a new record.
   2. If there are no match rules for your model:
      1. **Create** a new record.
This patch allows to import res.partner records by VAT when is_company==True by default.
* Fix wrong README format.

* [FIX][base_import_match] Avoid UnicodeEncodeError.

When the model or field you chose was translated and had some non-ascii
character, you got an error like this: `UnicodeEncodeError: 'ascii' codec can't
encode character u'\xed' in position 15: ordinal not in range(128)`.

Now, using unicode strings, that won't happen again.

* Do not require a hidden field.

* Further unicode protection, add ondelete clause.

@yajo yajo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review is almost perfect, let's wait for bots.

License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->

<openerp>
<data>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<odoo>

@yajo

yajo commented Dec 16, 2016

Copy link
Copy Markdown
Member

Oh sorry I did not remember, #649 is already there and looks better IMHO.

Please review it @nicomacr, thanks!

@yajo yajo closed this Dec 16, 2016
@nicomacr
nicomacr deleted the 9.0-mig-base_import_match branch December 16, 2016 14:08
SiesslPhillip pushed a commit to grueneerde/OCA-server-tools that referenced this pull request Nov 20, 2024
Syncing from upstream OCA/server-tools (12.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants