from odoo import models


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

    def action_save_as_template(self):
        """Open wizard to save this sale order as a quotation template."""
        self.ensure_one()
        return {
            'name': 'Save as Template',
            'type': 'ir.actions.act_window',
            'res_model': 'sale.order.save.template.wizard',
            'view_mode': 'form',
            'target': 'new',
            'context': {
                'default_sale_order_id': self.id,
            },
        }
