Esempio n. 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)'])
        # 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
Esempio n. 2
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
Esempio n. 3
0
 def init(self):
     if not tools.index_exists(self._cr, 'stock_move_line_free_reservation_index'):
         self._cr.execute("""
             CREATE INDEX stock_move_line_free_reservation_index
             ON
                 stock_move_line (id, company_id, product_id, lot_id, location_id, owner_id, package_id)
             WHERE
                 (state IS NULL OR state NOT IN ('cancel', 'done')) AND product_qty > 0""")