odoo 16: Many2one field - how to return value of another field Instead Of default 'id'

149 Views Asked by At

i have a following models:

  1. coa_ledgers with id, acc_name, ledger_acc etc.
  2. banks with id, bank_name, ledger_acc etc.

for my banks field 'ledger_acc' is Many2one to select from coa_ledgers and it should return the value of 'ledger_acc' field instead of 'id' field. ( Many2one field will display 'acc_name' column and should return 'ledger_acc' field value and NOT return id column value )

how i can achieve this? please help.

in my Model for banks i have Many2one field as below (by default this will Return 'id' field value from coa_ledgers but i want it to Return 'ledger_acc' field)

ledger_acc = fields.Many2one('coa_ledgers', string='Ledger A/c')

kindly help with all possible way(s).

regards

0

There are 0 best solutions below