İçereği Atla
Menü
Bu soru işaretlendi
2 Cevaplar
59 Görünümler

Hello,

I am trying to identify the correct Odoo term for the view when creating a delivery address in contacts. I mean the small view.

I want to inherit the view and add a custom field.


Thank you for your help!

Avatar
Vazgeç
En İyi Yanıt

Hi,


The correct Odoo term for the delivery address form view in contacts is view_partner_address_form. To confirm, activate developer mode, inspect the view, and find its External ID.


To inherit this view and add a custom field, create a custom module with a __manifest__.py file that depends on the base module. In models.py, inherit the res.partner model and add your custom field. In views.xml, create a record that inherits base.view_partner_address_form and use an XPath expression to position your custom field within the inherited view. Install the module to apply the changes.


Eg:

Python


from odoo import models, fields


class ResPartner(models.Model):

    _inherit = 'res.partner'


    my_custom_field = fields.Char(string="My Custom Field")


XML


<odoo>

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

        <field name="name">res.partner.address.form.inherit</field>

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

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

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

            <xpath expr="//field[@name='city']" position="after">

                <field name="my_custom_field"/>

            </xpath>

        </field>

    </record>

</odoo>


Hope it helps

Avatar
Vazgeç
En İyi Yanıt

Hi, 
It's hard to understand what you're referring to. What about a screenshot? 

If I understood it correctly though, you might be looking for <record id="view_partner_address_form"

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
1
Mar 15
4888
1
Nis 22
7434
3
Kas 25
275
2
Ağu 25
888
1
May 25
1915