[FORWARD] Forward port of server 7.0 until revision 4988
bzr revid: tde@openerp.com-20130528102733-bsszxp6nvy8yws3t
This commit is contained in:
commit
1d5068b63e
|
@ -40,7 +40,7 @@ License: GPL-2+
|
||||||
.
|
.
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
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
|
On Debian systems, the complete text of the GNU General Public License
|
||||||
can be found in /usr/share/common-licenses/GPL-2 file.
|
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
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with this library; if not, write to the Free
|
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
|
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.
|
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
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
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
|
On Debian systems, the complete text of the GNU General Public License
|
||||||
can be found in /usr/share/common-licenses/GPL-2 file.
|
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
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
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
|
On Debian systems, the complete text of the GNU General Public License
|
||||||
can be found in /usr/share/common-licenses/GPL-2 file.
|
can be found in /usr/share/common-licenses/GPL-2 file.
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# 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
|
||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# WSGI Handler sample configuration file.
|
# WSGI Handler sample configuration file.
|
||||||
#
|
#
|
||||||
# Change the appropriate settings below, in order to provide the parameters
|
# Change the appropriate settings below, in order to provide the parameters
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -31,6 +31,7 @@ import re
|
||||||
import smtplib
|
import smtplib
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
|
from openerp import SUPERUSER_ID
|
||||||
from openerp.osv import osv, fields
|
from openerp.osv import osv, fields
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
from openerp.tools import html2text
|
from openerp.tools import html2text
|
||||||
|
@ -419,11 +420,11 @@ class ir_mail_server(osv.osv):
|
||||||
# Get SMTP Server Details from Mail Server
|
# Get SMTP Server Details from Mail Server
|
||||||
mail_server = None
|
mail_server = None
|
||||||
if mail_server_id:
|
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:
|
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:
|
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:
|
if mail_server:
|
||||||
smtp_server = mail_server.smtp_host
|
smtp_server = mail_server.smtp_host
|
||||||
|
|
|
@ -54,6 +54,34 @@ class ir_sequence(openerp.osv.osv.osv):
|
||||||
"""
|
"""
|
||||||
_name = 'ir.sequence'
|
_name = 'ir.sequence'
|
||||||
_order = 'name'
|
_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 = {
|
_columns = {
|
||||||
'name': openerp.osv.fields.char('Name', size=64, required=True),
|
'name': openerp.osv.fields.char('Name', size=64, required=True),
|
||||||
'code': openerp.osv.fields.selection(_code_get, 'Code', size=64),
|
'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"),
|
'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"),
|
'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': 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"),
|
'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."),
|
'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'),
|
'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),
|
'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_increment': 1,
|
||||||
'number_next': 1,
|
'number_next': 1,
|
||||||
|
'number_next_actual': 1,
|
||||||
'padding' : 0,
|
'padding' : 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +151,7 @@ class ir_sequence(openerp.osv.osv.osv):
|
||||||
# object depends on it.
|
# object depends on it.
|
||||||
cr.execute("DROP SEQUENCE IF EXISTS %s RESTRICT " % names)
|
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.
|
""" Alter a PostreSQL sequence.
|
||||||
|
|
||||||
There is no access rights check.
|
There is no access rights check.
|
||||||
|
@ -129,9 +159,15 @@ class ir_sequence(openerp.osv.osv.osv):
|
||||||
if number_increment == 0:
|
if number_increment == 0:
|
||||||
raise osv.except_osv(_('Warning!'),_("Increment number must not be zero."))
|
raise osv.except_osv(_('Warning!'),_("Increment number must not be zero."))
|
||||||
assert isinstance(id, (int, long))
|
assert isinstance(id, (int, long))
|
||||||
cr.execute("""
|
seq_name = 'ir_sequence_%03d' % (id,)
|
||||||
ALTER SEQUENCE ir_sequence_%03d INCREMENT BY %%s RESTART WITH %%s
|
cr.execute("SELECT relname FROM pg_class WHERE relkind = %s AND relname=%s", ('S', seq_name))
|
||||||
""" % id, (number_increment, number_next))
|
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):
|
def create(self, cr, uid, values, context=None):
|
||||||
""" Create a sequence, in implementation == standard a fast gaps-allowed PostgreSQL sequence is used.
|
""" 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'])
|
n = values.get('number_next', row['number_next'])
|
||||||
if row['implementation'] == 'standard':
|
if row['implementation'] == 'standard':
|
||||||
if new_implementation in ('standard', None):
|
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:
|
else:
|
||||||
self._drop_sequence(cr, row['id'])
|
self._drop_sequence(cr, row['id'])
|
||||||
else:
|
else:
|
||||||
|
@ -200,7 +242,7 @@ class ir_sequence(openerp.osv.osv.osv):
|
||||||
force_company = context.get('force_company')
|
force_company = context.get('force_company')
|
||||||
if not force_company:
|
if not force_company:
|
||||||
force_company = self.pool.get('res.users').browse(cr, uid, uid).company_id.id
|
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 ]
|
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]
|
seq = preferred_sequences[0] if preferred_sequences else sequences[0]
|
||||||
if seq['implementation'] == 'standard':
|
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("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'],))
|
cr.execute("UPDATE ir_sequence SET number_next=number_next+number_increment WHERE id=%s ", (seq['id'],))
|
||||||
d = self._interpolation_dict()
|
d = self._interpolation_dict()
|
||||||
interpolated_prefix = self._interpolate(seq['prefix'], d)
|
try:
|
||||||
interpolated_suffix = self._interpolate(seq['suffix'], d)
|
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
|
return interpolated_prefix + '%%0%sd' % seq['padding'] % seq['number_next'] + interpolated_suffix
|
||||||
|
|
||||||
def next_by_id(self, cr, uid, sequence_id, context=None):
|
def next_by_id(self, cr, uid, sequence_id, context=None):
|
||||||
""" Draw an interpolated string using the specified sequence."""
|
""" Draw an interpolated string using the specified sequence."""
|
||||||
self.check_access_rights(cr, uid, 'read')
|
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)])
|
ids = self.search(cr, uid, ['&',('id','=', sequence_id),('company_id','in',company_ids)])
|
||||||
return self._next(cr, uid, ids, context)
|
return self._next(cr, uid, ids, context)
|
||||||
|
|
||||||
|
@ -234,8 +279,8 @@ class ir_sequence(openerp.osv.osv.osv):
|
||||||
specific company will get higher priority.
|
specific company will get higher priority.
|
||||||
"""
|
"""
|
||||||
self.check_access_rights(cr, uid, 'read')
|
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, ['&',('code','=', sequence_code),('company_id','in',company_ids)])
|
ids = self.search(cr, uid, ['&', ('code', '=', sequence_code), ('company_id', 'in', company_ids)])
|
||||||
return self._next(cr, uid, ids, context)
|
return self._next(cr, uid, ids, context)
|
||||||
|
|
||||||
def get_id(self, cr, uid, sequence_code_or_id, code_or_id='id', context=None):
|
def get_id(self, cr, uid, sequence_code_or_id, code_or_id='id', context=None):
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
<field name="suffix"/>
|
<field name="suffix"/>
|
||||||
<field name="padding"/>
|
<field name="padding"/>
|
||||||
<field name="number_increment"/>
|
<field name="number_increment"/>
|
||||||
<field name="number_next"/>
|
<field name="number_next_actual"/>
|
||||||
<field name="implementation"/>
|
<field name="implementation"/>
|
||||||
</group>
|
</group>
|
||||||
<group col="3" string="Legend (for prefix, suffix)">
|
<group col="3" string="Legend (for prefix, suffix)">
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
<field name="prefix"/>
|
<field name="prefix"/>
|
||||||
<field name="padding"/>
|
<field name="padding"/>
|
||||||
<field name="company_id" groups="base.group_multi_company"/>
|
<field name="company_id" groups="base.group_multi_company"/>
|
||||||
<field name="number_next"/>
|
<field name="number_next_actual"/>
|
||||||
<field name="number_increment"/>
|
<field name="number_increment"/>
|
||||||
<field name="implementation"/>
|
<field name="implementation"/>
|
||||||
</tree>
|
</tree>
|
||||||
|
|
|
@ -272,6 +272,10 @@ class res_company(osv.osv):
|
||||||
<header>
|
<header>
|
||||||
<pageTemplate>
|
<pageTemplate>
|
||||||
<frame id="first" x1="28.0" y1="28.0" width="%s" height="%s"/>
|
<frame id="first" x1="28.0" y1="28.0" width="%s" height="%s"/>
|
||||||
|
<stylesheet>
|
||||||
|
<!-- Set here the default font to use for all <para> tags -->
|
||||||
|
<parastyle name='Normal' fontName="DejaVu Sans"/>
|
||||||
|
</stylesheet>
|
||||||
<pageGraphics>
|
<pageGraphics>
|
||||||
<fill color="black"/>
|
<fill color="black"/>
|
||||||
<stroke color="black"/>
|
<stroke color="black"/>
|
||||||
|
@ -281,6 +285,9 @@ class res_company(osv.osv):
|
||||||
<drawCentredString x="%s" y="%s">[[ company.partner_id.name ]]</drawCentredString>
|
<drawCentredString x="%s" y="%s">[[ company.partner_id.name ]]</drawCentredString>
|
||||||
<stroke color="#000000"/>
|
<stroke color="#000000"/>
|
||||||
<lines>%s</lines>
|
<lines>%s</lines>
|
||||||
|
<!-- Set here the default font to use for all <drawString> tags -->
|
||||||
|
<!-- don't forget to change the 2 other occurence of <setFont> above if needed -->
|
||||||
|
<setFont name="DejaVu Sans" size="8"/>
|
||||||
</pageGraphics>
|
</pageGraphics>
|
||||||
</pageTemplate>
|
</pageTemplate>
|
||||||
</header>"""
|
</header>"""
|
||||||
|
@ -304,13 +311,16 @@ class res_company(osv.osv):
|
||||||
<pageTemplate>
|
<pageTemplate>
|
||||||
<frame id="first" x1="1.3cm" y1="3.0cm" height="%s" width="19.0cm"/>
|
<frame id="first" x1="1.3cm" y1="3.0cm" height="%s" width="19.0cm"/>
|
||||||
<stylesheet>
|
<stylesheet>
|
||||||
<paraStyle name="main_footer" fontName="DejaVu Sans" fontSize="8.0" alignment="CENTER"/>
|
<!-- Set here the default font to use for all <para> tags -->
|
||||||
<paraStyle name="main_header" fontName="DejaVu Sans" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
<parastyle name='Normal' fontName="DejaVu Sans"/>
|
||||||
|
<paraStyle name="main_footer" fontSize="8.0" alignment="CENTER"/>
|
||||||
|
<paraStyle name="main_header" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||||
</stylesheet>
|
</stylesheet>
|
||||||
<pageGraphics>
|
<pageGraphics>
|
||||||
|
<!-- Set here the default font to use for all <drawString> tags -->
|
||||||
|
<setFont name="DejaVu Sans" size="8"/>
|
||||||
<!-- You Logo - Change X,Y,Width and Height -->
|
<!-- You Logo - Change X,Y,Width and Height -->
|
||||||
<image x="1.3cm" y="%s" height="40.0" >[[ company.logo or removeParentNode('image') ]]</image>
|
<image x="1.3cm" y="%s" height="40.0" >[[ company.logo or removeParentNode('image') ]]</image>
|
||||||
<setFont name="DejaVu Sans" size="8"/>
|
|
||||||
<fill color="black"/>
|
<fill color="black"/>
|
||||||
<stroke color="black"/>
|
<stroke color="black"/>
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,7 @@ class res_currency(osv.osv):
|
||||||
'position' : 'after',
|
'position' : 'after',
|
||||||
'rounding': 0.01,
|
'rounding': 0.01,
|
||||||
'accuracy': 4,
|
'accuracy': 4,
|
||||||
|
'company_id': False,
|
||||||
}
|
}
|
||||||
_sql_constraints = [
|
_sql_constraints = [
|
||||||
# this constraint does not cover all cases due to SQL NULL handling for company_id,
|
# this constraint does not cover all cases due to SQL NULL handling for company_id,
|
||||||
|
|
|
@ -74,7 +74,8 @@ class format_address(object):
|
||||||
|
|
||||||
|
|
||||||
def _tz_get(self,cr,uid, context=None):
|
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):
|
class res_partner_category(osv.osv):
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,12 @@
|
||||||
<field name="domain_force">['|','|',('company_id.child_ids','child_of',[user.company_id.id]),('company_id','child_of',[user.company_id.id]),('company_id','=',False)]</field>
|
<field name="domain_force">['|','|',('company_id.child_ids','child_of',[user.company_id.id]),('company_id','child_of',[user.company_id.id]),('company_id','=',False)]</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="res_currency_rule" model="ir.rule">
|
||||||
|
<field name="name">multi-company currency rule</field>
|
||||||
|
<field model="ir.model" name="model_id" ref="model_res_currency"/>
|
||||||
|
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</openerp>
|
</openerp>
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@
|
||||||
"access_ir_filter employee","ir_filters employee","model_ir_filters","group_user",1,1,1,1
|
"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_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_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_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
|
"access_ir_needaction_mixin","ir_needaction_mixin","model_ir_needaction_mixin",,1,1,1,1
|
||||||
|
|
||||||
|
|
|
|
@ -291,22 +291,22 @@
|
||||||
assert res_101 == [], 'res_101: expected %r, got %r' % ([], res_101)
|
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)
|
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 }: |
|
!python {model: res.partner.category }: |
|
||||||
ids = self.search(cr, uid, [])
|
all_ids = self.search(cr, uid, [])
|
||||||
referenced_companies = set([x.company_id.id for x in self.browse(cr, uid, ids)])
|
parent_categs = set([c.parent_id.id for c in self.browse(cr, uid, all_ids) if c.parent_id])
|
||||||
companies = set(self.pool.get('res.company').search(cr, uid, [('currency_ids', '!=', False)]))
|
result = set(self.search(cr, uid, [('child_ids', '!=', False)]))
|
||||||
assert referenced_companies == companies
|
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 }: |
|
!python {model: res.partner.category }: |
|
||||||
ids = self.search(cr, uid, [])
|
all_ids = self.search(cr, uid, [])
|
||||||
referenced_companies = set([x.company_id.id for x in self.browse(cr, uid, ids)])
|
parent_categs = set([c.parent_id.id for c in self.browse(cr, uid, all_ids) if c.parent_id])
|
||||||
unreferenced_companies = set(self.pool.get('res.company').search(cr, uid, [])).difference(referenced_companies)
|
leaf_categs = set(all_ids) - parent_categs
|
||||||
companies = set(self.pool.get('res.company').search(cr, uid, [('currency_ids', '=', False)]))
|
result = set(self.search(cr, uid, [('child_ids', '=', False)]))
|
||||||
assert unreferenced_companies == companies
|
assert result and result == leaf_categs, "Got %r, expected %r" % (result, leaf_categs)
|
||||||
-
|
-
|
||||||
Equivalent queries.
|
Equivalent queries.
|
||||||
-
|
-
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: utf-8 -*-
|
# -*- 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])
|
leaf.add_join_context(next_model, working_model._inherits[next_model._name], 'id', working_model._inherits[next_model._name])
|
||||||
push(leaf)
|
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)
|
ids2 = to_ids(right, working_model, context)
|
||||||
dom = child_of_domain(left, ids2, working_model)
|
dom = child_of_domain(left, ids2, working_model)
|
||||||
for dom_leaf in reversed(dom):
|
for dom_leaf in reversed(dom):
|
||||||
|
|
|
@ -1,25 +1,8 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
|
||||||
# OpenERP, Open Source Management Solution
|
|
||||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
|
||||||
#
|
#
|
||||||
# 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/>.
|
|
||||||
#
|
|
||||||
##############################################################################
|
|
||||||
|
|
||||||
# Copyright (C) 2005, Fabien Pinckaers, UCL, FSA
|
# Copyright (C) 2005, Fabien Pinckaers, UCL, FSA
|
||||||
|
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or
|
# This library is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU Lesser General Public
|
# 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
|
# You should have received a copy of the GNU Lesser General Public
|
||||||
# License along with this library; if not, write to the Free Software
|
# 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 sys
|
||||||
import cStringIO
|
import cStringIO
|
||||||
|
|
|
@ -1,21 +1,22 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
|
||||||
# OpenERP, Open Source Management Solution
|
|
||||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# Copyright (C) 2005, Fabien Pinckaers, UCL, FSA
|
||||||
# it under the terms of the GNU Affero General Public License as
|
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||||
# 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,
|
# This library is free software; you can redistribute it and/or
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# modify it under the terms of the GNU Lesser General Public
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# License as published by the Free Software Foundation; either
|
||||||
# GNU Affero General Public License for more details.
|
# 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
|
# This library is distributed in the hope that it will be useful,
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# 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
|
||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,9 @@ CustomTTFonts = [ ('Helvetica',"DejaVu Sans", "DejaVuSans.ttf", 'normal'),
|
||||||
('Courier',"FreeMono", "FreeMono.ttf", 'normal'),
|
('Courier',"FreeMono", "FreeMono.ttf", 'normal'),
|
||||||
('Courier',"FreeMono Bold", "FreeMonoBold.ttf", 'bold'),
|
('Courier',"FreeMono Bold", "FreeMonoBold.ttf", 'bold'),
|
||||||
('Courier',"FreeMono Oblique", "FreeMonoOblique.ttf", 'italic'),
|
('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 = [
|
TTFSearchPath_Linux = [
|
||||||
|
|
|
@ -160,9 +160,11 @@ class _rml_styles(object,):
|
||||||
for style in node.findall('paraStyle'):
|
for style in node.findall('paraStyle'):
|
||||||
sname = style.get('name')
|
sname = style.get('name')
|
||||||
self.styles[sname] = self._para_style_update(style)
|
self.styles[sname] = self._para_style_update(style)
|
||||||
|
if sname in self.default_style:
|
||||||
self.styles_obj[sname] = reportlab.lib.styles.ParagraphStyle(sname, self.default_style["Normal"], **self.styles[sname])
|
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 variable in node.findall('initialize'):
|
||||||
for name in variable.findall('name'):
|
for name in variable.findall('name'):
|
||||||
self.names[ name.get('id')] = name.get('value')
|
self.names[ name.get('id')] = name.get('value')
|
||||||
|
@ -269,6 +271,7 @@ class _rml_doc(object):
|
||||||
from reportlab.pdfbase.ttfonts import TTFont
|
from reportlab.pdfbase.ttfonts import TTFont
|
||||||
|
|
||||||
for node in els:
|
for node in els:
|
||||||
|
|
||||||
for font in node.findall('registerFont'):
|
for font in node.findall('registerFont'):
|
||||||
name = font.get('fontName').encode('ascii')
|
name = font.get('fontName').encode('ascii')
|
||||||
fname = font.get('fontFile').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'}))
|
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):
|
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 = utils.attr_get(node, ['x','y','width','height'])
|
||||||
|
|
||||||
infos['y']+=infos['height']
|
infos['y']+=infos['height']
|
||||||
|
@ -616,7 +619,7 @@ class _rml_Illustration(platypus.flowables.Flowable):
|
||||||
drw.render(self.canv, None)
|
drw.render(self.canv, None)
|
||||||
|
|
||||||
class _rml_flowable(object):
|
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:
|
if images is None:
|
||||||
images = {}
|
images = {}
|
||||||
self.localcontext = localcontext
|
self.localcontext = localcontext
|
||||||
|
@ -625,6 +628,7 @@ class _rml_flowable(object):
|
||||||
self.images = images
|
self.images = images
|
||||||
self.path = path
|
self.path = path
|
||||||
self.title = title
|
self.title = title
|
||||||
|
self.canvas = canvas
|
||||||
|
|
||||||
def _textual(self, node):
|
def _textual(self, node):
|
||||||
rc1 = utils._process_text(self, node.text or '')
|
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'):
|
if key in ('rml_except', 'rml_loop', 'rml_tag'):
|
||||||
del txt_n.attrib[key]
|
del txt_n.attrib[key]
|
||||||
if not n.tag == 'bullet':
|
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 ''
|
txt_n.tail = n.tail and utils.xml2str(utils._process_text(self, n.tail.replace('\n',''))) or ''
|
||||||
rc1 += etree.tostring(txt_n)
|
rc1 += etree.tostring(txt_n)
|
||||||
return rc1
|
return rc1
|
||||||
|
@ -983,7 +990,7 @@ class _rml_template(object):
|
||||||
if self.localcontext and not self.localcontext.get('internal_header',False):
|
if self.localcontext and not self.localcontext.get('internal_header',False):
|
||||||
del self.localcontext['internal_header']
|
del self.localcontext['internal_header']
|
||||||
fis = []
|
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
|
story_cnt = 0
|
||||||
for node_story in node_stories:
|
for node_story in node_stories:
|
||||||
if story_cnt > 0:
|
if story_cnt > 0:
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Lesser General Public
|
# You should have received a copy of the GNU Lesser General Public
|
||||||
# License along with this library; if not, write to the Free Software
|
# 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
|
||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# 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
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# 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
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# 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'
|
!include 'MUI2.nsh'
|
||||||
|
|
Loading…
Reference in New Issue