Search code examples
pythonodooodoo-12

how to change <table> columns inside any odoo page


I'm new on python and odoo so excuse me for any dumb question

when I see a table inside any page, and I want to change the columns of it, maybe remove the (name) column and add (passport No) column ..etc how can I do that?

this is the table that I mean

tableImg

I've clicked on the "bug" icon (developer Tools) and chooses (Edit View: Form) option

this is what I got

2

3

so now I'm sure that <field name="slip_ids"/> is being converted to print the table.

so I've searched on this field name in the python file and I saw it's One2Many field

slip_ids = fields.One2many('hr.payslip', 'payslip_run_id', string='Payslips', readonly=True, states={'draft': [('readonly', False)]})

also I've searched for "payslip_run_id" and this is what I got

payslip_run_id = fields.Many2one('hr.payslip.run', string='Payslip Batches', readonly=True, copy=False, states={'draft': [('readonly', False)]})

please help me, where I can find the code that tells (slip_ids) field to print the table with those specific columns ? because I need to add other columns and remove some of the current

if there is anything that needs to be shared as well please let me know

thanks in advance


Solution

  • If inside One2many field, there is not any tree view defined that default it will take tree view which is available for that model.

    So in your case it will take tree which is available for hr.payslip. it can be hr_payroll.view_hr_payslip_tree this, if there is not any other tree view created.