34 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Python
		
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Python
		
	
	
| # -*- coding: utf-8 -*-
 | |
| # Part of Odoo. See LICENSE file for full copyright and licensing details.
 | |
| 
 | |
| from odoo import models, fields, api, _
 | |
| from odoo.exceptions import UserError
 | |
| 
 | |
| 
 | |
| class StockPicking(models.Model):
 | |
|     _inherit = 'stock.picking'
 | |
| 
 | |
|     @api.multi
 | |
|     def action_send_confirmation_to_office(self):
 | |
|         self.ensure_one()
 | |
|         delivery_template_id = self.env.ref('dp_custom.mail_template_data_confirmation_to_office').id
 | |
|         compose_form_id = self.env.ref('mail.email_compose_message_wizard_form').id
 | |
|         ctx = dict(
 | |
|             default_composition_mode='comment',
 | |
|             default_res_id=self.id,
 | |
|             default_model='stock.picking',
 | |
|             default_use_template=bool(delivery_template_id),
 | |
|             default_template_id=delivery_template_id,
 | |
|             custom_layout='dp_custom.mail_template_data_notification_to_office'
 | |
|         )
 | |
|         return {
 | |
|             'type': 'ir.actions.act_window',
 | |
|             'view_type': 'form',
 | |
|             'view_mode': 'form',
 | |
|             'res_model': 'mail.compose.message',
 | |
|             'view_id': compose_form_id,
 | |
|             'target': 'new',
 | |
|             'context': ctx,
 | |
|         }
 | |
| 
 |