Remove required on icon, action domain and action view sequence
issue7889 review54451002
This commit is contained in:
1 parent
c7f5c54a83
commit
633eb74e1f
3 files changed
+41
-21
No files matched your search
+23
-9
@@ -7,7 +7,9 @@ from functools import partial
|
||||
|
||||
from sql import Null
|
||||
|
||||
from ..model import ModelView, ModelStorage, ModelSQL, DeactivableMixin, fields
|
||||
from ..model import (
|
||||
ModelView, ModelStorage, ModelSQL, DeactivableMixin, fields,
|
||||
sequence_ordered)
|
||||
from ..tools import file_open
|
||||
from ..pyson import PYSONDecoder, PYSON, Eval
|
||||
from ..transaction import Transaction
|
||||
@@ -861,19 +863,23 @@ class ActionActWindow(ActionMixin, ModelSQL, ModelView):
|
||||
return Action.get_action_values(cls.__name__, [action_id])[0]
|
||||
|
||||
|
||||
class ActionActWindowView(DeactivableMixin, ModelSQL, ModelView):
|
||||
class ActionActWindowView(
|
||||
sequence_ordered(), DeactivableMixin, ModelSQL, ModelView):
|
||||
"Action act window view"
|
||||
__name__ = 'ir.action.act_window.view'
|
||||
sequence = fields.Integer('Sequence', required=True)
|
||||
view = fields.Many2One('ir.ui.view', 'View', required=True,
|
||||
ondelete='CASCADE')
|
||||
act_window = fields.Many2One('ir.action.act_window', 'Action',
|
||||
ondelete='CASCADE')
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(ActionActWindowView, cls).__setup__()
|
||||
cls._order.insert(0, ('sequence', 'ASC'))
|
||||
def __register__(cls, module_name):
|
||||
super().__register__(module_name)
|
||||
|
||||
table = cls.__table_handler__(module_name)
|
||||
|
||||
# Migration from 5.0: remove required on sequence
|
||||
table.not_null_action('sequence', 'remove')
|
||||
|
||||
@classmethod
|
||||
def create(cls, vlist):
|
||||
@@ -895,11 +901,11 @@ class ActionActWindowView(DeactivableMixin, ModelSQL, ModelView):
|
||||
pool.get('ir.action.keyword')._get_keyword_cache.clear()
|
||||
|
||||
|
||||
class ActionActWindowDomain(DeactivableMixin, ModelSQL, ModelView):
|
||||
class ActionActWindowDomain(
|
||||
sequence_ordered(), DeactivableMixin, ModelSQL, ModelView):
|
||||
"Action act window domain"
|
||||
__name__ = 'ir.action.act_window.domain'
|
||||
name = fields.Char('Name', translate=True)
|
||||
sequence = fields.Integer('Sequence', required=True)
|
||||
domain = fields.Char('Domain')
|
||||
count = fields.Boolean('Count')
|
||||
act_window = fields.Many2One('ir.action.act_window', 'Action',
|
||||
@@ -908,12 +914,20 @@ class ActionActWindowDomain(DeactivableMixin, ModelSQL, ModelView):
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(ActionActWindowDomain, cls).__setup__()
|
||||
cls._order.insert(0, ('sequence', 'ASC'))
|
||||
cls._error_messages.update({
|
||||
'invalid_domain': ('Invalid domain or search criteria '
|
||||
'"%(domain)s" on action "%(action)s".'),
|
||||
})
|
||||
|
||||
@classmethod
|
||||
def __register__(cls, module_name):
|
||||
super().__register__(module_name)
|
||||
|
||||
table = cls.__table_handler__(module_name)
|
||||
|
||||
# Migration from 5.0: remove required on sequence
|
||||
table.not_null_action('sequence', 'remove')
|
||||
|
||||
@classmethod
|
||||
def default_count(cls):
|
||||
return False
|
||||
|
||||
@@ -5,7 +5,7 @@ from functools import wraps
|
||||
|
||||
from sql.operators import NotIn
|
||||
|
||||
from trytond.model import ModelView, ModelSQL, fields, Unique
|
||||
from trytond.model import ModelView, ModelSQL, fields, Unique, sequence_ordered
|
||||
from trytond.modules import get_module_list, get_module_info
|
||||
from trytond.wizard import Wizard, StateView, Button, StateTransition, \
|
||||
StateAction
|
||||
@@ -381,22 +381,16 @@ class ModuleDependency(ModelSQL, ModelView):
|
||||
return 'unknown'
|
||||
|
||||
|
||||
class ModuleConfigWizardItem(ModelSQL, ModelView):
|
||||
class ModuleConfigWizardItem(sequence_ordered(), ModelSQL, ModelView):
|
||||
"Config wizard to run after activating a module"
|
||||
__name__ = 'ir.module.config_wizard.item'
|
||||
action = fields.Many2One('ir.action', 'Action', required=True,
|
||||
readonly=True)
|
||||
sequence = fields.Integer('Sequence', required=True)
|
||||
state = fields.Selection([
|
||||
('open', 'Open'),
|
||||
('done', 'Done'),
|
||||
], string='State', required=True, select=True)
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(ModuleConfigWizardItem, cls).__setup__()
|
||||
cls._order.insert(0, ('sequence', 'ASC'))
|
||||
|
||||
@classmethod
|
||||
def __register__(cls, module_name):
|
||||
TableHandler = backend.get('TableHandler')
|
||||
@@ -417,6 +411,11 @@ class ModuleConfigWizardItem(ModelSQL, ModelView):
|
||||
|
||||
super(ModuleConfigWizardItem, cls).__register__(module_name)
|
||||
|
||||
table = cls.__table_handler__(module_name)
|
||||
|
||||
# Migration from 5.0: remove required on sequence
|
||||
table.not_null_action('sequence', 'remove')
|
||||
|
||||
@staticmethod
|
||||
def default_state():
|
||||
return 'open'
|
||||
|
||||
+11
-4
@@ -3,7 +3,7 @@
|
||||
|
||||
import os
|
||||
|
||||
from trytond.model import ModelView, ModelSQL, fields
|
||||
from trytond.model import ModelView, ModelSQL, fields, sequence_ordered
|
||||
from trytond.tools import file_open
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.rpc import RPC
|
||||
@@ -13,7 +13,7 @@ __all__ = [
|
||||
]
|
||||
|
||||
|
||||
class Icon(ModelSQL, ModelView):
|
||||
class Icon(sequence_ordered(), ModelSQL, ModelView):
|
||||
'Icon'
|
||||
__name__ = 'ir.ui.icon'
|
||||
|
||||
@@ -21,16 +21,23 @@ class Icon(ModelSQL, ModelView):
|
||||
module = fields.Char('Module', readonly=True, required=True)
|
||||
path = fields.Char('SVG Path', readonly=True, required=True)
|
||||
icon = fields.Function(fields.Char('Icon', depends=['path']), 'get_icon')
|
||||
sequence = fields.Integer('Sequence', required=True)
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(Icon, cls).__setup__()
|
||||
cls._order.insert(0, ('sequence', 'ASC'))
|
||||
cls.__rpc__.update({
|
||||
'list_icons': RPC(),
|
||||
})
|
||||
|
||||
@classmethod
|
||||
def __register__(cls, module_name):
|
||||
super().__register__(module_name)
|
||||
|
||||
table = cls.__table_handler__(module_name)
|
||||
|
||||
# Migration from 5.0: remove required on sequence
|
||||
table.not_null_action('sequence', 'remove')
|
||||
|
||||
@staticmethod
|
||||
def default_module():
|
||||
return Transaction().context.get('module') or ''
|
||||
|
||||
Reference in new issue
Block a user