[IMP] support v10 manifest file naming convention

- As of v10, manifest files should be named `__manifest__.py`
- For backwards-compatibility, __openerp__.py manifest files
  will still be supported for the time being
- Limited refactoring, to add support for the 2 different
  naming conventions
- All textual references to __openerp_.py updated in
  documentation and examples
This commit is contained in:
Olivier Dony
2016-09-05 11:57:50 +02:00
parent c0566b2896
commit 4339196e52
36 changed files with 154 additions and 149 deletions
-1
View File
@@ -3,7 +3,6 @@
##############################################################################
#
# __openerp__.py
# l10n_cr_account
# First author: Carlos Vásquez <carlos.vasquez@clearcorp.co.cr> (ClearCorp S.A.)
# Copyright (c) 2010-TODAY ClearCorp S.A. (http://clearcorp.co.cr). All rights reserved.
+1 -1
View File
@@ -1,5 +1,5 @@
<addon name>
+-- __openerp__.py
+-- __manifest__.py
+-- controllers/
+-- static/
+-- lib/
+8 -8
View File
@@ -2,12 +2,12 @@
.. queue:: module/series
Building an OpenERP Web module
==============================
Building a Web module
=====================
There is no significant distinction between an OpenERP Web module and
an OpenERP module, the web part is mostly additional data and code
inside a regular OpenERP module. This allows providing more seamless
There is no significant distinction between a Web module and
a regular module, the web part is mostly additional data and code
inside a regular module. This allows providing more seamless
features by integrating your module deeper into the web client.
A Basic Module
@@ -19,11 +19,11 @@ A very basic OpenERP module structure will be our starting point:
web_example
├── __init__.py
└── __openerp__.py
└── __manifest__.py
.. patch::
This is a sufficient minimal declaration of a valid OpenERP module.
This is a sufficient minimal declaration of a valid module.
Web Declaration
---------------
@@ -36,7 +36,7 @@ module is automatically recognized as "web-enabled" if it contains a
web_example
├── __init__.py
├── __openerp__.py
├── __manifest__.py
└── static
is the extent of it. You should also change the dependency to list
+3 -3
View File
@@ -3,12 +3,12 @@
diff --git a/__init__.py b/__init__.py
new file mode 100644
diff --git a/__openerp__.py b/__openerp__.py
diff --git a/__manifest__.py b/__manifest__.py
new file mode 100644
--- /dev/null
+++ b/__openerp__.py
+++ b/__manifest__.py
@@ -0,0 +1,7 @@
+# __openerp__.py
+# __manifest__.py
+{
+ 'name': "Web Example",
+ 'description': "Basic example of a (future) web module",
+3 -3
View File
@@ -1,8 +1,8 @@
# HG changeset patch
# Parent 3ed382d9a8fe64fbb8e2bf4045e3fcd5c74c92bc
diff --git a/__openerp__.py b/__openerp__.py
--- a/__openerp__.py
+++ b/__openerp__.py
diff --git a/__manifest__.py b/__manifest__.py
--- a/__manifest__.py
+++ b/__manifest__.py
@@ -6,4 +6,5 @@
'depends': ['web'],
'data': ['web_example.xml'],
+3 -3
View File
@@ -1,9 +1,9 @@
# HG changeset patch
# Parent 43f21611dacb7c2b2f3810baeeef359ad7c329f0
diff --git a/__openerp__.py b/__openerp__.py
--- a/__openerp__.py
+++ b/__openerp__.py
diff --git a/__manifest__.py b/__manifest__.py
--- a/__manifest__.py
+++ b/__manifest__.py
@@ -7,4 +7,5 @@
'data': ['web_example.xml'],
'js': ['static/src/js/first_module.js'],
+3 -3
View File
@@ -1,8 +1,8 @@
# HG changeset patch
# Parent 8a986919a3e22cd7cca51210820c09d4545dc60d
diff --git a/__openerp__.py b/__openerp__.py
--- a/__openerp__.py
+++ b/__openerp__.py
diff --git a/__manifest__.py b/__manifest__.py
--- a/__manifest__.py
+++ b/__manifest__.py
@@ -3,5 +3,5 @@
'name': "Web Example",
'description': "Basic example of a (future) web module",
+3 -3
View File
@@ -1,7 +1,7 @@
Index: web_example/__openerp__.py
Index: web_example/__manifest__.py
===================================================================
--- web_example.orig/__openerp__.py
+++ web_example/__openerp__.py
--- web_example.orig/__manifest__.py
+++ web_example/__manifest__.py
@@ -8,4 +8,5 @@
'js': ['static/src/js/first_module.js'],
'css': ['static/src/css/web_example.css'],
+3 -3
View File
@@ -1,8 +1,8 @@
# HG changeset patch
# Parent 139dae60de67efa0017f5032f71ab774685c5507
diff --git a/__openerp__.py b/__openerp__.py
--- a/__openerp__.py
+++ b/__openerp__.py
diff --git a/__manifest__.py b/__manifest__.py
--- a/__manifest__.py
+++ b/__manifest__.py
@@ -4,4 +4,5 @@
'description': "Basic example of a (future) web module",
'category': 'Hidden',
+3 -3
View File
@@ -1,9 +1,9 @@
# HG changeset patch
# Parent 0026cb80097a724db8d36371bc00da993a51a06f
diff --git a/__openerp__.py b/__openerp__.py
--- a/__openerp__.py
+++ b/__openerp__.py
diff --git a/__manifest__.py b/__manifest__.py
--- a/__manifest__.py
+++ b/__manifest__.py
@@ -4,5 +4,6 @@
'description': "Basic example of a (future) web module",
'category': 'Hidden',
+4 -4
View File
@@ -303,7 +303,7 @@ action more easily.
#. Create ``openacademy/views/openacademy.xml`` with an action and
the menus triggering the action
#. Add it to the ``data`` list of ``openacademy/__openerp__.py``
#. Add it to the ``data`` list of ``openacademy/__manifest__.py``
.. patch::
@@ -687,7 +687,7 @@ instead of a single view its ``arch`` field is composed of any number of
#. Create a file ``openacademy/partner.py`` and import it in
``__init__.py``
#. Create a file ``openacademy/views/partner.xml`` and add it to
``__openerp__.py``
``__manifest__.py``
.. patch::
@@ -1374,7 +1374,7 @@ rights are usually created by a CSV file named after its model:
hold the OpenAcademy Manager group
#. Edit the file ``openacademy/security/ir.model.access.csv`` with
the access rights to the models
#. Finally update ``openacademy/__openerp__.py`` to add the new data
#. Finally update ``openacademy/__manifest__.py`` to add the new data
files to it
.. patch::
@@ -1688,7 +1688,7 @@ Dashboards
.. note:: Available dashboard styles are ``1``, ``1-1``, ``1-2``,
``2-1`` and ``1-1-1``
#. Update ``openacademy/__openerp__.py`` to reference the new data
#. Update ``openacademy/__manifest__.py`` to reference the new data
file
.. patch::
+3 -3
View File
@@ -1,10 +1,10 @@
# HG changeset patch
# Parent 303a5f4f011822dcb42b5833d579eabd3f03f4bf
Index: addons/openacademy/__openerp__.py
Index: addons/openacademy/__manifest__.py
===================================================================
--- addons.orig/openacademy/__openerp__.py 2014-08-26 17:26:18.143783102 +0200
+++ addons/openacademy/__openerp__.py 2014-08-26 17:26:18.135783102 +0200
--- addons.orig/openacademy/__manifest__.py 2014-08-26 17:26:18.143783102 +0200
+++ addons/openacademy/__manifest__.py 2014-08-26 17:26:18.135783102 +0200
@@ -25,7 +25,8 @@
# always loaded
+3 -3
View File
@@ -1,9 +1,9 @@
# HG changeset patch
# Parent 16e4cb131d9f7f3a72a8a1b0bc46c2ce9ac76435
Index: addons/openacademy/__openerp__.py
Index: addons/openacademy/__manifest__.py
===================================================================
--- addons.orig/openacademy/__openerp__.py 2014-08-26 17:25:53.519783468 +0200
+++ addons/openacademy/__openerp__.py 2014-08-26 17:25:53.511783468 +0200
--- addons.orig/openacademy/__manifest__.py 2014-08-26 17:25:53.519783468 +0200
+++ addons/openacademy/__manifest__.py 2014-08-26 17:25:53.511783468 +0200
@@ -27,6 +27,7 @@
'data': [
# 'security/ir.model.access.csv',
+2 -2
View File
@@ -1,9 +1,9 @@
# HG changeset patch
# Parent 0000000000000000000000000000000000000000
Index: addons/openacademy/__openerp__.py
Index: addons/openacademy/__manifest__.py
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ addons/openacademy/__openerp__.py 2014-08-26 17:25:49.787783523 +0200
+++ addons/openacademy/__manifest__.py 2014-08-26 17:25:49.787783523 +0200
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+{
+3 -3
View File
@@ -1,10 +1,10 @@
# HG changeset patch
# Parent 643813940cbea07bec792f9e1c60022a9292fa90
Index: addons/openacademy/__openerp__.py
Index: addons/openacademy/__manifest__.py
===================================================================
--- addons.orig/openacademy/__openerp__.py 2014-08-26 17:26:21.535783052 +0200
+++ addons/openacademy/__openerp__.py 2014-08-26 17:26:21.531783052 +0200
--- addons.orig/openacademy/__manifest__.py 2014-08-26 17:26:21.535783052 +0200
+++ addons/openacademy/__manifest__.py 2014-08-26 17:26:21.531783052 +0200
@@ -21,7 +21,7 @@
'version': '0.1',
@@ -10,10 +10,10 @@ Index: addons/openacademy/__init__.py
from . import controllers
from . import models
+from . import partner
Index: addons/openacademy/__openerp__.py
Index: addons/openacademy/__manifest__.py
===================================================================
--- addons.orig/openacademy/__openerp__.py 2014-08-26 17:26:01.227783353 +0200
+++ addons/openacademy/__openerp__.py 2014-08-26 17:26:01.223783354 +0200
--- addons.orig/openacademy/__manifest__.py 2014-08-26 17:26:01.227783353 +0200
+++ addons/openacademy/__manifest__.py 2014-08-26 17:26:01.223783354 +0200
@@ -28,6 +28,7 @@
# 'security/ir.model.access.csv',
'templates.xml',
+3 -3
View File
@@ -1,10 +1,10 @@
# HG changeset patch
# Parent c140f0a861a08881d8737bca0ffb83904a2059a3
Index: addons/openacademy/__openerp__.py
Index: addons/openacademy/__manifest__.py
===================================================================
--- addons.orig/openacademy/__openerp__.py 2014-08-29 08:39:43.975536806 +0200
+++ addons/openacademy/__openerp__.py 2014-08-29 08:39:52.000000000 +0200
--- addons.orig/openacademy/__manifest__.py 2014-08-29 08:39:43.975536806 +0200
+++ addons/openacademy/__manifest__.py 2014-08-29 08:39:52.000000000 +0200
@@ -31,6 +31,7 @@
'views/openacademy.xml',
'views/partner.xml',
+3 -3
View File
@@ -2,9 +2,9 @@
# Parent c72382bf0c5794135fa318f6ba59899b2277d8c5
# Parent 82f902dbb7aab4d3ddd9caaa9170536afa9d274d
diff --git a/openacademy/__openerp__.py b/openacademy/__openerp__.py
--- a/openacademy/__openerp__.py
+++ b/openacademy/__openerp__.py
diff --git a/openacademy/__manifest__.py b/openacademy/__manifest__.py
--- a/openacademy/__manifest__.py
+++ b/openacademy/__manifest__.py
@@ -29,6 +29,7 @@
'templates.xml',
'views/openacademy.xml',
+8 -8
View File
@@ -205,9 +205,9 @@ Odoo’s themes are packaged like modules. Even if you are designing a very simp
Create a folder and name it like this: ``theme_`` followed by your
theme's name.
``__openerp__.py``
``__manifest__.py``
Create an empty document and save it to your folder as
``__openerp__.py``. This will contain the configuration info for
``__manifest__.py``. This will contain the configuration info for
your theme.
``__init__.py``
@@ -229,10 +229,10 @@ The final result should be something like this:
.. image:: theme_tutorial_assets/img/folder.jpg
Edit ``__openerp__.py``
Edit ``__manifest__.py``
-----------------------
Open the ``__openerp__.py`` you created and copy/paste the following:
Open the ``__manifest__.py`` you created and copy/paste the following:
.. code-block:: python
@@ -349,7 +349,7 @@ target css rules to that element and avoid these affecting other content on the
The second xpath will add a welcome message just after the navigation menu.
The last step is to add layout.xml to the list of xml files used by
the theme. To do that, edit your ``__openerp__.py`` file like this
the theme. To do that, edit your ``__manifest__.py`` file like this
.. code-block:: python
@@ -457,7 +457,7 @@ can fill with snippets. To achieve this, just create a ``div`` with
You can create as many snippet areas as you like and place them anywhere in your pages.
Our page is almost ready. Now all we have to do is add **pages.xml** in our **__openerp__.py** file
Our page is almost ready. Now all we have to do is add **pages.xml** in our **__manifest__.py** file
.. code-block:: python
@@ -560,7 +560,7 @@ assets*".
Placing it after the last one, we ensure that our file will
be loaded at the end and take priority.
Finally add **assets.xml** in your **__openerp__.py** file.
Finally add **assets.xml** in your **__manifest__.py** file.
Update your theme
@@ -717,7 +717,7 @@ the attribute will automatically be applied to the element.
Since ``select_class`` method avoids multiple selections, the last "empty"
option will reset the snippet to default.
Add **options.xml** to ``__openerp__.py`` and update your theme.
Add **options.xml** to ``__manifest__.py`` and update your theme.
.. image:: theme_tutorial_assets/img/restart.png
+3 -3
View File
@@ -55,7 +55,7 @@ If you browse the ``petstore`` folder, you should see the following content:
| `-- mice.jpg
|-- __init__.py
|-- oepetstore.message_of_the_day.csv
|-- __openerp__.py
|-- __manifest__.py
|-- petstore_data.xml
|-- petstore.py
|-- petstore.xml
@@ -103,7 +103,7 @@ sub-folders are conventional and not strictly necessary.
Which only prints a small message in the browser's console.
The files in the ``static`` folder, need to be defined within the module in order for them to be loaded correctly. Everything in ``src/xml`` is defined in ``__openerp__.py`` while the contents of ``src/css`` and ``src/js`` are defined in ``petstore.xml``, or a similar file.
The files in the ``static`` folder, need to be defined within the module in order for them to be loaded correctly. Everything in ``src/xml`` is defined in ``__manifest__.py`` while the contents of ``src/css`` and ``src/js`` are defined in ``petstore.xml``, or a similar file.
.. warning::
@@ -127,7 +127,7 @@ The files in the ``static`` folder, need to be defined within the module in orde
This will reload the web client with optimizations disabled, making
development and debugging significantly more comfortable.
.. todo:: qweb files hooked via __openerp__.py, but js and CSS use bundles
.. todo:: qweb files hooked via __manifest__.py, but js and CSS use bundles
Odoo JavaScript Module
======================
+1 -1
View File
@@ -88,7 +88,7 @@ own :ref:`QWeb <reference/qweb>` templating system which integrates with other
features.
Create a template and ensure the template file is registered in the
``__openerp__.py`` manifest, and alter the controller to use our template:
``__manifest__.py`` manifest, and alter the controller to use our template:
.. patch::
+3 -3
View File
@@ -2,9 +2,9 @@
# Parent 91c0cc5b319e7bf240d359817b8bd044769a4f5c
# Parent 0a9ec16d98785205f25868bc23485569a1444cf3
diff --git a/academy/__openerp__.py b/academy/__openerp__.py
--- a/academy/__openerp__.py
+++ b/academy/__openerp__.py
diff --git a/academy/__manifest__.py b/academy/__manifest__.py
--- a/academy/__manifest__.py
+++ b/academy/__manifest__.py
@@ -24,7 +24,7 @@
# always loaded
+3 -3
View File
@@ -2,9 +2,9 @@
# Parent 2ee7212e5de4702dff08d9b5e4268e7dc261d038
# Parent 4ca7b848bb60c3573de7ed41a28b4b65186a5725
diff --git a/academy/__openerp__.py b/academy/__openerp__.py
--- a/academy/__openerp__.py
+++ b/academy/__openerp__.py
diff --git a/academy/__manifest__.py b/academy/__manifest__.py
--- a/academy/__manifest__.py
+++ b/academy/__manifest__.py
@@ -27,6 +27,7 @@
'security/ir.model.access.csv',
'templates.xml',
+2 -2
View File
@@ -10,10 +10,10 @@ new file mode 100644
+# -*- coding: utf-8 -*-
+import controllers
+import models
diff --git a/academy/__openerp__.py b/academy/__openerp__.py
diff --git a/academy/__manifest__.py b/academy/__manifest__.py
new file mode 100644
--- /dev/null
+++ b/academy/__openerp__.py
+++ b/academy/__manifest__.py
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+{
+3 -3
View File
@@ -2,9 +2,9 @@
# Parent 6106208621f01d5aea67727f09adf5c5b2a38642
# Parent ae97cfb61fd0e1a47727a9d8ed4a702116254eff
diff --git a/academy/__openerp__.py b/academy/__openerp__.py
--- a/academy/__openerp__.py
+++ b/academy/__openerp__.py
diff --git a/academy/__manifest__.py b/academy/__manifest__.py
--- a/academy/__manifest__.py
+++ b/academy/__manifest__.py
@@ -20,7 +20,7 @@
'version': '0.1',
+3 -3
View File
@@ -2,9 +2,9 @@
# Parent c8cc9e66a2701dad6589ff1d950e1cb7738d0854
# Parent 44a09b8865d418cda8b7c46dfb70fadc86e22184
diff --git a/academy/__openerp__.py b/academy/__openerp__.py
--- a/academy/__openerp__.py
+++ b/academy/__openerp__.py
diff --git a/academy/__manifest__.py b/academy/__manifest__.py
--- a/academy/__manifest__.py
+++ b/academy/__manifest__.py
@@ -26,6 +26,7 @@
'data': [
'security/ir.model.access.csv',
+3 -3
View File
@@ -2,9 +2,9 @@
# Parent 7ae0db4c2ddf5d0f7f58db2af8976fcec905cc4e
# Parent 06f959831b14dd5d2e0a57d3e14bf919e18f8e3a
diff --git a/academy/__openerp__.py b/academy/__openerp__.py
--- a/academy/__openerp__.py
+++ b/academy/__openerp__.py
diff --git a/academy/__manifest__.py b/academy/__manifest__.py
--- a/academy/__manifest__.py
+++ b/academy/__manifest__.py
@@ -20,7 +20,7 @@
'version': '0.1',
+1 -1
View File
@@ -95,7 +95,7 @@ The complete tree should look like
addons/<my_module_name>/
|-- __init__.py
|-- __openerp__.py
|-- __manifest__.py
|-- controllers/
| |-- __init__.py
| |-- <inherited_module_name>.py
+1 -1
View File
@@ -14,7 +14,7 @@ Manifest
The manifest file serves to declare a python package as an Odoo module
and to specify module metadata.
It is a file called ``__openerp__.py`` and contains a single Python
It is a file called ``__manifest__.py`` and contains a single Python
dictionary, where each key specifies module metadatum.
::
-3
View File
@@ -9,9 +9,6 @@ import jinja2
from . import Command
from odoo.modules.module import (get_module_root, MANIFEST, load_information_from_description_file as load_manifest)
class Scaffold(Command):
""" Generates an Odoo module skeleton. """
+6 -3
View File
@@ -2,12 +2,13 @@
# -*- coding: utf-8 -*-
import argparse
import glob
import itertools
import os
import sys
from . import Command
from .server import main
from odoo.modules.module import get_module_root, MANIFEST
from odoo.modules.module import get_module_root, MANIFEST_NAMES
from odoo.service.db import _create_empty_database, DatabaseExists
@@ -15,10 +16,12 @@ class Start(Command):
"""Quick start the Odoo server for your project"""
def get_module_list(self, path):
mods = glob.glob(os.path.join(path, '*/%s' % MANIFEST))
mods = itertools.chain.from_iterable(
glob.glob(os.path.join(path, '*/%s' % mname))
for mname in MANIFEST_NAMES
)
return [mod.split(os.path.sep)[-2] for mod in mods]
def run(self, cmdargs):
parser = argparse.ArgumentParser(
prog="%s start" % sys.argv[0].split(os.path.sep)[-1],
+7 -4
View File
@@ -23,6 +23,7 @@ import traceback
import urllib2
import urlparse
import warnings
from os.path import join as opj
from zlib import adler32
import babel.core
@@ -49,6 +50,8 @@ from odoo.service import security, model as service_model
from odoo.tools.func import lazy_property
from odoo.tools import ustr, consteq, frozendict
from odoo.modules.module import module_manifest
_logger = logging.getLogger(__name__)
rpc_request = logging.getLogger(__name__ + '.rpc.request')
rpc_response = logging.getLogger(__name__ + '.rpc.response')
@@ -1307,13 +1310,13 @@ class Root(object):
controllers and configure them. """
# TODO should we move this to ir.http so that only configured modules are served ?
statics = {}
for addons_path in odoo.modules.module.ad_paths:
for module in sorted(os.listdir(str(addons_path))):
if module not in addons_module:
manifest_path = os.path.join(addons_path, module, '__openerp__.py')
path_static = os.path.join(addons_path, module, 'static')
if os.path.isfile(manifest_path) and os.path.isdir(path_static):
mod_path = opj(addons_path, module)
manifest_path = module_manifest(mod_path)
path_static = opj(addons_path, module, 'static')
if manifest_path and os.path.isdir(path_static):
manifest = ast.literal_eval(open(manifest_path).read())
if not manifest.get('installable', True):
continue
+54 -52
View File
@@ -24,7 +24,7 @@ import odoo.tools as tools
import odoo.release as release
from odoo import SUPERUSER_ID, api
MANIFEST = '__openerp__.py'
MANIFEST_NAMES = ('__manifest__.py', '__openerp__.py')
README = ['README.rst', 'README.md', 'README.txt']
_logger = logging.getLogger(__name__)
@@ -253,6 +253,14 @@ def get_module_icon(module):
return ('/' + module + '/') + '/'.join(iconpath)
return '/base/' + '/'.join(iconpath)
def module_manifest(path):
"""Returns path to module manifest if one can be found under `path`, else `None`."""
if not path:
return None
for manifest_name in MANIFEST_NAMES:
if os.path.isfile(opj(path, manifest_name)):
return opj(path, manifest_name)
def get_module_root(path):
"""
Get closest module's root begining from path
@@ -273,8 +281,8 @@ def get_module_root(path):
@return: Module root path or None if not found
"""
while not os.path.exists(os.path.join(path, MANIFEST)):
new_path = os.path.abspath(os.path.join(path, os.pardir))
while not module_manifest(path):
new_path = os.path.abspath(opj(path, os.pardir))
if path == new_path:
return None
path = new_path
@@ -285,58 +293,53 @@ def load_information_from_description_file(module, mod_path=None):
:param module: The name of the module (sale, purchase, ...)
:param mod_path: Physical path of module, if not providedThe name of the module (sale, purchase, ...)
"""
if not mod_path:
mod_path = get_module_path(module)
terp_file = mod_path and opj(mod_path, MANIFEST) or False
if terp_file:
info = {}
if os.path.isfile(terp_file):
# default values for descriptor
info = {
'application': False,
'author': 'Odoo S.A.',
'auto_install': False,
'category': 'Uncategorized',
'depends': [],
'description': '',
'icon': get_module_icon(module),
'installable': True,
'license': 'LGPL-3',
'post_load': None,
'version': '1.0',
'web': False,
'website': 'https://www.odoo.com',
'sequence': 100,
'summary': '',
}
info.update(itertools.izip(
'depends data demo test init_xml update_xml demo_xml'.split(),
iter(list, None)))
manifest_file = module_manifest(mod_path)
if manifest_file:
# default values for descriptor
info = {
'application': False,
'author': 'Odoo S.A.',
'auto_install': False,
'category': 'Uncategorized',
'depends': [],
'description': '',
'icon': get_module_icon(module),
'installable': True,
'license': 'LGPL-3',
'post_load': None,
'version': '1.0',
'web': False,
'website': 'https://www.odoo.com',
'sequence': 100,
'summary': '',
}
info.update(itertools.izip(
'depends data demo test init_xml update_xml demo_xml'.split(),
iter(list, None)))
f = tools.file_open(terp_file)
try:
info.update(ast.literal_eval(f.read()))
finally:
f.close()
f = tools.file_open(manifest_file)
try:
info.update(ast.literal_eval(f.read()))
finally:
f.close()
if not info.get('description'):
readme_path = [opj(mod_path, x) for x in README
if os.path.isfile(opj(mod_path, x))]
if readme_path:
readme_text = tools.file_open(readme_path[0]).read()
info['description'] = readme_text
if not info.get('description'):
readme_path = [opj(mod_path, x) for x in README
if os.path.isfile(opj(mod_path, x))]
if readme_path:
readme_text = tools.file_open(readme_path[0]).read()
info['description'] = readme_text
if 'active' in info:
# 'active' has been renamed 'auto_install'
info['auto_install'] = info['active']
if 'active' in info:
# 'active' has been renamed 'auto_install'
info['auto_install'] = info['active']
info['version'] = adapt_version(info['version'])
return info
info['version'] = adapt_version(info['version'])
return info
#TODO: refactor the logger in this file to follow the logging guidelines
# for 6.0
_logger.debug('module %s: no %s file found.', module, MANIFEST)
_logger.debug('module %s: no manifest file found %s', module, MANIFEST_NAMES)
return {}
def load_openerp_module(module_name):
@@ -353,7 +356,6 @@ def load_openerp_module(module_name):
initialize_sys_path()
try:
mod_path = get_module_path(module_name)
__import__('odoo.addons.' + module_name)
# Call the module's post-load hook. This can done before any model or
@@ -382,9 +384,9 @@ def get_modules():
return name
def is_really_module(name):
manifest_name = opj(dir, name, MANIFEST)
zipfile_name = opj(dir, name)
return os.path.isfile(manifest_name)
for mname in MANIFEST_NAMES:
if os.path.isfile(opj(dir, name, mname)):
return True
return map(clean, filter(is_really_module, os.listdir(dir)))
plist = []
+2 -1
View File
@@ -458,12 +458,13 @@ class configmanager(object):
odoo.conf.server_wide_modules = ['web','web_kanban']
def _is_addons_path(self, path):
from odoo.modules.module import MANIFEST_NAMES
for f in os.listdir(path):
modpath = os.path.join(path, f)
if os.path.isdir(modpath):
def hasfile(filename):
return os.path.isfile(os.path.join(modpath, filename))
if hasfile('__init__.py') and (hasfile('__openerp__.py') or hasfile('__terp__.py')):
if hasfile('__init__.py') and any(hasfile(mname) for mname in MANIFEST_NAMES):
return True
return False