fix(portal): 5 hotfixes - /my route, button sizing, clickable cards, state sync, SO doc

1. /my now serves the FP dashboard (stock Odoo home was leaking
   through because parent route declared ['/my', '/my/home'] but my
   override only listed /my/home).
2. Button padding bumped to .5rem 1rem + font 1rem so o_fp_btn matches
   Odoo's standard Bootstrap button rhythm. Ghost button drops its
   custom padding override.
3. .o_fp_job_card on /my/home + /my/jobs is now an <a> wrapping the
   whole card area — full row is the click target, not just the WO
   number. Inner <a> on job.name dropped to avoid nested anchors;
   focus-visible outline added for keyboard nav.
4. fp.job.write() now mirrors state -> fp.portal.job.state via new
   _FP_JOB_STATE_TO_PORTAL_STATE map (confirmed->received,
   in_progress->in_progress, done->ready_to_ship). Fixes the bug where
   completed backend jobs left the portal stuck on 'in_progress'.
   'on_hold' and 'cancelled' intentionally not mirrored — manager
   choice what to surface.
5. Sales Order Confirmation now surfaces in the 'From You' group on
   the job detail page, pulled via job.x_fc_job_id.sale_order_id ->
   /report/pdf/sale.report_saleorder/<id>. Falls back to the upload
   placeholder when no SO is linked.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-05-17 03:13:00 -04:00
parent edcc325483
commit 28220f0732
7 changed files with 159 additions and 38 deletions

View File

@@ -188,13 +188,31 @@ class FpCustomerPortal(CustomerPortal):
{'key': 'shipping', 'label': 'Shipping', 'docs': []},
]
# FROM YOU — V1: placeholder (V2 will pull PO + drawings via SO link)
groups[0]['docs'].append({
'label': 'Customer documents',
'sub': 'Upload your PO and drawings via your sales contact for now',
'pending': True,
'icon': '📄',
})
# FROM YOU — surface the Sales Order Confirmation via the fp.job
# link added by fusion_plating_jobs (job.x_fc_job_id.sale_order_id).
# When no SO is linked, fall back to the placeholder so customers
# know where to upload their PO + drawings.
so = None
backend_job = job.x_fc_job_id if 'x_fc_job_id' in job._fields else None
if backend_job and 'sale_order_id' in backend_job._fields:
so = backend_job.sale_order_id
if so:
groups[0]['docs'].append({
'label': 'Sales Order Confirmation · %s' % so.name,
'sub': 'EN Plating · %s' % (
so.date_order and so.date_order.strftime('%b %d, %Y') or ''
),
'url': '/report/pdf/sale.report_saleorder/%s' % so.id,
'icon_class': 'o_fp_doc_icon_input',
'icon': '📄',
})
else:
groups[0]['docs'].append({
'label': 'Customer documents',
'sub': 'Upload your PO and drawings via your sales contact for now',
'pending': True,
'icon': '📄',
})
# SPECIFICATIONS — V1: placeholder (V2 will pull customer spec)
groups[1]['docs'].append({
@@ -261,7 +279,7 @@ class FpCustomerPortal(CustomerPortal):
# DASHBOARD
# ==========================================================================
@http.route(
['/my/home'],
['/my', '/my/home'],
type='http',
auth='user',
website=True,