简体   繁体   中英

Odoo 11 sales order confirm button override

I tried overriding the sales order confirm button with the below code:

class sale_order(models.Model):
    _inherit = 'sale.order'

    @api.multi
    def action_confirm(self):
        _logger = logging.getLogger(__name__)
        rec = super(sale_order, self).action_confirm()
        _logger.debug("this_action_took_place_sales")
        _logger.error('this_action_took_place_sales %s', "sales")
        return rec

I restarted the server and upgraded the code. Even then I do not see the message in the logs.

I read this answer: https://www.odoo.com/forum/help-1/question/sale-override-action-button-confirm-116695 and wrote the below code:

@api.multi
def action_button_confirm(self):
    _logger = logging.getLogger(__name__)
    rec = super(sale_order, self).action_button_confirm()
    _logger.debug("this_action_took_place_sales")
    _logger.error('this_action_took_place_sales %s', "sales")
    return rec

No logs even then. I checked the parent sales order file. (sale.py). The method over there is named action_confirm(self)

What is the correct way to override the sales confirm action button in odoo 11?

That method in Odoo v9 was renamed to action_confirm , the link referenced from the Odoo forum refers to Odoo v8 where the method was action_button_confirm . Just rename it to the new method name and you will be fine from v9 to v11

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM