Skip to Content
Menu
This question has been flagged
2 Replies
5145 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>

 

Avatar
Discard
Author Best Answer

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

Avatar
Discard
Best Answer

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>

Avatar
Discard
Related Posts Replies Views Activity
11
May 18
12444
2
Aug 23
3091
3
Apr 23
2207
3
Dec 22
33713
4
Oct 15
9447