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

Hi everyone,

I'm developping a custom module for Odoo and I'm using some default Odoo fields such as "create_date" and "write_date". My problem is that I dont want these fields to be displayed in the form view during creation and edition; but displayed when users consult it.

I've tried to do it through javascript but I dont know QWeb and though I read several documentations, I lack examples to understand the way widgets work. For instance, with jQuery(I only know the basics of this API) I don't know how to select the <div> inside my form view.

 Below are 2 screens to illustrate my problem. Thank you in advance for any help.

http://hpics.li/478100e  I dont want to display both date fields.

http://hpics.li/82b0112 I want to keep this.

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

Hi

YoU HaVTO redefine the field:

Class res_partner (osv.osv):

    _inherit = 'res.partner'

    _columns = {'create_date': fields.datetime ('Create Date', readonly = True),}


And Create tree view/Inherit view like:

<Field name = "create_date" />

Let me know if this is also not working.


Thanks,

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

I've tried your solution but the field is still displayed and editable.

Tác giả

I thought the easiest solution would be to hide the corresponding <div> through javascript but I don't succeed in selecting them.