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

I try to put the value from currency "rate" to my account_invoice rows.

my field looks like this:


show_rate = fields.Char(related="res_currency.rate", store=True)


this gives me everytime an error with res_currency. 

I want to see the "rate" field in my account_invoice rows. How can I manage that?


thank you

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

It's not fair to use related field here. Related field will write back the value to the currency table.

If you only need to see the value, you could use a functional field.

@api.one
@api.depends('currency_id', 'currency_id.rate')
def _compute_amount(self):
    self.currency_rate = self.currency_id.rate
currency_rate = fields.Float('Currency Rate', compute='_currency_rate', store=True)
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 11 20
3736
0
thg 7 25
651
3
thg 2 25
2892
1
thg 11 24
2660
1
thg 12 23
2552