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

analytic_account_id = fields.Many2one('account.analytic.account', string='Analytic Account', index=True, compute="_compute_analytic_account_id", store=True, readonly=False, check_company=True, copy=True)


How can this field be editable on the form? I googled and all the answers mentioned 'inverse' function, but this field does not seem like that.

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

Compute fields behave in different ways depending on store attribute

Store=True

  • In this case, compute method is activated only when fields mentioned in depends decorator.
  • Your field will be computed whenever the dependencies are changed
  • You are able to edit the final computed value, if required
  • You might want to give readonly=False for the field to be editable

Store=False

  • This is default value for computed fields
  • Your field will not be stored in database, and computed every time the field is called
  • You cannot edit value of the field in this case, as it is not stored


Thanks

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

Hi,

This field editable because of the "readonly=False" option passed in that field's definition. 

If you want to make it readonly, then you can make it by adding readonly=True.

Hope it will help you.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 6 25
15492
1
thg 5 25
993
3
thg 4 25
5706
2
thg 11 24
2205
Compute Fields Đã xử lý
2
thg 7 24
3402