Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cae36e2c60 | ||
|
|
ac071ceeff | ||
|
|
4064d0b701 | ||
| 04149f7d86 | |||
| d62280ee48 | |||
| cf544b1f2f | |||
| 99f17d0a36 | |||
| 7f8ee558e0 | |||
| 8d22bf9e2d | |||
| df49b9b0c6 | |||
| 3f814bac76 | |||
| b3bfe09f69 | |||
| 523f4dd1b3 |
@@ -1,57 +1,64 @@
|
||||
#!/bin/bash
|
||||
echo "";
|
||||
echo "===================================";
|
||||
echo "Install golang-go...";
|
||||
echo "===================================";
|
||||
apt-get -y install golang-go;
|
||||
if [ $? == 0 ] ; then
|
||||
echo 'golang-go installed'
|
||||
else
|
||||
echo 'ERROR: Installing golang-go NOT succesfull!'
|
||||
exit
|
||||
fi
|
||||
echo "";
|
||||
echo "===================================";
|
||||
echo "Installing mailhog...";
|
||||
echo "===================================";
|
||||
go install github.com/mailhog/MailHog@latest;
|
||||
if [ $? == 0 ] ; then
|
||||
echo "";
|
||||
echo "===================================";
|
||||
echo "Mailcatcher installed succesfully!";
|
||||
echo "===================================";
|
||||
echo "";
|
||||
else
|
||||
echo 'ERROR: Installing Mailcatcher NOT succesfull!'
|
||||
exit
|
||||
fi
|
||||
echo "===================================";
|
||||
echo "Copy Mailhog to bin...";
|
||||
echo "===================================";
|
||||
sudo cp ~/go/bin/MailHog /usr/local/bin/MailHog
|
||||
if [ $? == 0 ] ; then
|
||||
echo 'Mailhog copied'
|
||||
else
|
||||
echo 'ERROR: Copy Mailhog NOT succesfull!'
|
||||
exit
|
||||
fi
|
||||
echo "";
|
||||
echo "===================================";
|
||||
echo "Create MailHog service...";
|
||||
echo "===================================";
|
||||
sudo tee /etc/systemd/system/mailhog.service <<EOL
|
||||
echo ""
|
||||
set -e
|
||||
|
||||
GO_VERSION=1.22.5
|
||||
|
||||
echo "==================================="
|
||||
echo "Installeren van Go ${GO_VERSION}..."
|
||||
echo "==================================="
|
||||
|
||||
apt-get update
|
||||
apt-get -y install curl ca-certificates
|
||||
|
||||
cd /tmp
|
||||
curl -LO https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz
|
||||
|
||||
rm -rf /usr/local/go
|
||||
tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz
|
||||
|
||||
export PATH=/usr/local/go/bin:$PATH
|
||||
go version
|
||||
|
||||
echo ""
|
||||
echo "==================================="
|
||||
echo "Installing MailHog (prebuilt binary)..."
|
||||
echo "==================================="
|
||||
|
||||
# Download de officiële MailHog binary
|
||||
curl -sSL -o MailHog https://github.com/mailhog/MailHog/releases/download/v1.0.1/MailHog_linux_amd64
|
||||
|
||||
chmod +x MailHog
|
||||
mv MailHog /usr/local/bin/MailHog
|
||||
|
||||
echo "MailHog binary geïnstalleerd"
|
||||
|
||||
echo ""
|
||||
echo "==================================="
|
||||
echo "Create MailHog service..."
|
||||
echo "==================================="
|
||||
|
||||
tee /etc/systemd/system/mailhog.service <<EOL
|
||||
[Unit]
|
||||
Description=MailHog
|
||||
Description=MailHog Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
ExecStart=/usr/bin/env /usr/local/bin/MailHog > /dev/null 2>&1 &
|
||||
ExecStart=/usr/local/bin/MailHog
|
||||
Restart=always
|
||||
User=root
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOL
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl enable mailhog
|
||||
systemctl start mailhog
|
||||
echo "";
|
||||
echo "===================================";
|
||||
echo "Mailhog service created and started.";
|
||||
echo "===================================";
|
||||
|
||||
echo ""
|
||||
echo "==================================="
|
||||
echo "MailHog service created and started."
|
||||
echo "==================================="
|
||||
|
||||
42
testserver_o2b/README.rst
Normal file
42
testserver_o2b/README.rst
Normal file
@@ -0,0 +1,42 @@
|
||||
====================
|
||||
Testserver Open2Bizz
|
||||
====================
|
||||
|
||||
When installing this module it transforms the database into a test database.
|
||||
|
||||
**What happens**
|
||||
|
||||
- Adds a RED banner in backend (using module web_environment_ribbon from OCA)
|
||||
- Adds a blue banner in backend; stating test env
|
||||
- Adds a blue banner in FRONTEND (if website is installed) stating test env
|
||||
- Neutralizes the database:
|
||||
- Disables incoming emailserver(s)
|
||||
- Disables outgoing emailserver(s)
|
||||
- Disables ALL cron jobs
|
||||
- Disables Delivery services
|
||||
- Disables Payment providers
|
||||
- Disables Account (Bank) Sync
|
||||
- Disables optional freeze url parameter
|
||||
- Adds ENTERPRISE code from open2bizz (Partner code for test)
|
||||
|
||||
Optional: use the added page for website: testserver_page_website
|
||||
|
||||
**Manual** override the home page or make **inheritance** like:
|
||||
|
||||
<xpath expr="//t[@t-call='website.layout']" position="replace">
|
||||
|
||||
==========================
|
||||
DO NOT USE IN PRODUCTION ENVIRONMENT
|
||||
==========================
|
||||
|
||||
**Bugs:**
|
||||
|
||||
support@open2bizz.nl
|
||||
|
||||
|
||||
This module is maintained by Open2bizz.
|
||||
|
||||
.. image:: https://www.open2bizz.tech/logo.png
|
||||
:alt: Open2Bizz
|
||||
:target: https://www.open2bizz.tech
|
||||
|
||||
@@ -3,14 +3,19 @@
|
||||
'name': "Set as testserver Open2Bizz",
|
||||
|
||||
'summary': """
|
||||
Only to be used when installed as TEST env. Open2Bizz""",
|
||||
This module males an Odoo env into a test env!""",
|
||||
|
||||
'description': """
|
||||
This module males an Odoo env into a test env!
|
||||
Only to be used when installed as TEST env. Open2Bizz
|
||||
""",
|
||||
|
||||
'author': "Open2bizz",
|
||||
'website': "http://www.open2bizz.tech",
|
||||
'category': 'Uncategorized',
|
||||
'version': '17.0.1.0.0',
|
||||
'depends': ['web_environment_ribbon', 'mail','base','mailcatcher_menu',],
|
||||
'license': 'LGPL-3',
|
||||
'depends': ['web_environment_ribbon', 'mail','base','mailcatcher_menu'],
|
||||
'data': [
|
||||
'views/views.xml',
|
||||
'views/templates.xml',
|
||||
|
||||
@@ -25,6 +25,9 @@ class IrLogging(models.Model):
|
||||
UPDATE ir_config_parameter set value = '%s' where key = 'database.uuid';
|
||||
INSERT INTO ir_mail_server(smtp_host,smtp_port,name,smtp_authentication,smtp_encryption,active) VALUES ('127.0.0.1','1025','Lokale mailcatcher','login','name','t');
|
||||
INSERT INTO ir_mail_server(smtp_host,smtp_port,name,smtp_authentication,smtp_encryption,active) VALUES ('192.168.78.199','1025','Algemene mailcatcher','login','name','t');
|
||||
INSERT INTO ir_mail_server(smtp_host,smtp_port,name,smtp_authentication,smtp_encryption,active) VALUES ('hnode6.openworx.nl','1025','Algemene mailcatcher vanaf hnode4','login','name','t');
|
||||
UPDATE website SET google_analytics_key = NULL WHERE google_analytics_key IS NOT NULL;
|
||||
UPDATE product_template SET is_published = FALSE WHERE is_published = TRUE;
|
||||
""" %(db_id))
|
||||
if self.env['ir.config_parameter'].search([('key','=','web.base.url.freeze')]):
|
||||
self.env.cr.execute("""DELETE FROM ir_config_parameter WHERE key = 'web.base.url.freeze';""")
|
||||
@@ -47,6 +50,8 @@ class IrLogging(models.Model):
|
||||
self.env.cr.execute("""DELETE FROM account_online_link WHERE id > 0;""")
|
||||
if self.env['ir.model'].search([('model','=','account.journal')]):
|
||||
self.env.cr.execute("""UPDATE account_journal set bank_statements_source = 'undefined';""")
|
||||
if self.env['ir.model'].search([('model','=','mail.partner.device')]):
|
||||
self.env.cr.execute("""DELETE FROM mail_partner_device;""")
|
||||
ip_ok = False
|
||||
with os.popen("ip a") as f:
|
||||
for x in f.readlines():
|
||||
@@ -63,3 +68,39 @@ class IrLogging(models.Model):
|
||||
for ap in ADDONS_PATH.split(','):
|
||||
if ap[-10:] == 'testserver':
|
||||
_logger.error(os.system('./%s/testserver.sh' %(ap)))
|
||||
|
||||
|
||||
#module_website = self.env['ir.module.module'].search([('name','=','ir.module.module')])
|
||||
module_website = self.env['ir.module.module'].search([('name','=','website')])
|
||||
if module_website.state == 'installed':
|
||||
model_website_page = self.env['ir.model'].search([('model','=','website.page')])
|
||||
if model_website_page:
|
||||
for page in self.env['website.page'].search([('is_published','=',True)]):
|
||||
page.write({
|
||||
'is_published': False
|
||||
})
|
||||
for website in self.env['website'].search([]):
|
||||
website.write({
|
||||
'domain': f"None{website.id}"
|
||||
})
|
||||
for menu in self.env['website.menu'].search([('is_visible','=',True)]):
|
||||
if menu.website_id and menu.parent_id:
|
||||
menu.write({
|
||||
'website_id': False
|
||||
})
|
||||
elif menu.website_id and menu.url == "/":
|
||||
view = self.env['ir.ui.view']._xmlid_to_res_id('testserver_o2b.testserver_page_website')
|
||||
if view:
|
||||
menu.page_id.view_id = view.id
|
||||
|
||||
self._disable_web_push_notifications()
|
||||
_logger.debug(f"_______ disable_web_push_notifications ____")
|
||||
|
||||
def _disable_web_push_notifications(self):
|
||||
parameter = self.env['ir.config_parameter'].sudo()
|
||||
parameter.set_param('web_push.notification.enabled', '0')
|
||||
|
||||
parameters = self.env['ir.config_parameter'].sudo().search([
|
||||
('key', 'in', ('mail.web_push_vapid_private_key', 'mail.web_push_vapid_public_key', 'mail.sfu_server_key'))])
|
||||
for parameter in parameters:
|
||||
parameter.sudo().unlink()
|
||||
|
||||
@@ -1,24 +1,63 @@
|
||||
<odoo>
|
||||
<data>
|
||||
<!--
|
||||
<template id="listing">
|
||||
<ul>
|
||||
<li t-foreach="objects" t-as="object">
|
||||
<a t-attf-href="#{ root }/objects/#{ object.id }">
|
||||
<t t-esc="object.display_name"/>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Banner for web layout (backend Odoo) -->
|
||||
<template id="testserver_banner_web" name="TOP banner test backend" inherit_id="web.layout">
|
||||
<xpath expr="//body" position="inside">
|
||||
<div>
|
||||
<span style="text-align: center;color: #FFFFFF;background-color: #006CFE;position: relative;display: block;font-size: 16px;">
|
||||
This is a test database.
|
||||
<a href="https://www.open2bizz.tech/helpdesk" target="_blank" style="color: #000000;">
|
||||
See website to report issue's.
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
</xpath>
|
||||
</template>
|
||||
<template id="object">
|
||||
<h1><t t-esc="object.display_name"/></h1>
|
||||
<dl>
|
||||
<t t-foreach="object._fields" t-as="field">
|
||||
<dt><t t-esc="field"/></dt>
|
||||
<dd><t t-esc="object[field]"/></dd>
|
||||
|
||||
<!-- Banner for web layout (website Odoo) -->
|
||||
<!-- MR=> Dit geeft een foutmelding als er geen website geïnstalleerd is!
|
||||
<template id="testserver_banner_website" name="TOP banner test front" inherit_id="website.layout">
|
||||
<xpath expr="//body" position="before">
|
||||
<div>
|
||||
<span style="text-align: center;color: #FFFFFF;background-color: #006CFE;position: relative;display: block;font-size: 16px;">
|
||||
***** This is a test environment *****
|
||||
<a href="https://www.open2bizz.tech/helpdesk" target="_blank" style="color: #000000;">
|
||||
See website to report issue's.
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
</xpath>
|
||||
</template>
|
||||
-->
|
||||
|
||||
<!-- Replacement layout (website Odoo) -->
|
||||
<template id="testserver_page_website" name="Website page front">
|
||||
<t t-name="website.test-env">
|
||||
<t t-call="website.layout">
|
||||
<div id="wrap" class="oe_structure oe_empty">
|
||||
<section class="s_banner parallax s_parallax_is_fixed pb96 o_colored_level pt40"
|
||||
data-scroll-background-ratio="1"
|
||||
data-snippet="s_banner" data-name="Banner" style="background-image: none;">
|
||||
<span class="s_parallax_bg oe_img_bg o_bg_img_center"
|
||||
style="background-image: url("https://hd-beamers.nl/wp-content/uploads/2014/05/Testbeeld-1280x720p_hd-ready.png"); background-position: 50% 0px;"/>
|
||||
<div class="o_we_bg_filter" style="background-image: linear-gradient(135deg, rgba(21, 25, 116, 0.71) 0%, rgba(226, 51, 255, 0.5) 100%);"/>
|
||||
<div class="container">
|
||||
<div class="row s_nb_column_fixed">
|
||||
<div class="col-lg-6 jumbotron rounded o_cc o_cc1 pt32 pb32 o_colored_level" data-name="Box">
|
||||
<h1><font style="font-size: 62px;" class="o_default_snippet_text">TEST</font><br/></h1>
|
||||
<p class="lead o_default_snippet_text">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
||||
<a class="mb-2 btn btn-primary" href="/web/login" data-bs-original-title="" title="">Login</a>
|
||||
<br/>
|
||||
<br/>
|
||||
<a class="mb-2 btn btn-secondary" href="https://www.open2bizz.nl" data-bs-original-title="" title="">Open2Bizz</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</t>
|
||||
</t>
|
||||
</dl>
|
||||
</template>
|
||||
-->
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user