Skip to content
Snippets Groups Projects
Unverified Commit 9885ccfd authored by Robot Odoo's avatar Robot Odoo Committed by GitHub
Browse files

[IMP] *: correctly read/write website_published


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`.

Whenever possible, any access (read/search) on published state should be done on `website_published`.
Any write should be done on `is_published`.

This PR 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`
- Some models would create their own `website_published` field rather than using the
`website.published.mixin` mixin which should be used instead.
That was done to be able to override the default value of the boolean.
This commit simply adds the possibility to override the default value of the
mixin field.
- Fix wrong publish security check that were only checking `website_published` in vals.

closes odoo/odoo#35189

Signed-off-by: default avatarJérémy Kersten (jke) <jke@openerp.com>
parents f9c2716b 4086f344
No related branches found
No related tags found
Loading
Showing
with 86 additions and 78 deletions
Loading
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