Odoo Help

Welcome!

This community 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.

0

Adding a field to account.invoice

By
Javier Batres Velásquez
on 3/5/15, 1:00 PM 618 views

Hello I am trying to add a field for account.invoice, here is the .py code:

    

# -*- coding: utf-8 -*-
from openerp import fields, api, exceptions, models

class account_invoice(models.Model):
    _inherit = 'account.invoice'
    nit = fields.Char(string='NIT', help='Número de identificación tributaria', related='partner_id.nit', store=False)

 

And here is my XML file:

<?xml version="1.0" encoding="UTF-8"?>
<openerp>
    <data>
        <record id="inoice_nit" model="ir.ui.view">
            <field name="name">account.invoice.nit</field>
            <field name="model">account.invoice</field>
            <field name="inherit_id" ref="account.invoice_tree"/>
            <field name="arch" type="xml">
                <tree position="inside" >
                    <field name="nit" />
                </tree>
            </field>
        </record>
    </data>
</openerp>

 

0

Hello I have solved that and this was something really dummy... I wasnt adding tha .py to my __init__.py

0

zbik

--zbik--
5951
| 6 4 7
Lodz, Poland
--zbik--


zbik
On 3/5/15, 4:25 PM

Try this:

<?xml version="1.0" encoding="UTF-8"?>
<openerp>
    <data>
        <record id="inoice_nit" model="ir.ui.view">
            <field name="name">account.invoice.nit</field>
            <field name="model">account.invoice</field>
            <field name="inherit_id" ref="account.invoice_tree"/>
            <field name="arch" type="xml">
                <xpath expr="//tree" position="inside">
                    <field name="nit"/>
                </xpath>
            </field>
        </record>
    </data>
</openerp>

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 3/5/15, 1:00 PM
Seen: 618 times
Last updated: 3/16/15, 8:10 AM