[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:
Jérémy Kersten (jke) <jke@openerp.com>
Showing
- addons/test_website/data/test_website_data.xml 1 addition, 1 deletionaddons/test_website/data/test_website_data.xml
- addons/website/data/website_data.xml 3 additions, 3 deletionsaddons/website/data/website_data.xml
- addons/website/data/website_demo.xml 2 additions, 2 deletionsaddons/website/data/website_demo.xml
- addons/website/models/mixins.py 9 additions, 5 deletionsaddons/website/models/mixins.py
- addons/website/tests/test_page.py 2 additions, 2 deletionsaddons/website/tests/test_page.py
- addons/website/views/website_views.xml 2 additions, 3 deletionsaddons/website/views/website_views.xml
- addons/website_blog/controllers/main.py 1 addition, 1 deletionaddons/website_blog/controllers/main.py
- addons/website_blog/data/website_blog_demo.xml 2 additions, 2 deletionsaddons/website_blog/data/website_blog_demo.xml
- addons/website_blog/models/website_blog.py 4 additions, 3 deletionsaddons/website_blog/models/website_blog.py
- addons/website_crm_partner_assign/data/res_partner_grade_demo.xml 4 additions, 4 deletions...ebsite_crm_partner_assign/data/res_partner_grade_demo.xml
- addons/website_crm_partner_assign/models/res_partner.py 3 additions, 1 deletionaddons/website_crm_partner_assign/models/res_partner.py
- addons/website_customer/data/res_partner_demo.xml 4 additions, 4 deletionsaddons/website_customer/data/res_partner_demo.xml
- addons/website_customer/models/res_partner.py 3 additions, 1 deletionaddons/website_customer/models/res_partner.py
- addons/website_customer/views/res_partner_views.xml 2 additions, 2 deletionsaddons/website_customer/views/res_partner_views.xml
- addons/website_event/data/event_demo.xml 7 additions, 7 deletionsaddons/website_event/data/event_demo.xml
- addons/website_event_track/data/event_demo.xml 30 additions, 30 deletionsaddons/website_event_track/data/event_demo.xml
- addons/website_form/views/website_form_templates.xml 1 addition, 1 deletionaddons/website_form/views/website_form_templates.xml
- addons/website_hr_recruitment/data/hr_job_demo.xml 3 additions, 3 deletionsaddons/website_hr_recruitment/data/hr_job_demo.xml
- addons/website_hr_recruitment/views/website_hr_recruitment_templates.xml 1 addition, 1 deletion...hr_recruitment/views/website_hr_recruitment_templates.xml
- addons/website_membership/data/membership_demo.xml 2 additions, 2 deletionsaddons/website_membership/data/membership_demo.xml
Loading
Please register or sign in to comment