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

I want to change the field type selection in document management form..

Any one knows where and how I can change it? It been set url and binary by default.

Ảnh đại diện
Huỷ bỏ

to what type field you want to change

Tác giả

type : binary and url change with Type : document and url in selection type

I didnt get u.Can you please explain it clearly.

Tác giả

if you open module knowledge - document - create in form document you can see type of data, then i want to change that from binary and url to document and ural, how i can change that? i perhaps you undderstand what i mean...thanks

did u mean by chanding the selection field value to document and Url, if so i have edited the code below

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

that view is placed in ir.attachment , just inherit that model and redefine that field the python code is as:

class ir_attachment(osv.osv):
    _inherit='ir.attachment'
    _columns={
              'type':fields.selection( [ ('url','URL'), ('document','Document'), ],
            'Type', help="Document File or URL", required=True, change_default=True)
          }
_defaults = {
    'type': 'document',
    }
ir_attachment()

xml view is:

  <record id="ir_attachment_inherit" model="ir.ui.view">
                <field name="name">ir.attachment.form</field>
                <field name="model">ir.attachment</field>
                <field name="inherit_id" ref="base.view_attachment_form" />
                <field name="arch" type="xml">
                    <field name="type" position="replace">
                        <field name="type"/>
                    </field>

                </field>
        </record>
Ảnh đại diện
Huỷ bỏ
Tác giả

where i do suppose to put that your code?

you put that code in your .py file and .xml file(if you have)

Tác giả

in document page addons?

do you have with you a created openerp module

Tác giả

yes..which .py file and .xml file do i have to put your code in?

u can add this code class ir_attachment(osv.osv): .......ir_attachment() to your python file and the xml view to your xml file. if its not working please show me your screenshot of your py file and xml file

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

It work..thank you for your help..

Ảnh đại diện
Huỷ bỏ