[MERGE] merge from trunk addons

bzr revid: mra@mra-laptop-20100928124820-qj1wqixgbe8zsq7d
This commit is contained in:
Mustufa Rangwala 2010-09-28 18:18:20 +05:30
commit d588d72dcd
22 changed files with 5540 additions and 1 deletions

View File

@ -20,7 +20,6 @@
#
##############################################################################
import time
from mx import DateTime
from osv import osv, fields
from decimal import Decimal

View File

@ -3,6 +3,8 @@
-
!python {model: account.invoice}: |
import netsvc, tools, os
run_str = 'cp ' + tools.config['addons_path'] + '/l10n_ch/report/ocrbb.ttf' + ' ' + '/tmp/ocrbb.ttf'
os.system(run_str)
(data, format) = netsvc.LocalService('report.l10n_ch.bvr').create(cr, uid, [ref('account.test_invoice_1')], {}, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'l10ch-bvr_report.'+format), 'wb+').write(data)

View File

@ -39,6 +39,15 @@ class stock_move(osv.osv):
_columns = {
'move_dest_id_lines': fields.one2many('stock.move','move_dest_id', 'Children Moves')
}
def copy(self, cr, uid, id, default=None, context={}):
if default is None:
default = {}
default.update({
'move_dest_id_lines': [],
})
return super(stock_move, self).copy(cr, uid, id, default, context)
stock_move()
class mrp_production_workcenter_line(osv.osv):

View File

@ -49,5 +49,6 @@ keep track for the wiki groups, pages, and history
'installable': True,
'active': False,
'certificate': '0086363630317',
'web': True,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,2 @@
import widgets
import controllers

View File

@ -0,0 +1 @@
import wiki

View File

@ -0,0 +1,65 @@
###############################################################################
#
# Copyright (C) 2007-TODAY Tiny ERP Pvt Ltd. All Rights Reserved.
#
# $Id$
#
# Developed by Tiny (http://openerp.com) and Axelor (http://axelor.com).
#
# The OpenERP web client is distributed under the "OpenERP Public License".
# It's based on Mozilla Public License Version (MPL) 1.1 with following
# restrictions:
#
# - All names, links and logos of Tiny, OpenERP and Axelor must be
# kept as in original distribution without any changes in all software
# screens, especially in start-up page and the software header, even if
# the application source code has been changed or updated or code has been
# added.
#
# - All distributions of the software must keep source code with OEPL.
#
# - All integrations to any other software must keep source code with OEPL.
#
# If you need commercial licence to remove this kind of restriction please
# contact us.
#
# You can see the MPL licence at: http://www.mozilla.org/MPL/MPL-1.1.html
#
###############################################################################
import base64
import cherrypy
from openobject.tools import expose
from openerp.utils import rpc
from openerp.controllers import SecuredController
class WikiView(SecuredController):
_cp_path = "/wiki/wiki"
def get_attachment(self, **kwargs):
attachments = rpc.RPCProxy('ir.attachment')
file_name = kwargs.get('file').replace("'", '').strip()
id = kwargs.get('id').strip()
ids = attachments.search([('datas_fname', '=', file_name),
('res_model', '=', 'wiki.wiki'),
('res_id', '=', id)])
res = attachments.read(ids, ['datas'])[0].get('datas')
return res, file_name
@expose(content_type='application/octet')
def getImage(self, *kw, **kws):
res, _ = self.get_attachment(**kws)
return base64.decodestring(res)
@expose(content_type='application/octet')
def getfile(self, *kw, **kws):
res, file_name = self.get_attachment(**kws)
cherrypy.response.headers['Content-Disposition'] = 'filename="%s"' % (file_name,)
return base64.decodestring(res)

View File

@ -0,0 +1,20 @@
# German (Germany) translations for PROJECT.
# Copyright (C) 2009 ORGANIZATION
# This file is distributed under the same license as the PROJECT project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2009.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2009-11-18 17:21+0530\n"
"PO-Revision-Date: 2010-08-02 17:53+0530\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: de_DE <LL@li.org>\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel None\n"

View File

