Browse Source
[MIG][website_mass_mailing_name] Migration to v10
[MIG][website_mass_mailing_name] Migration to v10
- Relicense to LGPL. - Fix all known issues. - Enable tour only in demo instances. - Fix Sass headers. - Remove compiled css and maps. - Update JS modules to new api. - Update tour to new tours api. - Update module structure to match latest template.pull/342/merge
Jairo Llopis
7 years ago
committed by
Jairo Llopis
23 changed files with 303 additions and 290 deletions
-
17website_mass_mailing_name/README.rst
-
3website_mass_mailing_name/__init__.py
-
17website_mass_mailing_name/__manifest__.py
-
3website_mass_mailing_name/controllers/__init__.py
-
28website_mass_mailing_name/controllers/main.py
-
17website_mass_mailing_name/demo/assets.xml
-
12website_mass_mailing_name/i18n/de.po
-
23website_mass_mailing_name/i18n/es.po
-
12website_mass_mailing_name/i18n/fr.po
-
24website_mass_mailing_name/i18n/hr.po
-
12website_mass_mailing_name/i18n/sl.po
-
9website_mass_mailing_name/static/src/css/website_mass_mailing_name.css
-
7website_mass_mailing_name/static/src/css/website_mass_mailing_name.css.map
-
5website_mass_mailing_name/static/src/css/website_mass_mailing_name.sass
-
50website_mass_mailing_name/static/src/js/editor_tour.js
-
77website_mass_mailing_name/static/src/js/public_tour.js
-
60website_mass_mailing_name/static/src/js/website_mass_mailing_name.js
-
138website_mass_mailing_name/static/src/js/website_mass_mailing_name.tour.js
-
17website_mass_mailing_name/templates/assets.xml
-
14website_mass_mailing_name/templates/snippets.xml
-
3website_mass_mailing_name/tests/__init__.py
-
22website_mass_mailing_name/tests/test_ui.py
-
23website_mass_mailing_name/views/assets.xml
@ -1,5 +1,4 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# © 2016 Jairo Llopis <jairo.llopis@tecnativa.com> |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). |
|||
|
|||
from . import controllers |
@ -1,21 +1,24 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# © 2016 Jairo Llopis <jairo.llopis@tecnativa.com> |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
# Copyright 2016-2017 Jairo Llopis <jairo.llopis@tecnativa.com> |
|||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). |
|||
{ |
|||
"name": "Mass Mailing Subscription Snippet With Name", |
|||
"summary": "Ask for name when subscribing, and create and/or link partner", |
|||
"version": "8.0.1.0.0", |
|||
"version": "10.0.1.0.0", |
|||
"category": "Website", |
|||
"website": "https://tecnativa.com/", |
|||
"author": "Tecnativa, Odoo Community Association (OCA)", |
|||
"license": "AGPL-3", |
|||
"license": "LGPL-3", |
|||
"application": False, |
|||
"installable": True, |
|||
"depends": [ |
|||
"mass_mailing", |
|||
"website_mass_mailing", |
|||
], |
|||
"demo": [ |
|||
"demo/assets.xml", |
|||
], |
|||
"data": [ |
|||
"views/assets.xml", |
|||
"views/snippets.xml", |
|||
"templates/assets.xml", |
|||
"templates/snippets.xml", |
|||
], |
|||
} |
@ -1,5 +1,4 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# © 2016 Jairo Llopis <jairo.llopis@tecnativa.com> |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). |
|||
|
|||
from . import main |
@ -1,22 +1,28 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# © 2016 Jairo Llopis <jairo.llopis@tecnativa.com> |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
# Copyright 2016-2017 Jairo Llopis <jairo.llopis@tecnativa.com> |
|||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). |
|||
|
|||
from openerp.addons.mass_mailing.controllers.main import MassMailController |
|||
from openerp.http import request, route |
|||
from odoo.addons.website_mass_mailing.controllers import main |
|||
from odoo.http import request, route |
|||
|
|||
|
|||
class MassMailingPartner(MassMailController): |
|||
class MassMailController(main.MassMailController): |
|||
@route() |
|||
def is_subscriber(self, *args, **kwargs): |
|||
"""Get user name too.""" |
|||
result = super(MassMailingPartner, self).is_subscriber(*args, **kwargs) |
|||
email = result.get("email") or "" |
|||
result = super(MassMailController, self).is_subscriber(*args, **kwargs) |
|||
if request.website.user_id != request.env.user: |
|||
name = request.env.user.name |
|||
else: |
|||
name, email = (request.env["mail.mass_mailing.contact"] |
|||
.get_name_email(email, context=request.context)) |
|||
result["name"] = name |
|||
result["email"] = email |
|||
name = request.session.get("mass_mailing_name", "") |
|||
return dict(result, name=name) |
|||
|
|||
@route() |
|||
def subscribe(self, list_id, email, **post): |
|||
"""Store email with name in session.""" |
|||
result = super(MassMailController, self).subscribe( |
|||
list_id, email, **post) |
|||
name, email = request.env['mail.mass_mailing.contact'].sudo() \ |
|||
.get_name_email(email) |
|||
request.session["mass_mailing_name"] = name if name != email else "" |
|||
return result |
@ -0,0 +1,17 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- Copyright 2016-2017 Jairo Llopis <jairo.llopis@tecnativa.com> |
|||
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). --> |
|||
|
|||
<odoo> |
|||
|
|||
<template id="assets_frontend_demo" |
|||
inherit_id="website.assets_frontend"> |
|||
<xpath expr="."> |
|||
<script type="text/javascript" |
|||
src="/website_mass_mailing_name/static/src/js/editor_tour.js"/> |
|||
<script type="text/javascript" |
|||
src="/website_mass_mailing_name/static/src/js/public_tour.js"/> |
|||
</xpath> |
|||
</template> |
|||
|
|||
</odoo> |
@ -1,23 +1,24 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * website_mass_mailing_name |
|||
# |
|||
# * website_mass_mailing_name |
|||
# |
|||
# Translators: |
|||
# OCA Transbot <transbot@odoo-community.org>, 2017 |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 8.0\n" |
|||
"Project-Id-Version: Odoo Server 10.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2016-05-24 15:03+0000\n" |
|||
"PO-Revision-Date: 2016-05-24 17:04+0200\n" |
|||
"Last-Translator: <>\n" |
|||
"Language-Team: \n" |
|||
"POT-Creation-Date: 2017-07-22 00:51+0000\n" |
|||
"PO-Revision-Date: 2017-07-22 00:51+0000\n" |
|||
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n" |
|||
"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: 8bit\n" |
|||
"Plural-Forms: \n" |
|||
"Content-Transfer-Encoding: \n" |
|||
"Language: es\n" |
|||
"X-Generator: Poedit 1.8.7.1\n" |
|||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" |
|||
|
|||
#. module: website_mass_mailing_name |
|||
#: view:website:website.snippets |
|||
#: model:ir.ui.view,arch_db:website_mass_mailing_name.s_newsletter_subscribe_form |
|||
msgid "your name..." |
|||
msgstr "su nombre..." |
@ -0,0 +1,24 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * website_mass_mailing_name |
|||
# |
|||
# Translators: |
|||
# Bole <bole@dajmi5.com>, 2017 |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 10.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2017-12-01 02:19+0000\n" |
|||
"PO-Revision-Date: 2017-12-01 02:19+0000\n" |
|||
"Last-Translator: Bole <bole@dajmi5.com>, 2017\n" |
|||
"Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: \n" |
|||
"Language: hr\n" |
|||
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" |
|||
|
|||
#. module: website_mass_mailing_name |
|||
#: model:ir.ui.view,arch_db:website_mass_mailing_name.s_newsletter_subscribe_form |
|||
msgid "your name..." |
|||
msgstr "vaše ime..." |
@ -1,9 +0,0 @@ |
|||
@charset "UTF-8"; |
|||
/* © 2016 Jairo Llopis <jairo.llopis@tecnativa.com> |
|||
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ |
|||
.js_subscribe .form-control { |
|||
width: 50%; } |
|||
.js_subscribe[data-subscribe="on"] .js_subscribe_name:not([disabled]) { |
|||
display: none; } |
|||
|
|||
/*# sourceMappingURL=website_mass_mailing_name.css.map */ |
@ -1,7 +0,0 @@ |
|||
{ |
|||
"version": 3, |
|||
"mappings": ";;;AAKI,2BAAa;EACT,KAAK,EAAE,GAAG;AAGV,qEAAkC;EAC9B,OAAO,EAAE,IAAI", |
|||
"sources": ["website_mass_mailing_name.sass"], |
|||
"names": [], |
|||
"file": "website_mass_mailing_name.css" |
|||
} |
@ -0,0 +1,50 @@ |
|||
/* Copyright 2016-2017 Jairo Llopis <jairo.llopis@tecnativa.com> |
|||
* License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */
|
|||
odoo.define("website_mass_mailing_name.editor_tour", function (require) { |
|||
"use strict"; |
|||
var base = require("web_editor.base"); |
|||
var tour = require("web_tour.tour"); |
|||
|
|||
tour.register( |
|||
"mass_mailing_name_editor", |
|||
{ |
|||
test: true, |
|||
wait_for: base.ready(), |
|||
}, |
|||
[ |
|||
{ |
|||
content: "Edit the homepage", |
|||
trigger: ".o_menu_systray a[data-action=edit]", |
|||
}, |
|||
{ |
|||
content: "Drag and drop a text snippet", |
|||
trigger: ".oe_snippet[name='Text Block'] .oe_snippet_thumbnail", |
|||
run: "drag_and_drop #wrap", |
|||
}, |
|||
{ |
|||
content: "Drag and drop a newsletter snippet", |
|||
trigger: ".oe_snippet[name='Newsletter'] .oe_snippet_thumbnail", |
|||
run: "drag_and_drop #wrap .s_text_block", |
|||
}, |
|||
{ |
|||
content: "Let the default mailing list", |
|||
trigger: ".modal-dialog button:contains('Continue')", |
|||
}, |
|||
{ |
|||
content: "Save changes", |
|||
extra_trigger: "body:not(:has(.modal:visible))", |
|||
trigger: "#web_editor-top-edit button[data-action=save]", |
|||
}, |
|||
{ |
|||
content: "Subscribe Administrator", |
|||
extra_trigger: "body:not(:has(#web_editor-top-edit))", |
|||
trigger: ".js_subscribe_btn", |
|||
}, |
|||
{ |
|||
content: "Open user menu", |
|||
extra_trigger: ".js_subscribe .alert-success", |
|||
trigger: "#top_menu span:contains('Administrator')", |
|||
}, |
|||
] |
|||
); |
|||
}); |
@ -0,0 +1,77 @@ |
|||
/* Copyright 2016-2017 Jairo Llopis <jairo.llopis@tecnativa.com> |
|||
* License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */
|
|||
odoo.define("website_mass_mailing_name.public_tour", function (require) { |
|||
"use strict"; |
|||
var base = require("web_editor.base"); |
|||
var tour = require("web_tour.tour"); |
|||
|
|||
tour.register( |
|||
"mass_mailing_name_public", |
|||
{ |
|||
test: true, |
|||
wait_for: base.ready(), |
|||
}, |
|||
[ |
|||
{ |
|||
content: "Try to subscribe without data", |
|||
trigger: ".js_subscribe_btn", |
|||
}, |
|||
{ |
|||
content: "Enter a name", |
|||
extra_trigger: ".js_subscribe.has-error", |
|||
trigger: ".js_subscribe_name", |
|||
run: "text Visitor", |
|||
}, |
|||
{ |
|||
content: "Try to subscribe without email", |
|||
trigger: ".js_subscribe_btn", |
|||
}, |
|||
{ |
|||
content: "Remove the name", |
|||
extra_trigger: ".js_subscribe.has-error", |
|||
trigger: ".js_subscribe_name", |
|||
run: function () { |
|||
$(".js_subscribe_name").val(""); |
|||
}, |
|||
}, |
|||
{ |
|||
content: "Enter an email", |
|||
trigger: ".js_subscribe_email", |
|||
run: "text example@example.com", |
|||
}, |
|||
{ |
|||
content: "Try to subscribe without name", |
|||
trigger: ".js_subscribe_btn", |
|||
}, |
|||
{ |
|||
content: "Enter the name again", |
|||
extra_trigger: ".js_subscribe.has-error", |
|||
trigger: ".js_subscribe_name", |
|||
run: "text Visitor", |
|||
}, |
|||
{ |
|||
content: "Enter a wrong email", |
|||
trigger: ".js_subscribe_email", |
|||
run: "text bad email", |
|||
}, |
|||
{ |
|||
content: "Try to subscribe with a bad email", |
|||
trigger: ".js_subscribe_btn", |
|||
}, |
|||
{ |
|||
content: "Enter the good email", |
|||
extra_trigger: ".js_subscribe.has-error", |
|||
trigger: ".js_subscribe_email", |
|||
run: "text example@example.com", |
|||
}, |
|||
{ |
|||
content: "Try to subscribe with good information", |
|||
trigger: ".js_subscribe_btn", |
|||
}, |
|||
{ |
|||
content: "Subscription successful", |
|||
trigger: ".js_subscribe:not(.has-error) .alert-success", |
|||
}, |
|||
] |
|||
); |
|||
}); |
@ -1,138 +0,0 @@ |
|||
/* © 2016 Jairo Llopis <jairo.llopis@tecnativa.com> |
|||
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
|
|||
|
|||
"use strict"; |
|||
(function ($) { |
|||
openerp.Tour.register({ |
|||
id: "mass_mailing_partner", |
|||
name: "Insert a newsletter snippet and subscribe", |
|||
path: "/", |
|||
mode: "test", |
|||
steps: [ |
|||
{ |
|||
title: "Edit the homepage", |
|||
waitFor: "button[data-action=edit]", |
|||
element: "button[data-action=edit]", |
|||
}, |
|||
{ |
|||
title: "Click on Insert Blocks", |
|||
waitFor: "button[data-action=snippet]", |
|||
element: "button[data-action=snippet]", |
|||
}, |
|||
{ |
|||
title: "Click on Structure", |
|||
waitFor: "a[href='#snippet_structure']", |
|||
element: "a[href='#snippet_structure']", |
|||
}, |
|||
{ |
|||
title: "Drag and drop a text snippet", |
|||
waitFor: ".oe_snippet:contains('Text Block'):visible", |
|||
snippet: ".oe_snippet:contains('Text Block')", |
|||
}, |
|||
{ |
|||
title: "Click on Insert Blocks again", |
|||
waitFor: "#wrap h2:contains('A Great Headline'), \ |
|||
button[data-action=snippet]", |
|||
element: "button[data-action=snippet]", |
|||
}, |
|||
{ |
|||
title: "Click on Content", |
|||
waitFor: "a[href='#snippet_content']", |
|||
element: "a[href='#snippet_content']", |
|||
}, |
|||
{ |
|||
title: "Drag and drop a newsletter snippet", |
|||
waitFor: ".oe_snippet:contains('Newsletter'):visible", |
|||
snippet: ".oe_snippet:contains('Newsletter')", |
|||
}, |
|||
{ |
|||
title: "Let the default mailing list", |
|||
waitFor: ".modal button:contains('Continue'):visible", |
|||
element: ".modal button:contains('Continue'):visible", |
|||
}, |
|||
{ |
|||
title: "Save changes", |
|||
waitNot: ".modal:visible", |
|||
element: "button[data-action=save]", |
|||
}, |
|||
{ |
|||
title: "Subscribe Administrator", |
|||
waitFor: "button[data-action=edit]:visible, \ |
|||
.js_subscribe_btn:visible", |
|||
element: ".js_subscribe_btn", |
|||
}, |
|||
{ |
|||
title: "Open user menu", |
|||
waitFor: ".js_subscribe .alert-success:visible", |
|||
element: "#top_menu span:contains('Administrator')", |
|||
}, |
|||
{ |
|||
title: "Log out", |
|||
waitFor: ".js_usermenu a:contains('Logout'):visible", |
|||
element: ".js_usermenu a:contains('Logout'):visible", |
|||
}, |
|||
{ |
|||
title: "Try to subscribe without data", |
|||
waitFor: "#top_menu a[href='/web/login']:visible, \ |
|||
.js_subscribe_btn:visible", |
|||
element: ".js_subscribe_btn", |
|||
}, |
|||
{ |
|||
title: "Enter a name", |
|||
waitFor: ".js_subscribe.has-error", |
|||
element: ".js_subscribe_name", |
|||
sampleText: "Visitor", |
|||
}, |
|||
{ |
|||
title: "Try to subscribe without email", |
|||
element: ".js_subscribe_btn", |
|||
}, |
|||
{ |
|||
title: "Remove the name", |
|||
waitFor: ".js_subscribe.has-error", |
|||
element: ".js_subscribe_name", |
|||
sampleText: "", |
|||
}, |
|||
{ |
|||
title: "Enter an email", |
|||
element: ".js_subscribe_email", |
|||
sampleText: "example@example.com", |
|||
}, |
|||
{ |
|||
title: "Try to subscribe without name", |
|||
element: ".js_subscribe_btn", |
|||
}, |
|||
{ |
|||
title: "Enter the name again", |
|||
waitFor: ".js_subscribe.has-error", |
|||
element: ".js_subscribe_name", |
|||
sampleText: "Visitor", |
|||
}, |
|||
{ |
|||
title: "Enter a wrong email", |
|||
element: ".js_subscribe_email", |
|||
sampleText: "bad email", |
|||
}, |
|||
{ |
|||
title: "Try to subscribe with a bad email", |
|||
element: ".js_subscribe_btn", |
|||
}, |
|||
{ |
|||
title: "Enter the good email", |
|||
waitFor: ".js_subscribe.has-error", |
|||
element: ".js_subscribe_email", |
|||
sampleText: "example@example.com", |
|||
}, |
|||
{ |
|||
title: "Try to subscribe with good information", |
|||
element: ".js_subscribe_btn", |
|||
}, |
|||
// Expect this test to work in v9 when uncommenting this
|
|||
// {
|
|||
// title: "Subscription successful",
|
|||
// waitFor: ".js_subscribe:not(.has-error) \
|
|||
// .alert-success:visible",
|
|||
// },
|
|||
], |
|||
}); |
|||
})(jQuery); |
@ -0,0 +1,17 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- Copyright 2016-2017 Jairo Llopis <jairo.llopis@tecnativa.com> |
|||
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). --> |
|||
|
|||
<odoo> |
|||
|
|||
<template id="assets_frontend" |
|||
inherit_id="website.assets_frontend"> |
|||
<xpath expr="."> |
|||
<link rel="stylesheet" |
|||
href="/website_mass_mailing_name/static/src/css/website_mass_mailing_name.sass"/> |
|||
<script type="text/javascript" |
|||
src="/website_mass_mailing_name/static/src/js/website_mass_mailing_name.js"/> |
|||
</xpath> |
|||
</template> |
|||
|
|||
</odoo> |
@ -1,5 +1,4 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# © 2016 Jairo Llopis <jairo.llopis@tecnativa.com> |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). |
|||
|
|||
from . import test_ui |
@ -1,15 +1,25 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# © 2016 Jairo Llopis <jairo.llopis@tecnativa.com> |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
# Copyright 2016-2017 Jairo Llopis <jairo.llopis@tecnativa.com> |
|||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). |
|||
|
|||
from openerp.tests.common import HttpCase |
|||
from odoo.http import root |
|||
from odoo.tests.common import HttpCase |
|||
|
|||
|
|||
class UICase(HttpCase): |
|||
def test_ui(self): |
|||
"""Test snippet behavior.""" |
|||
tour = "odoo.__DEBUG__.services['web_tour.tour'].%s" |
|||
# Admin edits home page and adds subscription snippet |
|||
self.phantom_js( |
|||
"/", |
|||
"openerp.Tour.run('mass_mailing_partner', 'test')", |
|||
"openerp.Tour.tours.mass_mailing_partner", |
|||
"admin") |
|||
tour % "run('mass_mailing_name_editor')", |
|||
tour % "tours.mass_mailing_name_editor.ready", |
|||
login="admin") |
|||
# Forced log out |
|||
root.session_store.delete(self.session) |
|||
# Public user uses subscription snippet |
|||
self.phantom_js( |
|||
"/", |
|||
tour % "run('mass_mailing_name_public')", |
|||
tour % "tours.mass_mailing_name_public.ready") |
@ -1,23 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- © 2016 Jairo Llopis <jairo.llopis@tecnativa.com> |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> |
|||
|
|||
<openerp> |
|||
<data> |
|||
|
|||
<template id="assets_frontend" |
|||
inherit_id="mass_mailing.assets_frontend"> |
|||
<xpath expr="."> |
|||
<link rel="stylesheet" |
|||
href="/website_mass_mailing_name/static/src/css/website_mass_mailing_name.css"/> |
|||
<script type="text/javascript" |
|||
src="/website_mass_mailing_name/static/src/js/website_mass_mailing_name.js"/> |
|||
<t t-if="request.registry.test_cr"> |
|||
<script type="text/javascript" |
|||
src="/website_mass_mailing_name/static/src/js/website_mass_mailing_name.tour.js"/> |
|||
</t> |
|||
</xpath> |
|||
</template> |
|||
|
|||
</data> |
|||
</openerp> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue