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
This commit is contained in:
@@ -34,18 +34,42 @@ class ApplicationReceivedWizard(models.TransientModel):
|
||||
|
||||
signed_pages_11_12 = fields.Binary(
|
||||
string='Signed Pages 11 & 12',
|
||||
required=True,
|
||||
help='Upload the signed pages 11 and 12 from the application',
|
||||
help='Upload the signed pages 11 and 12 from the application. '
|
||||
'Not required if a remote signing request has been sent.',
|
||||
)
|
||||
signed_pages_filename = fields.Char(
|
||||
string='Pages Filename',
|
||||
)
|
||||
|
||||
has_pending_page11_request = fields.Boolean(
|
||||
compute='_compute_has_pending_page11_request',
|
||||
)
|
||||
has_signed_page11 = fields.Boolean(
|
||||
compute='_compute_has_pending_page11_request',
|
||||
)
|
||||
|
||||
notes = fields.Text(
|
||||
string='Notes',
|
||||
help='Any notes about the received application',
|
||||
)
|
||||
|
||||
@api.depends('sale_order_id')
|
||||
def _compute_has_pending_page11_request(self):
|
||||
for wiz in self:
|
||||
order = wiz.sale_order_id
|
||||
if order:
|
||||
requests = order.page11_sign_request_ids
|
||||
wiz.has_pending_page11_request = bool(
|
||||
requests.filtered(lambda r: r.state in ('draft', 'sent'))
|
||||
)
|
||||
wiz.has_signed_page11 = bool(
|
||||
order.x_fc_signed_pages_11_12
|
||||
or requests.filtered(lambda r: r.state == 'signed')
|
||||
)
|
||||
else:
|
||||
wiz.has_pending_page11_request = False
|
||||
wiz.has_signed_page11 = False
|
||||
|
||||
@api.model
|
||||
def default_get(self, fields_list):
|
||||
res = super().default_get(fields_list)
|
||||
@@ -53,7 +77,6 @@ class ApplicationReceivedWizard(models.TransientModel):
|
||||
if active_id:
|
||||
order = self.env['sale.order'].browse(active_id)
|
||||
res['sale_order_id'] = order.id
|
||||
# Pre-fill if documents already exist
|
||||
if order.x_fc_original_application:
|
||||
res['original_application'] = order.x_fc_original_application
|
||||
res['original_application_filename'] = order.x_fc_original_application_filename
|
||||
@@ -91,20 +114,33 @@ class ApplicationReceivedWizard(models.TransientModel):
|
||||
if order.x_fc_adp_application_status not in ('assessment_completed', 'waiting_for_application'):
|
||||
raise UserError("Can only receive application from 'Waiting for Application' status.")
|
||||
|
||||
# Validate files are uploaded
|
||||
if not self.original_application:
|
||||
raise UserError("Please upload the Original ADP Application.")
|
||||
if not self.signed_pages_11_12:
|
||||
raise UserError("Please upload the Signed Pages 11 & 12.")
|
||||
|
||||
# Update sale order with documents
|
||||
order.with_context(skip_status_validation=True).write({
|
||||
|
||||
page11_covered = bool(
|
||||
self.signed_pages_11_12
|
||||
or order.x_fc_signed_pages_11_12
|
||||
or order.page11_sign_request_ids.filtered(
|
||||
lambda r: r.state in ('sent', 'signed')
|
||||
)
|
||||
)
|
||||
if not page11_covered:
|
||||
raise UserError(
|
||||
"Signed Pages 11 & 12 are required.\n\n"
|
||||
"You can either upload the file here, or use the "
|
||||
"'Request Page 11 Signature' button on the sale order "
|
||||
"to send it for remote signing before confirming."
|
||||
)
|
||||
|
||||
vals = {
|
||||
'x_fc_adp_application_status': 'application_received',
|
||||
'x_fc_original_application': self.original_application,
|
||||
'x_fc_original_application_filename': self.original_application_filename,
|
||||
'x_fc_signed_pages_11_12': self.signed_pages_11_12,
|
||||
'x_fc_signed_pages_filename': self.signed_pages_filename,
|
||||
})
|
||||
}
|
||||
if self.signed_pages_11_12:
|
||||
vals['x_fc_signed_pages_11_12'] = self.signed_pages_11_12
|
||||
vals['x_fc_signed_pages_filename'] = self.signed_pages_filename
|
||||
order.with_context(skip_status_validation=True).write(vals)
|
||||
|
||||
# Post to chatter
|
||||
from datetime import date
|
||||
@@ -128,3 +164,15 @@ class ApplicationReceivedWizard(models.TransientModel):
|
||||
)
|
||||
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
def action_request_page11_signature(self):
|
||||
"""Open the Page 11 remote signing wizard from within the Application Received wizard."""
|
||||
self.ensure_one()
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'name': 'Request Page 11 Signature',
|
||||
'res_model': 'fusion_claims.send.page11.wizard',
|
||||
'view_mode': 'form',
|
||||
'target': 'new',
|
||||
'context': {'default_sale_order_id': self.sale_order_id.id},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user