Migration to python-sql

review1001002
This commit is contained in:
Cédric Krier committed 2013-09-06 22:34:16 +02:00
1 parent 2006fc36c4
commit 1bb60e0e98
2 files changed
+13 -6

No files matched your search

+8 -4
View File
@@ -2,7 +2,7 @@
#this repository contains the full copyright notices and license terms.
from trytond.model import ModelView, ModelSQL, fields
from trytond.transaction import Transaction
from trytond.backend import TableHandler
from trytond import backend
from trytond.pyson import Eval
__all__ = ['DashboardAction']
@@ -13,9 +13,7 @@ class DashboardAction(ModelSQL, ModelView):
__name__ = "dashboard.action"
user = fields.Many2One('res.user', 'User', required=True,
select=True)
sequence = fields.Integer('Sequence',
order_field='(%(table)s.sequence IS NULL) %(order)s, '
'%(table)s.sequence %(order)s')
sequence = fields.Integer('Sequence')
act_window = fields.Many2One('ir.action.act_window', 'Action',
required=True, ondelete='CASCADE', domain=[
('res_model', '!=', None),
@@ -35,6 +33,7 @@ class DashboardAction(ModelSQL, ModelView):
@classmethod
def __register__(cls, module_name):
TableHandler = backend.get('TableHandler')
cursor = Transaction().cursor
table = TableHandler(cursor, cls, module_name)
@@ -42,3 +41,8 @@ class DashboardAction(ModelSQL, ModelView):
# Migration from 2.4: drop required on sequence
table.not_null_action('sequence', action='remove')
@staticmethod
def order_sequence(tables):
table, _ = tables[None]
return [table.sequence == None, table.sequence]
+5 -2
View File
@@ -1,7 +1,7 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
from trytond.model import fields
from trytond.backend import TableHandler
from trytond import backend
from trytond.transaction import Transaction
from trytond.pool import PoolMeta
@@ -31,8 +31,11 @@ class User:
@classmethod
def __register__(cls, module_name):
super(User, cls).__register__(module_name)
TableHandler = backend.get('TableHandler')
cursor = Transaction().cursor
super(User, cls).__register__(module_name)
table = TableHandler(cursor, cls, module_name)
# Migration from 1.6