콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다

Hello I am able to bring two custom fields in project.project model. this is my custom_module.py code: #################################custom_module.py####################### from openerp.osv import fields, osv

class legacy_projects(osv.osv):

_inherit = "project.project"

_columns = {

'test': fields.integer('Test', size=11),
'test1':fields.char('umer', size=64)

}

_defaults ={ 'test': 0 }

legacy_projects(); ############################XML########################################### <openerp> <data> <record model="ir.ui.view" id="legacy_projects_project"> <field name="name">project.project.form</field> <field name="model">project.project</field> <field name="inherit_id" ref="project.edit_project"/> <field name="arch" type="xml"> <xpath expr="/form/sheet/group/group[2]/field[@name='partner_id']" position="after">

            <field name="test" />
            <field name="test1" />
        </xpath>
    </field>
</record>

</data> </openerp>

It works fyn and bringing two new fields in Project module. now in my custom_module.py file i want this file to be inherrited in other modules as well how can I do multiple inherritence in once .py file like After Default defintion should i start _inherit= "account.invoice" if yes then how to define it's Xml in the above given code kindly help me in it.. Thanks in Advance

아바타
취소
작성자

I have tried this : .py file..........................from openerp.osv import fields, osv

class legacy_projects(osv.osv):

_inherit = "project.project"

_columns = {

'test': fields.integer('Test', size=11),
'test1':fields.char('umer', size=64),
'legacy_projects_id': fields.integer('Legacy project ID', size=11),

}

_defaults ={ 'test': 0 'legacy_projects_id': 0, } _inherit = "account.invoice"

_columns = { 'test2' : fields.char('TESTING FIELD' , size=64),

legacy_projects();

작성자

and in xml created a new record in the same above xml file. <record model="ir.ui.view" id="account_invoice_view"> <field name="name">account.invoice.form</field> <field name="model">account.invoice</field> <field name="inherit_id" ref="account.invoice_form" /> <field name="arch" type="xml"> <xpath expr="/form/sheet/group/group[2]/field[@name='fiscal_position']" position="after">

            &lt;field name="test2"/&gt;

        &lt;/xpath&gt;      
&lt;/
작성자

then updated my module list then install Cutom_module:in project.project test and test1 fields appear but not in account.invoice nothing happens :S i dont know i think i 've messed it up.please help me in it.

관련 게시물 답글 화면 활동
0
3월 15
4384
3
6월 23
2352
2
4월 23
23338
1
9월 22
2647
1
8월 22
2616