Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

How add new filed to res.partner ?

Subscriure's

Get notified when there's activity on this post

This question has been flagged
res.partner
3 Respostes
17741 Vistes
Avatar
NiteshMVP

I'm new to OpenErp. I want to Add a new field "mother_name" in res.partner.So i have added the following code to res.partner.py In column's i have add like this

_columns = {
    'name': fields.char('Name', size=128, required=True, select=True),
    'date': fields.date('Date', select=1),
    'title': fields.many2one('res.partner.title', 'Title'),
    'parent_id': fields.many2one('res.partner', 'Related Company'),
    'child_ids': fields.one2many('res.partner', 'parent_id', 'Contacts', domain=[('active','=',True)]), # force "active_test" domain to bypass _search() override    
    'ref': fields.char('Reference', size=64, select=1),
    'date_delivery': fields.date('Expected Delivery Date'),
    'mother_ln': fields.char('Mother', size=64),
     .
     .
     .
     }

Now in res_partner_view.xml . I'm using the following code

    <record id="view_partner_tree" model="ir.ui.view">
        <field name="name">res.partner.tree</field>
        <field name="model">res.partner</field>
        <field eval="8" name="priority"/>
        <field name="arch" type="xml">
            <tree string="Contacts">
                <field name="name"/>
                <field name="function" invisible="1"/>
                <field name="phone"/>
                <field name="email"/>
                <field name="user_id" invisible="1"/>
                <field name="is_company" invisible="1"/>
                <field name="country" invisible="1"/>
                <field name="country_id" invisible="1"/>
                <field name="date_delivery"/>
                <field name="mother_ln"/>
                <field name="parent_id" invisible="1"/>
            </tree>
        </field>
    </record>

<record id="view_partner_form" model="ir.ui.view"> <field name="name">res.partner.form</field> <field name="model">res.partner</field> <field eval="1" name="priority"/> <field name="arch" type="xml"> <form string="Partners" version="7.0"> <sheet> <field name="image" widget="image" class="oe_left oe_avatar" options="{"preview_image": "image_medium", "size": [90, 90]}"/>

<label for="name"/> ( <field name="is_company" on_change="onchange_type(is_company)" class="oe_inline"/> <label for="is_company" string="Is a Company?"/>)

<field name="name" default_focus="1" placeholder="Name"/>

<field name="parent_id" placeholder="Company" domain="[('is_company', '=', True)]" context="{'default_is_company': True, 'default_supplier': supplier}" attrs="{'invisible': [('is_company','=', True),('parent_id', '=', False)]}" on_change="onchange_address(use_parent_address, parent_id)"/>

                <group>
                    <group>
                        <label for="type" attrs="{'invisible': [('parent_id','=', False)]}"/>
                        <div attrs="{'invisible': [('parent_id','=', False)]}" name="div_type">
                            <field class="oe_inline"
                                name="type"/>
                        </div>

                        <label for="street" string="Address"/>
                        <div>
                            <field name="use_parent_address" class="oe_edit_only oe_inline"
                                   on_change="onchange_address(use_parent_address, parent_id)"
                                   attrs="{'invisible': [('parent_id','=', False),('use_parent_address','=',False)]}"/>
                            <label for="use_parent_address" class="oe_edit_only" attrs="{'invisible': [('parent_id','=', False),('use_parent_address','=',False)]}"/>
                            <button name="open_parent" type="object" string="(edit company address)" class="oe_link oe_edit_only"
                                    attrs="{'invisible': ['|',('parent_id','=', False),('use_parent_address','=',False)]}"/>
                            <field name="street" placeholder="Street..."  attrs="{'readonly': [('use_parent_address','=',True)]}"/>
                            <field name="street2"  attrs="{'readonly': [('use_parent_address','=',True)]}"/>
                            <div class="address_format">
                                <field name="city" placeholder="City" style="width: 40%%" attrs="{'readonly': [('use_parent_address','=',True)]}"/>
                                <field name="state_id" class="oe_no_button" placeholder="State" style="width: 37%%" options='{"no_open": True}' on_change="onchange_state(state_id)" attrs="{'readonly': [('use_parent_address','=',True)]}"/>
                                <field name="zip" placeholder="ZIP" style="width: 20%%" attrs="{'readonly': [('use_parent_address','=',True)]}"/>
                            </div>
                            <field name="country_id" placeholder="Country" class="oe_no_button" options='{"no_open": True}' attrs="{'readonly': [('use_parent_address','=',True)]}"/>
                        </div>

                    </group>
                    <group>
                      <!-- We Don't require Job Position for Customer -->
                      <!--   <field name="function" placeholder="e.g. Sales Director"
                            attrs="{'invisible': [('is_company','=', True)]}"/> -->
                        <field name="phone" placeholder="e.g. +32.81.81.37.00"/>
                        <field name="mobile"/>
                        <field name="fax"/>
                        <field name="email" widget="email"/>
                        <!-- <field name="title" domain="[('domain', '=', 'contact')]"
                            options='{"no_open": True}' attrs="{'invisible': [('is_company','=', True)]}" /> -->
                    </group>
                    <field name="date_delivery"/>
                    <field name="mother_ln"/>
                    </group>
                    .
                    .
                    .
             </record>
