# Remove index from "type" field in sales, purchases and invoices

**URL:** https://discuss.tryton.org/t/remove-index-from-type-field-in-sales-purchases-and-invoices/1370
**Category:** Feature
**Created:** [May 3, 2019, 9:22am UTC](https://discuss.tryton.org/t/remove-index-from-type-field-in-sales-purchases-and-invoices/1370 "2019-05-03T09:22:43Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![albert](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/albert/32/21_2.png) [@albert](https://discuss.tryton.org/u/albert)
#### Post date: [May 3, 2019, 9:22am UTC](https://discuss.tryton.org/t/remove-index-from-type-field-in-sales-purchases-and-invoices/1370/1 "2019-05-03T09:22:43Z")

</div>

## Rational

Sale, Purchase and Invoice lines have a “type” field but that field that is declared with “select=True” which creates an index to the database.

However, checking on several customer databases we see that the index is never used (pretty normal as I don’t think there are any places that use type in a domain).

## Proposal

We should remove “select=True” from those fields.

I guess we should also remove the index with the migration code. Although if somebody really needs it, is going to be annoyed by core removing it.

Thoughts?

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [May 3, 2019, 9:27am UTC](https://discuss.tryton.org/t/remove-index-from-type-field-in-sales-purchases-and-invoices/1370/2 "2019-05-03T09:27:25Z")

</div>

I think it does not deserve a blueprint and we already have an issue for that: [Make better index (#5757) · Issues · Tryton / Tryton · GitLab](https://bugs.tryton.org/issue5757)

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [October 24, 2022, 6:00am UTC](https://discuss.tryton.org/t/remove-index-from-type-field-in-sales-purchases-and-invoices/1370/3 "2022-10-24T06:00:13Z")

</div>

This topic was automatically closed after 12 days. New replies are no longer allowed.
