[Python] How to display another field instead of default field in a many2one field in odoo

Discussão em 'Python' iniciado por Stack, Abril 13, 2025.

  1. Stack

    Stack Membro Participativo

    I want to display a custom field in many2one field in odoo but only in a particular view, the sales order view. These are my models

    class SalesPartnerBankInherit(models.Model):
    _inherit = 'res.partner.bank'

    display_on_sales = fields.Boolean(string='Display On Sales Quotation '
    'Report', readonly=False)
    location = fields.Char()


    I want to display the location field in my many2one field in sales order.

    class CustomSalesInherit(models.Model):
    _inherit = 'sale.order'

    quotation = fields.Text(string='Quotation Title', readonly=False,
    compute='_compute_quotation_title',

    location = fields.Many2one('res.partner.bank', domain=[('location', '!=', None)],
    string='Bank Account Location')

    Continue reading...

Compartilhe esta Página