Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
2029 Vistas

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
Descartar
Mejor respuesta

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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
2
ago 25
3069
3
feb 25
4473
0
may 24
46
1
abr 24
3926
4
sept 23
5733