summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrde <rde@odoo.com>2017-09-25 15:54:15 +0200
committerrde <rde@odoo.com>2017-09-26 16:08:14 +0200
commit8baabfb6be9e1db1af0828d705d07a1ec6f0029a (patch)
tree15cb01bcd2d445b48d0d0f05aeeff42b422b2599
parent0426849de18b587bd0624d644b1208a24edefde9 (diff)
[FIX] website_*: convert old ir.ui.view page=True into website.page in 1 record
Before this commit, website.page xml record were created in 2 steps: 1. Create an ir.ui.view record with <template> tag 2. Create a website.page record with <record model="website.page"> But this is useless since website.page inheritS ir.ui.view, you can create both records just in one <record> tag. Note: This is NOT TRUE in every case: Odoo's ORM will suffix external_id of inherited records (in this case the ir.ui.view created through the website.page record) with its model's name. This can be a problem in some case (this is an example): website_crm_template.xml create an ir.ui.view inheriting the ir.ui.view 'website.contactus'. But if we didn't keep website.page & ir.ui.view records split for that specific case, the ir.ui.view would inherit a website.page record causing an error. (website.contactus would be the id of the page record while the ir.ui.view's id would be website.contactus_ir_ui_view) In short: when migrating an ir.ui.view (<record> xml) to a website.page: * If there is record inheriting the ir.ui.view ID, then split website.page & ir.ui.view * if not, you can create the website.page and its ir.ui.view both in one record (<record model="website.page"). This commit also removed remaining page="True" from xml template since we removed the 'page' attribute from ir.ui.view model overrided in website module.
-rw-r--r--addons/base_import_module/tests/test_module/test.xml2
-rw-r--r--addons/website/data/website_data.xml11
-rw-r--r--addons/website_crm/views/website_crm_templates.xml9
-rw-r--r--addons/website_hr_recruitment/views/website_hr_recruitment_templates.xml9
-rw-r--r--addons/website_livechat/views/website_livechat.xml2
5 files changed, 9 insertions, 24 deletions
diff --git a/addons/base_import_module/tests/test_module/test.xml b/addons/base_import_module/tests/test_module/test.xml
index 80e24a4293b..9722d9478d1 100644
--- a/addons/base_import_module/tests/test_module/test.xml
+++ b/addons/base_import_module/tests/test_module/test.xml
@@ -11,7 +11,7 @@
<field name="currency_id" ref="base.EUR"/>
</record>
- <template id="test_page" name="Test Page" page="True">
+ <template id="test_page" name="Test Page">
<t t-call="website.layout">
<h1>
This page comes from an imported module!
diff --git a/addons/website/data/website_data.xml b/addons/website/data/website_data.xml
index a175e02f2c3..1b0de430feb 100644
--- a/addons/website/data/website_data.xml
+++ b/addons/website/data/website_data.xml
@@ -30,16 +30,7 @@
<field name="website_id" ref="default_website"/>
</record>
- <!--
- Keep homepage & contactus page split between ir_ui_view & website_page record
- So external_id of the ir_ui_view record is still 'website.contactus' and not 'website.contactus_ir_ui_view' (same for homepage)
- Indeed Odoo put a suffix on external_id on submodels records (inherits) with the model's name as suffix.
- eg: record website_page is 'website.contactus' & ir_ui_view record is 'website.contactus_ir_ui_view'
- but since website_crm_template.xml (and surely others) inherit the contactus ir_ui_view record (inherit_id="website.contactus"),
- the external_id of the contactus ir_ui_view record still has to be 'website.contactus'.
- (Put in another way, external_id 'website.contactus' can't be the external_id of the website_page record or the inherit will ofc fail)
- (Or change inherit_id in related files but possibly alot. Safer this way)
- -->
+ <!-- split between ir_ui_view & website_page record to keep external_id on ir_ui_view -->
<record id="homepage" model="ir.ui.view">
<field name="name">Home</field>
<field name="type">qweb</field>
diff --git a/addons/website_crm/views/website_crm_templates.xml b/addons/website_crm/views/website_crm_templates.xml
index 31c3f60d45e..6cafa2e4442 100644
--- a/addons/website_crm/views/website_crm_templates.xml
+++ b/addons/website_crm/views/website_crm_templates.xml
@@ -50,9 +50,11 @@
</div>
</xpath>
</template>
- <record id="contactus_thanks" model="ir.ui.view">
+ <record id="contactus_thanks" model="website.page">
<field name="name">Thanks (Contact us)</field>
<field name="type">qweb</field>
+ <field name="url">/contactus-thank-you</field>
+ <field name="website_published">True</field>
<field name="key">website_crm.contactus_thanks</field>
<field name="arch" type="xml">
<t name="Thanks (Contact us)" t-name="website_crm.contactus_thanks">
@@ -88,11 +90,6 @@
</t>
</field>
</record>
- <record id="contactus_thanks_page" model="website.page">
- <field name="url">/contactus-thank-you</field>
- <field name="website_published">True</field>
- <field name="ir_ui_view_id" ref="contactus_thanks" />
- </record>
<template id="website_crm_tests" name="Website CRM Tests" inherit_id="web.assets_common">
<xpath expr="." position="inside">
diff --git a/addons/website_hr_recruitment/views/website_hr_recruitment_templates.xml b/addons/website_hr_recruitment/views/website_hr_recruitment_templates.xml
index c4f37c5ec45..87e471e6f4d 100644
--- a/addons/website_hr_recruitment/views/website_hr_recruitment_templates.xml
+++ b/addons/website_hr_recruitment/views/website_hr_recruitment_templates.xml
@@ -385,7 +385,9 @@
</section>
</template>
-<record id="thankyou" model="ir.ui.view">
+<record id="thankyou" model="website.page">
+ <field name="url">/job-thank-you</field>
+ <field name="website_published">True</field>
<field name="name">Thank you (Recruitment)</field>
<field name="type">qweb</field>
<field name="key">website_hr_recruitment.thankyou</field>
@@ -445,11 +447,6 @@
</t>
</field>
</record>
-<record id="thankyou_page" model="website.page">
- <field name="url">/job-thank-you</field>
- <field name="website_published">True</field>
- <field name="ir_ui_view_id" ref="thankyou" />
-</record>
<template id="job_countries" inherit_id="website_hr_recruitment.index" active="False" customize_show="True" name="Filter by Countries">
<xpath expr="//div[@id='jobs_grid_left']" position="inside">
diff --git a/addons/website_livechat/views/website_livechat.xml b/addons/website_livechat/views/website_livechat.xml
index 523705d93a9..c43c4294dec 100644
--- a/addons/website_livechat/views/website_livechat.xml
+++ b/addons/website_livechat/views/website_livechat.xml
@@ -38,7 +38,7 @@
</template>
<!-- Page Layout -->
- <template id="channel_page" name="Livechat Channel Satisfaction Page" page="True">
+ <template id="channel_page" name="Livechat Channel Satisfaction Page">
<t t-call="website.layout">
<div id="wrap">
<div class="container">