I'm trying to add a boolean field to the expense line in hr.expense, but am struggling to find the relevant object and view names in Developer mode. I'm doing it as a custom module, but need some help with the onetomany relationship between hr.expense.expense, and hr.expense.line (i.e. I cannot figure out the view that I need to edit for the line item).
Basically I just want to add the boolen field at the end of the line (i.e. after the total field) - any pointers greatly appreciated!
This is the XML I'm using in the custom module:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record model="ir.ui.view" id="ocl_hr_expense">
<field name="name">hr.expense.line.tree</field>
<field name="model">hr.expense.line</field>
<field name="inherit_id" ref="hr_expense.hr_expense_form_view" />
<field name="arch" type="xml">
<xpath expr="//page[@string='Description']/field[@name='line_ids']/tree[@string='Expense Lines']/field[@name='total_amount']" position="after">
<field name="abc" />
</xpath>
</field>
</record>
</data>
</openerp>
and my boolean field is defined as follows:
from openerp.osv import fields, osv
class ocl_hr_expense(osv.osv):
_inherit = "hr.expense.line"
_columns = {
'abc': fields.boolean('ABC Reportable')
}
_defaults ={
'abc': 0
}
ocl_hr_expense()