Skip to Content
Menu
This question has been flagged
1 Reply
1474 Views

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
Discard
Best Answer

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
Discard
Related Posts Replies Views Activity
3
Apr 24
1008
0
May 24
46
1
Apr 24
1822
4
Sep 23
3084
2
Sep 23
5592