This question has been flagged
5 Replies
5532 Views

Good Morning ;)

Friends, i have tried to add some fields in the company menu.

I thought that the original file was under /base/view_company_form so i have tried this:

Python :

class seetek_invoice(osv.osv):

_description = "Company Payroll"

_inherit = 'res.company'

_columns = {

'a':fields.many2one('account.analytic.account', 'Analytic Account'),

'j': fields.many2one('account.journal', 'Salary Journal'),

}

XML:

<record id="view_seetek_company_form" model="ir.ui.view">

<field name="name">res.company.form.inherit</field>

<field name="model">res.company</field>

<field name="inherit_id" ref="base.view_company_form"/>

<field name="arch" type="xml">

<xpath expr="//page[@string='Report Configuration']" position="after">

<notebook position="inside">

<page string="Payroll">

<group name="payroll_grp" position="inside" string="Information Paie">

<field name="a"/>

<field name="j"/> 

</page>

</notebook>

</xpath>

</field>

</record>

But, nothing happened :/

So, who can help please ?!

Avatar
Discard

What do you mean with nothing happened? Did you update your module? By the way give your variables good names! Don't use one character field names.. Sooner or later that will get you in to trouble!

Best Answer

Hello,

you can try like this,

it will get solve your problem,

<record id="view_company_and_other_details" model="ir.ui.view">

<field name="name">view.company.and.other.details</field>

<field name="model">res.company</field>

    <field name="type">form</field>

        <field name="inherit_id" ref="base.view_company_form" />

       <field name="arch" type="xml">

           <notebook colspan="4" position="inside">

               <page string="Extra Details">

                  <group>

                        <field name="a" />

                        <field name="j" />

                  </group>

              </page>

           </notebook>

    </field>

</record>

-->upvote answer if you get solved your issue

Avatar
Discard
Author

Thanks for the answer but i have resolved my problem. what if you upvote my answer please:)

Author

Thanks for the answer but i have resolved my problem. what if you upvote my answer please:)

Best Answer

Hello,

As you have done inheritance of view need to write only one line either """<xpath expr="//page[@string='Report Configuration']" position="after">""" or """<notebook position="inside">""". Please write your view as like below. It will working good. 

<record id="view_seetek_company_form" model="ir.ui.view">

<field name="name">res.company.form.inherit</field>

<field name="model">res.company</field>

<field name="inherit_id" ref="base.view_company_form"/>

<field name="arch" type="xml">

<notebook position="inside">

<page string="Payroll">

<group name="payroll_grp" position="inside" string="Information Paie">

<field name="a"/>

<field name="j"/>

</page>

</notebook>

</field>

</record>

I am sure that it will help you.

Thanks.

Avatar
Discard
Author

Thanks a lot empiro ;) But you have lost to close the group :/

Author Best Answer

Here is the answer and it works perfectly :)

<record id="view_seetek_company_form" model="ir.ui.view">

<field name="name">res.company.form.inherit</field>

<field name="model">res.company</field>

<field name="inherit_id" ref="base.view_company_form"/>

<field name="arch" type="xml">

<notebook position="inside">

<page string="Payroll">

<group name="payroll_grp" position="inside" string="Information Paie">

<field name="a"/>

<ield name="j"/>

</group>

</page>

</notebook>

</field>

</record>

Avatar
Discard