[MERGE] [FWD] Forward porting in trunk of the 7.0 server branch until rev 4787 (revid odo@openerp.com-20130115124058-81kgv0cy9jp96ln4).

bzr revid: tde@openerp.com-20130115145001-f5w4y9axv3ddu4ww
This commit is contained in:
Thibault Delavallée 2013-01-15 15:50:01 +01:00
commit f5e2fb5ee8
10 changed files with 42 additions and 21 deletions

View File

@ -1969,6 +1969,7 @@
<field name="symbol">£</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
<field name="position">before</field>
<field name="company_id" ref="main_company"/>
</record>
<record id="rateGBP" model="res.currency.rate">

View File

@ -107,6 +107,8 @@ class ir_attachment(osv.osv):
full_path = self._full_path(cr, uid, location, fname)
try:
os.unlink(full_path)
except OSError:
_logger.error("_file_delete could not unlink %s",full_path)
except IOError:
# Harmless and needed for race conditions
_logger.error("_file_delete could not unlink %s",full_path)

View File

@ -40,7 +40,7 @@
<record id="ir_cron_view_tree" model="ir.ui.view">
<field name="model">ir.cron</field>
<field name="arch" type="xml">
<tree string="Scheduled Actions">
<tree string="Scheduled Actions" colors="grey:(not active)">
<field name="priority" string="Sequence"/>
<field name="name"/>
<field name="nextcall"/>
@ -48,6 +48,7 @@
<field name="interval_type"/>
<field name="numbercall"/>
<field name="user_id" invisible="1"/>
<field name="active"/>
</tree>
</field>
</record>

View File

@ -370,7 +370,7 @@ class ir_mail_server(osv.osv):
return msg
def send_email(self, cr, uid, message, mail_server_id=None, smtp_server=None, smtp_port=None,
smtp_user=None, smtp_password=None, smtp_encryption='none', smtp_debug=False,
smtp_user=None, smtp_password=None, smtp_encryption=None, smtp_debug=False,
context=None):
"""Sends an email directly (no queuing).
@ -388,7 +388,7 @@ class ir_mail_server(osv.osv):
extracted from the combined list of ``To``, ``CC`` and ``BCC`` headers.
:param mail_server_id: optional id of ir.mail_server to use for sending. overrides other smtp_* arguments.
:param smtp_server: optional hostname of SMTP server to use
:param smtp_encryption: one of 'none', 'starttls' or 'ssl' (see ir.mail_server fields for explanation)
:param smtp_encryption: optional TLS mode, one of 'none', 'starttls' or 'ssl' (see ir.mail_server fields for explanation)
:param smtp_port: optional SMTP port, if mail_server_id is not passed
:param smtp_user: optional SMTP user, if mail_server_id is not passed
:param smtp_password: optional SMTP password to use, if mail_server_id is not passed
@ -422,12 +422,6 @@ class ir_mail_server(osv.osv):
mail_server_ids = self.search(cr, uid, [], order='sequence', limit=1)
if mail_server_ids:
mail_server = self.browse(cr, uid, mail_server_ids[0])
else:
# we were passed an explicit smtp_server or nothing at all
smtp_server = smtp_server or tools.config.get('smtp_server')
smtp_port = tools.config.get('smtp_port', 25) if smtp_port is None else smtp_port
smtp_user = smtp_user or tools.config.get('smtp_user')
smtp_password = smtp_password or tools.config.get('smtp_password')
if mail_server:
smtp_server = mail_server.smtp_host
@ -436,6 +430,14 @@ class ir_mail_server(osv.osv):
smtp_port = mail_server.smtp_port
smtp_encryption = mail_server.smtp_encryption
smtp_debug = smtp_debug or mail_server.smtp_debug
else:
# we were passed an explicit smtp_server or nothing at all
smtp_server = smtp_server or tools.config.get('smtp_server')
smtp_port = tools.config.get('smtp_port', 25) if smtp_port is None else smtp_port
smtp_user = smtp_user or tools.config.get('smtp_user')
smtp_password = smtp_password or tools.config.get('smtp_password')
if smtp_encryption is None and tools.config.get('smtp_ssl'):
smtp_encryption = 'starttls' # STARTTLS is the new meaning of the smtp_ssl flag as of v7.0
if not smtp_server:
raise osv.except_osv(
@ -454,7 +456,7 @@ class ir_mail_server(osv.osv):
return message_id
try:
smtp = self.connect(smtp_server, smtp_port, smtp_user, smtp_password, smtp_encryption, smtp_debug)
smtp = self.connect(smtp_server, smtp_port, smtp_user, smtp_password, smtp_encryption or False, smtp_debug)
smtp.sendmail(smtp_from, smtp_to_list, message.as_string())
finally:
try:

View File

@ -212,12 +212,15 @@
<t t-if="record.has_image.raw_value === true">
<img t-att-src="kanban_image('res.partner', 'image', record.id.value, {'preview_image': 'image_small'})" class="oe_avatar oe_kanban_avatar_smallbox"/>
</t>
<t t-if="record.has_image.raw_value === false">
<t t-if="record.image and record.image.raw_value !== false">
<img t-att-src="'data:image/png;base64,'+record.image.raw_value" class="oe_avatar oe_kanban_avatar_smallbox"/>
</t>
<t t-if="record.has_image.raw_value === false and (!record.image or record.image.raw_value === false)">
<t t-if="record.is_company.raw_value === true">
<img t-att-src='_s + "/base/static/src/img/company_image.png"' class="oe_kanban_image"/>
<img t-att-src='_s + "/base/static/src/img/company_image.png"' class="oe_kanban_image oe_kanban_avatar_smallbox"/>
</t>
<t t-if="record.is_company.raw_value === false">
<img t-att-src='_s + "/base/static/src/img/avatar.png"' class="oe_kanban_image"/>
<img t-att-src='_s + "/base/static/src/img/avatar.png"' class="oe_kanban_image oe_kanban_avatar_smallbox"/>
</t>
</t>
</a>

View File

@ -2,6 +2,8 @@ openerp.base = function(instance) {
instance.base.apps_remote = null;
instance.base.apps_client = null;
var _t = instance.web._t;
instance.base.Apps = instance.web.Widget.extend({
template: 'EmptyComponent',
@ -98,7 +100,7 @@ openerp.base = function(instance) {
});
}).
fail(function(client) {
self.do_warn('Apps Server not reachable.', 'Showing local modules.', true);
self.do_warn(_t('OpenERP Apps Unreachable'), _t('Showing locally available modules'), true);
self.rpc('/web/action/load', {action_id: self.failback_action_id}).done(function(action) {
self.do_action(action);
instance.webclient.menu.open_action(action.id);

View File

@ -289,8 +289,8 @@ class date(_column):
This method may be passed as value to initialize _defaults.
:param Model model: model (osv) for which the date value is being
computed - technical field, currently ignored,
automatically passed when used in _defaults.
computed - automatically passed when used in
_defaults.
:param datetime timestamp: optional datetime value to use instead of
the current date and time (must be a
datetime, regular dates can't be converted
@ -303,9 +303,13 @@ class date(_column):
today = timestamp or DT.datetime.now()
context_today = None
if context and context.get('tz'):
tz_name = context['tz']
else:
tz_name = model.pool.get('res.users').read(cr, SUPERUSER_ID, uid, ['tz'])['tz']
if tz_name:
try:
utc = pytz.timezone('UTC')
context_tz = pytz.timezone(context['tz'])
context_tz = pytz.timezone(tz_name)
utc_today = utc.localize(today, is_dst=False) # UTC = no DST
context_today = utc_today.astimezone(context_tz)
except Exception:
@ -346,9 +350,14 @@ class datetime(_column):
"""
assert isinstance(timestamp, DT.datetime), 'Datetime instance expected'
if context and context.get('tz'):
tz_name = context['tz']
else:
registry = openerp.modules.registry.RegistryManager.get(cr.dbname)
tz_name = registry.get('res.users').read(cr, SUPERUSER_ID, uid, ['tz'])['tz']
if tz_name:
try:
utc = pytz.timezone('UTC')
context_tz = pytz.timezone(context['tz'])
context_tz = pytz.timezone(tz_name)
utc_timestamp = utc.localize(timestamp, is_dst=False) # UTC = no DST
return utc_timestamp.astimezone(context_tz)
except Exception:

