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

I created a function that computes the internal reference I need so I need directions on how to add it to the internal reference field. Thanks in advance :)

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

Hi,

Inherit the corresponding model and add the compute to corresponding field.

class ModelName(models.Model):
_inherit = "model.name"

so_line = fields.Char(compute='_compute_function_name')

To do it from user interface, use automated actions in odoo. See a use case here: https://www.youtube.com/watch?v=Cz5eM5FDmTE&list=PLqRRLx0cl0hq6DeOzGlfHyjgBxjN5jW90&index=1


Thanks

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

So if the id of the internal reference is "default_code" do I write it instead of "so_line"? Will that override it?

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

For an option that does not  require you to build a module, and leverages the SEQUENCE model, see https://www.odoo.com/forum/help-1/question/can-i-assign-a-custom-field-the-value-of-a-sequence-without-a-module-143107

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 10 24
1660
2
thg 3 24
1944
0
thg 12 22
1572
2
thg 11 19
6816
1
thg 5 17
3269