[FIX] website_event: Impossible to track proposal on website

Programming error introduced by 602807acdf

Steps to reproduce the bug:

- Create an event with category='conference'
- Checked Track Proposals on Website
- Save it

An error was raised saying that the website with the id of the event didn't exist.

Further, with the fix but without a website_id specified, checked Track proposal didn't
add the menu to track proposals on the conference.

opw:1904078

closes odoo/odoo#28688
This commit is contained in:
Goffin Simon
2018-11-14 15:31:08 +00:00
parent 2b245ebb43
commit 7077f18e3a
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -81,7 +81,7 @@ class Event(models.Model):
event.menu_id.unlink()
elif event.website_menu:
if not event.menu_id:
root_menu = self.env['website.menu'].create({'name': event.name, 'website_id': event.id})
root_menu = self.env['website.menu'].create({'name': event.name, 'website_id': event.website_id.id})
event.menu_id = root_menu
for sequence, (name, url, xml_id) in enumerate(event._get_menu_entries()):
event._create_menu(sequence, name, url, xml_id)
@@ -96,7 +96,7 @@ class Event(models.Model):
'url': url,
'parent_id': self.menu_id.id,
'sequence': sequence,
'website_id': self.id,
'website_id': self.website_id.id,
})
return menu
+1 -1
View File
@@ -31,7 +31,7 @@
<field name="inherit_id" ref="event.view_event_form"/>
<field name="arch" type="xml">
<field name="organizer_id" position="before">
<field name="website_id" options="{'no_create': True}" groups="website.group_multi_website"/>
<field name="website_id" options="{'no_create': True}" attrs="{'required': [('website_menu','=',True)]}" groups="website.group_multi_website"/>
</field>
<button name="toggle_active" position="before">
<field name="website_url" invisible="1"/>