Odoo Help


Add a Field to the Invoice Line (v8)

David Birchmier
on 12/28/14, 7:08 PM 5,199 views

What Models/Views/etc must be edited in order to add a new field to the Invoice Line? 

Here's an example of where I want to add the field:

Thanks for your help! :) 

@David, Could you describe the field that you would like to add to the invoice line, is it a picture, your own custom text field, a computed field, etc.? This will help me to better answer your question. With that being said, you may find that you can edit the general invoice layout by inheriting and modifying the following id: inherit_id="account.report_invoice_document" This covers much of the body of the invoice. In terms of models this will depend on the nature of the field you'd like to place there.

Luke Branch
on 12/28/14, 11:09 PM

Hi Luke, Thanks for your detailed reply! The type of field I wish to add is a text field which will be limited to 7 characters, numbers only. Here's a specific use-case, if that helps: #1 In our workflow, every billable incident has a TICKET NUMBER associated with it. #2 When we bill, each line item is associated with a TICKET NUMBER #3 I want to add a custom field to allow us to enter the TICKET NUMBER that is associated with that line item that is being billed for. #4 This will output on the printed report invoice (I think I know how to do that) as well as be searchable/saved in the database for future reference. #5 The goal is to be able to correlate each line item with a specific Ticket # to allow us to reference more details if needed regarding any invoice line item. Hope this makes sense. Thanks again for the help!

David Birchmier
on 12/28/14, 11:17 PM

Baiju KS

--Baiju KS--
| 5 5 8
Kochi, India
--Baiju KS--
ODOO technical

        I like learning new thing, especially technical thing. I am a quick learner, I can learn technical things very fast. I have good logical skill,  I have immense interest in programming.

e-mail id : baijuks@hotmail.com

Baiju KS
On 12/29/14, 4:46 AM

Hi David,

Please check this , is it okay

I inherited 'account.invoice.line'
and added a integer field to that object

and then i inherited the view form i.e.. 'invoice_form' in account
and added that field to view part

Yes! That is PERFECT! You rock!

David Birchmier
on 12/29/14, 10:36 AM

Yes! That is PERFECT! You rock!

David Birchmier
on 12/29/14, 10:36 AM

can you please mark it as correct.?

Baiju KS
on 12/29/14, 10:37 AM

Marked as correct! Can you tell me how you achieved that result?

David Birchmier
on 12/29/14, 12:36 PM

Do you have a Skype id, or you want me to e-mail that to you?

Baiju KS
on 12/29/14, 1:00 PM

@Baiju and David, Please consider updating your answer with the method you have used if possible so that others viewing your post that are looking to accomplish something similar can learn from what you have done.

Luke Branch
on 12/29/14, 9:29 PM
Odoo Honduras
On 2/26/16, 2:52 PM

Hope it be usefull to you


from . import "name of yor module"



'name': 'Name of your module',

'version': '0.1',

'depends': ['account'],

'author': "Daniel Hernández",

'website': 'http://www.odoohonduras.com',

'category': 'Invoicing',

'data': [

'views/report_account_invoice.xml', # In order to show your field in the invoice document

' "name of your module" _view.xml',




from openerp import models, fields, api, _

class account_invoice_line(models.Model):

_inherit = 'account.invoice.line'

your_field_name = fields.Char(string='Your field name')


<?xml version="1.0" encoding="utf-8"?>



<record id="invoice_form_inherit" model="ir.ui.view">

<field name="name">account.invoice.inherit</field>

<field name="model">account.invoice</field>

<field name="inherit_id" ref="account.invoice_form"/>

<field name="arch" type="xml">

<xpath expr="//page[@string='Invoice Lines']/field[@name='invoice_line']/tree/field[@name='quantity']" position="before">

<field name="your field"/>




<!--<record id="invoice_supplier_form_inherit" model="ir.ui.view">

<field name="name">account.invoice.supplier.form.inherit</field>

<field name="model">account.invoice</field>

<field name="inherit_id" ref="account.invoice_supplier_form"/>

<field name="arch" type="xml">

<xpath expr="//tree[@string='Invoice lines']/field[@name='quantity']" position="before">

<field name="second_uom" attrs="{'readonly': [('state', '!=', 'draft')]}"/>






Abd in views folder


<?xml version="1.0" encoding="utf-8"?>



<template id="report_invoice_document_itemnumber"


<xpath expr="//div[contains(@class, 'page')]/table[1]/thead/tr/th[1]" position="before">

<th>String of your field</th>


<xpath expr="//div[contains(@class, 'page')]/table[1]/tbody/tr/td[1]" position="before">


<span t-field="l.your field"/>






Herry prasetyo
On 5/7/18, 10:22 PM
<xpath expr="//form/sheet/notebook/page[1]/field[@name='invoice_line_ids']/tree/field[@name='price_unit']" position="after">
<field name="deduction"/>

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

3 follower(s)


Asked: 12/28/14, 7:08 PM
Seen: 5199 times
Last updated: 5/7/18, 10:22 PM