Skip to content

[FIX] point inherit to copied views - #430

Merged
yajo merged 2 commits into
OCA:10.0from
yelizariev:10.0-website_multi_theme-theme_clean
Mar 14, 2018
Merged

yajo merged 2 commits into
OCA:10.0from
yelizariev:10.0-website_multi_theme-theme_clean

Conversation

@yelizariev

Copy link
Copy Markdown
Member

Otherwise, theme_customize doesn't work when we have a chain of views like in
theme_clean:

theme_clean.option_bg_shade_light2 inherits theme_clean.less
theme_clean.less inherits website.assets_frontend

without this update, website_multi_theme copies
theme_clean.option_bg_shade_light2 but keeps inherit_id the same (i.e. to
theme_clean.less, which is not used, because it has a copy)

@yelizariev

Copy link
Copy Markdown
Member Author

@yajo 😃

@ilmir-k ilmir-k left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@yajo yajo added this to the 10.0 milestone Mar 7, 2018

@yajo yajo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@yajo

yajo commented Mar 7, 2018

Copy link
Copy Markdown
Member

Travis has ❌

@yelizariev
yelizariev force-pushed the 10.0-website_multi_theme-theme_clean branch from a138aa7 to 08c5743 Compare March 7, 2018 16:19
@yelizariev

yelizariev commented Mar 7, 2018

Copy link
Copy Markdown
Member Author

it's fixed and squashed
yelizariev@2f87813

Also, I've added separate commit to fix jslints

@yelizariev

Copy link
Copy Markdown
Member Author

@pedrobaeza, could you take a look?

Comment thread website_multi_theme/models/website.py Outdated
copied_view.inherit_id = custom_layout
data.attrib["inherit_id"] = custom_layout.key
copied_view.arch = etree.tostring(data)
elif (copied_view.inherit_id and

@pedrobaeza pedrobaeza Mar 7, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very hard to read. Can you somehow split this to be more readable (an else, then prepare variables and make the comparison)?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be better yelizariev@52eff0a

@yelizariev
yelizariev force-pushed the 10.0-website_multi_theme-theme_clean branch from efa0bf9 to 4c9b1da Compare March 8, 2018 16:13
Comment thread website_multi_theme/models/website.py Outdated
layout_pattern = self.env.ref("website_multi_theme.layout_pattern")

def view2module(view):
return view and view.model_data_id.module

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if you know that Odoo lets you browse empty recordsets, returning a falsey value for all fields.

Thus, you can use a variable instead of a method if you want, just below line 141 you can write:

copied_view_module = copied_view.model_data_id.module

It will be False if len(copied_view)==0.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I know. For some reason, I thought that it could be False in the middle of the chain, so I decided just to make the extra check. But it's not needed here. You are right

@pedrobaeza

Copy link
Copy Markdown
Member

Please rebase after merging the other patch

@yelizariev
yelizariev force-pushed the 10.0-website_multi_theme-theme_clean branch 4 times, most recently from 32154aa to aeede0a Compare March 12, 2018 17:46
Ivan Yelizariev added 2 commits March 12, 2018 22:47
Otherwise theme_customize doesn't work when we have chain of views like in
theme_clean:

theme_clean.option_bg_shade_light2 inherits theme_clean.less
theme_clean.less inherits website.assets_frontend

without this update, website_multi_theme copies
theme_clean.option_bg_shade_light2 but keeps inherit_id the same (i.e. to
theme_clean.less, which is not used, because it has a copy)
@yelizariev
yelizariev force-pushed the 10.0-website_multi_theme-theme_clean branch from aeede0a to 94248f6 Compare March 12, 2018 17:48
@yelizariev

Copy link
Copy Markdown
Member Author

Rebased.
Also, I made refactoring and changed only last number in the version (to 10.0.1.0.2) as this update doesn't require module updating

@ilmir-k

ilmir-k commented Mar 13, 2018

Copy link
Copy Markdown

@pedrobaeza @yajo could you review the updates please. Thanks

@yajo yajo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good. It would be nice to have some testing on it.

@pedrobaeza

Copy link
Copy Markdown
Member

Can you add those tests?

@yelizariev

yelizariev commented Mar 13, 2018

Copy link
Copy Markdown
Member Author

Not soon...
Also, the code uses website.multi_theme_id.converted_theme_addon which is empty for demo data. So I'm not sure how to make CI tests for it

@yajo

yajo commented Mar 14, 2018

Copy link
Copy Markdown
Member

I prefer to have the fix than not having tests for it. It can be a good future improvement, but I'm not blocking just for that. Thanks @yelizariev!

@yajo
yajo merged commit b6f9e05 into OCA:10.0 Mar 14, 2018
yelizariev pushed a commit to yelizariev/website that referenced this pull request Apr 23, 2018
* [FIX] point inherit to copied views

Otherwise theme_customize doesn't work when we have chain of views like in
theme_clean:

theme_clean.option_bg_shade_light2 inherits theme_clean.less
theme_clean.less inherits website.assets_frontend

without this update, website_multi_theme copies
theme_clean.option_bg_shade_light2 but keeps inherit_id the same (i.e. to
theme_clean.less, which is not used, because it has a copy)

* [LINT] remove unused arguments, add semicolon
yajo pushed a commit that referenced this pull request May 23, 2018
* [FIX] point inherit to copied views

Otherwise theme_customize doesn't work when we have chain of views like in
theme_clean:

theme_clean.option_bg_shade_light2 inherits theme_clean.less
theme_clean.less inherits website.assets_frontend

without this update, website_multi_theme copies
theme_clean.option_bg_shade_light2 but keeps inherit_id the same (i.e. to
theme_clean.less, which is not used, because it has a copy)

* [LINT] remove unused arguments, add semicolon
HviorForgeFlow pushed a commit to ForgeFlow/website that referenced this pull request Oct 16, 2018
* [FIX] point inherit to copied views

Otherwise theme_customize doesn't work when we have chain of views like in
theme_clean:

theme_clean.option_bg_shade_light2 inherits theme_clean.less
theme_clean.less inherits website.assets_frontend

without this update, website_multi_theme copies
theme_clean.option_bg_shade_light2 but keeps inherit_id the same (i.e. to
theme_clean.less, which is not used, because it has a copy)

* [LINT] remove unused arguments, add semicolon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants