diff --git a/debian/copyright b/debian/copyright index f681d540a0a..e477adb524d 100644 --- a/debian/copyright +++ b/debian/copyright @@ -40,7 +40,7 @@ License: GPL-2+ . You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL-2 file. @@ -93,7 +93,7 @@ License: LGPL-2.1 . You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . On Debian systems, the complete text of the GNU Library General Public License can be found in /usr/share/common-licenses/LGPL-2.1 file. @@ -137,7 +137,7 @@ License: GPL-2+ . You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL-2 file. @@ -159,7 +159,7 @@ License: GPL-2+ . You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL-2 file. diff --git a/history/check_profile_l10n_all.py b/history/check_profile_l10n_all.py index 5c1c1fa9bca..e7b391a942a 100644 --- a/history/check_profile_l10n_all.py +++ b/history/check_profile_l10n_all.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################## # diff --git a/history/gen_graph.sh b/history/gen_graph.sh index b052528eef4..7be31ed8061 100755 --- a/history/gen_graph.sh +++ b/history/gen_graph.sh @@ -24,7 +24,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # ############################################################################## diff --git a/openerp-wsgi.py b/openerp-wsgi.py index 9ae18ffc69e..90f43ddab21 100644 --- a/openerp-wsgi.py +++ b/openerp-wsgi.py @@ -1,4 +1,3 @@ -#!/usr/bin/python # WSGI Handler sample configuration file. # # Change the appropriate settings below, in order to provide the parameters diff --git a/openerp/addons/base/currency_data.xml b/openerp/addons/base/currency_data.xml index 7173b8492ab..96ff81cc0d1 100644 --- a/openerp/addons/base/currency_data.xml +++ b/openerp/addons/base/currency_data.xml @@ -9,7 +9,6 @@ 0.01 4 before - 1.2834 @@ -23,7 +22,6 @@ Bs.F 0.0001 4 - 5.864 @@ -36,7 +34,6 @@ $ 0.01 4 - 1.3388 @@ -50,7 +47,6 @@ CHF 0.01 4 - 1.3086 @@ -63,7 +59,6 @@ R$ 0.01 4 - 2.2344 @@ -76,7 +71,6 @@ ¥ 0.01 4 - 8.7556 @@ -90,7 +84,6 @@ $ 0.01 4 - 2933.8378 @@ -103,7 +96,6 @@ 0.01 4 - 26.5634 @@ -116,7 +108,6 @@ kr 0.01 4 - 7.4445 @@ -130,7 +121,6 @@ Ft 0.01 4 - 271.5621 @@ -143,7 +133,6 @@ Rp 0.01 4 - 14352.00 @@ -161,7 +150,6 @@ Ls 0.01 4 - 0.7086 @@ -174,7 +162,6 @@ kr 0.01 4 - 7.8668 @@ -187,7 +174,6 @@ XPF 1.00 4 - 119.331742 @@ -200,7 +186,6 @@ B/. 0.01 4 - 1.2676 @@ -213,7 +198,6 @@ 0.01 4 - 4.1005 @@ -226,7 +210,6 @@ kr 0.01 4 - 10.3004 @@ -239,7 +222,6 @@ $ 0.01 4 - 5.0881 @@ -252,7 +234,6 @@ 0.01 4 - 59.9739 @@ -265,7 +246,6 @@ $ 0.01 4 - 1.4070 @@ -278,7 +258,6 @@ 0.01 4 - 10.1969 @@ -291,7 +270,6 @@ 0.01 4 - 26330.01 @@ -304,7 +282,6 @@ $ 0.01 4 - 11.1608 @@ -317,7 +294,6 @@ ¥ 0.01 4 - 133.62 @@ -330,7 +306,6 @@ лв 0.01 4 - 1.9558 @@ -343,7 +318,6 @@ Lt 0.01 4 - 3.4528 @@ -356,7 +330,6 @@ lei 0.01 4 - 4.2253 @@ -369,7 +342,6 @@ kn 0.01 4 - 7.2936 @@ -382,7 +354,6 @@ руб 0.01 4 - 43.16 @@ -395,7 +366,6 @@ TL 0.01 4 - 2.1411 @@ -408,7 +378,6 @@ 0.01 4 - 1662.37 @@ -421,7 +390,6 @@ $ 0.01 4 - 18.6664 @@ -434,7 +402,6 @@ RM 0.01 4 - 4.8887 @@ -447,7 +414,6 @@ $ 0.01 4 - 1.9764 @@ -460,7 +426,6 @@ Php 0.01 4 - 66.1 @@ -473,7 +438,6 @@ $ 0.01 4 - 2.0126 @@ -486,7 +450,6 @@ R 0.01 4 - 10.5618 @@ -515,7 +478,6 @@ Rs 0.01 4 - 40.28 @@ -528,7 +490,6 @@ CFA 1 4 - 655.957 @@ -541,7 +502,6 @@ FCFA 1 4 - 655.957 @@ -554,7 +514,6 @@ USh 1 4 - 3401.91388 @@ -567,7 +526,6 @@ L 0.01 4 - 25 @@ -580,7 +538,6 @@ $ 0.01 4 - 710 @@ -593,7 +550,6 @@ $ 0.01 4 - @@ -606,7 +562,6 @@ Afs 0.01 4 - @@ -619,7 +574,6 @@ Kz 0.01 4 - @@ -632,7 +586,6 @@ $ 0.01 4 - @@ -645,7 +598,6 @@ դր. 0.01 4 - @@ -658,7 +610,6 @@ Afl. 0.01 4 - @@ -671,7 +622,6 @@ m 0.01 4 - @@ -684,7 +634,6 @@ B$ 0.01 4 - @@ -697,7 +646,6 @@ BD 0.01 4 - @@ -710,7 +658,6 @@ 0.01 4 - @@ -723,7 +670,6 @@ Bds$ 0.01 4 - @@ -736,7 +682,6 @@ BR 0.01 4 - @@ -749,7 +694,6 @@ BZ$ 0.01 4 - @@ -762,7 +706,6 @@ BD$ 0.01 4 - @@ -775,7 +718,6 @@ Nu. 0.01 4 - @@ -788,7 +730,6 @@ Bs. 0.01 4 - @@ -801,7 +742,6 @@ KM 0.01 4 - @@ -814,7 +754,6 @@ P 0.01 4 - @@ -827,7 +766,6 @@ FBu 0.01 4 - @@ -840,7 +778,6 @@ 0.01 4 - @@ -853,7 +790,6 @@ $ 0.01 4 - @@ -866,7 +802,6 @@ CF 0.01 4 - @@ -879,7 +814,6 @@ Fr 0.01 4 - @@ -892,7 +826,6 @@ $ 0.01 4 - @@ -905,7 +838,6 @@ ƒ 0.01 4 - @@ -918,7 +850,6 @@ £ 0.01 4 - @@ -931,7 +862,6 @@ Fdj 0.01 4 - @@ -944,7 +874,6 @@ RD$ 0.01 4 - @@ -957,7 +886,6 @@ TPE 0.01 4 - @@ -970,7 +898,6 @@ S/. 0.01 4 - @@ -983,7 +910,6 @@ 0.01 4 - @@ -996,7 +922,6 @@ ¢ 0.01 4 - @@ -1009,7 +934,6 @@ Nfk 0.01 4 - @@ -1022,7 +946,6 @@ kr 0.01 4 - @@ -1035,7 +958,6 @@ Br 0.01 4 - @@ -1048,7 +970,6 @@ £ 0.01 4 - @@ -1061,7 +982,6 @@ FJ$ 0.01 4 - @@ -1074,7 +994,6 @@ 0.01 4 - @@ -1087,7 +1006,6 @@ £ 0.01 4 - @@ -1100,7 +1018,6 @@ Q 0.01 4 - @@ -1113,7 +1030,6 @@ FG 0.01 4 - @@ -1125,7 +1041,6 @@ GWP 0.01 4 - @@ -1138,7 +1053,6 @@ $ 0.01 4 - @@ -1151,7 +1065,6 @@ G 0.01 4 - @@ -1164,7 +1077,6 @@ kr 0.01 4 - @@ -1177,7 +1089,6 @@ 0.01 4 - @@ -1190,7 +1101,6 @@ ع.د 0.01 4 - @@ -1203,7 +1113,6 @@ 0.01 4 - @@ -1216,7 +1125,6 @@ $ 0.01 4 - @@ -1229,7 +1137,6 @@ د.ا 0.01 4 - @@ -1242,7 +1149,6 @@ лв 0.01 4 - @@ -1255,7 +1161,6 @@ KSh 0.01 4 - @@ -1268,7 +1173,6 @@ د.ك 0.01 4 - @@ -1281,7 +1185,6 @@ лв 0.01 4 - @@ -1294,7 +1197,6 @@ 0.01 4 - @@ -1307,7 +1209,6 @@ ل.ل 0.01 4 - @@ -1320,7 +1221,6 @@ L 0.01 4 - @@ -1333,7 +1233,6 @@ L$ 0.01 4 - @@ -1346,7 +1245,6 @@ ل.د 0.01 4 - @@ -1359,7 +1257,6 @@ MOP$ 0.01 4 - @@ -1372,7 +1269,6 @@ ден 0.01 4 - @@ -1385,7 +1281,6 @@ Ar 0.01 4 - @@ -1398,7 +1293,6 @@ MK 0.01 4 - @@ -1411,7 +1305,6 @@ 0.01 4 - @@ -1424,7 +1317,6 @@ UM 0.01 4 - @@ -1437,7 +1329,6 @@ L 0.01 4 - @@ -1450,7 +1341,6 @@ 0.01 4 - @@ -1463,7 +1353,6 @@ د.م. 0.01 4 - @@ -1476,7 +1365,6 @@ $ 0.01 4 - @@ -1489,7 +1377,6 @@ DZ 0.01 4 - @@ -1502,7 +1389,6 @@ GH¢ 0.01 4 - @@ -1515,7 +1401,6 @@ D 0.01 4 - @@ -1528,7 +1413,6 @@ Ƶ 0.01 4 - @@ -1541,7 +1425,6 @@ MT 0.01 4 - @@ -1554,7 +1437,6 @@ K 0.01 4 - @@ -1567,7 +1449,6 @@ $ 0.01 4 - @@ -1580,7 +1461,6 @@ 0.01 4 - @@ -1593,7 +1473,6 @@ L 0.01 4 - @@ -1606,7 +1485,6 @@ C$ 0.01 4 - @@ -1619,7 +1497,6 @@ 0.01 4 - @@ -1632,7 +1509,6 @@ 0.01 4 - @@ -1645,7 +1521,6 @@ Z$ 0.01 4 - @@ -1658,7 +1533,6 @@ ZK 0.01 4 - @@ -1671,7 +1545,6 @@ 0.01 4 - @@ -1684,7 +1557,6 @@ Bs 0.01 4 - @@ -1697,7 +1569,6 @@ 0.01 4 - @@ -1710,7 +1581,6 @@ VT 0.01 4 - @@ -1723,7 +1593,6 @@ лв 0.01 4 - @@ -1736,7 +1605,6 @@ $U 0.01 4 - @@ -1749,7 +1617,6 @@ د.إ 0.01 4 - @@ -1762,7 +1629,6 @@ 0.01 4 - @@ -1775,7 +1641,6 @@ m 0.01 4 - @@ -1788,7 +1653,6 @@ TL 0.01 4 - @@ -1801,7 +1665,6 @@ DT 0.01 4 - @@ -1814,7 +1677,6 @@ $ 0.01 4 - @@ -1827,7 +1689,6 @@ T$ 0.01 4 - @@ -1840,7 +1701,6 @@ ฿ 0.01 4 - @@ -1853,7 +1713,6 @@ x/y 0.01 4 - @@ -1865,7 +1724,6 @@ TJR 0.01 4 - @@ -1878,7 +1736,6 @@ NT$ 0.01 4 - @@ -1891,7 +1748,6 @@ £ 0.01 4 - @@ -1904,7 +1760,6 @@ E 0.01 4 - @@ -1917,7 +1772,6 @@ $ 0.01 4 - @@ -1930,7 +1784,6 @@ £Sd 0.01 4 - @@ -1943,7 +1796,6 @@ Rs 0.01 4 - @@ -1956,7 +1808,6 @@ £ 0.01 4 - @@ -1970,7 +1821,6 @@ 0.01 4 before - @@ -1983,7 +1833,6 @@ Sh. 0.01 4 - @@ -1996,7 +1845,6 @@ SI$ 0.01 4 - @@ -2009,7 +1857,6 @@ Le 0.01 4 - @@ -2022,7 +1869,6 @@ SR 0.01 4 - @@ -2035,7 +1881,6 @@ din. 0.01 4 - @@ -2048,7 +1893,6 @@ SR 0.01 4 - @@ -2061,7 +1905,6 @@ Db 0.01 4 - @@ -2074,7 +1917,6 @@ 0.01 4 - @@ -2087,7 +1929,6 @@ WS$ 0.01 4 - @@ -2100,7 +1941,6 @@ £ 0.01 4 - @@ -2113,7 +1953,6 @@ RF 0.01 4 - @@ -2126,7 +1965,6 @@ R 0.01 4 - @@ -2139,7 +1977,6 @@ L 0.01 4 - @@ -2152,7 +1989,6 @@ QR 0.01 4 - @@ -2165,7 +2001,6 @@ 0.01 4 - @@ -2178,7 +2013,6 @@ S/. 0.01 4 - @@ -2191,7 +2025,6 @@ 0.01 4 - @@ -2204,7 +2037,6 @@ K 0.01 4 - @@ -2217,7 +2049,6 @@ Rs. 0.01 4 - @@ -2230,7 +2061,6 @@ ر.ع. 0.01 4 - @@ -2243,7 +2073,6 @@ $ 0.01 4 - @@ -2256,7 +2085,6 @@ Sk 0.01 4 - @@ -2268,7 +2096,6 @@ SIT 0.01 4 - @@ -2281,7 +2108,6 @@ дин. 0.01 4 - diff --git a/openerp/addons/base/ir/ir_mail_server.py b/openerp/addons/base/ir/ir_mail_server.py index 10fc5f82187..2ae2f3d7c5c 100644 --- a/openerp/addons/base/ir/ir_mail_server.py +++ b/openerp/addons/base/ir/ir_mail_server.py @@ -31,6 +31,7 @@ import re import smtplib import threading +from openerp import SUPERUSER_ID from openerp.osv import osv, fields from openerp.tools.translate import _ from openerp.tools import html2text @@ -419,11 +420,11 @@ class ir_mail_server(osv.osv): # Get SMTP Server Details from Mail Server mail_server = None if mail_server_id: - mail_server = self.browse(cr, uid, mail_server_id) + mail_server = self.browse(cr, SUPERUSER_ID, mail_server_id) elif not smtp_server: - mail_server_ids = self.search(cr, uid, [], order='sequence', limit=1) + mail_server_ids = self.search(cr, SUPERUSER_ID, [], order='sequence', limit=1) if mail_server_ids: - mail_server = self.browse(cr, uid, mail_server_ids[0]) + mail_server = self.browse(cr, SUPERUSER_ID, mail_server_ids[0]) if mail_server: smtp_server = mail_server.smtp_host diff --git a/openerp/addons/base/ir/ir_sequence.py b/openerp/addons/base/ir/ir_sequence.py index 8ba94d37006..0f505814c0c 100644 --- a/openerp/addons/base/ir/ir_sequence.py +++ b/openerp/addons/base/ir/ir_sequence.py @@ -54,6 +54,34 @@ class ir_sequence(openerp.osv.osv.osv): """ _name = 'ir.sequence' _order = 'name' + + def _get_number_next_actual(self, cr, user, ids, field_name, arg, context=None): + '''Return number from ir_sequence row when no_gap implementation, + and number from postgres sequence when standard implementation.''' + res = dict.fromkeys(ids) + for element in self.browse(cr, user, ids, context=context): + if element.implementation != 'standard': + res[element.id] = element.number_next + else: + # get number from postgres sequence. Cannot use + # currval, because that might give an error when + # not having used nextval before. + statement = ( + "SELECT last_value, increment_by, is_called" + " FROM ir_sequence_%03d" + % element.id) + cr.execute(statement) + (last_value, increment_by, is_called) = cr.fetchone() + if is_called: + res[element.id] = last_value + increment_by + else: + res[element.id] = last_value + return res + + def _set_number_next_actual(self, cr, uid, id, name, value, args=None, context=None): + return self.write(cr, uid, id, {'number_next': value or 0}, context=context) + + _columns = { 'name': openerp.osv.fields.char('Name', size=64, required=True), 'code': openerp.osv.fields.selection(_code_get, 'Code', size=64), @@ -67,6 +95,7 @@ class ir_sequence(openerp.osv.osv.osv): 'prefix': openerp.osv.fields.char('Prefix', size=64, help="Prefix value of the record for the sequence"), 'suffix': openerp.osv.fields.char('Suffix', size=64, help="Suffix value of the record for the sequence"), 'number_next': openerp.osv.fields.integer('Next Number', required=True, help="Next number of this sequence"), + 'number_next_actual': openerp.osv.fields.function(_get_number_next_actual, fnct_inv=_set_number_next_actual, type='integer', required=True, string='Next Number', help='Next number that will be used. This number can be incremented frequently so the displayed value might already be obsolete'), 'number_increment': openerp.osv.fields.integer('Increment Number', required=True, help="The next number of the sequence will be incremented by this number"), 'padding' : openerp.osv.fields.integer('Number Padding', required=True, help="OpenERP will automatically adds some '0' on the left of the 'Next Number' to get the required padding size."), 'company_id': openerp.osv.fields.many2one('res.company', 'Company'), @@ -77,6 +106,7 @@ class ir_sequence(openerp.osv.osv.osv): 'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'ir.sequence', context=c), 'number_increment': 1, 'number_next': 1, + 'number_next_actual': 1, 'padding' : 0, } @@ -121,7 +151,7 @@ class ir_sequence(openerp.osv.osv.osv): # object depends on it. cr.execute("DROP SEQUENCE IF EXISTS %s RESTRICT " % names) - def _alter_sequence(self, cr, id, number_increment, number_next): + def _alter_sequence(self, cr, id, number_increment, number_next=None): """ Alter a PostreSQL sequence. There is no access rights check. @@ -129,9 +159,15 @@ class ir_sequence(openerp.osv.osv.osv): if number_increment == 0: raise osv.except_osv(_('Warning!'),_("Increment number must not be zero.")) assert isinstance(id, (int, long)) - cr.execute(""" - ALTER SEQUENCE ir_sequence_%03d INCREMENT BY %%s RESTART WITH %%s - """ % id, (number_increment, number_next)) + seq_name = 'ir_sequence_%03d' % (id,) + cr.execute("SELECT relname FROM pg_class WHERE relkind = %s AND relname=%s", ('S', seq_name)) + if not cr.fetchone(): + # sequence is not created yet, we're inside create() so ignore it, will be set later + return + statement = "ALTER SEQUENCE %s INCREMENT BY %d" % (seq_name, number_increment) + if number_next is not None: + statement += " RESTART WITH %d" % (number_next, ) + cr.execute(statement) def create(self, cr, uid, values, context=None): """ Create a sequence, in implementation == standard a fast gaps-allowed PostgreSQL sequence is used. @@ -160,7 +196,13 @@ class ir_sequence(openerp.osv.osv.osv): n = values.get('number_next', row['number_next']) if row['implementation'] == 'standard': if new_implementation in ('standard', None): - self._alter_sequence(cr, row['id'], i, n) + # Implementation has NOT changed. + # Only change sequence if really requested. + if row['number_next'] != n: + self._alter_sequence(cr, row['id'], i, n) + else: + # Just in case only increment changed + self._alter_sequence(cr, row['id'], i) else: self._drop_sequence(cr, row['id']) else: @@ -200,7 +242,7 @@ class ir_sequence(openerp.osv.osv.osv): force_company = context.get('force_company') if not force_company: force_company = self.pool.get('res.users').browse(cr, uid, uid).company_id.id - sequences = self.read(cr, uid, seq_ids, ['company_id','implementation','number_next','prefix','suffix','padding']) + sequences = self.read(cr, uid, seq_ids, ['name','company_id','implementation','number_next','prefix','suffix','padding']) preferred_sequences = [s for s in sequences if s['company_id'] and s['company_id'][0] == force_company ] seq = preferred_sequences[0] if preferred_sequences else sequences[0] if seq['implementation'] == 'standard': @@ -210,14 +252,17 @@ class ir_sequence(openerp.osv.osv.osv): cr.execute("SELECT number_next FROM ir_sequence WHERE id=%s FOR UPDATE NOWAIT", (seq['id'],)) cr.execute("UPDATE ir_sequence SET number_next=number_next+number_increment WHERE id=%s ", (seq['id'],)) d = self._interpolation_dict() - interpolated_prefix = self._interpolate(seq['prefix'], d) - interpolated_suffix = self._interpolate(seq['suffix'], d) + try: + interpolated_prefix = self._interpolate(seq['prefix'], d) + interpolated_suffix = self._interpolate(seq['suffix'], d) + except ValueError: + raise osv.except_osv(_('Warning'), _('Invalid prefix or suffix for sequence \'%s\'') % (seq.get('name'))) return interpolated_prefix + '%%0%sd' % seq['padding'] % seq['number_next'] + interpolated_suffix def next_by_id(self, cr, uid, sequence_id, context=None): """ Draw an interpolated string using the specified sequence.""" self.check_access_rights(cr, uid, 'read') - company_ids = self.pool.get('res.company').search(cr, uid, [], order='company_id', context=context) + [False] + company_ids = self.pool.get('res.company').search(cr, uid, [], context=context) + [False] ids = self.search(cr, uid, ['&',('id','=', sequence_id),('company_id','in',company_ids)]) return self._next(cr, uid, ids, context) @@ -234,8 +279,8 @@ class ir_sequence(openerp.osv.osv.osv): specific company will get higher priority. """ self.check_access_rights(cr, uid, 'read') - company_ids = self.pool.get('res.company').search(cr, uid, [], order='company_id', context=context) + [False] - ids = self.search(cr, uid, ['&',('code','=', sequence_code),('company_id','in',company_ids)]) + company_ids = self.pool.get('res.company').search(cr, uid, [], context=context) + [False] + ids = self.search(cr, uid, ['&', ('code', '=', sequence_code), ('company_id', 'in', company_ids)]) return self._next(cr, uid, ids, context) def get_id(self, cr, uid, sequence_code_or_id, code_or_id='id', context=None): diff --git a/openerp/addons/base/ir/ir_sequence_view.xml b/openerp/addons/base/ir/ir_sequence_view.xml index 0fa46d61957..050eb9e2333 100644 --- a/openerp/addons/base/ir/ir_sequence_view.xml +++ b/openerp/addons/base/ir/ir_sequence_view.xml @@ -20,7 +20,7 @@ - + @@ -57,7 +57,7 @@ - + diff --git a/openerp/addons/base/res/res_company.py b/openerp/addons/base/res/res_company.py index cd17f6da3d9..20e94b3e631 100644 --- a/openerp/addons/base/res/res_company.py +++ b/openerp/addons/base/res/res_company.py @@ -272,6 +272,10 @@ class res_company(osv.osv):
+ + + + @@ -281,6 +285,9 @@ class res_company(osv.osv): [[ company.partner_id.name ]] %s + + +
""" @@ -304,13 +311,16 @@ class res_company(osv.osv): - - + + + + + + [[ company.logo or removeParentNode('image') ]] - diff --git a/openerp/addons/base/res/res_currency.py b/openerp/addons/base/res/res_currency.py index 70bc8299dbe..efe33f32fd9 100644 --- a/openerp/addons/base/res/res_currency.py +++ b/openerp/addons/base/res/res_currency.py @@ -77,6 +77,7 @@ class res_currency(osv.osv): 'position' : 'after', 'rounding': 0.01, 'accuracy': 4, + 'company_id': False, } _sql_constraints = [ # this constraint does not cover all cases due to SQL NULL handling for company_id, diff --git a/openerp/addons/base/res/res_partner.py b/openerp/addons/base/res/res_partner.py index d140fe62ccc..69ad16b8106 100644 --- a/openerp/addons/base/res/res_partner.py +++ b/openerp/addons/base/res/res_partner.py @@ -74,7 +74,8 @@ class format_address(object): def _tz_get(self,cr,uid, context=None): - return [(x, x) for x in pytz.all_timezones] + # put POSIX 'Etc/*' entries at the end to avoid confusing users - see bug 1086728 + return [(tz,tz) for tz in sorted(pytz.all_timezones, key=lambda tz: tz if not tz.startswith('Etc/') else '_')] class res_partner_category(osv.osv): diff --git a/openerp/addons/base/security/base_security.xml b/openerp/addons/base/security/base_security.xml index b0de06078af..8895268814f 100644 --- a/openerp/addons/base/security/base_security.xml +++ b/openerp/addons/base/security/base_security.xml @@ -87,6 +87,12 @@ ['|','|',('company_id.child_ids','child_of',[user.company_id.id]),('company_id','child_of',[user.company_id.id]),('company_id','=',False)]
+ + multi-company currency rule + + ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] + + diff --git a/openerp/addons/base/security/ir.model.access.csv b/openerp/addons/base/security/ir.model.access.csv index 35d5b82bc41..e3198abb8fa 100644 --- a/openerp/addons/base/security/ir.model.access.csv +++ b/openerp/addons/base/security/ir.model.access.csv @@ -114,7 +114,7 @@ "access_ir_filter employee","ir_filters employee","model_ir_filters","group_user",1,1,1,1 "access_ir_filters","ir_filters_all","model_ir_filters",,1,1,1,1 "access_ir_config_parameter","ir_config_parameter","model_ir_config_parameter",,1,0,0,0 -"access_ir_mail_server_all","ir_mail_server","model_ir_mail_server",,1,0,0,0 +"access_ir_mail_server","ir_mail_server","model_ir_mail_server","group_system",1,1,1,1 "access_ir_actions_client","ir_actions_client all","model_ir_actions_client",,1,0,0,0 "access_ir_needaction_mixin","ir_needaction_mixin","model_ir_needaction_mixin",,1,1,1,1 diff --git a/openerp/addons/base/test/test_osv_expression.yml b/openerp/addons/base/test/test_osv_expression.yml index f1610e8b3a4..1516f090e94 100644 --- a/openerp/addons/base/test/test_osv_expression.yml +++ b/openerp/addons/base/test/test_osv_expression.yml @@ -291,22 +291,22 @@ assert res_101 == [], 'res_101: expected %r, got %r' % ([], res_101) assert res_102 == company_ids, 'res_102: expected %r, got %r' % (company_ids, res_102) - - Property of the query (one2many != False). + Verify domain evaluation for `one2many != False` - - !python {model: res.currency }: | - ids = self.search(cr, uid, []) - referenced_companies = set([x.company_id.id for x in self.browse(cr, uid, ids)]) - companies = set(self.pool.get('res.company').search(cr, uid, [('currency_ids', '!=', False)])) - assert referenced_companies == companies + !python {model: res.partner.category }: | + all_ids = self.search(cr, uid, []) + parent_categs = set([c.parent_id.id for c in self.browse(cr, uid, all_ids) if c.parent_id]) + result = set(self.search(cr, uid, [('child_ids', '!=', False)])) + assert result and result == parent_categs, "Got %r, expected %r" % (result, parent_categs) - - Property of the query (one2many = False). + Verify domain evaluation for `one2many == False` - - !python {model: res.currency }: | - ids = self.search(cr, uid, []) - referenced_companies = set([x.company_id.id for x in self.browse(cr, uid, ids)]) - unreferenced_companies = set(self.pool.get('res.company').search(cr, uid, [])).difference(referenced_companies) - companies = set(self.pool.get('res.company').search(cr, uid, [('currency_ids', '=', False)])) - assert unreferenced_companies == companies + !python {model: res.partner.category }: | + all_ids = self.search(cr, uid, []) + parent_categs = set([c.parent_id.id for c in self.browse(cr, uid, all_ids) if c.parent_id]) + leaf_categs = set(all_ids) - parent_categs + result = set(self.search(cr, uid, [('child_ids', '=', False)])) + assert result and result == leaf_categs, "Got %r, expected %r" % (result, leaf_categs) - Equivalent queries. - diff --git a/openerp/cli/server.py b/openerp/cli/server.py index 0315468b7b2..2ee9e53b3ca 100644 --- a/openerp/cli/server.py +++ b/openerp/cli/server.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################## # diff --git a/openerp/netsvc.py b/openerp/netsvc.py index 626d983a221..755f6513b25 100644 --- a/openerp/netsvc.py +++ b/openerp/netsvc.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################## # diff --git a/openerp/osv/expression.py b/openerp/osv/expression.py index 530eb83a2cc..ef02882422c 100644 --- a/openerp/osv/expression.py +++ b/openerp/osv/expression.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################## # @@ -790,7 +789,7 @@ class expression(object): leaf.add_join_context(next_model, working_model._inherits[next_model._name], 'id', working_model._inherits[next_model._name]) push(leaf) - elif not field and left == 'id' and operator == 'child_of': + elif left == 'id' and operator == 'child_of': ids2 = to_ids(right, working_model, context) dom = child_of_domain(left, ids2, working_model) for dom_leaf in reversed(dom): diff --git a/openerp/report/render/rml2html/rml2html.py b/openerp/report/render/rml2html/rml2html.py index 0e82a5d3ea8..9122d068e6e 100644 --- a/openerp/report/render/rml2html/rml2html.py +++ b/openerp/report/render/rml2html/rml2html.py @@ -1,25 +1,8 @@ # -*- coding: utf-8 -*- ############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (). # -# 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 . -# -############################################################################## - # Copyright (C) 2005, Fabien Pinckaers, UCL, FSA +# Copyright (C) 2004-2009 Tiny SPRL (). # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -33,7 +16,9 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# +############################################################################## import sys import cStringIO diff --git a/openerp/report/render/rml2html/utils.py b/openerp/report/render/rml2html/utils.py index b811cc5d47b..7c81a65a4e8 100644 --- a/openerp/report/render/rml2html/utils.py +++ b/openerp/report/render/rml2html/utils.py @@ -1,21 +1,22 @@ # -*- coding: utf-8 -*- ############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (). # -# 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. +# Copyright (C) 2005, Fabien Pinckaers, UCL, FSA +# Copyright (C) 2004-2009 Tiny SPRL (). # -# 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. +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. # -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # ############################################################################## diff --git a/openerp/report/render/rml2pdf/customfonts.py b/openerp/report/render/rml2pdf/customfonts.py index 0c0095b8818..172b14b55fb 100644 --- a/openerp/report/render/rml2pdf/customfonts.py +++ b/openerp/report/render/rml2pdf/customfonts.py @@ -56,7 +56,9 @@ CustomTTFonts = [ ('Helvetica',"DejaVu Sans", "DejaVuSans.ttf", 'normal'), ('Courier',"FreeMono", "FreeMono.ttf", 'normal'), ('Courier',"FreeMono Bold", "FreeMonoBold.ttf", 'bold'), ('Courier',"FreeMono Oblique", "FreeMonoOblique.ttf", 'italic'), - ('Courier',"FreeMono BoldOblique", "FreeMonoBoldOblique.ttf", 'bolditalic'),] + ('Courier',"FreeMono BoldOblique", "FreeMonoBoldOblique.ttf", 'bolditalic'), + ('Sun-ExtA',"Sun-ExtA", "sun-exta.ttf", 'normal'), +] TTFSearchPath_Linux = [ diff --git a/openerp/report/render/rml2pdf/trml2pdf.py b/openerp/report/render/rml2pdf/trml2pdf.py index 7973ac56ec8..243cc02a0b3 100644 --- a/openerp/report/render/rml2pdf/trml2pdf.py +++ b/openerp/report/render/rml2pdf/trml2pdf.py @@ -160,9 +160,11 @@ class _rml_styles(object,): for style in node.findall('paraStyle'): sname = style.get('name') self.styles[sname] = self._para_style_update(style) - - self.styles_obj[sname] = reportlab.lib.styles.ParagraphStyle(sname, self.default_style["Normal"], **self.styles[sname]) - + if sname in self.default_style: + for key, value in self.styles[sname].items(): + setattr(self.default_style[sname], key, value) + else: + self.styles_obj[sname] = reportlab.lib.styles.ParagraphStyle(sname, self.default_style["Normal"], **self.styles[sname]) for variable in node.findall('initialize'): for name in variable.findall('name'): self.names[ name.get('id')] = name.get('value') @@ -269,6 +271,7 @@ class _rml_doc(object): from reportlab.pdfbase.ttfonts import TTFont for node in els: + for font in node.findall('registerFont'): name = font.get('fontName').encode('ascii') fname = font.get('fontFile').encode('ascii') @@ -435,7 +438,7 @@ class _rml_canvas(object): self.canvas.circle(x_cen=utils.unit_get(node.get('x')), y_cen=utils.unit_get(node.get('y')), r=utils.unit_get(node.get('radius')), **utils.attr_get(node, [], {'fill':'bool','stroke':'bool'})) def _place(self, node): - flows = _rml_flowable(self.doc, self.localcontext, images=self.images, path=self.path, title=self.title).render(node) + flows = _rml_flowable(self.doc, self.localcontext, images=self.images, path=self.path, title=self.title, canvas=self.canvas).render(node) infos = utils.attr_get(node, ['x','y','width','height']) infos['y']+=infos['height'] @@ -616,7 +619,7 @@ class _rml_Illustration(platypus.flowables.Flowable): drw.render(self.canv, None) class _rml_flowable(object): - def __init__(self, doc, localcontext, images=None, path='.', title=None): + def __init__(self, doc, localcontext, images=None, path='.', title=None, canvas=None): if images is None: images = {} self.localcontext = localcontext @@ -625,6 +628,7 @@ class _rml_flowable(object): self.images = images self.path = path self.title = title + self.canvas = canvas def _textual(self, node): rc1 = utils._process_text(self, node.text or '') @@ -634,7 +638,10 @@ class _rml_flowable(object): if key in ('rml_except', 'rml_loop', 'rml_tag'): del txt_n.attrib[key] if not n.tag == 'bullet': - txt_n.text = utils.xml2str(self._textual(n)) + if n.tag == 'pageNumber': + txt_n.text = self.canvas and str(self.canvas.getPageNumber()) or '' + else: + txt_n.text = utils.xml2str(self._textual(n)) txt_n.tail = n.tail and utils.xml2str(utils._process_text(self, n.tail.replace('\n',''))) or '' rc1 += etree.tostring(txt_n) return rc1 @@ -983,7 +990,7 @@ class _rml_template(object): if self.localcontext and not self.localcontext.get('internal_header',False): del self.localcontext['internal_header'] fis = [] - r = _rml_flowable(self.doc,self.localcontext, images=self.images, path=self.path, title=self.title) + r = _rml_flowable(self.doc,self.localcontext, images=self.images, path=self.path, title=self.title, canvas=None) story_cnt = 0 for node_story in node_stories: if story_cnt > 0: diff --git a/openerp/report/render/rml2pdf/utils.py b/openerp/report/render/rml2pdf/utils.py index adca350c8d0..ae70cd46c94 100644 --- a/openerp/report/render/rml2pdf/utils.py +++ b/openerp/report/render/rml2pdf/utils.py @@ -16,7 +16,7 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # ############################################################################## diff --git a/openerp/service/cron.py b/openerp/service/cron.py index fe57aa7186c..f21b27f7fea 100644 --- a/openerp/service/cron.py +++ b/openerp/service/cron.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################## # diff --git a/openerp/service/http_server.py b/openerp/service/http_server.py index 63e8ce8338e..e25e75dba62 100644 --- a/openerp/service/http_server.py +++ b/openerp/service/http_server.py @@ -23,7 +23,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ############################################################################### diff --git a/openerp/service/websrv_lib.py b/openerp/service/websrv_lib.py index 7767cff2b30..9aeeff38828 100644 --- a/openerp/service/websrv_lib.py +++ b/openerp/service/websrv_lib.py @@ -21,7 +21,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ############################################################################### diff --git a/openerp/tests/test_mail.py b/openerp/tests/test_mail.py old mode 100644 new mode 100755 diff --git a/setup.nsi b/setup.nsi index 653a8798bb2..859ebdb39e2 100644 --- a/setup.nsi +++ b/setup.nsi @@ -21,7 +21,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##################################################################################### !include 'MUI2.nsh' diff --git a/setup.py b/setup.py old mode 100755 new mode 100644 index 00bfa571d2c..28c78a98236 --- a/setup.py +++ b/setup.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################## #