Odoo Help
Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM
|
e-Commerce
|
Accounting
|
Inventory
|
PoS
|
Project management
|
MRP
|
etc.
Refresh tree view after closing export dialog
When I use the export function to export records from a custom model to an excel or csv, I change a boolean field on the model and add a timestamp that the records have been exported. Now I need to refresh my tree view so the booleans and the timestamp are automatically displayed.
(FYI: I change the values by extending the export_data function of the standard Odoo model.)
After generating and downloading the exported file I the export dialog does not close out of itself.
How do I achieve that the export dialog automatically closes after a successfull export and then reloads my existing tree view?
Unfortunatly I don't have enough karma to alter my original post
EDIT: Respective code:
@api.multi
def export_data(self, fields_to_export, raw_data=False):
for r in self:
r.printed = True
r.timestamp_printed = fields.Datetime.now()
rec_id = super(pricehistory, self).export_data(fields_to_export, raw_data=False)
After this the view returns to the export dialog. However there is no way to refresh the view from which the record export was called.
As ODOO use XMLHttpRequest
so after the method call the view not reload [for performance enhancement ] by default ,but you can do it using tag reload.
try this code in the method , it will refresh/reload the view after method called:
return {
'type': 'ir.actions.client',
'tag': 'reload',
}
Unfortunately this doesn't work either. The tree view from which the records were exported doesn't display the changes to the records after the export.
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.
RegisterOdoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.
Test it nowQuestion tools
Stats
Asked: 4/22/16, 9:41 AM |
Seen: 1074 times |
Last updated: 4/23/16, 6:07 AM |