[FIX] website_*: prevent record to be unpublished on website change

Before this commit, when changing the website field in a record form view,
the is_published field would be force to false, ending unpublishing the record
if it was published.

That behavior was coming from the fact that is_published field is missing from
the form view. Thus, onchange on website is triggering a recompute server side
without is_published as the JS framework is not sending the field.
The ORM is then fallbacking on default Boolean value (False) for is_published
when sending back the onchange result.

This would only appear on object with 'website.published.multi.mixin' and with
website_id in the form view.

task-1919689

closes odoo/odoo#29707
This commit is contained in:
Romain Derie
2018-12-21 13:47:58 +00:00
parent 8d6bb22298
commit d73c4e583a
5 changed files with 5 additions and 0 deletions
@@ -40,6 +40,7 @@
class="oe_stat_button"
icon="fa-globe">
<field name="website_published" widget="website_button"/>
<field name="is_published" invisible="1"/>
</button>
</button>
<label for="is_online" position="after">
@@ -10,6 +10,7 @@
<button class="oe_stat_button" name="website_publish_button"
type="object" icon="fa-globe" groups="hr.group_hr_user">
<field name="website_published" widget="website_button"/>
<field name="is_published" invisible="1"/>
</button>
</button>
<xpath expr="//page[@name='public']/group" position="inside">
@@ -20,6 +20,7 @@
<button class="oe_stat_button" name="website_publish_button"
type="object" icon="fa-globe">
<field name="website_published" widget="website_button"/>
<field name="is_published" invisible="1"/>
</button>
</div>
</field>
@@ -88,6 +88,7 @@
<button class="oe_stat_button" name="website_publish_button"
type="object" icon="fa-globe" attrs="{'invisible': [('sale_ok','=',False)]}">
<field name="website_published" widget="website_button"/>
<field name="is_published" invisible="1"/>
</button>
</xpath>
<xpath expr="//page[@name='sales']" position="after">
@@ -212,6 +212,7 @@
<button class="oe_stat_button" name="website_publish_button"
type="object" icon="fa-globe">
<field name="website_published" widget="website_button"/>
<field name="is_published" invisible="1"/>
</button>
<button name="toggle_active" type="object" confirm="(Un)archiving a channel automatically (un)archives its slides. Do you want to proceed?" class="oe_stat_button" icon="fa-archive">
<field name="active" widget="boolean_button" options='{"terminology": "archive"}'/>