Migrate to version 3.4

This commit is contained in:
Sergi Almacellas Abellana 2014-11-05 17:37:46 +01:00
parent d9f5ab8a6a
commit d3e1323de0
4 changed files with 14 additions and 14 deletions

View File

@ -1,3 +1,4 @@
Version 3.4.0 - 2014-11-03
* Open history data with the correct __history values * Open history data with the correct __history values
* Fix user permisions * Fix user permisions

20
babi.py
View File

@ -23,9 +23,9 @@ from trytond.pyson import Eval, Bool, PYSONEncoder, Id, In, Not, PYSONDecoder
from trytond.pool import Pool, PoolMeta from trytond.pool import Pool, PoolMeta
from trytond.transaction import Transaction from trytond.transaction import Transaction
from trytond.tools import safe_eval from trytond.tools import safe_eval
from trytond.config import CONFIG from trytond.config import config
from trytond import backend from trytond import backend
from trytond.protocols.jsonrpc import object_hook, JSONEncoder from trytond.protocols.jsonrpc import JSONDecoder, JSONEncoder
from .babi_eval import babi_eval from .babi_eval import babi_eval
@ -82,13 +82,14 @@ def unaccent(text):
def start_celery(): def start_celery():
celery_start = CONFIG.get('celery_start', True) celery_start = config.get('celery', 'auto_start', True)
if not CELERY_AVAILABLE or not celery_start: if not CELERY_AVAILABLE or not celery_start:
return return
db = Transaction().cursor.database_name db = Transaction().cursor.database_name
env = { env = {
'TRYTON_DATABASE': db, 'TRYTON_DATABASE': db,
'TRYTON_CONFIG': CONFIG.configfile # TODO: Save current config to a file and update the setting
'TRYTON_CONFIG': '',
} }
# Copy environment variables in order to get virtualenvs working # Copy environment variables in order to get virtualenvs working
for key, value in os.environ.iteritems(): for key, value in os.environ.iteritems():
@ -1122,7 +1123,7 @@ class ReportExecution(ModelSQL, ModelView):
if not self.filter_values: if not self.filter_values:
self.raise_user_error('filter_parameters', self.rec_name) self.raise_user_error('filter_parameters', self.rec_name)
filter_data = json.loads(self.filter_values.encode('utf-8'), filter_data = json.loads(self.filter_values.encode('utf-8'),
object_hook=object_hook) object_hook=JSONDecoder())
values = {} values = {}
for key, value in filter_data.iteritems(): for key, value in filter_data.iteritems():
key = '_'.join(key.split('_')[:-1]) key = '_'.join(key.split('_')[:-1])
@ -1483,13 +1484,13 @@ class OpenExecutionSelect(ModelView):
execution_readonly = fields.Boolean('Execution Readonly') execution_readonly = fields.Boolean('Execution Readonly')
@classmethod @classmethod
def default_get(cls, fields, with_rec_name=True, with_on_change=True): def default_get(cls, fields, with_rec_name=True):
pool = Pool() pool = Pool()
Execution = pool.get('babi.report.execution') Execution = pool.get('babi.report.execution')
Menu = pool.get('ir.ui.menu') Menu = pool.get('ir.ui.menu')
result = super(OpenExecutionSelect, cls).default_get(fields, result = super(OpenExecutionSelect, cls).default_get(fields,
with_rec_name, with_on_change) with_rec_name)
active_id = Transaction().context.get('active_id') active_id = Transaction().context.get('active_id')
model_name = Transaction().context.get('active_model') model_name = Transaction().context.get('active_model')
@ -2245,7 +2246,7 @@ class OpenChartStart(ModelView):
depends=['execution']) depends=['execution'])
@classmethod @classmethod
def default_get(cls, fields, with_rec_name=True, with_on_change=True): def default_get(cls, fields, with_rec_name=True):
pool = Pool() pool = Pool()
Execution = pool.get('babi.report.execution') Execution = pool.get('babi.report.execution')
model_name = Transaction().context.get('active_model') model_name = Transaction().context.get('active_model')
@ -2253,8 +2254,7 @@ class OpenChartStart(ModelView):
('babi_model.model', '=', model_name), ('babi_model.model', '=', model_name),
], limit=1) ], limit=1)
result = super(OpenChartStart, cls).default_get(fields, with_rec_name, result = super(OpenChartStart, cls).default_get(fields, with_rec_name)
with_on_change)
if len(executions) != 1: if len(executions) != 1:
return result return result
execution, = executions execution, = executions

View File

@ -38,10 +38,9 @@ class Cron:
return super(Cron, cls).create(vlist) return super(Cron, cls).create(vlist)
@classmethod @classmethod
def default_get(cls, fields, with_rec_name=True, with_on_change=True): def default_get(cls, fields, with_rec_name=True):
User = Pool().get('res.user') User = Pool().get('res.user')
res = super(Cron, cls).default_get(fields, with_rec_name, res = super(Cron, cls).default_get(fields, with_rec_name)
with_on_change)
cron_user, = User.search([ cron_user, = User.search([
('active', '=', False), ('active', '=', False),
('login', '=', 'user_cron_trigger'), ('login', '=', 'user_cron_trigger'),

View File

@ -1,5 +1,5 @@
[tryton] [tryton]
version=3.2.0 version=3.4.0
depends: depends:
ir ir
res res