This question has been flagged

Hello everyone,

I am trying to hide Zip from my contacts form and addresses. I am trying to replace it with a postal code field.

I tried to add a .py file to the base folder in addons with a inhert function but it keeps locking up the server.

version 12 


thank you in advance

Yes I am very new to odoo development so a step by step would be much appreciated

I did go through the module creation and inheritance. Can't seem to get the right process 



Avatar
Discard

Thank you everyone! Helped very much

Best Answer

In the python file

from odoo import models,fields,api
class ResPartner(models.Model):
_inherit = 'res.partner'
postal_code = fileds.Integer(string="Postal Code")



In the xml file


<odoo>
    <record id="partner_inherit_postal" model="ir.ui.view">
    <field name="name">partner.postal.code.inherit</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='zip']" position="replace">
            <field name="postal_code"/>
        <xpath>
    </field>
</record>
</odoo>

You get the basic idea..


Avatar
Discard