Odoo 10 : Call a confirmation form (Yes / No) from Wizard

前端 未结 3 594
失恋的感觉
失恋的感觉 2021-01-16 06:50

I want to add to my purchase order a \'cancel\' button. This button will change the state of my record to \'canceled\'. When the user click on this button the script verify

相关标签:
3条回答
  • 2021-01-16 07:08

    You should return the Action directly from def canceled_progressbar method, instead of defining it separately.

    Also, I don't think your method def return_confirmation will be able to receive the value the way you tried by returning either 'True' or 'False'.

    Here you should directly add your code in the wizard based on the clicking 'Yes' or 'No' buttons, the one that you are planning in def return_confirmation.

    0 讨论(0)
  • 2021-01-16 07:17

    You can add:

    confirm="Your Custom message like Are you sure you want to process this?"
    

    in button in xml.

    0 讨论(0)
  • 2021-01-16 07:26

    Well, this is what I wrote :

        @api.multi
        def yes(self):
            print 'yes function'
            self.env['tjara.purchase_order'].function1()
    
        @api.multi
        def no(self):
            print 'no function'
            self.env['purchase_order'].function1()
    

    The 'canceled_progressbar' method return :

        @api.multi
        def canceled_progressbar(self):
            print 'canceled_progressbar'
            return {
                'name': 'Are you sure?',
                'type': 'ir.actions.act_window',
                'res_model': 'tjara.confirm_wizard',
                'view_mode': 'form',
                'view_type': 'form',
                'target': 'new',
            }
    

    And I added two function according to the confirmation :

        @api.multi
        def function1(self):
            print 'this function 1'
    
        @api.multi
        def function2(self):
            print 'this function 2'
    

    I was wondering if I can make only one function but it seems like impossible.

    Thank you all for helping.

    0 讨论(0)
提交回复
热议问题