Browse Source

publish muk_web_client_refresh - 12.0

pull/35/head
MuK IT GmbH 6 years ago
parent
commit
5b042f5031
  1. 23
      muk_web_client_refresh/__init__.py
  2. 4
      muk_web_client_refresh/__manifest__.py
  3. 5
      muk_web_client_refresh/doc/changelog.rst
  4. 1
      muk_web_client_refresh/models/__init__.py
  5. 62
      muk_web_client_refresh/models/base_automation.py
  6. 13
      muk_web_client_refresh/static/description/index.html

23
muk_web_client_refresh/__init__.py

@ -17,5 +17,26 @@
#
###################################################################################
from odoo import api, SUPERUSER_ID
from . import controllers
from . import models
from . import models
REFRESH_RULE_MODELS = [
'account.bank.statement', 'account.invoice', 'account.journal',
'account.move', 'crm.lead', 'event.event', 'fleet.vehicle', 'hr.contract',
'hr.department', 'hr.employee', 'hr.job', 'hr.leave', 'lunch.order',
'mrp.bom', 'mrp.document', 'mrp.workorder', 'product.category',
'product.template', 'project.project', 'project.task', 'purchase.order',
'repair.order', 'res.partner', 'res.users', 'sale.order', 'slide.slide',
'stock.inventory', 'stock.move', 'survey.page', 'survey.survey',
]
def _install_initialize_rules(cr, registry):
env = api.Environment(cr, SUPERUSER_ID, {})
for model_name in REFRESH_RULE_MODELS:
env['base.automation'].create_refresh_rules(model_name)
def _uninstall_remove_rules(cr, registry):
env = api.Environment(cr, SUPERUSER_ID, {})
env['base.automation'].search([('state', '=', 'refresh')]).unlink()

4
muk_web_client_refresh/__manifest__.py

@ -20,7 +20,7 @@
{
"name": "MuK Web Refresh",
"summary": """Web Client Refresh""",
"version": "12.0.2.1.6",
"version": "12.0.2.2.0",
"category": "Extra Tools",
"license": "AGPL-3",
"website": "http://www.mukit.at",
@ -51,4 +51,6 @@
},
"application": False,
"installable": True,
"post_init_hook": "_install_initialize_rules",
"uninstall_hook": "_uninstall_remove_rules",
}

5
muk_web_client_refresh/doc/changelog.rst

@ -1,3 +1,8 @@
`2.2.0`
-------
- Automatically initiate refresh rules
`2.1.0`
-------

1
muk_web_client_refresh/models/__init__.py

@ -19,4 +19,5 @@
from . import base
from . import ir_actions
from . import base_automation
from . import res_config_settings

62
muk_web_client_refresh/models/base_automation.py

@ -0,0 +1,62 @@
###################################################################################
#
# Copyright (C) 2018 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 <http://www.gnu.org/licenses/>.
#
###################################################################################
import logging
from odoo import api, models, fields
_logger = logging.getLogger(__name__)
class BaseAutomation(models.Model):
_inherit = 'base.automation'
#----------------------------------------------------------
# Functions
#----------------------------------------------------------
@api.model
def create_refresh_rules(self, model_name):
model = self.env['ir.model'].search(
[('model', '=', model_name)], limit=1)
if model_name in self.env and model.exists():
triggers = [
('on_create', 'Creation'),
('on_write', 'Update'),
('on_unlink', 'Deletion')
]
for trigger in triggers:
refresh_rules = self.search([
('model_id', '=', model.id),
('trigger', '=', trigger[0])
], limit=1)
if refresh_rules.exists():
refresh_rules.write({
'active': True
})
else:
self.create({
'trigger': trigger[0],
'state': 'refresh',
'model_id': model.id,
'name': "Refresh %s on %s" % (
model.name,
trigger[1]
)
})

13
muk_web_client_refresh/static/description/index.html

@ -52,7 +52,7 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<div style="max-width: 84%; margin: 16px 8%;">
<h3 class="oe_slogan">Customize Process</h3>
<h3 class="oe_slogan">Chatter Support</h3>
<div class="row">
<div class="mb16 col-lg-6">
<div class="oe_demo oe_screenshot">
@ -101,15 +101,18 @@
contact us, if you need any help with your Odoo integration or
addiontal features.</h5>
<div class="oe_slogan">
<a class="btn btn-primary btn-lg mt8" href="mailto:sale@mukit.at">
<i class="fa fa-envelope"></i> Email
<a class="btn btn-primary btn-lg mt8" href="https://mukit.at">
<i class="fa fa-globe"></i> Website
</a>
<a class="btn btn-primary btn-lg mt8" href="https://mukit.at/page/contactus">
<i class="fa fa-phone"></i> Contact
</a>
<a class="btn btn-primary btn-lg mt8" href="mailto:support@mukit.at">
<i class="fa fa-life-ring"></i> Support
<a class="btn btn-primary btn-lg mt8" href="https://github.com/muk-it">
<i class="fa fa-github"></i> Issues
</a>
<a class="btn btn-primary btn-lg mt8" href="mailto:sale@mukit.at">
<i class="fa fa-envelope"></i> Request a Feature
</a>
</div>
<img src="logo.png" style="width: 200px; margin-bottom: 20px; display: block;" class="mx-auto center-block">
</section>
Loading…
Cancel
Save