Skip to Content
Menu
This question has been flagged
3 Replies
5703 Views

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?

Avatar
Discard
Author Best Answer

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.

Avatar
Discard
Best Answer

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',
}
Avatar
Discard
Author

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.

The code above only works with <button type="object">. It refreshes the tree containing the button.

Related Posts Replies Views Activity
3
Dec 19
6996
1
Oct 16
5327
0
Mar 15
3799
1
May 17
4602
0
Dec 24
41