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

Odoo 10

for example: a float x_uvp is in sale.order. i want to calculate x_uvp /1,19. 

What do i have to put into depends and calculate?


 

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

The value 1.19 is always fix? or coming from any other input field?

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

 Have you checked the ORM API documentation (https://www.odoo.com/documentation/9.0/reference/orm.html#computed-fields)?

Are you going to add an additional field to the model? If so something like the following should work.

x_uvp_display = fields.Float(string='UVP scaled'. compute='_compute_x_uvp_display')


@api.onchange('x_uvp')

@api.depends('x_uvp')

def _compute_x_uvp_display(self):

     for rec in self:

         rec.x_uvp_display = rec.x_uvp / 1.19

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 3 24
1964
2
thg 11 19
6886
1
thg 2 24
1666
2
thg 1 24
1996
1
thg 5 23
14408