@ -0,0 +1,24 @@
# German (Germany) translations for PROJECT.
# Copyright (C) 2009 ORGANIZATION
# This file is distributed under the same license as the PROJECT project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2009.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2009-11-18 17:21+0530\n"
"PO-Revision-Date: 2010-08-02 17:53+0530\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: de_DE <LL@li.org>\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel None\n"
#: widgets/wikimarkup/__init__.py:1981
msgid "Table of Contents"
msgstr ""

View File

@ -0,0 +1,20 @@
# Spanish (Spain) translations for PROJECT.
# Copyright (C) 2009 ORGANIZATION
# This file is distributed under the same license as the PROJECT project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2009.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2009-11-18 17:21+0530\n"
"PO-Revision-Date: 2010-08-02 17:53+0530\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: es_ES <LL@li.org>\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel None\n"

View File

@ -0,0 +1,24 @@
# Spanish (Spain) translations for PROJECT.
# Copyright (C) 2009 ORGANIZATION
# This file is distributed under the same license as the PROJECT project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2009.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2009-11-18 17:21+0530\n"
"PO-Revision-Date: 2010-08-02 17:53+0530\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: es_ES <LL@li.org>\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel None\n"
#: widgets/wikimarkup/__init__.py:1981
msgid "Table of Contents"
msgstr ""

View File

@ -0,0 +1,20 @@
# French (France) translations for PROJECT.
# Copyright (C) 2009 ORGANIZATION
# This file is distributed under the same license as the PROJECT project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2009.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2009-11-18 17:21+0530\n"
"PO-Revision-Date: 2010-08-02 17:53+0530\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: fr_FR <LL@li.org>\n"
"Plural-Forms: nplurals=2; plural=(n > 1)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel None\n"

View File

@ -0,0 +1,24 @@
# French (France) translations for PROJECT.
# Copyright (C) 2009 ORGANIZATION
# This file is distributed under the same license as the PROJECT project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2009.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2009-11-18 17:21+0530\n"
"PO-Revision-Date: 2010-08-02 17:53+0530\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: fr_FR <LL@li.org>\n"
"Plural-Forms: nplurals=2; plural=(n > 1)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel None\n"
#: widgets/wikimarkup/__init__.py:1981
msgid "Table of Contents"
msgstr ""

View File

@ -0,0 +1,19 @@
# Translations template for PROJECT.
# Copyright (C) 2010 ORGANIZATION
# This file is distributed under the same license as the PROJECT project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2010-08-02 17:52+0530\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel None\n"

View File

@ -0,0 +1,23 @@
# Translations template for PROJECT.
# Copyright (C) 2010 ORGANIZATION
# This file is distributed under the same license as the PROJECT project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2010-08-02 17:52+0530\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel None\n"
#: widgets/wikimarkup/__init__.py:1981
msgid "Table of Contents"
msgstr ""

View File

@ -0,0 +1,32 @@
.wikiwidget #toc {
border:1px solid #aaaaaa;
background-color:#f9f9f9;
padding:5px;
}
h1, h2, h3, h4, h5, h6 {
color: black;
background: none;
font-weight: normal;
margin: 0;
padding-top: .5em;
padding-bottom: .17em;
border-bottom: 1px solid #aaa;
}
h1 { font-size: 188%; }
h2 { font-size: 150%; }
h3, h4, h5, h6 {
border-bottom: none;
}
h3 { font-size: 132%; }
h4 { font-size: 116%; }
h5 { font-size: 100%; }
h6 { font-size: 80%; }
pre {
background-color:#F9F9F9;
border:1px dashed #2F6FAB;
color:black;
line-height:1.1em;
padding:1em;
}

View File

@ -0,0 +1 @@
from wiki import WikiWidget

View File

@ -0,0 +1 @@
import feedparser

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,23 @@
% if editable and not inline:
<textarea rows="10" id="${name}" name="${name}" class="${css_class}"
${py.attrs(attrs, kind=kind)} style="width: 99%;">${value}</textarea>
<script type="text/javascript">
if (!window.browser.isWebKit) {
new openerp.ui.TextArea('${name}');
}
</script>
% endif
% if editable and inline:
<input type="text" id="${name}" name="${name}" class="${css_class}"
${py.attrs(attrs, kind=kind, value=value)}/>
% endif
% if editable and error:
<span class="fielderror">${error}</span>
% endif
% if not editable and value:
<div kind="${kind}" id="${name}" class="${css_class}">${data|n}</div>
% endif

