bzr revid: christophe@tinyerp.com-20080805110138-ni5s4jule8abrf9x
This commit is contained in:
Christophe Simonis 2008-08-05 13:01:38 +02:00
commit 58996f2c51
9 changed files with 63 additions and 30 deletions

View File

@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: Tiny ERP
Version: 3.2.0
Version: 4.3.0
Author: Tiny.be
Author-email: fp at tiny be
Maintainer: Tiny.be

View File

@ -653,7 +653,7 @@
<separator colspan="4" string="Status"/>
<field name="state"/>
<group col="2" colspan="2">
<button colspan="2" name="%(act_menu_create)d" string="Create a Menu" type="action"/>
<button colspan="2" name="%(act_menu_create)d" string="Create a Menu" type="action" target="new"/>
</group>
</page>
<page string="Information">

View File

@ -324,13 +324,13 @@ class actions_server(osv.osv):
if 'action' in localdict:
return localdict['action']
if action.state == 'email':
user = "%s@yahoo.co.in," % (config['smtp_user'])
user = config['email_from']
subject = action.name
body = action.message
if tools.email_send_attach(user, action.address, subject, body) == True:
logger.notifyChannel('email', netsvc.LOG_INFO, 'Email successfully send to : %s' % (user))
if tools.email_send_attach(user, action.address, subject, body, debug=False) == True:
logger.notifyChannel('email', netsvc.LOG_INFO, 'Email successfully send to : %s' % (action.address))
else:
logger.notifyChannel('email', netsvc.LOG_ERROR, 'Failed to send email to : %s' % (user))
logger.notifyChannel('email', netsvc.LOG_ERROR, 'Failed to send email to : %s' % (action.address))
return False
actions_server()

View File

@ -64,16 +64,29 @@ class ir_translation(osv.osv, Cacheable):
_columns = {
'name': fields.char('Field Name', size=128, required=True),
'res_id': fields.integer('Resource ID'),
'res_id': fields.integer('Resource ID', select=True),
'lang': fields.selection(_get_language, string='Language', size=5),
'type': fields.selection(TRANSLATION_TYPE, string='Type', size=16),
'type': fields.selection(TRANSLATION_TYPE, string='Type', size=16, select=True),
'src': fields.text('Source'),
'value': fields.text('Translation Value'),
}
_sql = """
create index ir_translation_ltn on ir_translation (lang,type,name);
create index ir_translation_res_id on ir_translation (res_id);
"""
def _auto_init(self, cr, context={}):
super(ir_translation, self)._auto_init(cr, context)
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = %s', ('ir_translation_ltns',))
if not cr.fetchone():
cr.execute('CREATE INDEX ir_translation_ltns ON ir_translation (lang, type, name, src)')
cr.commit()
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = %s', ('ir_translation_ltn',))
if not cr.fetchone():
cr.execute('CREATE INDEX ir_translation_ltn ON ir_translation (lang, type, name)')
cr.commit()
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = %s', ('ir_translation_lts',))
if not cr.fetchone():
cr.execute('CREATE INDEX ir_translation_lts ON ir_translation (lang, type, src)')
cr.commit()
def _get_ids(self, cr, uid, name, tt, lang, ids):
translations, to_fetch = {}, []

View File

@ -38,8 +38,8 @@ class workflow(osv.osv):
_log_access = False
_columns = {
'name': fields.char('Name', size=64, required=True),
'osv': fields.char('Resource Model', size=64, required=True),
'on_create': fields.boolean('On Create'),
'osv': fields.char('Resource Model', size=64, required=True,select=True),
'on_create': fields.boolean('On Create', select=True),
'activities': fields.one2many('workflow.activity', 'wkf_id', 'Activities'),
}
_defaults = {
@ -142,11 +142,11 @@ class wkf_instance(osv.osv):
_rec_name = 'res_type'
_log_access = False
_columns = {
'wkf_id': fields.many2one('workflow', 'Workflow', ondelete='restrict'),
'wkf_id': fields.many2one('workflow', 'Workflow', ondelete='restrict', select=True),
'uid': fields.integer('User ID'),
'res_id': fields.integer('Resource ID'),
'res_type': fields.char('Resource Model', size=64),
'state': fields.char('State', size=32),
'res_id': fields.integer('Resource ID', select=True),
'res_type': fields.char('Resource Model', size=64, select=True),
'state': fields.char('State', size=32, select=True),
}
def _auto_init(self, cr, context={}):
super(wkf_instance, self)._auto_init(cr, context)
@ -154,6 +154,11 @@ class wkf_instance(osv.osv):
if not cr.fetchone():
cr.execute('CREATE INDEX wkf_instance_res_id_res_type_state_index ON wkf_instance (res_id, res_type, state)')
cr.commit()
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'wkf_instance_res_id_wkf_id_index\'')
if not cr.fetchone():
cr.execute('CREATE INDEX wkf_instance_res_id_wkf_id_index ON wkf_instance (res_id, wkf_id)')
cr.commit()
wkf_instance()
class wkf_workitem(osv.osv):
@ -162,10 +167,10 @@ class wkf_workitem(osv.osv):
_log_access = False
_rec_name = 'state'
_columns = {
'act_id': fields.many2one('workflow.activity', 'Activity', required=True, ondelete="cascade"),
'subflow_id': fields.many2one('workflow.instance', 'Subflow', ondelete="cascade"),
'inst_id': fields.many2one('workflow.instance', 'Instance', required=True, ondelete="cascade", select=1),
'state': fields.char('State', size=64),
'act_id': fields.many2one('workflow.activity', 'Activity', required=True, ondelete="cascade", select=True),
'subflow_id': fields.many2one('workflow.instance', 'Subflow', ondelete="cascade", select=True),
'inst_id': fields.many2one('workflow.instance', 'Instance', required=True, ondelete="cascade", select=True),
'state': fields.char('State', size=64, select=True),
}
wkf_workitem()

