İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
2046 Görünümler

i want add a column .

How is that possible.



def _get_columns_name(self, options):
columns = [
{},
{'name': _("Due Date"), 'class': 'date', 'style': 'white-space:nowrap;'},
{'name': _("Journal"), 'class': '', 'style': 'text-align:center; white-space:nowrap;'},
{'name': _("Account"), 'class': '', 'style': 'text-align:center; white-space:nowrap;'},
{'name': _("Exp. Date"), 'class': 'date', 'style': 'white-space:nowrap;'},
{'name': _("As of: %s") % format_date(self.env, options['date']['date_to']), 'class': 'number sortable', 'style': 'white-space:nowrap;'},
{'name': _("1 - 30"), 'class': 'number sortable', 'style': 'white-space:nowrap;'},
{'name': _("31 - 60"), 'class': 'number sortable', 'style': 'white-space:nowrap;'},
{'name': _("61 - 90"), 'class': 'number sortable', 'style': 'white-space:nowrap;'},
{'name': _("91 - 120"), 'class': 'number sortable', 'style': 'white-space:nowrap;'},
{'name': _("Older"), 'class': 'number sortable', 'style': 'white-space:nowrap;'},
{'name': _("Total"), 'class': 'number sortable', 'style': 'white-space:nowrap;'},
]
return columns

Avatar
Vazgeç
En İyi Yanıt

Hello Mohamed,

Hope you are doing well.

If you want to add column then you have to inherit that model in that you want to add column and override the _get_columns_name method and easily add the new column like below.

@api.model
def _get_columns_name(self, options):
columns_names = super(Model, self)._get_columns_name(options)
columns_names.append({'name': _('New Column Name'), 'class': 'number sortable', 'style': 'white-space:nowrap;'})
return columns_names

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
2
Ağu 25
3071
3
Şub 25
4476
0
May 24
46
1
Nis 24
3929
4
Eyl 23
5750