[FIX] website: make "Edit in backend" always go to website backend

Before this commit, clicking "Edit in backend" from the website could randomly
lead to the backend under another menu or without module, depending on the
other modules that are installed or version com/ent used.

After this commit, it will always open the backend under the specifiec menu
or website menu if not defined.

+ uses existing website dedicated action for product.template in 'Edit backend'

task-1919436
closes #30555

Co-authored by seb@odoo.com

closes odoo/odoo#30657
This commit is contained in:
Jeremy Kersten
2019-01-29 10:54:56 +00:00
parent 09be5b235c
commit d609dbdd11
3 changed files with 4 additions and 3 deletions
@@ -171,7 +171,7 @@
<span class="sr-only">Toggle Dropdown</span>
</a>
<div class="dropdown-menu" role="menu">
<a role="menuitem" style="text-align: left;" t-attf-href="/web#return_label=Website&amp;view_type=form&amp;model=#{main_object._name}&amp;id=#{main_object.id}&amp;action=#{action}"
<a role="menuitem" style="text-align: left;" t-attf-href="/web#return_label=Website&amp;view_type=form&amp;model=#{main_object._name}&amp;id=#{main_object.id}&amp;action=#{action}&amp;menu_id=#{menu or main_object.env.ref('website.menu_website_configuration').id}"
class="dropdown-item" title='Edit in backend' id="edit-in-backend">Edit in backend</a>
</div>
</li>
+1 -1
View File
@@ -413,7 +413,7 @@
<button type="button" t-attf-class="btn btn-default dropdown-toggle dropdown-toggle-split" t-att-id="'dopprod-%s' % object.id" data-toggle="dropdown"/>
<div class="dropdown-menu" role="menu" t-att-aria-labelledby="'dopprod-%s' % object.id">
<t t-raw="0"/>
<a role="menuitem" t-attf-href="/web#return_label=Website&amp;view_type=form&amp;model=#{object._name}&amp;id=#{object.id}&amp;action=#{action}"
<a role="menuitem" t-attf-href="/web#return_label=Website&amp;view_type=form&amp;model=#{object._name}&amp;id=#{object.id}&amp;action=#{action}&amp;menu_id=#{menu or object.env.ref('website.menu_website_configuration').id}"
title='Edit in backend' class="dropdown-item" t-if="publish_edit">Edit</a>
</div>
</div>
+2 -1
View File
@@ -413,9 +413,10 @@
<!-- /shop/product product page -->
<template id="product_edit_options" inherit_id="website.user_navbar" name="Edit Product Options">
<xpath expr="//li[@id='edit-page-menu']" position="after">
<t t-if="main_object._name == 'product.template'" t-set="action" t-value="'product.product_template_action'" />
<t t-if="main_object._name == 'product.template'" t-set="action" t-value="'website_sale.product_template_action_website'" />
</xpath>
</template>
<template id="product" name="Product">
<t t-set="first_possible_combination" t-value="product._get_first_possible_combination()"/>