Skip to content

[10.0][MIG] website snippet country dropdown - #349

Merged
pedrobaeza merged 4 commits into
OCA:10.0from
HaTry:10.0-mig-website_snippet_country_dropdown
Jun 9, 2017
Merged

pedrobaeza merged 4 commits into
OCA:10.0from
HaTry:10.0-mig-website_snippet_country_dropdown

Conversation

@HaTry

@HaTry HaTry commented May 30, 2017

Copy link
Copy Markdown

Migration of website snippet country dropdown to v10.0.

  • The option of insert this snippet as been removed.
    Because of Odoo seems to even forbid dragging the snippet into a <form> element that is inside an
    editable area.
  • Add test.

@oca-clabot

Copy link
Copy Markdown

Hey @HaTry, thank you for your Pull Request.

It looks like some users haven't signed our Contributor License Agreement, yet.
You can read and sign our full Contributor License Agreement here: http://odoo-community.org/page/website.cla
Here is a list of the users:

  • felix (no github login found)

Appreciation of efforts,
OCA CLAbot

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

Generally OK, but still needed to fix some comments.

Besides those, please squash the translation commits.

@@ -0,0 +1,2 @@

import test No newline at end of file

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.

You don't have to import tests, this folder is autoimported when needed.

var country_code_test = 'ES';
var vat_number_test = 'B01010101';

tour.register("demo_page", {

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.

Don't register the tour with this name. Tours share a global namespace, and demo_page seems like you are testing another thing. Better call it website_snippet_country_dropdown_tour_demo_page for example.

run: function(){
var complete_field = $("#complete_field").val();
if(complete_field !== country_code_test + vat_number_test)
console.log("error");

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.

Since this is not very common, future reviewers will appreciate little comments about why you are doing this check in a function and why this console.log.

console.log("error");
}
}]);
}) No newline at end of file

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.

Configure your editor to always add a newline at the end of file, and do it.

@@ -0,0 +1,2 @@

import test_snippet_country_dropdown No newline at end of file

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.

You need to put from . import before.

You also need the license boilerplate as you can see in the module template.

@@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.

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 license header is not accepted. Use the official one as I linked above.

self.phantom_js(
"/",
"odoo.__DEBUG__.services['web_tour.tour'].run('demo_page')",
"odoo.__DEBUG__.services['web_tour.tour'].tours.demo_page.ready"

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.

You will have to change the tour name as above.

<script type="text/javascript"
src="/website_snippet_country_dropdown/static/src/js/website_snippet_country_dropdown.js"/>
<script type="text/javascript"
src="/website_snippet_country_dropdown/static/src/js/web_tour_country_dropdown.js"/>

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.

Test tour assets should be added in a demo view to avoid overloading the main frontend.

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

Better, although still some things to fix.

# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

import test No newline at end of file
from . import tests

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.

Oh sorry I think I mistaked before in the comment. You don't have to import tests in the addon's __init__.py; never.
This module gets autoimported when running the unit tests.

content: "Validate Text",
trigger: '#no_country_field',
run: function(){
// This funtion alow to evaluate a hide html element

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.

"function"
"allow"
"hidden"

trigger: '#no_country_field',
run: function(){
// This funtion alow to evaluate a hide html element
// Imposible to do it though trigger

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.

"Impossible"
"through"

# © 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from . import test_snippet_country_dropdown No newline at end of file

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.

Remember to add a newline character at the end of all files. Usually you can configure your text editor to do it automatically.

self.phantom_js(
"/",
"odoo.__DEBUG__.services['web_tour.tour'].run('website_snippet_country_dropdown_tour_demo_page')",
"odoo.__DEBUG__.services['web_tour.tour'].tours.website_snippet_country_dropdown_tour_demo_page.ready"

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.

Limit to 79 chars/line. You'll probably have to join 2 strings to get to that.

@pedrobaeza pedrobaeza mentioned this pull request May 30, 2017
35 tasks

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

Tested in a local machine. O.K.

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

Tested again in a local machine. O.K.
Last minor changes be good.

@HaTry
HaTry force-pushed the 10.0-mig-website_snippet_country_dropdown branch from 0e9abc9 to c836a5a Compare May 30, 2017 16:19
@pedrobaeza

Copy link
Copy Markdown
Member

Is the CLA signed?

@yajo

yajo commented May 31, 2017

Copy link
Copy Markdown
Member

So I believe; @jbeficent?

@yajo yajo self-assigned this May 31, 2017
@yajo yajo added this to the 10.0 milestone May 31, 2017
@yajo

yajo commented May 31, 2017

Copy link
Copy Markdown
Member

I pushed a commit here to see if it fixes travis.

@pedrobaeza
pedrobaeza merged commit dabf2e2 into OCA:10.0 Jun 9, 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.

7 participants