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

Hello, 

I'm creating a new sector on the settings page of my module, where I have a value and an update icon, which aims to update the field value when I click on the icon.

But when I call the function to execute the function, the page is updated and I never get the value, but the value is printed in the terminal with a logger, does anyone have any suggestions?


My XML code:


button type="object" name="refresh_credits" class="btn-link" icon="fa-refresh"/>
field name="new_credits"/>

My python code inside a class:

class ResConfigSettings(models.TransientModel):
    _inherit = 'res.config.settings'
    
    new_credits = fields.Integer()

    def refresh_credits(self):
        data_details_credits = self.env['show.credits'].content_credits_info()
        _logger.info(self.env['show.credits'].content_credits_info()[4])
        self.new_credits = data_details_credits[4]
 
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

This module do the job:

https://github.com/OCA/web/tree/14.0/web_refresher

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

My problem is to stop refreshing the page and not update the specific value, because the value is being updated, as shown in the terminal, but I never get to see this value because the page is reloaded whenever I press the refresh icon , any suggestion?

I've been doing some tests and I think the problem is in the XML in the button when I say type="object", but I can't solve it

Ả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 15
6700
1
thg 3 15
4197
0
thg 3 15
3420
1
thg 2 22
6866
0
thg 12 19
5474