fix(fusion_claims): OWL wizard review fixes (statement handler, scss borders, tech guard)

- Move the call-type select handler into onCallType() — OWL cannot compile a
  multi-statement inline t-on body (was a render-breaking crash on mount).
- Replace color-mix() inside border shorthands with var(--sb-border) (Odoo-19
  SCSS drops color-mix in a border shorthand).
- Technician placeholder option value '' (not 'false') so the required-tech
  guard isn't bypassed.
- Remove dead setTiming(); null-coalesce the refdata onWillStart load.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-06-04 01:29:55 -04:00
parent 56ca82c611
commit 46d19fd581
3 changed files with 13 additions and 7 deletions

View File

@@ -25,8 +25,10 @@ export class ServiceBookingWizard extends Component {
onWillStart(async () => {
const r = await rpc("/fusion_claims/service_booking/refdata", {});
Object.assign(this.state, {
technicians: r.technicians, calloutRates: r.callout_rates,
perKm: r.per_km, labour: r.labour,
technicians: r.technicians || [],
calloutRates: r.callout_rates || [],
perKm: r.per_km ?? 0.70,
labour: r.labour || this.state.labour,
});
});
}
@@ -59,9 +61,13 @@ export class ServiceBookingWizard extends Component {
this.state.device = ev.target.value;
this.state.category = ev.target.value === "lift" ? "lift" : "standard";
}
onCallType(ev) {
const r = this.state.calloutRates.find(x => x.code === ev.target.value);
if (r) { this.state.category = r.category; this.state.timing = r.timing; }
}
setCust(m) { this.state.custMode = m; }
setTiming(t) { this.state.timing = t; }
setAmpm(v) { this.state.ampm = v; }
toggleInShop() { this.state.inShop = !this.state.inShop; }
_timeStartFloat() { return (this.state.hour % 12) + (this.state.ampm === "PM" ? 12 : 0) + this.state.minute / 60; }

View File

@@ -221,7 +221,7 @@
align-items: center;
justify-content: space-between;
background: var(--sb-money-soft);
border: 1px solid color-mix(in srgb, var(--sb-money) 35%, transparent);
border: 1px solid var(--sb-border);
border-radius: 10px;
padding: 11px 14px;
margin-top: 4px;
@@ -234,7 +234,7 @@
.estimate {
grid-column: 1 / -1;
background: var(--sb-money-soft);
border: 1px solid color-mix(in srgb, var(--sb-money) 40%, transparent);
border: 1px solid var(--sb-border);
border-left: 5px solid var(--sb-money);
border-radius: 13px;
padding: 15px 18px;

View File

@@ -82,7 +82,7 @@
<div class="row" t-if="!state.inShop">
<label class="fl">Service call type</label>
<select class="f"
t-on-change="(ev) => { const r = state.calloutRates.find(x => x.code === ev.target.value); if (r) { state.category = r.category; state.timing = r.timing; } }">
t-on-change="onCallType">
<t t-foreach="state.calloutRates" t-as="r" t-key="r.code">
<option t-att-value="r.code"
t-att-selected="state.category === r.category and state.timing === r.timing">
@@ -143,7 +143,7 @@
<div class="row">
<label class="fl">Technician</label>
<select class="f" t-model.number="state.technicianId">
<option value="false">— Choose —</option>
<option value="">— Choose —</option>
<t t-foreach="state.technicians" t-as="t" t-key="t.id">
<option t-att-value="t.id"><t t-esc="t.name"/></option>
</t>