Skip to content
Snippets Groups Projects
Commit 553e24cc authored by rde's avatar rde Committed by Jeremy Kersten
Browse files

[IMP] website: button to easily back to page manager from form view

Before this commit:
When you were on the page manager and you were editing a website.page's
content, it would redirect you to the website.page's ir.ui.view's form view in
the backend.
From there, you would'nt have an easy way to get back to the page manager:
your only option was to go to the website module and click on 'go to website'
and then click on menu/manage pages.
It was not convenient when you were editing multiple page quickly or just
taking a look into some pages.

Now, you have a button on the ir.ui.view's form view to get directly on the page
manager.

Note: this back button is obviously invisible for ir.ui.view not related to a
website.page
parent 3549078e
No related branches found
No related tags found
No related merge requests found
...@@ -20,6 +20,13 @@ class View(models.Model): ...@@ -20,6 +20,13 @@ class View(models.Model):
customize_show = fields.Boolean("Show As Optional Inherit", default=False) customize_show = fields.Boolean("Show As Optional Inherit", default=False)
website_id = fields.Many2one('website', ondelete='cascade', string="Website") website_id = fields.Many2one('website', ondelete='cascade', string="Website")
page_ids = fields.One2many('website.page', compute='_compute_page_ids', store=False)
@api.one
def _compute_page_ids(self):
self.page_ids = self.env['website.page'].search(
[('view_id', '=', self.id)]
)
@api.multi @api.multi
def unlink(self): def unlink(self):
...@@ -142,3 +149,11 @@ class View(models.Model): ...@@ -142,3 +149,11 @@ class View(models.Model):
return lang_code return lang_code
else: else:
return super(View, self).get_default_lang_code() return super(View, self).get_default_lang_code()
@api.multi
def redirect_to_page_manager(self):
return {
'type': 'ir.actions.act_url',
'url': '/website/pages',
'target': 'self',
}
...@@ -209,12 +209,17 @@ ...@@ -209,12 +209,17 @@
<field name="inherit_id" ref="base.view_view_form"/> <field name="inherit_id" ref="base.view_view_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="name" position="after"> <field name="name" position="after">
<field name="website_id" readonly="1"/> <field name="website_id" readonly="1"/>
<field name="key" readonly="1"/> <field name="key" readonly="1"/>
<field name="page_ids" invisible="1" />
</field> </field>
<sheet position="before">
<header>
<button name="redirect_to_page_manager" string="Go to Page Manager"
type="object" attrs="{'invisible': [('page_ids', '=', [])]}"/>
</header>
</sheet>
</field> </field>
</record> </record>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment