Odoo Help

1

2
1 Answer
1
Tomas Parnarauskas
04-06-13 06:23

It could be done like this:

__init__.py:

import res_partner
import res_company

__openerp__.py:

{
    'name': 'Company code',
    'version': '1.0',
    'depends': ['base_vat'],
    'author': 'Oerp',
    'description': """
Address Book
==========================================

Adds new field code in partners object. 

    """,
    'website': '',
    'category': 'base',
    'demo': [],
    'test': [],
    'data': ['res_partner_view.xml'
    ],
    'auto_install': False,
    'installable': True,
}

res_partner.py:

from openerp.osv import osv, fields

class res_partner(osv.osv):
    _name = 'res.partner'
    _inherit = 'res.partner'
    _columns = {
        'company_registry': fields.char('Company Registry', help="Registry code of company", size=64)
    }
res_partner()

res_company.py:

from openerp.osv import osv, fields

class res_company(osv.osv):
    _name = 'res.company'
    _inherit = 'res.company'
    _columns = {
        'company_registry': fields.related('partner_id', 'company_registry', string="Company Registry", type="char", size=64)
    }
res_company()

res_partner_view.xml:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
    <record id="view_partner_form1" model="ir.ui.view">
        <field name="name">re.partner.vat.inherit1</field>
        <field name="model">res.partner</field>
        <field name="inherit_id" ref="base_vat.view_partner_form"/>
        <field name="arch" type="xml">
            <label for="vat" position="before"> 
                <field name="company_registry" placeholder="e.g. 300341211" class="oe_inline"/>
            </label>
        </field>            
    </record>
</data>
</openerp>
Stel een vraag
Keep Informed
0 volger(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now