Skip to content

[10.0] Migrate website legal page to version 10.0 - #310

Closed
hurrinico wants to merge 6 commits into
OCA:10.0from
hurrinico:10.0-mig-website_legal_page
Closed

hurrinico wants to merge 6 commits into
OCA:10.0from
hurrinico:10.0-mig-website_legal_page

Conversation

@hurrinico

Copy link
Copy Markdown

No description provided.

@pedrobaeza pedrobaeza mentioned this pull request Jan 3, 2017
35 tasks
@hurrinico
hurrinico force-pushed the 10.0-mig-website_legal_page branch from 761bc8a to f4be405 Compare January 9, 2017 10:13
@hurrinico
hurrinico force-pushed the 10.0-mig-website_legal_page branch from f4be405 to a46c1a0 Compare January 9, 2017 11:54

@eLBati eLBati 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.

thanks

@eugen-don

Copy link
Copy Markdown
Member

@hurrinico
thank you my friend, i was looking for this module... works like expected...

@lasley lasley added this to the 10.0 milestone Mar 17, 2017

@lasley lasley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oops actually looks like there's a few warnings

https://travis-ci.org/OCA/website/jobs/190224344#L456

@lasley

lasley commented Mar 17, 2017

Copy link
Copy Markdown
Contributor

Hint the warnings are due to us using website. in a few views, which is a namespace we don't own. I'm almost positive it should be as simple as removing that prefix from the ids & updating the link

@pedrobaeza

Copy link
Copy Markdown
Member

@hurrinico please fix what @lasley says and I'll merge.

@eLBati

eLBati commented May 5, 2017

Copy link
Copy Markdown
Member

@lasley @pedrobaeza @hurrinico changing

<template id="website.legal" name="Legal advice" page="True">

to

<template id="website_legal_page.legal" name="Legal advice" page="True">

would prevent page /page/legal to be served (404 error)

What do you suggest?

cc @antespi

@lasley

lasley commented May 5, 2017

Copy link
Copy Markdown
Contributor

Hmmmm I see the problem. Odoo SA's /page interface is enforcing the bad practice of editing namespaces you don't own.

A controller with an explicit route is my preferred. Interface or not, it is pretty commonly accepted practice to isolate everything by namespacing & breaking the good practice is not worth the 6-7 lines of code we'll save.

That's my opinion. Anyone else have thoughts?

@antespi

antespi commented May 5, 2017

Copy link
Copy Markdown
Contributor

I agree with @lasley

@JonathanNEMRY

Copy link
Copy Markdown

add setup here hurrinico#1

@hurrinico

Copy link
Copy Markdown
Author

@lasley @antespi i'm quite busy at the moment, and that type of mod require to change all the module, but prs are welcom

@eLBati

eLBati commented May 26, 2017

Copy link
Copy Markdown
Member

@lasley I don't know how to implement what you suggest. Hints?

@lasley

lasley commented May 26, 2017

Copy link
Copy Markdown
Contributor

@eLBati - I'll actually submit a PR in the next few days. I was just looking, and it seems I had a branch doing exactly this in v9 + updating the privacy policy in accordance with some advice I have received from legal counsel.

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

I feel adding custom controllers is an overkill.

This addon just adds 3 pages, and it uses the tool Odoo uses for pages. It lets submodules to know the URL for that page and make sure it exists; these pages are expected to be changed by the user. Seems legit IMHO; custom controllers and so on would be more code to maintain for basically no benefit.

@yajo

yajo commented May 29, 2017

Copy link
Copy Markdown
Member

@lasley This is working perfectly and is holding other PRs; mind if we merge as it is? You can update the texts later, and we can defer the controller conversation to future v11...

@lasley

lasley commented May 30, 2017

Copy link
Copy Markdown
Contributor

@yajo - merging as is will break the 10.0 Runbot build going forward. Is that something we're OK with?

@yajo

yajo commented May 31, 2017

Copy link
Copy Markdown
Member

Hmm no, definitely. It seems it breaks due to 3 warnings:

