Browse Source

base_import_match module

pull/871/head
cubells 8 years ago
committed by Pedro M. Baeza
parent
commit
66f8265ed9
  1. 9
      base_import_match/README.rst
  2. 3
      base_import_match/__init__.py
  3. 14
      base_import_match/__openerp__.py
  4. 33
      base_import_match/data/base_import_match.xml
  5. 29
      base_import_match/data/base_import_match.yml
  6. 45
      base_import_match/demo/base_import_match.xml
  7. 40
      base_import_match/demo/base_import_match.yml
  8. 3
      base_import_match/models/__init__.py
  9. 5
      base_import_match/models/base_import.py
  10. 3
      base_import_match/tests/__init__.py
  11. 3
      base_import_match/tests/test_import.py
  12. 9
      base_import_match/views/base_import_match_view.xml

9
base_import_match/README.rst

@ -84,7 +84,7 @@ To use this module, you need to:
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot :alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/149/8.0
:target: https://runbot.odoo-community.org/runbot/149/9.0
Known Issues / Roadmap Known Issues / Roadmap
====================== ======================
@ -98,11 +98,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues Bugs are tracked on `GitHub Issues
<https://github.com/OCA/server-tools/issues>`_. In case of trouble, please <https://github.com/OCA/server-tools/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first, 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/OCA/
server-tools/issues/new?body=module:%20
base_import_match%0Aversion:%20
8.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
help us smashing it by providing a detailed and welcomed feedback.
Credits Credits
======= =======
@ -111,6 +107,7 @@ Contributors
------------ ------------
* Jairo Llopis <yajo.sk8@gmail.com> * Jairo Llopis <yajo.sk8@gmail.com>
* Vicent Cubells <vicent.cubells@tecnativa.com>
Maintainer Maintainer
---------- ----------

3
base_import_match/__init__.py

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# 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). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models from . import models

14
base_import_match/__openerp__.py

@ -1,13 +1,15 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# 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). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{ {
"name": "Base Import Match", "name": "Base Import Match",
"summary": "Try to avoid duplicates before importing", "summary": "Try to avoid duplicates before importing",
"version": "8.0.1.0.1",
"version": "9.0.1.0.0",
"category": "Tools", "category": "Tools",
"website": "https://grupoesoc.es",
"author": "Grupo ESOC Ingeniería de Servicios, "
"website": "https://tecnativa.com",
"author": "Grupo ESOC Ingeniería de Servicios,"
"Tecnativa, "
"Odoo Community Association (OCA)", "Odoo Community Association (OCA)",
"license": "AGPL-3", "license": "AGPL-3",
"application": False, "application": False,
@ -17,10 +19,10 @@
], ],
"data": [ "data": [
"security/ir.model.access.csv", "security/ir.model.access.csv",
"data/base_import_match.yml",
"data/base_import_match.xml",
"views/base_import_match_view.xml", "views/base_import_match_view.xml",
], ],
"demo": [ "demo": [
"demo/base_import_match.yml",
"demo/base_import_match.xml",
], ],
} }

33
base_import_match/data/base_import_match.xml

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="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). -->
<odoo noupdate="1">
<!-- Match partners by VAT when is_company is True -->
<record model="base_import.match" id="res_partner_vat">
<field name="model_id" eval="ref('base.model_res_partner')"/>
<field name="sequence" type="int">10</field>
</record>
<record model="base_import.match.field" id="res_partner_vat_vat">
<field name="match_id" ref="base_import_match.res_partner_vat"/>
<field name="field_id" ref="base.field_res_partner_vat"/>
</record>
<record model="base_import.match.field" id="res_partner_vat_is_company">
<field name="match_id" ref="base_import_match.res_partner_vat"/>
<field name="field_id" ref="base.field_res_partner_is_company"/>
<field name="conditional">True</field>
<field name="imported_value">True</field>
</record>
<!-- Match users by login -->
<record model="base_import.match" id="res_users_login">
<field name="model_id" eval="ref('base.model_res_users')"/>
<field name="sequence" type="int">50</field>
</record>
<record model="base_import.match.field" id="res_users_login_login">
<field name="match_id" ref="base_import_match.res_users_login"/>
<field name="field_id" ref="base.field_res_users_login"/>
</record>
</odoo>

29
base_import_match/data/base_import_match.yml

@ -1,29 +0,0 @@
# -*- coding: utf-8 -*-
# © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
- !context {noupdate: True}
# Match partners by VAT when is_company is True
- !record {id: res_partner_vat, model: base_import.match}:
model_id: base.model_res_partner
sequence: 10
- !record {id: res_partner_vat_vat, model: base_import.match.field}:
match_id: res_partner_vat
field_id: base.field_res_partner_vat
- !record {id: res_partner_vat_is_company, model: base_import.match.field}:
match_id: res_partner_vat
field_id: base.field_res_partner_is_company
conditional: True
imported_value: "True"
# Match users by login
- !record {id: res_users_login, model: base_import.match}:
model_id: base.model_res_users
sequence: 50
- !record {id: res_users_login_login, model: base_import.match.field}:
match_id: res_users_login
field_id: base.field_res_users_login

