Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
2047 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
2
srp 25
3071
3
úno 25
4476
0
kvě 24
46
1
dub 24
3929
4
zář 23
5750