2017-05-29 09:33:12,132 149 INFO openerp_test odoo.modules.loading: loading website_legal_page/views/website_legal.xml
2017-05-29 09:33:12,199 149 WARNING openerp_test odoo.addons.base.ir.ir_model: Creating the ir.model.data legal in module website instead of website_legal_page.
2017-05-29 09:33:12,199 149 INFO openerp_test odoo.modules.loading: loading website_legal_page/views/website_privacy.xml
2017-05-29 09:33:12,268 149 WARNING openerp_test odoo.addons.base.ir.ir_model: Creating the ir.model.data privacy in module website instead of website_legal_page.
2017-05-29 09:33:12,268 149 INFO openerp_test odoo.modules.loading: loading website_legal_page/views/website_terms.xml
2017-05-29 09:33:12,341 149 WARNING openerp_test odoo.addons.base.ir.ir_model: Creating the ir.model.data terms in module website instead of website_legal_page.

Hard to fix if we don't do custom controllers... OK, well if you can have it for today it would be great, we are at #ocacodesprint merging like crazy goats! 🐐

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

As said, we need to fix bots, which will probably include adding the controller.

@pedrobaeza

Copy link
Copy Markdown
Member

What is the state of this?

@yajo

yajo commented Jun 9, 2017

Copy link
Copy Markdown
Member

You see, current design raises warnings, which kills runbot. @lasley suggested to add custom controllers and that's what we're waiting for.

@pedrobaeza

Copy link
Copy Markdown
Member

OK, thanks for the heads-up. Let's see if @hurrinico can work on this.

@hurrinico

Copy link
Copy Markdown
Author

Hi @pedrobaeza as i said few days ago, this mod is quite hard and at the moment i'm quite busy, so can be difficult to me redefine all the module

@lasley

lasley commented Jun 9, 2017

Copy link
Copy Markdown
Contributor

I've actually already done this, just need to add tests. Will submit a PR today

@pedrobaeza

Copy link
Copy Markdown
Member

@lasley did you checked your code for making the PR?

@lasley

lasley commented Jun 12, 2017

Copy link
Copy Markdown
Contributor

hurrinico#3 - TBD whether tests pass

lasley and others added 2 commits June 12, 2017 16:19
* Move legal pages to explicit /legal routes
[10.0] [IMP] website_legal: Move to explicit route
@pedrobaeza

Copy link
Copy Markdown
Member

Everything is now green, so please update your reviews, @lasley and @yajo

type='http',
website=True,
)
def show(self, page='legal'):

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.

SEO-wise, if you have a /legal and a /legal/legal page that are the same, you get penalized.

I think you should better not add a default page and require it (404 error otherwise), or make it redirect to /legal/legal if not page.

Remember to add **kwargs so that we can add ?debug=assets and so on.

Also, this controller's name should be legal instead of show IMHO.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/legal is the default route here. I guess technically /legal/legal would work too, but I'm pretty sure I rigged everything up as /legal

@lasley lasley Jun 13, 2017

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oh I see, you're recommending explicitly denying (still early here, need coffee).

What about /legal/overview or something? I don't like the one duplicated

response = self.url_open('/legal')
self.assertEqual(
response.getcode(),
200,

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 will change with my above comment.

name="Legal advice Link">
<xpath expr="//footer//div/span[@t-field='res_company.name']" position="after">
<span>- <a href="/page/legal">Legal advice</a></span>
<span>- <a href="/legal">Legal Advice</a></span>

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.

/legal/advice maybe? Better than /legal/legal, right?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍 will solve above

name="Privacy policy Link">
<xpath expr="//footer//div/span[@t-field='res_company.name']" position="after">
<span>- <a href="/page/privacy">Privacy policy</a></span>
<span>- <a href="/legal/privacy">Privacy Policy</a></span>

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.

It turns out that it is better for SEO having a explicit name than a short one (unless the explicit one is too long). What if we take the chance to rename this one to /legal/privacy-policy?

name="Terms of use Link">
<xpath expr="//footer//div/span[@t-field='res_company.name']" position="after">
<span>- <a href="/page/terms">Terms of use</a></span>
<span>- <a href="/legal/terms">Terms of use</a></span>

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 one could be /legal/usage-terms too.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I went with terms-of-use so that it more closely matches the link text

@rafaelbn

Copy link
Copy Markdown
Member

@yajo as @hurrinico said #310 (comment) he cannot finish this PR so please make a PR to his branch to go ahead

@lasley

lasley commented Jun 13, 2017

Copy link
Copy Markdown
Contributor

Superseding with #353 in order to save a bunch of side merges/PRs

@lasley lasley closed this Jun 13, 2017
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.