diff --git a/testserver_o2b/README.rst b/testserver_o2b/README.rst new file mode 100644 index 0000000..5aa4199 --- /dev/null +++ b/testserver_o2b/README.rst @@ -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: + + + +========================== +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 + diff --git a/testserver_o2b/__manifest__.py b/testserver_o2b/__manifest__.py index a73954d..88a2ec0 100644 --- a/testserver_o2b/__manifest__.py +++ b/testserver_o2b/__manifest__.py @@ -3,17 +3,17 @@ 'name': "testserver_o2b", 'summary': """ - Short (1 phrase/line) summary of the module's purpose, used as - subtitle on modules listing or apps.openerp.com""", + This module males an Odoo env into a test env!""", 'description': """ - Long description of module's purpose + This module males an Odoo env into a test env! """, - 'author': "My Company", - 'website': "http://www.yourcompany.com", + 'author': "Open2bizz", + 'website': "http://www.open2bizz.tech", 'category': 'Uncategorized', 'version': '17.0.1.0.0', + 'license': 'LGPL-3', 'depends': ['web_environment_ribbon', 'mail','base',], 'data': [ 'views/views.xml', diff --git a/testserver_o2b/models/init_test.py b/testserver_o2b/models/init_test.py index 9323673..7c7f096 100644 --- a/testserver_o2b/models/init_test.py +++ b/testserver_o2b/models/init_test.py @@ -62,3 +62,25 @@ 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')]) + 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': "" + }) + 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 \ No newline at end of file diff --git a/testserver_o2b/views/templates.xml b/testserver_o2b/views/templates.xml index cea6b39..62d02fc 100644 --- a/testserver_o2b/views/templates.xml +++ b/testserver_o2b/views/templates.xml @@ -1,24 +1,61 @@ - + -