Browse Source

Merge pull request #176 from KolushovAlexandr/11.0-4d9d9c5ed50e64ade618d8a3657fa91cbc50860a

11.0 4d9d9c5ed5
pull/184/head
Ivan Yelizariev 6 years ago
committed by GitHub
parent
commit
3247df878d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      README.md
  2. 2
      mail_multi_website/models/mail_template.py
  3. 48
      mail_private/static/src/js/test_private.js
  4. 3
      mail_private/template.xml
  5. 4
      mail_private/tests/__init__.py
  6. 32
      mail_private/tests/test_js.py

2
README.md

@ -1,3 +1,5 @@
[![Build Status](https://travis-ci.com/it-projects-llc/mail-addons.svg?branch=11.0)](https://travis-ci.com/it-projects-llc/mail-addons)
# mail-addons
Odoo mail addons

2
mail_multi_website/models/mail_template.py

@ -98,7 +98,7 @@ class MailTemplate(models.Model):
if record_company and record_website \
and record_website.company_id != company:
# company and website are incompatible, so keep only website
# company and website are incompatible, so keep only company
record_website = self.env['website'] # empty value
record_context = dict(force_company=record_company.id, website_id=record_website.id)

48
mail_private/static/src/js/test_private.js

@ -0,0 +1,48 @@
/* Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).*/
odoo.define('mail_private.tour', function (require) {
"use strict";
var tour = require("web_tour.tour");
var core = require('web.core');
var _t = core._t;
var email = 'mail_private test email';
var steps = [{
trigger: '.o_thread_message strong.o_mail_redirect:contains("Agrolait")',
content: _t("Open Partners Form"),
position: 'bottom',
}, {
trigger: "button.oe_compose_post_private",
content: _t("Click on Private mail creating button"),
position: "bottom"
}, {
// for some reason (due to tricky renderings) button.oe_composer_uncheck could not be find by the tour manager
trigger: ".o_control_panel.o_breadcrumb_full li.active",
content: _t("Dummy action"),
}, {
trigger: "button.oe_composer_uncheck",
extra_trigger: "button.oe_composer_uncheck",
content: _t("Uncheck all Followers"),
timeout: 10000,
}, {
trigger: "div.o_composer_suggested_partners input:first",
content: _t("Check the first one"),
}, {
trigger: "textarea.o_composer_text_field:first",
content: _t("Write some email"),
run: function() {
$('textarea.o_composer_text_field:first').val(email);
},
}, {
trigger: ".o_composer_send .o_composer_button_send",
content: _t("Send email"),
}, {
trigger: ".o_mail_thread .o_thread_message:contains(" + email + ")",
content: _t("Send email"),
}
];
tour.register('mail_private_tour', { test: true, url: '/web' }, steps);
});

3
mail_private/template.xml

@ -8,6 +8,9 @@
<script
type="text/javascript"
src="/mail_private/static/src/js/mail_private.js"></script>
<script
type="text/javascript"
src="/mail_private/static/src/js/test_private.js"></script>
</xpath>
</template>
</odoo>

4
mail_private/tests/__init__.py

@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from . import test_js

32
mail_private/tests/test_js.py

@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
import odoo.tests
from odoo.api import Environment
@odoo.tests.common.at_install(True)
@odoo.tests.common.post_install(True)
class TestUi(odoo.tests.HttpCase):
def test_01_mail_private(self):
# needed because tests are run before the module is marked as
# installed. In js web will only load qweb coming from modules
# that are returned by the backend in module_boot. Without
# this you end up with js, css but no qweb.
cr = self.registry.cursor()
env = Environment(cr, self.uid, {})
env['ir.module.module'].search([('name', '=', 'mail_private')], limit=1).state = 'installed'
cr.release()
env = Environment(self.registry.test_cr, self.uid, {})
partners = env['res.partner'].search([])
new_follower = env['res.partner'].search([('name', 'ilike', 'Ja')])
for partner in partners:
partner.message_subscribe(new_follower.ids, [])
self.phantom_js("/web",
"odoo.__DEBUG__.services['web_tour.tour'].run('mail_private_tour', 1000)",
"odoo.__DEBUG__.services['web_tour.tour'].tours.mail_private_tour.ready",
login="admin", timeout=90)
Loading…
Cancel
Save