View File

@ -130,7 +130,7 @@ def start_services_workers():
def _reexec():
"""reexecute openerp-server process with (nearly) the same arguments"""
if openerp.tools.osutil.is_running_as_nt_service():
subprocess.call('sc stop {0} && sc start {0}'.format(nt_service_name), shell=True)
subprocess.call('net stop {0} && net start {0}'.format(nt_service_name), shell=True)
exe = os.path.basename(sys.executable)
strip_args = ['-d', '-u']
a = sys.argv[:]

View File

@ -205,7 +205,7 @@ class configmanager(object):
group.add_option('--smtp-port', dest='smtp_port', my_default=25,
help='specify the SMTP port', type="int")
group.add_option('--smtp-ssl', dest='smtp_ssl', action='store_true', my_default=False,
help='specify the SMTP server support SSL or not')
help='if passed, SMTP connections will be encrypted with SSL (STARTTLS)')
group.add_option('--smtp-user', dest='smtp_user', my_default=False,
help='specify the SMTP username for sending email')
group.add_option('--smtp-password', dest='smtp_password', my_default=False,

View File

@ -886,8 +886,9 @@ def trans_generate(lang, modules, cr):
for root, dummy, files in osutil.walksymlinks(path):
for fname in fnmatch.filter(files, '*.py'):
babel_extract_terms(fname, path, root)
# mako provides a babel extractor: http://docs.makotemplates.org/en/latest/usage.html#babel
for fname in fnmatch.filter(files, '*.mako'):
babel_extract_terms(fname, path, root, trans_type='report')
babel_extract_terms(fname, path, root, 'mako', trans_type='report')
# Javascript source files in the static/src/js directory, rest is ignored (libs)
if fnmatch.fnmatch(root, '*/static/src/js*'):
for fname in fnmatch.filter(files, '*.js'):