跳至内容
菜单
此问题已终结
2 回复
5100 查看

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>

 

形象
丢弃
编写者 最佳答案

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

形象
丢弃
最佳答案

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>

形象
丢弃
相关帖文 回复 查看 活动
11
5月 18
12392
2
8月 23
3059
3
4月 23
2177
3
12月 22
33650
4
10月 15
9408