Skip to content

Commit

Permalink
[13.0][OU] website_slides: categories migration
Browse files Browse the repository at this point in the history
The fields `is_preview` and `is_published` are values expected be `True`
as default when the category is created. It can be seen how in the
`create()` and in the `write()` this is explicitly evaluated as long as
in the controller, which is the main way to create categories now. Also,
we must ensure that those categories are active. Al should be as the
old specific model didn't have the field itself.

TT32244
  • Loading branch information
chienandalu committed Oct 4, 2021
1 parent 4c4cd1a commit 1273be6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions addons/website_slides/migrations/13.0.2.0/post-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,14 @@ def convert_slide_categories(env):
openupgrade.logged_query(
env.cr, sql.SQL("""
INSERT INTO slide_slide (
create_date, create_uid, write_date, write_uid, is_category,
name, channel_id, old_category_id, sequence, slide_type
active, create_date, create_uid, write_date, write_uid, is_category,
name, channel_id, old_category_id, sequence, slide_type, is_published,
is_preview
)
SELECT
sc.create_date, sc.create_uid, sc.write_date, sc.write_uid, True,
sc.name, sc.channel_id, sc.id, min(ss.sequence) - 1 as sequence, 'document'
True, sc.create_date, sc.create_uid, sc.write_date, sc.write_uid, True,
sc.name, sc.channel_id, sc.id, min(ss.sequence) - 1 as sequence, 'document',
True, True
FROM slide_slide ss
JOIN slide_category sc ON sc.id = ss.{category_id}
WHERE ss.channel_id IN (
Expand Down

0 comments on commit 1273be6

Please sign in to comment.