Example #1
0
 def _auto_init(self):
     res = super(IrValues, self)._auto_init()
     tools.create_index(self._cr,
                        'ir_values_key_model_key2_res_id_user_id_idx',
                        self._table,
                        ['key', 'model', 'key2', 'res_id', 'user_id'])
     return res
    def init(self):
        """Create index for :meth:`~.move_report_domain`

        This method follows the logic of :meth:`~.move_report_domain`, which
        returns a domain with either two or three clauses depending on the
        value of `~._edi_move_report_via`. To complicate things,
        `~._edi_move_report_via` is allowed to be overridden in models
        inheriting from this one. This method gets called for each derived
        model and creates the appropriate index for each one.
        """
        super(EdiMoveReportDocument, self).init()

        Move = self.env["stock.move"]

        if self._edi_move_report_via is not None:
            tools.create_index(
                self._cr,
                "stock_move_state_picking_type_id_%s_index" %
                (self._edi_move_report_via, ),
                Move._table,
                ["state", "picking_type_id", self._edi_move_report_via],
            )
        else:
            tools.create_index(
                self._cr,
                "stock_move_state_picking_type_id_index",
                Move._table,
                ["state", "picking_type_id"],
            )
Example #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
Example #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)'])
     tools.create_unique_index(self._cr, 'ir_translation_unique', self._table,
                               ['type', 'name', 'lang', 'res_id', 'md5(src)'])
     return res
 def init(self):
     tools.create_index(
         self._cr,
         "stock_valuation_layer_usage_index",
         self._table,
         ["stock_valuation_layer_id", "stock_move_id", "stock_move_id"],
     )
Example #6
0
    def init(self):
        """ Creates index for model order """
        super(SaleOrder, self).init()

        tools.create_index(
            self._cr,
            "sale_order_requested_date_priority_id_index",
            self._table,
            ["requested_date ASC", "priority DESC", "id ASC"],
        )
Example #7
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
Example #8
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
Example #9
0
    def init(self):
        """ Creates indexes for _check_resultant_package_level
        """
        super(StockMoveLine, self).init()

        tools.create_index(
            self._cr,
            "stock_move_line_state_result_package_id_index",
            self._table,
            ["state", "result_package_id"],
        )
        tools.create_index(
            self._cr,
            "stock_move_line_state_u_result_parent_package_id_index",
            self._table,
            ["state", "u_result_parent_package_id"],
        )
    def init(self):
        """Create index for :meth:`~.pick_report_domain`

        This method follows the logic of :meth:`~.pick_report_domain`, which
        returns a domain with either two or three clauses depending on the
        value of `~._edi_pick_report_via`. To complicate things,
        `~._edi_pick_report_via` is allowed to be overridden in models
        inheriting from this one. This method gets called for each derived
        model and creates the appropriate index for each one.
        """
        super(EdiPickReportDocument, self).init()

        Picking = self.env['stock.picking']

        if self._edi_pick_report_via is not None:
            tools.create_index(
                self._cr, 'stock_picking_state_picking_type_id_%s_index' %
                (self._edi_pick_report_via, ), Picking._table,
                ['state', 'picking_type_id', self._edi_pick_report_via])
        else:
            tools.create_index(self._cr,
                               'stock_picking_state_picking_type_id_index',
                               Picking._table, ['state', 'picking_type_id'])
Example #11
0
 def _auto_init(self):
     res = super(IrAttachment, self)._auto_init()
     tools.create_index(self._cr, 'ir_attachment_res_idx',
                        self._table, ['res_model', 'res_id'])
     return res
Example #12
0
 def _auto_init(self):
     res = super(HolidaysRequest, self)._auto_init()
     tools.create_index(self._cr, 'hr_leave_date_to_date_from_index',
                        self._table, ['date_to', 'date_from'])
     return res
 def init(self):
     tools.create_index(self._cr, 'stock_valuation_layer_index',
                        self._table, [
                            'product_id', 'remaining_qty', 'stock_move_id',
                            'company_id', 'create_date'
                        ])
Example #14
0
 def _auto_init(self):
     res = super(HolidaysRequest, self)._auto_init()
     tools.create_index(self._cr, 'hr_leave_date_to_date_from_index',
                        self._table, ['date_to', 'date_from'])
     return res
Example #15
0
 def init(self):
     res = super(Attachment, self).init()
     # ir_http._xmlid_to_obj is using this index for multi-website
     tools.create_index(self._cr, 'ir_attachment_key_website_idx',
                        self._table, ['key', 'website_id'])
     return res
Example #16
0
 def _auto_init(self):
     res = super(FieldFile, self)._auto_init()
     tools.create_index(self._cr, 'muk_dms_file_reference_idx', self._table,
                        ['reference_model', 'reference_id'])
     return res
Example #17
0
 def _auto_init(self):
     res = super(IrAttachment, self)._auto_init()
     tools.create_index(self._cr, 'ir_attachment_res_idx',
                        self._table, ['res_model', 'res_id'])
     return res
Example #18
0
 def init(self):
     tools.create_index(self._cr, 'account_move_line_move_product_index',
                        self._table, ['move_id', 'product_id'])
Example #19
0
 def init(self):
     tools.create_index(self._cr, "hr_work_entry_date_start_date_stop_index", self._table, ["date_start", "date_stop"])
Example #20
0
 def _auto_init(self):
     res = super(IrValues, self)._auto_init()
     tools.create_index(self._cr, 'ir_values_key_model_key2_res_id_user_id_idx',
                        self._table, ['key', 'model', 'key2', 'res_id', 'user_id'])
     return res