Skip to content

Commit

Permalink
Fix multi company style and double data elements
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernando La Chica committed Aug 14, 2020
1 parent a9974dd commit b2c03b0
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 4 deletions.
4 changes: 2 additions & 2 deletions odoo_module_migrate/migration_scripts/migrate_080_allways.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
_TEXT_REPLACES = {
".py": {"from openerp": "from odoo", "import openerp": "import odoo"},
".xml": {
r"( |\t)*<openerp>(\n| |\t)*<data>": "<odoo>",
r"( |\t)*<\/data>(\n| |\t)*<\/openerp>": "</odoo>",
r"( |\t)*<openerp>": "<odoo>",
r"( |\t)*<\/openerp>": "</odoo>",
}
}
8 changes: 7 additions & 1 deletion odoo_module_migrate/migration_scripts/migrate_120_130.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,15 @@
r"\.sudo\((?P<user>[^/)]+?)\)": r".with_user(\g<user>)",
r"\.suspend_security": ".sudo",
r"\"base_suspend_security\",\n": "",
r"self.env.user.company_id": r"self.env.company"
},
".xml": {
r"( |\t)*<field name=('|\")view_type('|\")>.*</field>\n": "",
r"src_model": "binding_model",
r"( |\t)*<field name=('|\")domain_force('|\")>"
r".*company_id.*child_of.*</field>\n":
r"\t\t<field name=\2domain_force\2>"
r"['|',('company_id','=',False),"
r"('company_id', 'in', company_ids)]</field>\n",
r"src_model": "binding_model"
}
}
4 changes: 4 additions & 0 deletions tests/data_result/module_080_130/demo/demo_ir_values.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<odoo>

<data>
<record name="demo_values" model="ir.values">
<field name="name">My Demo Values</field>
</record>
</data>

</odoo>
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<odoo>

<data>
<record name="demo_category" model="product.category">
<field name="name">My Demo Category</field>
</record>
</data>

</odoo>
5 changes: 5 additions & 0 deletions tests/data_result/module_080_130/views/sale_order.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record id="action_order_custom_field_a" model="ir.actions.act_window">
<field name="name">Custom field A</field>
<field name="res_model">sale.report</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('custom_field','=','a')]</field>
</record>
</data>

<data noupdate="1">

<record id="action_order_custom_field_b" model="ir.actions.act_window">
<field name="name">Custom field B</field>
Expand Down Expand Up @@ -34,4 +38,5 @@
res_model="account.move.line"
binding_model="account.move"
view_mode="tree"/>
</data>
</odoo>
5 changes: 4 additions & 1 deletion tests/data_template/module_080/views/sale_order.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<data noupdate="0">
<record id="action_order_custom_field_a" model="ir.actions.act_window">
<field name="name">Custom field A</field>
<field name="res_model">sale.report</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('custom_field','=','a')]</field>
</record>
</data>

<data noupdate="1">

<record id="action_order_custom_field_b" model="ir.actions.act_window">
<field name="name">Custom field B</field>
Expand Down

0 comments on commit b2c03b0

Please sign in to comment.