Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
5126 Lượt xem

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>

 

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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>

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
11
thg 5 18
12422
2
thg 8 23
3079
3
thg 4 23
2196
3
thg 12 22
33691
4
thg 10 15
9435