Holger Brunn
7 years ago
committed by
OCA-git-bot
8 changed files with 199 additions and 50 deletions
-
1base_import_odoo/__openerp__.py
-
42base_import_odoo/demo/import_odoo_database_field.xml
-
6base_import_odoo/demo/import_odoo_database_model.xml
-
93base_import_odoo/models/import_odoo_database.py
-
17base_import_odoo/models/import_odoo_database_field.py
-
36base_import_odoo/tests/test_base_import_odoo.py
-
10base_import_odoo/views/import_odoo_database.xml
-
42base_import_odoo/views/import_odoo_database_field.xml
@ -1,23 +1,59 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<openerp> |
|||
<data noupdate="1"> |
|||
<record id="mapping_user_id" model="import.odoo.database.field"> |
|||
<record id="mapping_partner_id_root" model="import.odoo.database.field"> |
|||
<field name="database_id" ref="demodb" /> |
|||
<field name="mapping_type">fixed</field> |
|||
<field name="model_id" ref="base.model_res_partner" /> |
|||
<field name="local_id" ref="base.partner_root" /> |
|||
<field name="remote_id" ref="base.partner_root" /> |
|||
</record> |
|||
<record id="mapping_partner_id_company" model="import.odoo.database.field"> |
|||
<field name="database_id" ref="demodb" /> |
|||
<field name="mapping_type">fixed</field> |
|||
<field name="model_id" ref="base.model_res_partner" /> |
|||
<field name="local_id" ref="base.main_partner" /> |
|||
<field name="remote_id" ref="base.main_partner" /> |
|||
</record> |
|||
<record id="mapping_partner_id_public" model="import.odoo.database.field"> |
|||
<field name="database_id" ref="demodb" /> |
|||
<field name="mapping_type">fixed</field> |
|||
<field name="model_id" ref="base.model_res_partner" /> |
|||
<field name="local_id" ref="base.public_partner" /> |
|||
<field name="remote_id" ref="base.public_partner" /> |
|||
</record> |
|||
<record id="mapping_user_root" model="import.odoo.database.field"> |
|||
<field name="database_id" ref="demodb" /> |
|||
<field name="mapping_type">fixed</field> |
|||
<field name="model_id" ref="base.model_res_users" /> |
|||
<field name="local_id" ref="mapped_admin" /> |
|||
<field name="remote_id" ref="base.user_root" /> |
|||
</record> |
|||
<record id="mapping_user_public" model="import.odoo.database.field"> |
|||
<field name="database_id" ref="demodb" /> |
|||
<field name="mapping_type">fixed</field> |
|||
<field name="model_id" ref="base.model_res_users" /> |
|||
<field name="local_id" ref="base.public_user" /> |
|||
<field name="remote_id" ref="base.public_user" /> |
|||
</record> |
|||
<record id="mapping_company_id" model="import.odoo.database.field"> |
|||
<field name="database_id" ref="demodb" /> |
|||
<field name="mapping_type">fixed</field> |
|||
<field name="model_id" ref="base.model_res_company" /> |
|||
<field name="local_id" ref="base.main_company" /> |
|||
<field name="remote_id" ref="base.main_company" /> |
|||
</record> |
|||
<record id="mapping_login" model="import.odoo.database.field"> |
|||
<field name="database_id" ref="demodb" /> |
|||
<field name="mapping_type">unique</field> |
|||
<field name="model_id" ref="base.model_res_users" /> |
|||
<field name="fields_id" ref="base.field_res_users_login" /> |
|||
<field name="unique" eval="True" /> |
|||
<field name="field_ids" eval="[(4, ref('base.field_res_users_login'))]" /> |
|||
</record> |
|||
<record id="mapping_groups" model="import.odoo.database.field"> |
|||
<field name="database_id" ref="demodb" /> |
|||
<field name="mapping_type">by_field</field> |
|||
<field name="model_id" ref="base.model_res_groups" /> |
|||
<field name="field_ids" eval="[(4, ref('base.field_res_groups_name'))]" /> |
|||
</record> |
|||
</data> |
|||
</openerp> |
@ -0,0 +1,42 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<openerp> |
|||
<data> |
|||
<record id="view_import_odoo_database_field_form" model="ir.ui.view"> |
|||
<field name="model">import.odoo.database.field</field> |
|||
<field name="arch" type="xml"> |
|||
<form> |
|||
<group> |
|||
<field name="model_id" /> |
|||
<field name="model" invisible="True" /> |
|||
<field name="mapping_type" /> |
|||
</group> |
|||
<div attrs="{'invisible': [('mapping_type', '!=', 'fixed')]}" class="oe_edit_only"> |
|||
When a record of this model is imported, it will be replaced with the record you select as local ID. If you select a field and/or a remote ID, this replacement is only effective when setting the specified field and/or when the remote value is the specified record. |
|||
</div> |
|||
<div attrs="{'invisible': [('mapping_type', '!=', 'by_field')]}" class="oe_edit_only"> |
|||
Select fields which must be equal to treat a pair of remote and local records of this model as being equal. |
|||
</div> |
|||
<div attrs="{'invisible': [('mapping_type', '!=', 'unique')]}" class="oe_edit_only"> |
|||
Select fields for which to generate unique values during import. You'll need this for res.users#login for example. |
|||
</div> |
|||
<group> |
|||
<field name="local_id" attrs="{'invisible': [('mapping_type', '!=', 'fixed')], 'required': [('mapping_type', '=', 'fixed')]}" /> |
|||
<field name="remote_id" attrs="{'invisible': [('mapping_type', '!=', 'fixed')]}" /> |
|||
<field name="field_ids" attrs="{'required': [('mapping_type', 'in', ['by_field', 'unique'])]}" widget="many2many_tags" domain="[mapping_type == 'fixed' and ('relation', '=', model) or ('model_id', '=', model_id)]"/> |
|||
</group> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
<record id="view_import_odoo_database_field_tree" model="ir.ui.view"> |
|||
<field name="model">import.odoo.database.field</field> |
|||
<field name="arch" type="xml"> |
|||
<tree> |
|||
<field name="sequence" widget="handle" /> |
|||
<field name="model_id" /> |
|||
<field name="mapping_type" /> |
|||
<field name="field_ids" /> |
|||
</tree> |
|||
</field> |
|||
</record> |
|||
</data> |
|||
</openerp> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue