示例#1
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)'])
     tools.create_unique_index(self._cr, 'ir_translation_unique', self._table,
                               ['type', 'name', 'lang', 'res_id', 'md5(src)'])
     return res
示例#2
0
文件: res_users.py 项目: Gorrice/odoo
 def _auto_init(self):
     result = super(ResUsers, self)._auto_init()
     # Use unique index to implement unique constraint per website, even if website_id is null 
     # (not possible using a constraint)
     tools.create_unique_index(self._cr, 'res_users_login_key_unique_website_index',
         self._table, ['login', 'COALESCE(website_id,-1)'])
     return result
示例#3
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)'])
     tools.create_unique_index(self._cr, 'ir_translation_unique', self._table,
                               ['type', 'name', 'lang', 'res_id', 'md5(src)'])
     return res
示例#4
0
 def _auto_init(self):
     res = super(SyncLink, self)._auto_init()
     tools.create_unique_index(
         self._cr,
         "sync_link_refs_uniq_index",
         self._table,
         ["relation", "system1", "system2", "ref1", "ref2"],
     )
     return res
示例#5
0
 def _auto_init(self):
     result = super(ResUsers, self)._auto_init()
     # Use unique index to implement unique constraint per website, even if website_id is null
     # (not possible using a constraint)
     tools.create_unique_index(self._cr,
                               'res_users_login_key_unique_website_index',
                               self._table,
                               ['login', 'COALESCE(website_id,-1)'])
     return result
示例#6
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
示例#7
0
 def _auto_init(self):
     res = super(PullRequests, self)._auto_init()
     tools.create_unique_index(self._cr,
                               'runbot_merge_unique_pr_per_target',
                               self._table,
                               ['number', 'target', 'repository'])
     self._cr.execute("CREATE INDEX IF NOT EXISTS runbot_merge_pr_head "
                      "ON runbot_merge_pull_requests "
                      "USING hash (head)")
     return res
 def _auto_init(self):
     result = super(CommissionRule, self)._auto_init()
     # Unique index to handle product_id, template_id, pricelist_id even if those are null (not possible using a constraint).
     tools.create_unique_index(
         self._cr, 'commission_rule_check_combination_unique_index',
         self._table, [
             'plan_id', 'category_id', 'COALESCE(product_id, -1)',
             'COALESCE(template_id, -1)', 'COALESCE(pricelist_id, -1)'
         ])
     return result
示例#9
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
示例#10
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'")
     if not tools.index_exists(self._cr, 'ir_translation_selection_unique'):
         self._cr.execute("CREATE UNIQUE INDEX ir_translation_selection_unique ON ir_translation (type, lang, name, md5(src)) WHERE type IN ('selection', 'constraint', 'sql_constraint')")
     return res
示例#11
0
 def _auto_init(self):
     res = super(Partner, self)._auto_init()
     tools.create_unique_index(self._cr, 'runbot_merge_unique_gh_login',
                               self._table, ['github_login'])
     return res
示例#12
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
示例#13
0
文件: models.py 项目: Tecnativa/odoo
 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'])
示例#14
0
 def _auto_init(self):
     res = super()._auto_init()
     tools.create_unique_index(self._cr, 'runbot_merge_review_m2m', self._table, ['partner_id', 'repository_id'])
     return res
示例#15
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
示例#16
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'])
示例#17
0
 def _auto_init(self):
     res = super(Repository, self)._auto_init()
     tools.create_unique_index(self._cr, 'runbot_merge_unique_repo',
                               self._table, ['name'])
     return res
示例#18
0
 def _auto_init(self):
     res = super(Branch, self)._auto_init()
     tools.create_unique_index(self._cr,
                               'runbot_merge_unique_branch_per_repo',
                               self._table, ['name', 'project_id'])
     return res
示例#19
0
文件: ir_filters.py 项目: 10537/odoo
 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