[MIG] base_import_match: Migration to 12.0

[UPD] README.rst

[UPD] Update base_import_match.pot
This commit is contained in:
ernesto
2019-02-08 09:26:42 -05:00
committed by Augusto Weiss
parent ba23d45aed
commit cb72b4b44f
22 changed files with 716 additions and 100 deletions

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# Copyright 2016 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Jairo Llopis <jairo.llopis@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, models
@@ -20,7 +19,8 @@ class Base(models.AbstractModel):
if self.env["base_import.match"]._usable_rules(self._name, fields):
newdata = list()
# Data conversion to ORM format
import_fields = map(models.fix_import_export_id_paths, fields)
import_fields = list(
map(models.fix_import_export_id_paths, fields))
converted_data = self._convert_records(
self._extract_records(import_fields, data))
# Mock Odoo to believe the user is importing the ID field
@@ -44,7 +44,10 @@ class Base(models.AbstractModel):
match = self.env["base_import.match"]._match_find(
self, record, row)
# Give a valid XMLID to this row if a match was found
row["id"] = (match._BaseModel__export_xml_id()
# To generate externals IDS.
match.export_data(fields)
ext_id = match.get_external_id()
row["id"] = (ext_id[match.id]
if match else row.get("id", u""))
# Store the modified row, in the same order as fields
newdata.append(tuple(row[f] for f in clean_fields))

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# Copyright 2016 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
@@ -26,6 +25,7 @@ class BaseImportMatch(models.Model):
domain=[("transient", "=", False)],
help="In this model you will apply the match.")
model_name = fields.Char(
string="Model name",
related="model_id.model",
store=True,
index=True)