diff --git a/addons/base_module_publish/base_module_publish_wizard.xml b/addons/base_module_publish/base_module_publish_wizard.xml
index 0c2a13007a2..6dc2238aa41 100644
--- a/addons/base_module_publish/base_module_publish_wizard.xml
+++ b/addons/base_module_publish/base_module_publish_wizard.xml
@@ -10,7 +10,7 @@
diff --git a/addons/base_module_publish/wizard/base_module_publish.py b/addons/base_module_publish/wizard/base_module_publish.py
index 1cfaab61815..8fe4422e8aa 100644
--- a/addons/base_module_publish/wizard/base_module_publish.py
+++ b/addons/base_module_publish/wizard/base_module_publish.py
@@ -41,14 +41,15 @@ intro_form = '''
'''
intro_fields = {
- 'text': {'string':'Introduction', 'type':'text', 'readonly':True, 'default': lambda *args: """
+ 'text': {'string':'Introduction', 'type':'text', 'readonly':True,
+ 'default': lambda *args: """
This system will automatically publish the selected module to the
Tiny ERP official website. You can use it to quickly publish a new
module or update an existing one (new version).
Make sure you read the publication manual and modules guidelines
before continuing:
- http://tinyerp.com
+ http://www.tinyerp.com
Thank you for contributing !
"""},
@@ -67,59 +68,69 @@ check_form = '''
'''
check_fields = {
'name': {'string':'Name', 'type':'char', 'size':64, 'readonly':True},
- 'shortdesc': {'string':'Small description', 'type':'char', 'size':200, 'readonly':True},
+ 'shortdesc': {'string':'Small description', 'type':'char', 'size':200,
+ 'readonly':True},
'author': {'string':'Author', 'type':'char', 'size':128, 'readonly':True},
'website': {'string':'Website', 'type':'char', 'size':200, 'readonly':True},
'url': {'string':'Download URL', 'type':'char', 'size':200, 'readonly':True},
- 'image': {'string':'Image file', 'type':'image'},
+ 'image': {'string':'Image file', 'type':'image', 'help': 'support only .png files'},
'description': {'string':'Description', 'type':'text', 'readonly':True},
'version': {'string':'Version', 'type':'char', 'readonly':True},
- 'demourl': {'string':'Demo URL', 'type':'char', 'size':128},
- 'docurl': {'string':'Documentation URL', 'type':'char', 'size':128},
+ 'demourl': {'string':'Demo URL', 'type':'char', 'size':128,
+ 'help': 'empty to keep existing value'},
+ 'docurl': {'string':'Documentation URL', 'type':'char', 'size':128,
+ 'help': 'Empty to keep existing value'},
'category': {'string':'Category', 'type':'selection', 'size':64, 'required':True,
- 'selection': _get_selection
- },
- 'licence': {
+ 'selection': _get_selection},
+ 'license': {
'string':'Licence', 'type':'selection', 'size':64, 'required':True,
- 'selection': [('GPL', 'GPL'), ('Other proprietary','Other proprietary')],
- 'default': lambda *args: 'GPL'
+ 'selection': [('GPL-2', 'GPL-2'), ('Other proprietary','Other proprietary')],
+ 'default': lambda *args: 'GPL-2'
},
+ 'include_src': {'string': 'Include source', 'type': 'boolean',
+ 'default': lambda *a: True},
'operation': {
'string':'Operation',
'type':'selection',
'readonly':True,
'selection':[('0','Creation'),('1','Modification')],
},
- 'url_download': {'string':'Download URL', 'type':'char', 'size':128},
+ 'url_download': {'string':'Download URL', 'type':'char', 'size':128,
+ 'help': 'Keep empty for an auto upload of the module'},
}
upload_info_form = '''
'''
end_fields = {
- 'text_end': {'string':'Summary', 'type':'text', 'readonly':True, 'default': lambda *args: """
+ 'text_end': {'string':'Summary', 'type':'text', 'readonly':True,
+ 'default': lambda *args: """
Thank you for contributing !
Your module has been successfully uploaded to the official website.
@@ -183,7 +197,8 @@ def post_multipart(host, selector, fields, files):
L.append(value)
for (key,fname,value) in files:
L.append('--' + BOUNDARY)
- L.append('Content-Disposition: form-data; name="%s"; filename="%s"' % (key, fname))
+ L.append('Content-Disposition: form-data; name="%s"; filename="%s"'
+ % (key, fname))
L.append('Content-Type: application/octet-stream')
L.append('')
L.append(value)
@@ -210,11 +225,10 @@ def _upload(self, cr, uid, datas, context):
mod = pool.get('ir.module.module').browse(cr, uid, datas['id'])
download = datas['form']['url_download'] or ''
if not download:
- res = module_zip.createzip(cr, uid, datas['id'], context, b64enc=False)
-
- download = 'http://tinyerp.com/download/modules/'+res['module_filename']
-
- result = post_multipart('www.tinyerp.com', '/mtree_upload.php',
+ res = module_zip.createzip(cr, uid, datas['id'], context,
+ b64enc=False, src=datas['form']['include_src'])
+ download = 'http://www.tinyerp.com/download/modules/'+res['module_filename']
+ result = post_multipart('www.tinyerp.com', '/mtree_upload.php',
[
('login',datas['form']['login']),
('password',datas['form']['password']),
@@ -223,8 +237,6 @@ def _upload(self, cr, uid, datas, context):
('module', res['module_filename'], res['module_file'])
])
- # module_file & module_filename
-
updata = {
'link_name': mod.shortdesc or '',
'new_cat_id': datas['form']['category'],
@@ -236,7 +248,7 @@ def _upload(self, cr, uid, datas, context):
'cust_2': datas['form']['demourl'] or '', # Put here the download url
'cust_3': mod.url or '/',
'cust_4': datas['form']['docurl'] or '',
- 'cust_5': datas['form']['licence'] or '',
+ 'cust_5': datas['form']['license'] or '',
'cust_6': mod.latest_version or '',
'cust_7': mod.name,
'option': 'com_mtree',
@@ -256,7 +268,8 @@ def _upload(self, cr, uid, datas, context):
files = []
if datas['form']['image']:
- files.append(('link_image', 'link_image.png', base64.decodestring(datas['form']['image'])))
+ files.append(('link_image', 'link_image.png',
+ base64.decodestring(datas['form']['image'])))
result = post_multipart('www.tinyerp.com', '/index.php', updata.items(), files)
return {'result': result}
@@ -276,11 +289,11 @@ def module_check(self, cr, uid, data, context):
class base_module_publish(wizard.interface):
states = {
'init': {
- 'actions': [],
+ 'actions': [],
'result': {
- 'type':'form',
+ 'type':'form',
'arch':intro_form,
- 'fields':intro_fields,
+ 'fields':intro_fields,
'state':[
('end','Cancel'),
('step1','Continue')
@@ -288,11 +301,11 @@ class base_module_publish(wizard.interface):
}
},
'step1': {
- 'actions': [module_check,_get_edit],
+ 'actions': [module_check, _get_edit],
'result': {
- 'type':'form',
+ 'type':'form',
'arch':check_form,
- 'fields':check_fields,
+ 'fields':check_fields,
'state':[
('end','Cancel'),
('init', 'Previous'),
@@ -303,9 +316,9 @@ class base_module_publish(wizard.interface):
'step2': {
'actions': [],
'result': {
- 'type':'form',
+ 'type':'form',
'arch':upload_info_form,
- 'fields':upload_info_fields,
+ 'fields':upload_info_fields,
'state':[
('end','Cancel'),
('step1', 'Previous'),
@@ -316,9 +329,9 @@ class base_module_publish(wizard.interface):
'publish': {
'actions': [_upload], # Action to develop: upload method
'result': {
- 'type':'form',
+ 'type':'form',
'arch':end_form,
- 'fields':end_fields,
+ 'fields':end_fields,
'state':[
('end','Close')
]
diff --git a/addons/base_module_publish/wizard/module_zip.py b/addons/base_module_publish/wizard/module_zip.py
index d3698cafc8e..68d4ddfdfc4 100644
--- a/addons/base_module_publish/wizard/module_zip.py
+++ b/addons/base_module_publish/wizard/module_zip.py
@@ -8,20 +8,23 @@ from zipfile import PyZipFile, ZIP_DEFLATED
import StringIO
import base64
-def _zippy(archive, fromurl, path):
+def _zippy(archive, fromurl, path, src=True):
url = os.path.join(fromurl, path)
if os.path.isdir(url):
if path.split('/')[-1]=='.svn':
return False
for fname in os.listdir(url):
- _zippy(archive, fromurl, path and os.path.join(path, fname) or fname)
+ _zippy(archive, fromurl, path and os.path.join(path, fname) or fname, src=src)
else:
- if (path.split('.')[-1] not in ['py','pyo','pyc']) or (os.path.basename(path)=='__terp__.py'):
- print 'Adding', os.path.join(fromurl, path), 'as', path
+ if src:
+ exclude = ['pyo', 'pyc']
+ else:
+ exclude = ['py','pyo','pyc']
+ if (path.split('.')[-1] not in exclude) or (os.path.basename(path)=='__terp__.py'):
archive.write(os.path.join(fromurl, path), path)
return True
-def createzip(cr, uid, moduleid, context, b64enc=True):
+def createzip(cr, uid, moduleid, context, b64enc=True, src=True):
module_obj=pooler.get_pool(cr.dbname).get('ir.module.module')
module_name = module_obj.browse(cr, uid, moduleid).name
module_version = module_obj.browse(cr, uid, moduleid).latest_version
@@ -31,7 +34,7 @@ def createzip(cr, uid, moduleid, context, b64enc=True):
archname = StringIO.StringIO('wb')
archive = PyZipFile(archname, "w", ZIP_DEFLATED)
archive.writepy(os.path.join(ad,module_name))
- _zippy(archive, ad, module_name)
+ _zippy(archive, ad, module_name, src=src)
archive.close()
val =archname.getvalue()
archname.close()
diff --git a/addons/base_module_publish/wizard/wizard_module_export.py b/addons/base_module_publish/wizard/wizard_module_export.py
index 8a13129b982..b8d9a65079e 100644
--- a/addons/base_module_publish/wizard/wizard_module_export.py
+++ b/addons/base_module_publish/wizard/wizard_module_export.py
@@ -31,14 +31,24 @@ import pooler
import module_zip
-finish_form ='''
+init_form = '''
+'''
+
+init_fields = {
+ 'include_src': {'string': 'Include sources', 'type': 'boolean',
+ 'default': lambda *a: True,},
+}
+
+finish_form = '''
-'''
+'''
finish_fields = {
'module_file': {'string': 'Module .zip file', 'type':'binary', 'readonly':True},
@@ -47,17 +57,18 @@ finish_fields = {
class move_module_wizard(wizard.interface):
def createzip(self, cr, uid, data, context):
- return module_zip.createzip(cr, uid, data['id'], context)
+ return module_zip.createzip(cr, uid, data['id'], context, src=data['form']['include_src'])
states = {
'init': {
+ 'actions': [],
+ 'result': {'type': 'form', 'arch': init_form,
+ 'fields': init_fields, 'state': [('end', 'Cancel'), ('zip', 'Ok')]},
+ },
+ 'zip': {
'actions': [createzip],
- 'result': {
- 'type':'form',
- 'arch':finish_form,
- 'fields':finish_fields,
- 'state':[('end','Close')]
- }
+ 'result': {'type': 'form', 'arch': finish_form,
+ 'fields': finish_fields, 'state': [('end', 'Close')]},
}
}
-move_module_wizard('base.module.export')
+move_module_wizard('base_module_publish.module_export')