تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
6680 أدوات العرض

I want to add two custom fields in res.partner Customer address information zip and state_id. The zip and state_id are my customized fields and would replace the already present. I want to treat the zip as postcode and state as County (not country, it is administrative unit in UK)

class res_partner(osv.osv):    

    _inherit = "res.partner"

     _columns = {
        'zip' : fields.many2one('postcodes'),
       'state_id':fields.many2one('postcodes'),

}

Now the problem is I want the fields to provide auto-complete. I guess I can make one auto-complete by changing it to 'name' but I want both of them to provide auto-completion. I also don't want to mess with name_get or name_search as it will screw the name_get/name_search default functionality used by other fields. I have tried different things but didn't work. My view architecture is also given below. How can I do that.

<field name="arch" type="xml">
            <xpath expr="/form/sheet/group//field[@name='zip']" position="replace">
                <field name="zip"  placeholder="Post Code"  on_change="onchange_postcode(zip)"/>
            </xpath>
            <field name='state_id' position="replace">
                <field name="state_id"  placeholder="County"  on_change="onchange_County(state_id)"/>
            </field>

الصورة الرمزية
إهمال
أفضل إجابة

In Odoo by default every many2one fields are auto-complete. 

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
0
يوليو 17
4563
2
سبتمبر 15
9090
name_get تم الحل
2
يوليو 24
9862
1
يناير 22
3425
0
ديسمبر 15
5302