45
base_import_match/demo/base_import_match.xml

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="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). -->
<odoo noupdate="1">
<!-- Match partners by name, parent_id and is_company -->
<record model="base_import.match" id="res_partner_parent_name_is_company">
<field name="model_id" eval="ref('base.model_res_partner')"/>
<field name="sequence" type="int">20</field>
</record>
<record model="base_import.match.field" id="res_partner_parent_name_is_company_name">
<field name="match_id" ref="res_partner_parent_name_is_company"/>
<field name="field_id" ref="base.field_res_partner_name"/>
</record>
<record model="base_import.match.field" id="res_partner_parent_name_is_company_parent">
<field name="match_id" ref="res_partner_parent_name_is_company"/>
<field name="field_id" ref="base.field_res_partner_parent_id"/>
</record>
<record model="base_import.match.field" id="res_partner_parent_name_is_company_is_company">
<field name="match_id" ref="res_partner_parent_name_is_company"/>
<field name="field_id" ref="base.field_res_partner_is_company"/>
</record>
<!-- Match partner by email -->
<record model="base_import.match" id="res_partner_email">
<field name="model_id" eval="ref('base.model_res_partner')"/>
<field name="sequence" type="int">30</field>
</record>
<record model="base_import.match.field" id="res_partner_email_email">
<field name="match_id" ref="base_import_match.res_partner_email"/>
<field name="field_id" ref="base.field_res_partner_email"/>
</record>
<!-- Match partner by name -->
<record model="base_import.match" id="res_partner_name">
<field name="model_id" eval="ref('base.model_res_partner')"/>
<field name="sequence" type="int">40</field>
</record>
<record model="base_import.match.field" id="res_partner_name_name">
<field name="match_id" ref="base_import_match.res_partner_name"/>
<field name="field_id" ref="base.field_res_partner_name"/>
</record>
</odoo>

40
base_import_match/demo/base_import_match.yml

@ -1,40 +0,0 @@
# -*- coding: utf-8 -*-
# © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
- !context {noupdate: True}
# Match partners by name, parent_id and is_company
- !record {id: res_partner_parent_name_is_company, model: base_import.match}:
model_id: base.model_res_partner
sequence: 20
- !record {id: res_partner_parent_name_is_company_name, model: base_import.match.field}:
match_id: res_partner_parent_name_is_company
field_id: base.field_res_partner_name
- !record {id: res_partner_parent_name_is_company_parent, model: base_import.match.field}:
match_id: res_partner_parent_name_is_company
field_id: base.field_res_partner_parent_id
- !record {id: res_partner_parent_name_is_company_is_company, model: base_import.match.field}:
match_id: res_partner_parent_name_is_company
field_id: base.field_res_partner_is_company
# Match partner by email
- !record {id: res_partner_email, model: base_import.match}:
model_id: base.model_res_partner
sequence: 30
- !record {id: res_partner_email_email, model: base_import.match.field}:
match_id: res_partner_email
field_id: base.field_res_partner_email
# Match partner by name
- !record {id: res_partner_name, model: base_import.match}:
model_id: base.model_res_partner
sequence: 40
- !record {id: res_partner_name_name, model: base_import.match.field}:
match_id: res_partner_name
field_id: base.field_res_partner_name

3
base_import_match/models/__init__.py

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# 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). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import base_import from . import base_import

5
base_import_match/models/base_import.py

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# 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). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import api, fields, models from openerp import api, fields, models
from openerp import SUPERUSER_ID # TODO remove in v10 from openerp import SUPERUSER_ID # TODO remove in v10
@ -20,7 +21,7 @@ class BaseImportMatch(models.Model):
"Model", "Model",
required=True, required=True,
ondelete="cascade", ondelete="cascade",
domain=[("osv_memory", "=", False)],
domain=[("transient ", "=", False)],
help="In this model you will apply the match.") help="In this model you will apply the match.")
model_name = fields.Char( model_name = fields.Char(
related="model_id.model", related="model_id.model",

3
base_import_match/tests/__init__.py

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# 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). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import test_import from . import test_import

3
base_import_match/tests/test_import.py

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# 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). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from os import path from os import path

9
base_import_match/views/base_import_match_view.xml

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
<!-- 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). --> License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
<openerp>
<data>
<odoo>
<record id="match_form_view" model="ir.ui.view"> <record id="match_form_view" model="ir.ui.view">
<field name="name">Import match form view</field> <field name="name">Import match form view</field>
@ -78,5 +78,4 @@
action="match_action" action="match_action"
parent="base.next_id_9"/> parent="base.next_id_9"/>
</data>
</openerp>
</odoo>
Loading…
Cancel
Save