Browse Source

[FIX] we can't, but it's possible

pull/480/head
Holger Brunn 8 years ago
parent
commit
32f391c8b5
No known key found for this signature in database GPG Key ID: 1C9760FECA3AE18
  1. 4
      field_rrule/__init__.py
  2. 8
      field_rrule/__openerp__.py
  3. 16
      field_rrule/hooks.py

4
field_rrule/__init__.py

@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import socket
from .field_rrule import FieldRRule
if socket.getfqdn().endswith('odoo-community.org'):
import demo
from .hooks import post_load_hook

8
field_rrule/__openerp__.py

@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
# © 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import socket
{
"name": "Repetition Rules",
"version": "8.0.1.0.0",
@ -16,10 +14,12 @@ import socket
"data": [
'views/templates.xml',
],
"demo": [] if not socket.getfqdn().endswith('odoo-community.org')
else [
# this will be activated in the module's post_load_hook if we run on oca's
# runbot
"demo_deactivated": [
'demo/res_partner.xml'
],
"post_load": "post_load_hook",
"qweb": [
'static/src/xml/field_rrule.xml',
],

16
field_rrule/hooks.py

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# © 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import socket
import inspect
def post_load_hook():
"""do some trickery to have demo data/model on runbot, but nowhere else"""
if socket.getfqdn().endswith('odoo-community.org'): # pragma: nocover
from . import demo
for frame, filename, lineno, funcname, line, index in inspect.stack():
if 'package' in frame.f_locals:
frame.f_locals['package'].info['demo'] =\
frame.f_locals['package'].info['demo_deactivated']
continue
Loading…
Cancel
Save