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

Hello,

I'm using Odoo 13.0. I have added a field in a tree view with a progressbar widget. But I'm not able to edit this field.

Here is my view code :

<record id="view_task_tree2_inherited_inherited" model="ir.ui.view">
  <field name="name">project.task.tree.inherited.inherited</field>
  <field name="model">project.task</field>
  <field name="inherit_id" ref="hr_timesheet.view_task_tree2_inherited"/>
  <field eval="2" name="priority"/>
  <field name="arch" type="xml">
  <xpath expr="/tree" position="attributes">
  <attribute name="editable">top</attribute>
  </xpath>
  <field name="effective_hours" position="after">
  <field name="real_estimated_progress" widget="progressbar" readonly="0" optional="show"
groups="hr_timesheet.group_hr_timesheet_user"/>
  </field>
  </field>
</record>

Is it possible to edit a field having widget attributes defined to "progressbar" ?

Thank's a lot.

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

Same problem in form view for the field having widget "progressbar" defined.

Tác giả

if I remove the "widget="progressbar"" attribute, the field becomes editable. But it's not that I want. I want to edit the field from the progressbar. Is it possible ?

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

Hello Mathieu
When you have used widget progressbar you can edit field with help of passing options="{'editable': true}" in field.
EX:

<field name="real_estimated_progress" widget="progressbar" readonly="0" optional="show"
 groups="hr_timesheet.group_hr_timesheet_user" options="{'editable':true}" />

Note:If your field is compute then Make sure to write inverse function to make it editable.
Thanks
Edited:

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

Sorry but the field is still not editable even with the option defined. The field is still white (not grey like a readonly one) but not editable because of the progressbar display.

Make sure your filed is not compute and if not then clicking on field will allow to edit value when you will use above attribute.

Tác giả

@husain , the filed is not compute. Here is its definition :

class Task(models.Model):

_inherit = "project.task"

real_estimated_progress = fields.Integer("Real estimated progress", store=True, group_operator="avg", help="Display estimated real progression of current task; in terms of work instead of time spent.")

@Mathieu

Please refer image attached to answer.May be you are not clicking on field after applying option attribute.

You need to click the field in edit mode to change the value.

Tác giả

Yes, I made a new try after uninstalling my module and reinstalling it and it works perfectly now ! You were right.

I want to thank you for your help and above all your patience.

Thank's a lot

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 9 20
3581
1
thg 1 20
5761
2
thg 12 22
5077
1
thg 12 21
4033
0
thg 11 21
3192