[MERGE] branch merged with lp:~openerp-dev/openobject-addons/trunk-dev-addons3

bzr revid: mtr@mtr-20101214062148-l81pwyxqkk1c20t8
This commit is contained in:
mtr
2010-12-14 11:51:48 +05:30
11 changed files with 270 additions and 32 deletions
+14 -14
View File
@@ -289,20 +289,20 @@ class account_account(osv.osv):
sums = {}
while brs:
current = brs[0]
can_compute = True
for child in current.child_id:
if child.id not in sums:
can_compute = False
try:
brs.insert(0, brs.pop(brs.index(child)))
except ValueError:
brs.insert(0, child)
if can_compute:
brs.pop(0)
for fn in field_names:
sums.setdefault(current.id, {})[fn] = accounts.get(current.id, {}).get(fn, 0.0)
if current.child_id:
sums[current.id][fn] += sum(sums[child.id][fn] for child in current.child_id)
# can_compute = True
# for child in current.child_id:
# if child.id not in sums:
# can_compute = False
# try:
# brs.insert(0, brs.pop(brs.index(child)))
# except ValueError:
# brs.insert(0, child)
# if can_compute:
brs.pop(0)
for fn in field_names:
sums.setdefault(current.id, {})[fn] = accounts.get(current.id, {}).get(fn, 0.0)
if current.child_id:
sums[current.id][fn] += sum(sums[child.id][fn] for child in current.child_id)
res = {}
null_result = dict((fn, 0.0) for fn in field_names)
for id in ids:
+1 -2
View File
@@ -72,7 +72,7 @@ class email_server(osv.osv):
}
def check_duplicate(self, cr, uid, ids):
# RFC *-* Why this limitation? why not in SQL constraint?
# RFC *-* Why this limitation? why not in SQL constraint?
vals = self.read(cr, uid, ids, ['user', 'password'])[0]
cr.execute("select count(id) from email_server where user=%s and password=%s", (vals['user'], vals['password']))
res = cr.fetchone()
@@ -113,7 +113,6 @@ class email_server(osv.osv):
for server in self.browse(cr, uid, ids, context):
logger.notifyChannel('imap', netsvc.LOG_INFO, 'fetchmail start checking for new emails on %s' % (server.name))
context.update({'server_id': server.id, 'server_type': server.type})
count = 0
try:
if server.type == 'imap':
imap_server = None
-16
View File
@@ -7,21 +7,5 @@
<field name="type">general</field>
</record>
<record id="product_consultant" model="product.product">
<field name="list_price">75.0</field>
<field name="standard_price">30.0</field>
<field name="uom_id" ref="product.uom_hour"/>
<field name="uom_po_id" ref="product.uom_hour"/>
<field name="name">Service on Timesheet</field>
<field name="categ_id" ref="product.cat0"/>
<field name="type">service</field>
<field eval="False" name="purchase_ok"/>
</record>
<record id="hr.employee" model="hr.employee">
<field name="product_id" ref="product_consultant"/>
<field name="journal_id" ref="analytic_journal"/>
</record>
</data>
</openerp>
+15
View File
@@ -2,6 +2,21 @@
<openerp>
<data noupdate="1">
<record id="product_consultant" model="product.product">
<field name="list_price">75.0</field>
<field name="standard_price">30.0</field>
<field name="uom_id" ref="product.uom_hour"/>
<field name="uom_po_id" ref="product.uom_hour"/>
<field name="name">Service on Timesheet</field>
<field name="categ_id" ref="product.cat0"/>
<field name="type">service</field>
<field eval="False" name="purchase_ok"/>
</record>
<record id="hr.employee" model="hr.employee">
<field name="product_id" ref="product_consultant"/>
<field name="journal_id" ref="analytic_journal"/>
</record>
<!-- complete our example employee -->
<record id="hr.employee1" model="hr.employee">
<field name="product_id" ref="product_consultant"/>
+15
View File
@@ -0,0 +1,15 @@
OpenERP, Open Source Management Solution
Copyright © 2010 OpenERP SA (<http://openerp.com>).
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 Lice
along with this program. If not, see <http://www.gnu.org/licenses/>.
+19
View File
@@ -0,0 +1,19 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010 OpenERP s.a. (<http://openerp.com>).
#
# 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/>.
#
##############################################################################
+34
View File
@@ -0,0 +1,34 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010 OpenERP s.a. (<http://openerp.com>).
#
# 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/>.
#
##############################################################################
{
'name': 'Add uservoice button in header',
'version': '1.0',
'category': 'Generic Modules/Others',
'description': "",
'author': 'OpenERP s.a.',
'website': 'http://openerp.com',
'depends': ['base'],
'data': [],
'installable': True,
'active': False,
'web': True,
'certificate': '0040452504963885',
}
+22
View File
@@ -0,0 +1,22 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010 OpenERP s.a. (<http://openerp.com>).
#
# 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 editors
import controllers
+68
View File
@@ -0,0 +1,68 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010 OpenERP s.a. (<http://openerp.com>).
#
# 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/>.
#
##############################################################################
from openerp.controllers import SecuredController
from openerp.utils import rpc
from openobject.tools import expose
import cherrypy
class Root(SecuredController):
_cp_path = "/openerp"
@expose(mark_only=True)
def menu(self, active=None, next=None):
try:
menu_id = int(active)
except (TypeError, ValueError):
menu_id = False
menus = rpc.RPCProxy("ir.ui.menu")
ids = menus.search([('parent_id', '=', False)])
if next or active:
if not menu_id and ids:
menu_id = ids[0]
menu = ''
if menu_id:
ctx = dict(lang='NO_LANG') # force loading original string even if the english have been translated...
menu = menus.read([menu_id], ['name'], ctx)[0]['name'] or ''
general_forum = 77459
forum = {
'accounting': 87921,
'administration': 87935,
'human resources': 87923,
'knowledge': 87927,
'manufacturing': 87915,
'marketing': 87925,
'point of sale': 87929,
'project': 87919,
'purchases': 87911,
'sales': 87907,
'tools': 87933,
'warehouse': 87913,
}.get(menu.lower().strip(), general_forum)
cherrypy.request.uservoice_forum = forum
return super(Root, self).menu(active, next)
+75
View File
@@ -0,0 +1,75 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010 OpenERP s.a. (<http://openerp.com>).
#
# 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 openobject.templating
class BaseTemplateEditor(openobject.templating.TemplateEditor):
templates = ['/openobject/controllers/templates/base.mako']
def edit(self, template, template_text):
output = super(BaseTemplateEditor, self).edit(template, template_text)
end_head = output.index('</head>')
output = output[:end_head] + """
<link rel="stylesheet" type="text/css" href="/web_uservoice/static/css/uservoice.css"/>
""" + output[end_head:]
end_body = output.index('</body>')
# testing forum: 84397
output = output[:end_body] + """
<script type="text/javascript">
var uservoiceOptions = {
key: 'openerpsa',
host: 'feedback.openerp.com',
forum: '${getattr(cp.request, 'uservoice_forum', 77459)}',
lang: 'en',
showTab: false
};
function _loadUserVoice() {
var s = document.createElement('script');
s.src = ("https:" == document.location.protocol ? "https://" : "http://") + "cdn.uservoice.com/javascripts/widgets/tab.js";
document.getElementsByTagName('head')[0].appendChild(s);
}
_loadSuper = window.onload;
window.onload = (typeof window.onload != 'function') ? _loadUserVoice : function() { _loadSuper(); _loadUserVoice(); };
</script>
""" + output[end_body:]
return output
class HeaderTemplateEditor(openobject.templating.TemplateEditor):
templates = ['/openerp/controllers/templates/header.mako']
def edit(self, template, template_text):
output = super(HeaderTemplateEditor, self).edit(template, template_text)
PAT = '<ul class="tools">'
ul = output.index(PAT)
output = output[:ul] + """
<p class="logout feedback"><a href="#" onclick="UserVoice.Popin.show(uservoiceOptions); return false;"><img src="/web_uservoice/static/images/uv_favicon.png" />feedback</a></p>
""" + output[ul:]
return output
@@ -0,0 +1,7 @@
#corner p.feedback a {
/*color: #9a0404;*/
}
#corner p.feedback img {
vertical-align: middle;
margin-right: 0.5em;
}