0
Avatar
Descartar
Avatar
Shashank Verma
Best Answer

Hello

Add new field in py file

columns={

mother_name': fields.char('Mother Name', size=64),

}

Xml file <tree> <field name="mother_name"/> </tree>

<form> <field name="mother_name"/> </form>
0
Avatar
Descartar
NiteshMVP
Autor

i've give the same dude.But i'm getting the following error "ProgrammingError: column res_partner.mother_name does not exist"

NiteshMVP
Autor

i'm getting the following error
OpenERP Server Error

Client Traceback (most recent call last): File "/usr/lib/pymodules/python2.7/openerp/addons/web/http.py", line 204, in dispatch response["result"] = method(self, **self.params) File "/usr/lib/pymodules/python2.7/openerp/addons/web/controllers/main.py", line 867, in authenticate req.session.authenticate(db, login, password, env) File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", ProgrammingError: column res_partner.mother_name does not exist LINE 1: ...,res_partne

Shashank Verma

Have u updated the database by running -u all -d ur_db_name?

Avatar
Ankit H Gandhi(AHG)
Best Answer

Hello Nitesh,

try this code may be help full

in .py file

from openerp.osv import osv, fields

class res_partner(osv.Model):
    _inherit = 'res.partner'
    _columns = {
        'mother_name': fields.char('Mother Name', size=64)
    }

in .xml file

<openerp>
    <data>
        <record model="ir.ui.view" id="view_partner_form_inherited">
            <field name="name">view.partner.form.inherited</field>
            <field name="model">res.partner</field>
            <field name="inherit_id" ref="base.view_partner_form"/>
            <field name="arch" type="xml">
                <xpath expr="//field[@name='website']" position="after">
                    <field name="mother_name"/>
                </xpath>
            </field>
        </record>
    </data>
</openerp>

if you find this answer helpful, please give me a thumbs up vote    

Thanks & Regards,

Ankit H Gandhi

0
Avatar
Descartar
Avatar
José DESGRIS
Best Answer

Hello,

I have not tried python yet but I can tell you you can add a field using Odoo's technical interface.

Go to the database and add the field (Is it the error "the column does not exist" ???)

Then go to the views res.partner.tree and res.partner.form and add the field so it appears on the screen.

Best regards,

José

0
Avatar
Descartar
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrar-se
Related Posts Respostes Vistes Activitat
Domain for res.partner having which are tagged with users ? Solved
res.partner
Avatar
Avatar
2
d’oct. 23
6614
Restrict duplicate phone number creation in res_partner odoo 16
res.partner
Avatar
Avatar
Avatar
Avatar
3
de set. 23
3421
Insert/update via API trying to create contact with contact image included, not inserting or updating field image_1920 on res.partner
res.partner
Avatar
0
de maig 23
3392
Bonjour à tous comment faire de telle sort qu'un utilisateur ne voit que ses propres "contact" créé.
res.partner
Avatar
Avatar
1
de maig 23
2601
Hello everyone how to make such a fate that a user sees only his own "contact" created Solved
res.partner
Avatar
Avatar
1
d’abr. 23
2382
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now