[FIX] website: switch page_id from menu on cow
Before this commit, if you had a page_id set on a menu, and that you fork this page, the page_id from the menu was always pointing to the previous one, so you see old page, but edit new page. > Reproduce: > Fork Contactus (Page_id on menu become wrong) > Refresh contact us (done on save btw) > You see old content > Edit with Html Editor, you sill see that forked view exists! Bug was hidden before that we set page_id on menu, but it is needed if we want to support the groups visibility on the menu item. closes odoo/odoo#39472 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
This commit is contained in:
@@ -143,12 +143,14 @@
|
||||
<record id="menu_home" model="website.menu">
|
||||
<field name="name">Home</field>
|
||||
<field name="url">/</field>
|
||||
<field name="page_id" ref="website.homepage_page"/>
|
||||
<field name="parent_id" ref="website.main_menu"/>
|
||||
<field name="sequence" type="int">10</field>
|
||||
</record>
|
||||
<record id="menu_contactus" model="website.menu">
|
||||
<field name="name">Contact us</field>
|
||||
<field name="url">/contactus</field>
|
||||
<field name="page_id" ref="website.contactus_page"/>
|
||||
<field name="parent_id" ref="website.main_menu"/>
|
||||
<field name="sequence" type="int">60</field>
|
||||
</record>
|
||||
|
||||
@@ -189,10 +189,11 @@ class View(models.Model):
|
||||
def _create_website_specific_pages_for_view(self, new_view, website):
|
||||
for page in self.page_ids:
|
||||
# create new pages for this view
|
||||
page.copy({
|
||||
new_page = page.copy({
|
||||
'view_id': new_view.id,
|
||||
'is_published': page.is_published,
|
||||
})
|
||||
page.menu_ids.filtered(lambda m: m.website_id.id == website.id).page_id = new_page.id
|
||||
|
||||
@api.model
|
||||
def get_related_views(self, key, bundles=False):
|
||||
|
||||
@@ -103,10 +103,10 @@ var PagePropertiesDialog = weWidgets.Dialog.extend({
|
||||
this.$('.ask_for_redirect').addClass('d-none');
|
||||
this.$('.redirect_type').addClass('d-none');
|
||||
this.$('.warn_about_call').addClass('d-none');
|
||||
if (this.page.visibility != 'password') {
|
||||
if (this.page.visibility !== 'password') {
|
||||
this.$('.show_visibility_password').addClass('d-none');
|
||||
}
|
||||
if (this.page.visibility != 'restricted_group') {
|
||||
if (this.page.visibility !== 'restricted_group') {
|
||||
this.$('.show_visibility_group').addClass('d-none');
|
||||
}
|
||||
this.autocompleteWithGroups(this.$('#visibility_group'));
|
||||
@@ -353,8 +353,8 @@ var PagePropertiesDialog = weWidgets.Dialog.extend({
|
||||
response(founds);
|
||||
});
|
||||
},
|
||||
change: (event, ui) => {
|
||||
var $target = $(event.target);
|
||||
change: (ev, ui) => {
|
||||
var $target = $(ev.target);
|
||||
if (!ui.item) {
|
||||
$target.val("");
|
||||
$target.removeData('group-id');
|
||||
@@ -396,7 +396,9 @@ var PagePropertiesDialog = weWidgets.Dialog.extend({
|
||||
var createRedirect = this.$('input#create_redirect').prop('checked');
|
||||
this.$('.redirect_type').toggleClass('d-none', !createRedirect);
|
||||
},
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_onVisibilityChanged: function (ev) {
|
||||
this.$('.show_visibility_password').toggleClass('d-none', ev.target.value !== 'password');
|
||||
this.$('.show_visibility_group').toggleClass('d-none', ev.target.value !== 'restricted_group');
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
//
|
||||
// This file is meant to determine the timezone of a website visitor
|
||||
// If the visitor already exists, no need to keep the timezone cookie
|
||||
// as the timezone is set on the visitor.
|
||||
// This file is meant to allow to switch the type of an input #password
|
||||
// from password to text on mousedown on an input group.
|
||||
// On mouse down, we see the password in clear text
|
||||
// On mouse up, we hide it again.
|
||||
//
|
||||
odoo.define('website.show_password', function (require) {
|
||||
'use strict';
|
||||
|
||||
Reference in New Issue
Block a user