The `website_published` field from the website's mixins is basically a readonly
from `is_published` field.
On read, this field will simply read `is_published` and check if the record's
website_id is accessible (only for the multi mixin).
On write, it will always write on `is_published`.
This commit improves a few things:
- A lot of code was writting on website_published which was just then writting
on is_published. Writting directly on is_published makes more sense.
- Some backend fields would still reference `website_published` instead of
`is_published` which would just go through the related for no reason.
Plus, using `is_published` will make the field tooltip more accurate as we
are not in a website context ('Visible on current website' to 'Is Published')
- Filter and search on tree view were still using the `website_published`
related field, which is just a readonly when we are not in a frontend
context.
- Some create and write function would have security check on
`website_published` value but that was wrong as the user could bypass that by
simply writting on `is_published`. For the write method, check `is_published`
is more accurate as it will cover both case since `website_published` will
then call the write method on `is_published`
101 lines
5.5 KiB
XML
101 lines
5.5 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
<data noupdate="1">
|
|
|
|
<!-- RECORDS FOR RESET VIEWS TESTS -->
|
|
<record id="test_view" model="ir.ui.view">
|
|
<field name="name">Test View</field>
|
|
<field name="type">qweb</field>
|
|
<field name="key">test_website.test_view</field>
|
|
<field name="arch" type="xml">
|
|
<t name="Test View" priority="29" t-name="test_website.test_view">
|
|
<t t-call="website.layout">
|
|
<p>Test View</p>
|
|
<p>placeholder</p>
|
|
</t>
|
|
</t>
|
|
</field>
|
|
</record>
|
|
<record id="test_page_view" model="ir.ui.view">
|
|
<field name="name">Test Page View</field>
|
|
<field name="type">qweb</field>
|
|
<field name="key">test_website.test_page_view</field>
|
|
<field name="arch" type="xml">
|
|
<t name="Test Page View" priority="29" t-name="test_website.test_page_view">
|
|
<t t-call="website.layout">
|
|
<div id="oe_structure_test_website_page" class="oe_structure oe_empty"/>
|
|
<p>Test Page View</p>
|
|
<p>placeholder</p>
|
|
</t>
|
|
</t>
|
|
</field>
|
|
</record>
|
|
<record id="test_error_view" model="ir.ui.view">
|
|
<field name="name">Test Error View</field>
|
|
<field name="type">qweb</field>
|
|
<field name="key">test_website.test_error_view</field>
|
|
<field name="arch" type="xml">
|
|
<t name="Test Error View" t-name="test_website.test_error_view">
|
|
<t t-call="website.layout">
|
|
<div class="container">
|
|
<h1>Test Error View</h1>
|
|
<div class="row">
|
|
<ul class="list-group http_error col-6">
|
|
<li class="list-group-item list-group-item-primary"><h2>http Errors</h2></li>
|
|
<li class="list-group-item"><a href="/test_user_error_http">http UserError (400)</a></li>
|
|
<li class="list-group-item"><a href="/test_validation_error_http">http ValidationError (400)</a></li>
|
|
<li class="list-group-item"><a href="/test_missing_error_http">http MissingError (400)</a></li>
|
|
<li class="list-group-item"><a href="/test_karma_error_http">http KarmaError (400)</a></li>
|
|
<li class="list-group-item"><a href="/test_access_error_http">http AccessError (403)</a></li>
|
|
<li class="list-group-item"><a href="/test_access_denied_http">http AccessDenied (403)</a></li>
|
|
<li class="list-group-item"><a href="/test_internal_error_http">http InternalServerError (500)</a></li>
|
|
<li class="list-group-item"><a href="/test_not_found_http">http NotFound (404)</a></li>
|
|
</ul>
|
|
<ul class="list-group rpc_error col-6">
|
|
<li class="list-group-item list-group-item-primary"><h2>rpc Warnings</h2></li>
|
|
<li class="list-group-item"><a href="/test_user_error_json">rpc UserError</a></li>
|
|
<li class="list-group-item"><a href="/test_validation_error_json">rpc ValidationError</a></li>
|
|
<li class="list-group-item"><a href="/test_missing_error_json">rpc MissingError</a></li>
|
|
<li class="list-group-item"><a href="/test_karma_error_json">rpc KarmaError</a></li>
|
|
<li class="list-group-item"><a href="/test_access_error_json">rpc AccessError</a></li>
|
|
<li class="list-group-item"><a href="/test_access_denied_json">rpc AccessDenied</a></li>
|
|
<li class="list-group-item list-group-item-primary"><h2>rpc Errors</h2></li>
|
|
<li class="list-group-item"><a href="/test_internal_error_json">rpc InternalServerError</a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</t>
|
|
</t>
|
|
</field>
|
|
</record>
|
|
<record id="test_page" model="website.page">
|
|
<field name="is_published">True</field>
|
|
<field name="url">/test_page_view</field>
|
|
<field name="view_id" ref="test_page_view"/>
|
|
</record>
|
|
<record id="test_view_to_be_t_called" model="ir.ui.view">
|
|
<field name="name">Test View To Be t-called</field>
|
|
<field name="type">qweb</field>
|
|
<field name="key">test_website.test_view_to_be_t_called</field>
|
|
<field name="arch" type="xml">
|
|
<t name="Test View To Be t-called" priority="29" t-name="test_website.test_view_to_be_t_called">
|
|
<p>Test View To Be t-called</p>
|
|
<p>placeholder</p>
|
|
</t>
|
|
</field>
|
|
</record>
|
|
<template id="test_view_child_broken" inherit_id="test_website.test_view" active="False">
|
|
<xpath expr="//p[last()]" position="replace">
|
|
<p>Test View Child Broken</p>
|
|
<p>placeholder</p>
|
|
</xpath>
|
|
</template>
|
|
|
|
<!-- RECORDS FOR MODULE OPERATION TESTS -->
|
|
<template id="update_module_base_view">
|
|
<div>I am a base view</div>
|
|
</template>
|
|
|
|
</data>
|
|
</odoo>
|