# -*- coding: utf-8 -*- # License, author and contributors information in: # __openerp__.py file at the root folder of this module. from openerp import models, fields, api class SaleOrder(models.Model): _inherit = 'sale.order' @api.multi def open_order_service_form(self): order_service_obj = self.env['orden.servicio'] order_service_vals = { 'sale_order_id': self.id, # Pasa el ID del Pedido de Venta a la Orden de Servicio 'partner_id': self.partner_id, # Otros campos relacionados con la Orden de Servicio que deseas establecer } order_service = order_service_obj.create(order_service_vals) view_id = self.env.ref('orden_servicio.form_orden_servicio_mejorado').id return { 'name': 'Orden de Servicio', 'view_type': 'form', 'view_mode': 'form', 'res_model': 'orden.servicio', 'res_id': order_service.id, 'view_id': [view_id], 'type': 'ir.actions.act_window', }