Help

欢迎!

该社区面向专业人士和我们产品和服务的爱好者。
分享和讨论最好的内容和新的营销理念,建立您的专业形象,一起成为更好的营销人员。


0

Can I trigger a "page refresh" after archiving a One2many record?

Avatar
odoo
Avatar
Discard
2 Answers
0
Avatar
odoo
Best Answer

Just return a client reload action at the end of your code:

def your_method(self):

​# your code ends with
  self.action_archive()

# line to add
  return { 'type': 'ir.actions.client', 'tag': 'reload' }
Avatar
Discard
0
Avatar
odoo
Best Answer

Hello and thank you for your question regarding Odoo's One2many field behavior.



  This issue occurs because the Odoo client-side framework does not automatically refresh the view when a record in a One2many field is archived programmatically. To ensure the UI reflects the change, you can trigger a refresh in your code. Here's how you can do it:

  1. Use the trigger_up method to signal the need for a refresh. This method allows you to interact with the Odoo framework to update the UI.

  2. In your custom JavaScript widget or action, after archiving the record, call this.trigger_up('reload'); if you're within a widget, or use trigger_up('reload', {keepChanges: true}); for more complex scenarios where you want to keep unsaved changes visible.

  3. Ensure that your JavaScript code is properly integrated with Odoo's asset management system to ensure it's loaded and executed as expected.


For personalized assistance:
https://www.pragtech.co.in/contact-us-mql.html

Avatar
Discard