[IMP] base: add a constraint on ir.ui.view to avoid groups on template
Template arch can contrains "groups" attributes on the html tag but can't have group_id setted. (to allow a cache per template and lang instead of a cache per template, user and lang)
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<template id="report_invoice_layouted" inherit_id="account.report_invoice_document" groups="sale.group_sale_layout">
|
||||
<xpath expr="//table" position="replace">
|
||||
<t t-foreach="o.order_lines_layouted()" t-as="page">
|
||||
<template id="report_invoice_layouted" inherit_id="account.report_invoice_document">
|
||||
<xpath expr="//table" position="attributes">
|
||||
<attribute name="groups">!sale.group_sale_layout</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//table" position="after">
|
||||
<t groups="sale.group_sale_layout" t-foreach="o.order_lines_layouted()" t-as="page">
|
||||
<table class="table table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -70,9 +73,12 @@
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<template id="report_invoice_document_inherit_sale" inherit_id="account.report_invoice_document" groups="sale.group_delivery_invoice_address">
|
||||
<xpath expr="//div[@name='invoice_address']" position="replace">
|
||||
<div class="col-xs-5 col-xs-offset-7">
|
||||
<template id="report_invoice_document_inherit_sale" inherit_id="account.report_invoice_document">
|
||||
<xpath expr="//div[@name='invoice_address']" position="attributes">
|
||||
<attribute name="groups">!sale.group_delivery_invoice_address</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//div[@name='invoice_address']" position="before">
|
||||
<div class="col-xs-5 col-xs-offset-7" groups="sale.group_delivery_invoice_address">
|
||||
<strong t-if="o.partner_shipping_id == o.partner_id">Invoicing and shipping address:</strong>
|
||||
<strong t-if="o.partner_shipping_id != o.partner_id">Invoicing address:</strong>
|
||||
<div t-field="o.partner_id"
|
||||
|
||||
@@ -96,7 +96,9 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr t-foreach="o.pack_operation_ids" t-as="pack_operation">
|
||||
<t t-set="pack_operation_ids" t-value="o.pack_operation_ids"/>
|
||||
<t groups="base.group_portal" t-set="pack_operation_ids" t-value="o.pack_operation_ids.sudo()"/>
|
||||
<tr t-foreach="pack_operation_ids" t-as="pack_operation">
|
||||
<td><span t-field="pack_operation.product_id"/><br/>
|
||||
<span t-field="pack_operation.product_id.description_picking"/>
|
||||
<t t-if="not pack_operation.product_id and pack_operation.package_id"><span t-field="pack_operation.package_id"/></t></td>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<!-- Front-end/Back-end integration -->
|
||||
<template groups="base.group_user" id="user_navbar" inherit_id="website.layout">
|
||||
<template id="user_navbar" inherit_id="website.layout">
|
||||
<xpath expr="//body" position="attributes">
|
||||
<attribute name="class">o_connected_user</attribute>
|
||||
<attribute name="t-att-class">'o_connected_user' if env['ir.ui.view'].user_has_groups('base.group_user') else ''</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//body/div['id=wrawrap']" position="before">
|
||||
<nav t-if="website and menu_data" id="oe_main_menu_navbar" class="o_main_navbar">
|
||||
<nav groups="base.group_user" t-if="website and menu_data" id="oe_main_menu_navbar" class="o_main_navbar">
|
||||
<ul id="oe_applications">
|
||||
<li class="dropdown active">
|
||||
<a class="dropdown full" data-toggle="dropdown" href="#">
|
||||
@@ -92,7 +92,7 @@
|
||||
|
||||
<!-- Add new page/content modal -->
|
||||
<xpath expr="//body/div['id=wrawrap']" position="after">
|
||||
<div class="modal" id="o_website_add_page_modal">
|
||||
<div groups="base.group_user" class="modal" id="o_website_add_page_modal">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<ul>
|
||||
<li groups="base.group_website_designer"><a href="#" data-action="new_page"><i class="fa fa-file-o"/><p>New Page</p></a></li>
|
||||
|
||||
@@ -480,9 +480,9 @@
|
||||
</template>
|
||||
|
||||
<!-- User Navbar -->
|
||||
<template id="content_new_blogpost" inherit_id="website.user_navbar" groups="base.group_website_designer">
|
||||
<template id="content_new_blogpost" inherit_id="website.user_navbar">
|
||||
<xpath expr="//div[@id='o_website_add_page_modal']//ul" position="inside">
|
||||
<li><a href="#" data-action="new_blog_post"><i class="fa fa-rss"/><p>New Blog Post</p></a></li>
|
||||
<li groups="base.group_website_designer"><a href="#" data-action="new_blog_post"><i class="fa fa-rss"/><p>New Blog Post</p></a></li>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -629,9 +629,9 @@
|
||||
|
||||
|
||||
<!-- User Navbar -->
|
||||
<template id="content_new_event" inherit_id="website.user_navbar" groups="event.group_event_manager">
|
||||
<template id="content_new_event" inherit_id="website.user_navbar">
|
||||
<xpath expr="//div[@id='o_website_add_page_modal']//ul" position="inside">
|
||||
<li><a href="#" data-action="new_event"><i class="fa fa-glass"/><p>New Event</p></a></li>
|
||||
<li groups="event.group_event_manager"><a href="#" data-action="new_event"><i class="fa fa-glass"/><p>New Event</p></a></li>
|
||||
</xpath>
|
||||
</template>
|
||||
</odoo>
|
||||
|
||||
@@ -1505,9 +1505,9 @@
|
||||
</template>
|
||||
|
||||
<!-- User Navbar -->
|
||||
<template id="content_new_forum" inherit_id="website.user_navbar" groups="base.group_user">
|
||||
<template id="content_new_forum" inherit_id="website.user_navbar">
|
||||
<xpath expr="//div[@id='o_website_add_page_modal']//ul" position="inside">
|
||||
<li><a href="#" data-action="new_forum"><i class="fa fa-comment"/><p>New Forum</p></a></li>
|
||||
<li groups="base.group_user"><a href="#" data-action="new_forum"><i class="fa fa-comment"/><p>New Forum</p></a></li>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -293,9 +293,9 @@
|
||||
</template>
|
||||
|
||||
<!-- User Navbar -->
|
||||
<template id="content_new_job_offer" inherit_id="website.user_navbar" groups="base.group_hr_manager">
|
||||
<template id="content_new_job_offer" inherit_id="website.user_navbar">
|
||||
<xpath expr="//div[@id='o_website_add_page_modal']//ul" position="inside">
|
||||
<li><a href="/jobs/add" class="js_link2post"><i class="fa fa-briefcase"/><p>New Job Offer</p></a></li>
|
||||
<li groups="base.group_hr_manager"><a href="/jobs/add" class="js_link2post"><i class="fa fa-briefcase"/><p>New Job Offer</p></a></li>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -1488,9 +1488,9 @@
|
||||
|
||||
|
||||
<!-- User Navbar -->
|
||||
<template id="content_new_product" inherit_id="website.user_navbar" groups="sales_team.group_sale_manager">
|
||||
<template id="content_new_product" inherit_id="website.user_navbar">
|
||||
<xpath expr="//div[@id='o_website_add_page_modal']//ul" position="inside">
|
||||
<li><a id="create-new-product" href="#" data-action="new_product"><i class="fa fa-shopping-cart"/><p>New Product</p></a></li>
|
||||
<li groups="sales_team.group_sale_manager"><a id="create-new-product" href="#" data-action="new_product"><i class="fa fa-shopping-cart"/><p>New Product</p></a></li>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -31,9 +31,4 @@
|
||||
</t>
|
||||
</xpath>
|
||||
</template>
|
||||
<template id="report_picking_portal" inherit_id="stock.report_picking" groups="base.group_portal">
|
||||
<xpath expr="//tr[@t-foreach='o.pack_operation_ids']" position="attributes">
|
||||
<attribute name="t-foreach">o.pack_operation_ids.sudo()</attribute>
|
||||
</xpath>
|
||||
</template>
|
||||
</odoo>
|
||||
@@ -299,6 +299,13 @@ actual arch.
|
||||
raise ValidationError(_('Invalid view definition'))
|
||||
return True
|
||||
|
||||
@api.constrains('type', 'groups_id')
|
||||
def _check_groups(self):
|
||||
for view in self:
|
||||
if view.type == 'qweb' and view.groups_id:
|
||||
print view.key, view.groups_id
|
||||
raise ValidationError(_("Qweb view can not have 'Groups' define on the record. Use 'groups' atttributes inside the view definition"))
|
||||
|
||||
_sql_constraints = [
|
||||
('inheritance_mode',
|
||||
"CHECK (mode != 'extension' OR inherit_id IS NOT NULL)",
|
||||
|
||||
Reference in New Issue
Block a user