Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
22354 Lượt xem

Friends,

I hav to change the name "supplier" to "owner" in sale module...

Hw it is possible using a custom module..

Thanks...

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

You can do this by 2 ways..

1) Redefine that field in the custom module and change the string of it.

2) Inherit the view and over there change the "string" attribute of it.

 

Ảnh đại diện
Huỷ bỏ
Tác giả

how to redefine? can you give me an example

Copy that field from original module and put it in your module and change the string.

Tác giả

thanks... 1 vote & 1 tick

Welcome @aci aisha...

Example for approach (1): my_field = fields.Many2one(string='NewDisplayString')

Assuming that my_field is defined in a base model, which you inherit, then only the string will be changed and the other information (e.g. which model is referenced) is taken from the base model

Câu trả lời hay nhất

Hello aci aisha,

here i give you example of modified the string supplier to owner

hope this code very helpfull for you.

<record id="purchase_order_form_view_inherit" model="ir.ui.view">
            <field name="name">purchase.order.form.view.inherit</field>
            <field name="model">purchase.order</field>
            <field name="inherit_id" ref="purchase.purchase_order_form"/>
            <field name="arch" type="xml">
                <xpath expr="//field[@name='partner_id']" position="attributes">
                    <attribute name="string">Owner</attribute>
                </xpath>
            </field>
        </record>

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

Thanks & Regards,

Ankit H Gandhi

Ảnh đại diện
Huỷ bỏ
Tác giả

helpful..1 vote

This works only at first installation. I'm trying to add another field to my form view and I can't update due to an error saying that the field cannot be found in parent view... if I uninstall and install, works fine.