How to add gender, birthdate and oder information to this page
BR
Ricardo Gross
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
How to add gender, birthdate and oder information to this page
BR
Ricardo Gross
Hi Recardo,
You can create custom field by Manually(From GUI) and Custom module(By the Python code).
GUI:
Go under the Menu: (Settings > Technical > Database Structure > Models).
Search res.partner model and add field which want you in res.partner form.
After go under the menu (Settings > Technical > User Interface > Views).
Search view_partner_form and then add those fields which you have have created manually after lang field.
<field name="field_name1"/>
<field name="field_name2"/>
<field name="field_name3"/>
After save the Form view and go under the Customer and refresh the page.
Custom Module(Technically):
Create fields in python file (res_partner.py).
from odoo import api, fields, models, _
class Partner(models.Model):
_inherit = "res.partner"
birth_date = fields.Date('Birth Date')
gender = fields.Selection([('male', 'Male'),('female', 'Female')], string='Gender')
Create View File (res_partner_view.xml)
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- Inherit partner form view -->
<record id="view_partner_form_inherit" model="ir.ui.view">
<field name="name">res.partner.form.inherit</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<field name="lang" position="after">
<field name="birth_date"/>
<field name="gender"/>
</field>
</field>
</record>
Hope this will help you.
Thanks.
Perfect, thank you very much for your answers !! :-)
BR
Ricardo
you can achieve this using inheritance:
model.py
class groups(models.Model):
_inherit = 'res.groups'
# we inherited res.groups model which is Odoo/OpenERP built in model and created two fields in that model.
field_1 = fields.Char(required=True,string="Field One")
field_2 = fields.Boolean(default=False,string="Field Two")
xml
<openerp>
<data>
<record model="ir.ui.view" id="res_group_form_view_inherited">
<field name="name">res.group.form.view.inherited</field>
<field name="model">res.groups</field>
<field name="inherit_id" ref="base.view_groups_form" />
<!-- <field name="groups_id" eval="[(6, 0, [ref('obe_core.obe_coordinator')])]"/> -->
<field name="priority" eval="15"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">
<field name="field_1"/>
</xpath>
<xpath expr="//field[@name='user_name']" position="after">
<field name="field_2"/>
</xpath>
</field>
</record>
</data>
</openerp>
Hi Ricardo Gross,
Actually, I did not get your requirement correctly,
If you want to add extra information in contacts (res.partner) you just do one thing,
Just inherits the form [ base.view_partner_form]
add the new field that you need in res.partner. and don't forget to add the fields in python files too.
Thank you.
if you want to add above fields in existing model than you need inheritance.
http://learnopenerp.blogspot.com/2018/01/inheritance-in-models-and-views.html