In sale.order we can sort the list view by sale order name. Likewise i need to make a field sortable in odoo16.
i tried this code,
from odoo import models, fields, api
class PricelistItem(models.Model):
_inherit = "product.pricelist.item"
_order = 'custom_name, id desc'
custom_name = fields.Char('Custom name', compute="_compute_custom_name")
@api.depends('name')
def _compute_custom_name(self):
for rec in self:
if rec:
rec.custom_name = rec.name
i need to sort name field in model product.pricelist.item,
thanks in advance.