diff --git a/muk_web_client_refresh/models/refresh_rule.py b/muk_web_client_refresh/models/refresh_rule.py deleted file mode 100644 index bfb2567..0000000 --- a/muk_web_client_refresh/models/refresh_rule.py +++ /dev/null @@ -1,133 +0,0 @@ -# -*- coding: utf-8 -*- - -################################################################################### -# -# Copyright (C) 2017 MuK IT GmbH -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -################################################################################### - -import logging - -from odoo import _ -from odoo import models, modules, api, fields -from odoo.exceptions import ValidationError, AccessError - -_logger = logging.getLogger(__name__) - -class RefreshRule(models.Model): - _name = 'muk_web_client_refresh.rule' - _description = "Auto Refresh Rule" - - name = fields.Char( - string="Name", - required=True) - - model = fields.Many2one( - 'ir.model', - string="Model", - required=True, - help="Select model for which you want to refresh the corresponding views.") - - refresh_create = fields.Boolean( - string="Refresh on Create", - default=True) - - refresh_write = fields.Boolean( - string="Refresh on Writes", - default=True) - - refresh_unlink = fields.Boolean( - string="Refresh on Unlink", - default=True) - - _sql_constraints = [ - ('model_uniq', 'unique(model)', - ("There is already a rule defined on this model.")) - ] - - def _register_hook(self): - super(RefreshRule, self)._register_hook() - return self._patch_methods() - - @api.multi - def _patch_methods(self): - for rule in self: - model = self.env[rule.model.model] - if rule.refresh_create: - model._patch_method('create', rule._make_create()) - if rule.refresh_write: - model._patch_method('write', rule._make_write()) - if rule.refresh_unlink: - model._patch_method('unlink', rule._make_unlink()) - - @api.multi - def _revert_methods(self): - for rule in self: - model = self.env[rule.model.model] - for method in ['create', 'write', 'unlink']: - if getattr(rule, 'refresh_%s' % method) and hasattr(getattr(model, method), 'origin'): - model._revert_method(method) - - @api.model - def create(self, vals): - record = super(RefreshRule, self).create(vals) - record._register_hook() - modules.registry.Registry(self.env.cr.dbname).signal_changes() - return record - - @api.multi - def write(self, vals): - self._revert_methods() - result = super(RefreshRule, self).write(vals) - self._patch_methods() - modules.registry.Registry(self.env.cr.dbname).signal_changes() - return result - - @api.multi - def unlink(self): - self._revert_methods() - modules.registry.Registry(self.env.cr.dbname).signal_changes() - return super(RefreshRule, self).unlink() - - @api.multi - def _make_create(self): - @api.model - @api.returns('self', lambda value: value.id) - def create_refresh(self, vals, **kwargs): - result = create_refresh.origin(self, vals, **kwargs) - self.env['bus.bus'].sendone('refresh', [self.env.cr.dbname, self._name, self._uid]) - - - return result - return create_refresh - - @api.multi - def _make_write(self): - @api.multi - def write_refresh(self, vals, **kwargs): - result = write_refresh.origin(self, vals, **kwargs) - self.env['bus.bus'].sendone('refresh', [self.env.cr.dbname, self._name, self._uid]) - return result - return write_refresh - - @api.multi - def _make_unlink(self): - @api.multi - def unlink_refresh(self, **kwargs): - result = unlink_refresh.origin(self, **kwargs) - self.env['bus.bus'].sendone('refresh', [self.env.cr.dbname, self._name, self._uid]) - return result - return unlink_refresh \ No newline at end of file diff --git a/muk_web_client_refresh/security/ir.model.access.csv b/muk_web_client_refresh/security/ir.model.access.csv deleted file mode 100644 index 0829074..0000000 --- a/muk_web_client_refresh/security/ir.model.access.csv +++ /dev/null @@ -1,3 +0,0 @@ -id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink - -access_refresh_rule_manager,refresh_rule_manager,model_muk_web_client_refresh_rule,base.group_erp_manager,1,1,1,1 diff --git a/muk_web_client_refresh/static/description/demo.mp4 b/muk_web_client_refresh/static/description/demo.mp4 deleted file mode 100644 index fa0d9df..0000000 Binary files a/muk_web_client_refresh/static/description/demo.mp4 and /dev/null differ diff --git a/muk_web_client_refresh/tests/__init__.py b/muk_web_client_refresh/tests/__init__.py deleted file mode 100644 index f62e48e..0000000 --- a/muk_web_client_refresh/tests/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- - -################################################################################### -# -# Copyright (C) 2017 MuK IT GmbH -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -################################################################################### - -from . import test_refresh - diff --git a/muk_web_client_refresh/tests/test_refresh.py b/muk_web_client_refresh/tests/test_refresh.py deleted file mode 100644 index d40a170..0000000 --- a/muk_web_client_refresh/tests/test_refresh.py +++ /dev/null @@ -1,76 +0,0 @@ -# -*- coding: utf-8 -*- - -################################################################################### -# -# Copyright (C) 2017 MuK IT GmbH -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -################################################################################### - -import os -import base64 -import unittest - -from contextlib import closing - -from odoo import _ -from odoo.tests import common - -class RefreshTestCase(common.TransactionCase): - - at_install = False - post_install = True - - def setUp(self): - super(RefreshTestCase, self).setUp() - self.partner = self.env['res.partner'].sudo() - self.model = self.env['ir.model'].sudo() - self.bus = self.env['bus.bus'].sudo() - self.rule = self.env['muk_web_client_refresh.rule'].sudo() - - def tearDown(self): - super(RefreshTestCase, self).tearDown() - - def test_refresh_rule(self): - start = self.bus.search([], count=True) - model = self.model.search([('model', '=', 'res.partner')], limit=1) - rule = self.rule.create({ - 'name': "TestRule", - 'model': model.id, - 'refresh_create': True, - 'refresh_write': True, - 'refresh_unlink': True}) - partner = self.partner.create({ - 'name': "Test", - }) - create = self.bus.search([], count=True) - self.assertTrue(start < create) - partner.write({'name': "Rename"}) - write = self.bus.search([], count=True) - self.assertTrue(write > create) - partner.unlink() - delete = self.bus.search([], count=True) - self.assertTrue(write < delete) - rule.write({'refresh_create': False}) - start = self.bus.search([], count=True) - partner = self.partner.create({ - 'name': "Test", - }) - create = self.bus.search([], count=True) - self.assertTrue(start == create) - rule.unlink() - partner.unlink() - delete = self.bus.search([], count=True) - self.assertTrue(start == delete) \ No newline at end of file diff --git a/muk_web_client_refresh/views/refresh_menu.xml b/muk_web_client_refresh/views/refresh_menu.xml deleted file mode 100644 index c90d871..0000000 --- a/muk_web_client_refresh/views/refresh_menu.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - diff --git a/muk_web_client_refresh/views/refresh_rule_view.xml b/muk_web_client_refresh/views/refresh_rule_view.xml deleted file mode 100644 index ebe766f..0000000 --- a/muk_web_client_refresh/views/refresh_rule_view.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - muk_web_client_refresh_rule.tree - muk_web_client_refresh.rule - - - - - - - - - - - - - muk_web_client_refresh_rule.form - muk_web_client_refresh.rule - -
- - - - - - - - - - - -
-
-
- - - Rules - muk_web_client_refresh.rule - tree,form - - - - -
diff --git a/muk_web_preview_mail/tests/test_mail_parse.py b/muk_web_preview_mail/tests/test_mail_parse.py index 0e73a84..51f9a60 100644 --- a/muk_web_preview_mail/tests/test_mail_parse.py +++ b/muk_web_preview_mail/tests/test_mail_parse.py @@ -44,7 +44,7 @@ class MailParseTestCase(common.HttpCase): def test_parse_mail(self): self.authenticate('admin', 'admin') - url = "/web/preview/converter/mail" + url = "/web/preview/mail" params = {'url': "/web/content?id={}".format(self.sample_mail_attachment.id)} url_parts = list(urlparse(url)) query = dict(parse_qsl(url_parts[4])) diff --git a/muk_web_preview_rst/tests/test_rst.py b/muk_web_preview_rst/tests/test_rst.py index 0db4220..de83465 100644 --- a/muk_web_preview_rst/tests/test_rst.py +++ b/muk_web_preview_rst/tests/test_rst.py @@ -44,7 +44,7 @@ class ReStructuredTextParseTestCase(common.HttpCase): def test_rst(self): self.authenticate('admin', 'admin') - url = "/web/preview/converter/mail" + url = "/web/preview/rst" params = {'url': "/web/content?id={}".format(self.sample.id)} url_parts = list(urlparse(url)) query = dict(parse_qsl(url_parts[4]))