تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
5190 أدوات العرض

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
مايو 18
12467
2
أغسطس 23
3137
3
أبريل 23
2251
3
ديسمبر 22
33763
4
أكتوبر 15
9510