Files
Odoo-Modules/fusion_ltc_management/wizard/ltc_repair_create_so_wizard.py
Nexa Admin 431052920e feat: separate fusion field service and LTC into standalone modules, update core modules
- fusion_claims: separated field service logic, updated controllers/views
- fusion_tasks: updated task views and map integration
- fusion_authorizer_portal: added page 11 signing, schedule booking, migrations
- fusion_shipping: new standalone shipping module (Canada Post, FedEx, DHL, Purolator)
- fusion_ltc_management: new standalone LTC management module
2026-03-11 16:19:52 +00:00

49 lines
1.5 KiB
Python

# -*- coding: utf-8 -*-
# Copyright 2024-2026 Nexa Systems Inc.
# License OPL-1 (Odoo Proprietary License v1.0)
from odoo import models, fields, api, _
from odoo.exceptions import UserError
class LTCRepairCreateSOWizard(models.TransientModel):
_name = 'fusion.ltc.repair.create.so.wizard'
_description = 'LTC Repair - Link Contact & Create Sale Order'
repair_id = fields.Many2one(
'fusion.ltc.repair',
string='Repair Request',
required=True,
readonly=True,
)
client_name = fields.Char(
string='Client Name',
readonly=True,
)
action_type = fields.Selection([
('create_new', 'Create New Contact'),
('link_existing', 'Link to Existing Contact'),
], string='Action', default='create_new', required=True)
partner_id = fields.Many2one(
'res.partner',
string='Existing Contact',
)
def action_confirm(self):
self.ensure_one()
repair = self.repair_id
if self.action_type == 'create_new':
if not self.client_name:
raise UserError(_('Client name is required to create a new contact.'))
partner = self.env['res.partner'].create({
'name': self.client_name,
})
repair.client_id = partner
elif self.action_type == 'link_existing':
if not self.partner_id:
raise UserError(_('Please select an existing contact.'))
repair.client_id = self.partner_id
return repair._create_linked_sale_order()