Odoo - Auto close wizard and refresh parent

I created a normal view for a class in my module. Now i wanted to show that same view in another class on a button click . I have done that but the issue i am facing is that when that popup open it gives two buttons Save and Discard. Once i click save i should auto close and it should also refresh the parent view from which it was loaded. Is this possible in Odoo?

Beside this how can i create a javascript file in Odoo. I visited official documentation but i was unable to understand that do we have a javascript file against each class or against each module and how to create that and what are the things i can do in that javscript file. Basically i am asking for a well documentation for better understanding.

Edit : This is my button click function

@api.multi
def add_deposit_action(self):
    return {
            "type": "ir.actions.act_window",
            "name": 'Add A Deposit',
            "res_model": "amgl.order",
            "views": [[False, "form"]],
            "context": {'customer_id': self.id,
                        'account_number': self.account_number,
                        'date_opened': self.date_opened,
                        'account_type': self.account_type},
            'target': 'new',
            'is_deposit': True
        }

Answers:

Answer

Yes. To reload the parent view (original view), you could return the tag reload in your popup

return {
    'type': 'ir.actions.client',
    'tag': 'reload',
}

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.