View File

@ -0,0 +1,228 @@
###############################################################################
#
# Copyright (C) 2007-TODAY Tiny ERP Pvt Ltd. All Rights Reserved.
#
# $Id$
#
# Developed by Tiny (http://openerp.com) and Axelor (http://axelor.com).
#
# The OpenERP web client is distributed under the "OpenERP Public License".
# It's based on Mozilla Public License Version (MPL) 1.1 with following
# restrictions:
#
# - All names, links and logos of Tiny, OpenERP and Axelor must be
# kept as in original distribution without any changes in all software
# screens, especially in start-up page and the software header, even if
# the application source code has been changed or updated or code has been
# added.
#
# - All distributions of the software must keep source code with OEPL.
#
# - All integrations to any other software must keep source code with OEPL.
#
# If you need commercial licence to remove this kind of restriction please
# contact us.
#
# You can see the MPL licence at: http://www.mozilla.org/MPL/MPL-1.1.html
#
###############################################################################
import re
import random
import locale
from base64 import b64encode
from base64 import b64decode
from StringIO import StringIO
import cherrypy
import wikimarkup
from openobject.widgets import JSLink, CSSLink
from openerp.utils import rpc
from openerp.widgets import register_widget
from openerp.widgets.form import Text
_image = re.compile(r'img:(.*)\.(.*)', re.UNICODE)
_rss = re.compile(r'rss:(.*)\.(.*)', re.UNICODE)
_attach = re.compile(r'attach:(.*)\.(.*)', re.UNICODE)
_internalLinks = re.compile(r'\[\[.*\]\]', re.UNICODE)
_edit = re.compile(r'edit:(.*)\|(.*)', re.UNICODE)
_view = re.compile(r'view:(.*)\|(.*)', re.UNICODE)
class WikiParser(wikimarkup.Parser):
def parse(self, text, id):
text = text.replace('&nbsp;', 'n-b-s-p')
text = text.replace('&amp;', 'n-a-m-p')
text = text.replace('&','&amp;')
text = text.replace('n-b-s-p', '&nbsp;')
text = text.replace('n-a-m-p', '&amp;')
text = text.replace('<code>', '<pre>')
text = text.replace('</code>', '</pre>')
text = wikimarkup.to_unicode(text)
text = self.strip(text)
text = super(WikiParser, self).parse(text)
text = self.addImage(text, id)
text = self.attachDoc(text, id)
text = self.recordLink(text)
text = self.viewRecordLink(text)
text = self.addInternalLinks(text)
#TODO : already implemented but we will implement it later after releasing the 5.0
#text = self.addRss(text, id)
return text
def viewRecordLink(self, text):
def record(path):
record = path.group().replace('view:','').split("|")
model = record[0]
text = record[1].replace('\r','').strip()
label = "View Record"
if len(record) > 2:
label = record[2]
proxy = rpc.RPCProxy(model)
ids = proxy.name_search(text, [], 'ilike', {})
if len(ids):
id = ids[0][0]
else:
try:
id = int(text)
except:
id = 0
return "[[/openerp/form/view?model=%s&amp;id=%d | %s]]" % (model, id, label)
bits = _view.sub(record, text)
return bits
def addRss(self, text, id):
def addrss(path):
rssurl = path.group().replace('rss:','')
import rss.feedparser as feedparser
data = feedparser.parse(rssurl)
values = "<h2>%s</h2><br/>" % (data.feed.title)
values += "%s<br/>" % (data.channel.description)
for entry in data['entries']:
values += "<h3><a href='%s'> %s </a></h3><br/>" % (entry.link, entry.title)
values += "%s <br/>" % (entry.summary)
return values
bits = _rss.sub(addrss, text)
return bits
def attachDoc(self, text, id):
def document(path):
file = path.group().replace('attach:','')
if file.startswith('http') or file.startswith('ftp'):
return "<a href='%s'>Download File</a>" % (file)
else:
proxy = rpc.RPCProxy('ir.attachment')
ids = proxy.search([('datas_fname','=',file.strip()), ('res_model','=','wiki.wiki'), ('res_id','=',id)])
if len(ids) > 0:
return "<a href='/widget_wiki/wiki/getfile?file=%s&amp;id=%d'>%s</a>" % (file, id, file)
else:
return """<a onclick="openobject.tools.openWindow(openobject.http.getURL('/openerp/attachment', {model: 'wiki.wiki', id: %d}),
{name : 'Wiki Attachments'})">Attach : %s </a>""" % (id, file)
bits = _attach.sub(document, text)
return bits
def addImage(self, text, id):
def image(path):
file = path.group().replace('img:','')
if file.startswith('http') or file.startswith('ftp'):
return "<img src='%s'/>" % (file)
else:
proxy = rpc.RPCProxy('ir.attachment')
ids = proxy.search([('datas_fname','=',file.strip()), ('res_model','=','wiki.wiki'), ('res_id','=',id)])
if len(ids) > 0:
return "<img src='/widget_wiki/wiki/getImage?file=%s&amp;id=%d'/>" % (file, id)
else:
return """<a onclick="openobject.tools.openWindow(openobject.http.getURL('/openerp/attachment', {model: 'wiki.wiki', id: %d}),
{name : 'Wiki Attachments'})">Attach : %s </a>""" % (id, file)
#"[[/attachment/?model=wiki.wiki&amp;id=%d | Attach:%s]]" % (id, file)
bits = _image.sub(image, text)
return bits
def recordLink(self, text):
def record(path):
record = path.group().replace('edit:','').split("|")
model = record[0]
text = record[1].replace('\r','').strip()
label = "Edit Record"
if len(record) > 2:
label = record[2]
proxy = rpc.RPCProxy(model)
ids = proxy.name_search(text, [], '=', {})
if len(ids):
id = ids[0][0]
else:
try:
id = int(text)
except:
id = 0
return "[[/openerp/form/edit?model=%s&amp;id=%d | %s]]" % (model, id, label)
bits = _edit.sub(record, text)
return bits
def addInternalLinks(self, text):
proxy = rpc.RPCProxy('wiki.wiki')
def link(path):
link = path.group().replace('[','').replace('[','').replace(']','').replace(']','').split("|")
name_to_search = link[0].strip()
mids = proxy.search([('name','ilike', name_to_search)])
link_str = ""
if mids:
if len(link) == 2:
link_str = "<a href='/openerp/form/view?model=wiki.wiki&amp;id=%s'>%s</a>" % (mids[0], link[1])
elif len(link) == 1:
link_str = "<a href='/openerp/form/view?model=wiki.wiki&amp;id=%s'>%s</a>" % (mids[0], link[0])
else:
if len(link) == 2:
link_str = "<a href='%s'>%s</a>" % (link[0], link[1])
elif len(link) == 1:
link_str = "<a href='/openerp/form/edit?model=wiki.wiki&amp;id=False'>%s</a>" % (link[0])
return link_str
bits = _internalLinks.sub(link, text)
return bits
def wiki2html(text, showToc, id):
p = WikiParser(show_toc=showToc)
return p.parse(text, id)
class WikiWidget(Text):
template = "/wiki/widgets/templates/wiki.mako"
params = ["data"]
css = [CSSLink("wiki", "css/wiki.css")]
data = None
def set_value(self, value):
super(WikiWidget, self).set_value(value)
if value:
toc = True
id = False
if hasattr(cherrypy.request, 'terp_record'):
params = cherrypy.request.terp_params
if params._terp_model == 'wiki.wiki':
proxy = rpc.RPCProxy('wiki.wiki')
toc = proxy.read([params.id], ['toc'])[0]['toc']
id = params.id
text = value+'\n\n'
html = wiki2html(text, toc, id)
self.data = html
register_widget(WikiWidget, ["text_wiki"])

File diff suppressed because it is too large Load Diff