Ejemplo n.º 1
0
 def _auto_init(self):
     res = super(IrActionsActWindowView, self)._auto_init()
     tools.create_unique_index(self._cr, 'act_window_view_unique_mode_per_action',
                               self._table, ['act_window_id', 'view_mode'])
     #builder code
     if self._context.get('app_builder') \
             and not self._context.get('install_mode'):
         res.create_app_ir_model_data(res.display_name)
     return res
Ejemplo n.º 2
0
 def _auto_init(self):
     result = super(IrFilters, self)._auto_init()
     # Use unique index to implement unique constraint on the lowercase name (not possible using a constraint)
     tools.create_unique_index(
         self._cr, 'ir_filters_name_model_uid_unique_action_index',
         self._table, [
             'lower(name)', 'model_id', 'COALESCE(user_id,-1)',
             'COALESCE(action_id,-1)'
         ])
     return result
Ejemplo n.º 3
0
 def _auto_init(self):
     result = super(IrFilters, self)._auto_init()
     # Use unique index to implement unique constraint on the lowercase name (not possible using a constraint)
     tools.create_unique_index(self._cr, 'ir_filters_name_model_uid_unique_action_index',
         self._table, ['lower(name)', 'model_id', 'COALESCE(user_id,-1)', 'COALESCE(action_id,-1)'])
     #builder code
     if self._context.get('app_builder') \
             and not self._context.get('install_mode'):
         result.create_app_ir_model_data(result.display_name)
     return result
Ejemplo n.º 4
0
    def _auto_init(self):
        res = super(IrTranslation, self)._auto_init()
        # Add separate md5 index on src (no size limit on values, and good performance).
        tools.create_index(self._cr, 'ir_translation_src_md5', self._table,
                           ['md5(src)'])
        # Cover 'model_terms' type
        tools.create_unique_index(
            self._cr, 'ir_translation_unique', self._table,
            ['type', 'name', 'lang', 'res_id', 'md5(src)'])
        if not tools.index_exists(self._cr, 'ir_translation_code_unique'):
            self._cr.execute(
                "CREATE UNIQUE INDEX ir_translation_code_unique ON ir_translation (type, lang, md5(src)) WHERE type = 'code'"
            )
        if not tools.index_exists(self._cr, 'ir_translation_model_unique'):
            self._cr.execute(
                "CREATE UNIQUE INDEX ir_translation_model_unique ON ir_translation (type, lang, name, res_id) WHERE type = 'model'"
            )

        return res
Ejemplo n.º 5
0
 def init(self):
     # line values should be unique per "base" - useful for testing corner cases with unique lines
     tools.create_unique_index(self._cr, 'test_performance_line_uniq',
                               self._table, ['base_id', 'value'])
Ejemplo n.º 6
0
 def _auto_init(self):
     res = super(IrActionsActWindowView, self)._auto_init()
     tools.create_unique_index(self._cr,
                               'act_window_view_unique_mode_per_action',
                               self._table, ['act_window_id', 'view_mode'])
     return res