İçereği Atla
Menü
Bu soru işaretlendi
2 Cevaplar
3563 Görünümler

Hi,

Sale order line field, How can i  find it's relation name.
tax_id = fields.Many2many('account.tax', string='Taxes', domain=['|', ('active', '=', False), ('active', '=', True)])


Thanks

Avatar
Vazgeç
En İyi Yanıt

As relational name is not given in the field definition, system generates the relational table's name automatically. In this case the table name is "account_tax_sale_order_line_rel".

There is a following rule for that:

If name is not given, it is automatically generated from provided "model_name" and "comodel_name" after sorted by alphabetical order (account_tax, sale_order_line = account_tax_sale_order_line_rel)

Original Code in framework:

tables = sorted([model._table, comodel._table])
relation = '%s_%s_rel' % tuple(tables)
Sudhir Arya
ERP Harbor Consulting Services
Skype:sudhir@erpharbor.com
Website: http://www.erpharbor.com
Avatar
Vazgeç
Üretici

Thanks for explanation.

En İyi Yanıt

you can find the related tables from db ending with _rel. for eg:

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
2
Tem 25
5021
2
Ara 24
8003
2
Kas 24
28795
2
May 24
7668
3
Mar 24
7141