View File

@ -329,8 +329,14 @@ class common(netsvc.Service):
logger.notifyChannel("web-service", netsvc.LOG_INFO, "%s from '%s' using database '%s'" % (msg, login, db))
return res or False
def about(self):
return _('''
def about(self, extended=False):
"""Return information about the OpenERP Server.
@param extended: if True then return version info
@return string if extended is False else tuple
"""
info = _('''
OpenERP is an ERP+CRM program for small and medium businesses.
@ -339,6 +345,10 @@ GNU Public Licence.
(c) 2003-TODAY, Fabien Pinckaers - Tiny sprl''')
if extended:
return info, tinyerp_version
return info
def timezone_get(self, db, login, password):
return time.tzname[0]
common()

View File

@ -34,6 +34,7 @@ import netsvc,logging
class configmanager(object):
def __init__(self, fname=None):
self.options = {
'email_from':False,
'verbose': False,
'interface': '', # this will bind the server to all interfaces
'port': '8069',
@ -95,7 +96,9 @@ class configmanager(object):
parser.add_option('--debug', dest='debug_mode', action='store_true', default=False, help='enable debug mode')
parser.add_option("--assert-exit-level", dest='assert_exit_level', help="specify the level at which a failed assertion will stop the server " + str(assert_exit_levels))
parser.add_option("-S", "--secure", dest="secure", action="store_true", help="launch server over https instead of http", default=False)
parser.add_option('--email-from', dest='email_from', default='', help='specify the SMTP email address for sending email')
parser.add_option('--smtp', dest='smtp_server', default='', help='specify the SMTP server for sending email')
parser.add_option('--smtp-ssl', dest='smtp_ssl', default='', help='specify the SMTP server support SSL or not')
parser.add_option('--smtp-user', dest='smtp_user', default='', help='specify the SMTP username for sending email')
parser.add_option('--smtp-password', dest='smtp_password', default='', help='specify the SMTP password for sending email')
parser.add_option('--price_accuracy', dest='price_accuracy', default='2', help='specify the price accuracy')
@ -150,7 +153,7 @@ class configmanager(object):
self.options['pidfile'] = False
for arg in ('interface', 'port', 'db_name', 'db_user', 'db_password', 'db_host',
'db_port', 'logfile', 'pidfile', 'secure', 'smtp_server', 'smtp_user', 'smtp_password', 'price_accuracy', 'netinterface', 'netport', 'db_maxconn', 'commit_mode', 'addons_path'):
'db_port', 'logfile', 'pidfile', 'secure', 'smtp_ssl', 'email_from', 'smtp_server', 'smtp_user', 'smtp_password', 'price_accuracy', 'netinterface', 'netport', 'db_maxconn', 'commit_mode', 'addons_path'):
if getattr(opt, arg):
self.options[arg] = getattr(opt, arg)

View File

@ -352,7 +352,10 @@ def email_send_attach(email_from, email_to, subject, body, email_cc=None, email_
from email import Encoders
msg = MIMEMultipart()
if not ssl:
ssl = config['smtp_ssl']
msg['Subject'] = Header(subject.decode('utf8'), 'utf-8')
msg['From'] = email_from
del msg['Reply-To']

View File

@ -60,10 +60,9 @@ def translate(cr, name, source_type, lang, source=None):
class GettextAlias(object):
def __call__(self, source):
frame = inspect.stack()[1][0]
cr = frame.f_locals['cr']
context = frame.f_locals.get('context', {})
lang = context.get('lang', False)
if not lang:
cr = frame.f_locals.get('cr')
lang = frame.f_locals.get('context', {}).get('lang', False)
if not (lang and cr):
return source
return translate(cr, None, 'code', lang, source) or source