Merge branch 'master-issue-website-menu-69' into 'master'

[FIX] Warning 'website.menu.write() with unknown fields: className, style, text' and Fix Isuue: #69

See merge request flectra-hq/flectra!63
This commit is contained in:
Parthiv Patel 2018-05-18 07:13:11 +00:00
commit 4bd185b9a9

View File

@ -981,7 +981,6 @@ class Menu(models.Model):
if to_delete: if to_delete:
self.browse(to_delete).unlink() self.browse(to_delete).unlink()
for menu in data['data']: for menu in data['data']:
del menu['is_homepage']
mid = menu['id'] mid = menu['id']
# new menu are prefixed by new- # new menu are prefixed by new-
if isinstance(mid, pycompat.string_types): if isinstance(mid, pycompat.string_types):
@ -995,6 +994,14 @@ class Menu(models.Model):
menu['page_id'] = page.id menu['page_id'] = page.id
elif menu_id.page_id: elif menu_id.page_id:
menu_id.page_id.write({'url': menu['url']}) menu_id.page_id.write({'url': menu['url']})
if 'is_homepage' in menu:
del menu['is_homepage']
if 'className' in menu:
del menu['className']
if 'style' in menu:
del menu['style']
if 'text' in menu:
del menu['text']
menu_id.write(menu) menu_id.write(menu)
return True return True