|
278 | 278 | <t t-foreach="cfg_step_attribute_line_ids" t-as="line"> |
279 | 279 | <t t-set="custom_value" t-value="custom_value_ids.filtered(lambda x, line=line: x.attribute_id == line.attribute_id)"/> |
280 | 280 | <t t-set="available_val" t-value="any(val.id in available_value_ids for val in line.value_ids)"/> |
281 | | - <label class="control-label" t-esc="line.attribute_id.name" t-att-data-oe-id="line.attribute_id.id"></label> |
282 | | - <select t-att-id="'%s%s' % (field_prefix, line.attribute_id.id)" |
283 | | - t-att-data-oe-id="line.attribute_id.id" |
284 | | - t-att-data-attr-required="line.required" |
285 | | - t-att-multiple="'multiple' if line.multi else None" |
286 | | - t-att-name="'%s%s' % (field_prefix, line.attribute_id.id)" |
287 | | - t-att-class="'form-control config_attribute' + (' required_config_attrib' if (not available_val and line.required and line.custom) or (available_val and line.required) else '') + (' d-none' if not line.value_ids else '')" |
288 | | - t-att-data-old-val-id="(value_ids & line.value_ids) and (value_ids & line.value_ids).ids[0] or ''"> |
| 281 | + <div t-att-class="'attribute_container'"> |
| 282 | + <label class="control-label" t-esc="line.attribute_id.name" t-att-data-oe-id="line.attribute_id.id"></label> |
| 283 | + <select t-att-id="'%s%s' % (field_prefix, line.attribute_id.id)" |
| 284 | + t-att-data-oe-id="line.attribute_id.id" |
| 285 | + t-att-data-attr-required="line.required" |
| 286 | + t-att-multiple="'multiple' if line.multi else None" |
| 287 | + t-att-name="'%s%s' % (field_prefix, line.attribute_id.id)" |
| 288 | + t-att-class="'form-control config_attribute' + (' required_config_attrib' if (not available_val and line.required and line.custom) or (available_val and line.required) else '') + (' d-none' if not line.value_ids else '')" |
| 289 | + t-att-data-old-val-id="(value_ids & line.value_ids) and (value_ids & line.value_ids).ids[0] or ''"> |
289 | 290 |
|
290 | | - <!-- t-att-disabled="'disabled' if not available_val_ids and not line.custom else None" --> |
291 | | - <option name=""/> |
292 | | - <t t-foreach="line.value_ids" t-as="value"> |
293 | | - <option |
294 | | - t-att-selected="'selected' if value.id in value_ids.ids else None" |
295 | | - t-att-class="'config_attr_value' + (' disabled' if value.id not in available_value_ids else '')" |
296 | | - t-att-value="value.id" |
297 | | - t-att-data-oe-id="value.id" |
298 | | - t-att-name="value.id" |
299 | | - t-att-disabled="value.id not in available_value_ids and True or False"> |
300 | | - <t t-esc="value.name"/> |
301 | | - <t t-set="price_extra" t-value="extra_prices.get(value.id, 0)"/> |
302 | | - <t t-if="price_extra"> |
303 | | - (+<t t-esc="price_extra" t-options="{'widget': 'monetary', 'display_currency': pricelist.currency_id, 'from_currency': website.currency_id}"/>) |
304 | | - </t> |
305 | | - </option> |
306 | | - </t> |
| 291 | + <!-- t-att-disabled="'disabled' if not available_val_ids and not line.custom else None" --> |
| 292 | + <option name=""/> |
| 293 | + <t t-foreach="line.value_ids" t-as="value"> |
| 294 | + <option |
| 295 | + t-att-selected="'selected' if value.id in value_ids.ids else None" |
| 296 | + t-att-class="'config_attr_value' + (' disabled' if value.id not in available_value_ids else '')" |
| 297 | + t-att-value="value.id" |
| 298 | + t-att-data-oe-id="value.id" |
| 299 | + t-att-name="value.id" |
| 300 | + t-att-disabled="value.id not in available_value_ids and True or False"> |
| 301 | + <t t-esc="value.name"/> |
| 302 | + <t t-set="price_extra" t-value="extra_prices.get(value.id, 0)"/> |
| 303 | + <t t-if="price_extra"> |
| 304 | + (+<t t-esc="price_extra" t-options="{'widget': 'monetary', 'display_currency': pricelist.currency_id, 'from_currency': website.currency_id}"/>) |
| 305 | + </t> |
| 306 | + </option> |
| 307 | + </t> |
| 308 | + <t t-if="line.custom"> |
| 309 | + <option |
| 310 | + t-att-selected="'selected' if custom_value or not line.value_ids else None" |
| 311 | + t-att-class="'config_attr_value custom_config_attr_value' + (' disabled' if custom_val_id.id not in available_value_ids else '')" |
| 312 | + t-att-value="custom_val_id.id" |
| 313 | + t-att-data-oe-id="custom_val_id.id" |
| 314 | + t-att-name="custom_val_id.id" |
| 315 | + t-att-disabled="custom_val_id.id not in available_value_ids and True or False"> |
| 316 | + <t t-esc="custom_val_id.name"/> |
| 317 | + </option> |
| 318 | + </t> |
| 319 | + </select> |
307 | 320 | <t t-if="line.custom"> |
308 | | - <option |
309 | | - t-att-selected="'selected' if custom_value or not line.value_ids else None" |
310 | | - t-att-class="'config_attr_value custom_config_attr_value' + (' disabled' if custom_val_id.id not in available_value_ids else '')" |
311 | | - t-att-value="custom_val_id.id" |
312 | | - t-att-data-oe-id="custom_val_id.id" |
313 | | - t-att-name="custom_val_id.id" |
314 | | - t-att-disabled="custom_val_id.id not in available_value_ids and True or False"> |
315 | | - <t t-esc="custom_val_id.name"/> |
316 | | - </option> |
| 321 | + <div t-att-class="'custom_field_container mt16' + (' d-none' if not custom_value and line.value_ids else '')" |
| 322 | + t-att-data-oe-id="line.attribute_id.id"> |
| 323 | + <t t-call="website_product_configurator.config_custom_field"/> |
| 324 | + </div> |
317 | 325 | </t> |
318 | | - </select> |
319 | | - <t t-if="line.custom"> |
320 | | - <div t-att-class="'custom_field_container mt16' + (' d-none' if not custom_value and line.value_ids else '')" |
321 | | - t-att-data-oe-id="line.attribute_id.id"> |
322 | | - <t t-call="website_product_configurator.config_custom_field"/> |
323 | | - </div> |
324 | | - </t> |
| 326 | + </div> |
325 | 327 | </t> |
326 | 328 | </t> |
327 | 329 | </xpath> |
|
336 | 338 | <t t-foreach="cfg_step_attribute_line_ids" t-as="line"> |
337 | 339 | <t t-set="custom_value" t-value="custom_value_ids.filtered(lambda x, line=line: x.attribute_id == line.attribute_id)"/> |
338 | 340 | <t t-set="available_val" t-value="any(val.id in available_value_ids for val in line.value_ids)"/> |
339 | | - <label class="control-label" t-esc="line.attribute_id.name" t-att-data-oe-id="line.attribute_id.id"></label> |
340 | | - <fieldset t-att-id="'%s%s' % (field_prefix, line.attribute_id.id)" |
341 | | - t-att-data-oe-id="line.attribute_id.id" |
342 | | - t-att-data-attr-required="line.required" |
343 | | - t-att-name="'%s%s' % (field_prefix, line.attribute_id.id)" |
344 | | - t-att-class="'form-control config_attribute' + (' required_config_attrib' if (not available_val and line.required and line.custom) or (available_val and line.required) else '') + (' d-none' if not line.value_ids else '')" |
345 | | - style="height: unset;" |
346 | | - t-att-data-old-val-id="(value_ids & line.value_ids) and (value_ids & line.value_ids).ids[0] or ''"> |
347 | | - <t t-foreach="line.value_ids" t-as="value"> |
348 | | - <div class="radio-card-container"> |
349 | | - <div class="info_config_attr_value_radio"> |
350 | | - <span class="label_config_attr_value_radio"> |
351 | | - <t t-esc="value.name"/> |
352 | | - </span> |
353 | | - <t t-set="price_extra" t-value="extra_prices.get(value.id, 0)"/> |
354 | | - <t t-if="price_extra"> |
355 | | - <span class="label_config_price_extra_radio"> |
356 | | - (+<t t-esc="price_extra" t-options="{'widget': 'monetary', 'display_currency': pricelist.currency_id, 'from_currency': website.currency_id}"/>) |
| 341 | + <div t-att-class="'attribute_container'"> |
| 342 | + <label class="control-label" t-esc="line.attribute_id.name" t-att-data-oe-id="line.attribute_id.id"></label> |
| 343 | + <fieldset t-att-id="'%s%s' % (field_prefix, line.attribute_id.id)" |
| 344 | + t-att-data-oe-id="line.attribute_id.id" |
| 345 | + t-att-data-attr-required="line.required" |
| 346 | + t-att-name="'%s%s' % (field_prefix, line.attribute_id.id)" |
| 347 | + t-att-class="'form-control config_attribute' + (' required_config_attrib' if (not available_val and line.required and line.custom) or (available_val and line.required) else '') + (' d-none' if not line.value_ids else '')" |
| 348 | + style="height: unset;" |
| 349 | + t-att-data-old-val-id="(value_ids & line.value_ids) and (value_ids & line.value_ids).ids[0] or ''"> |
| 350 | + <t t-foreach="line.value_ids" t-as="value"> |
| 351 | + <div class="radio-card-container"> |
| 352 | + <div class="info_config_attr_value_radio"> |
| 353 | + <span class="label_config_attr_value_radio"> |
| 354 | + <t t-esc="value.name"/> |
357 | 355 | </span> |
358 | | - </t> |
| 356 | + <t t-set="price_extra" t-value="extra_prices.get(value.id, 0)"/> |
| 357 | + <t t-if="price_extra"> |
| 358 | + <span class="label_config_price_extra_radio"> |
| 359 | + (+<t t-esc="price_extra" t-options="{'widget': 'monetary', 'display_currency': pricelist.currency_id, 'from_currency': website.currency_id}"/>) |
| 360 | + </span> |
| 361 | + </t> |
| 362 | + <input t-att-id="'%s%s' % (field_prefix, line.attribute_id.id)" |
| 363 | + t-att-checked="'checked' if value.id in value_ids.ids else None" |
| 364 | + t-att-type="line.multi and 'checkbox' or 'radio'" |
| 365 | + t-att-class="'config_attr_value'" |
| 366 | + t-att-value="value.id" |
| 367 | + t-att-data-oe-id="value.id" |
| 368 | + t-att-name="'%s%s' % (field_prefix, line.attribute_id.id)" |
| 369 | + t-att-disabled="value.id not in available_value_ids and True or False" |
| 370 | + t-att-title="value.name"/> |
| 371 | + </div> |
| 372 | + <label class="image_config_attr_value_radio" |
| 373 | + for="'%s%s' % (field_prefix, line.attribute_id.id)" |
| 374 | + t-att-data-val-id="value.id" |
| 375 | + t-attf-style="background-image:url(/web/image/product.attribute.value/{{value.id}}/image_medium);" |
| 376 | + t-att-title="value.name"> |
| 377 | + </label> |
| 378 | + </div> |
| 379 | + </t> |
| 380 | + <t t-if="line.custom"> |
| 381 | + <div class="radio-card-container"> |
| 382 | + <span t-esc="custom_val_id.name" class="label_config_attr_value_radio" t-att-title="custom_val_id.name"/> |
359 | 383 | <input t-att-id="'%s%s' % (field_prefix, line.attribute_id.id)" |
360 | | - t-att-checked="'checked' if value.id in value_ids.ids else None" |
| 384 | + t-att-checked="'checked' if custom_value or not line.value_ids else None" |
361 | 385 | t-att-type="line.multi and 'checkbox' or 'radio'" |
362 | | - t-att-class="'config_attr_value'" |
363 | | - t-att-value="value.id" |
364 | | - t-att-data-oe-id="value.id" |
| 386 | + t-att-class="'config_attr_value custom_config_attr_value'" |
| 387 | + t-att-value="custom_val_id.id" |
| 388 | + t-att-data-oe-id="custom_val_id.id" |
365 | 389 | t-att-name="'%s%s' % (field_prefix, line.attribute_id.id)" |
366 | | - t-att-disabled="value.id not in available_value_ids and True or False" |
367 | | - t-att-title="value.name"/> |
| 390 | + t-att-disabled="custom_val_id.id not in available_value_ids and True or False" |
| 391 | + t-att-title="custom_val_id.name"/> |
| 392 | + <label class="image_config_attr_value_radio" |
| 393 | + for="'%s%s' % (field_prefix, line.attribute_id.id)" |
| 394 | + t-att-data-val-id="custom_val_id.id" |
| 395 | + t-attf-style="background-image:url(/web/image/product.attribute.value/{{custom_val_id.id}}/image_medium);" |
| 396 | + t-att-title="custom_val_id.name"> |
| 397 | + </label> |
368 | 398 | </div> |
369 | | - <label class="image_config_attr_value_radio" |
370 | | - for="'%s%s' % (field_prefix, line.attribute_id.id)" |
371 | | - t-att-data-val-id="value.id" |
372 | | - t-attf-style="background-image:url(/web/image/product.attribute.value/{{value.id}}/image_medium);" |
373 | | - t-att-title="value.name"> |
374 | | - </label> |
375 | | - </div> |
376 | | - </t> |
| 399 | + </t> |
| 400 | + </fieldset> |
377 | 401 | <t t-if="line.custom"> |
378 | | - <div class="radio-card-container"> |
379 | | - <span t-esc="custom_val_id.name" class="label_config_attr_value_radio" t-att-title="custom_val_id.name"/> |
380 | | - <input t-att-id="'%s%s' % (field_prefix, line.attribute_id.id)" |
381 | | - t-att-checked="'checked' if custom_value or not line.value_ids else None" |
382 | | - t-att-type="line.multi and 'checkbox' or 'radio'" |
383 | | - t-att-class="'config_attr_value custom_config_attr_value'" |
384 | | - t-att-value="custom_val_id.id" |
385 | | - t-att-data-oe-id="custom_val_id.id" |
386 | | - t-att-name="'%s%s' % (field_prefix, line.attribute_id.id)" |
387 | | - t-att-disabled="custom_val_id.id not in available_value_ids and True or False" |
388 | | - t-att-title="custom_val_id.name"/> |
389 | | - <label class="image_config_attr_value_radio" |
390 | | - for="'%s%s' % (field_prefix, line.attribute_id.id)" |
391 | | - t-att-data-val-id="custom_val_id.id" |
392 | | - t-attf-style="background-image:url(/web/image/product.attribute.value/{{custom_val_id.id}}/image_medium);" |
393 | | - t-att-title="custom_val_id.name"> |
394 | | - </label> |
| 402 | + |
| 403 | + <div t-att-class="'custom_field_container' + (' d-none' if not custom_value and line.value_ids else '')" |
| 404 | + t-att-data-oe-id="line.attribute_id.id"> |
| 405 | + <t t-call="website_product_configurator.config_custom_field"/> |
395 | 406 | </div> |
396 | 407 | </t> |
397 | | - </fieldset> |
398 | | - <t t-if="line.custom"> |
399 | | - |
400 | | - <div t-att-class="'custom_field_container' + (' d-none' if not custom_value and line.value_ids else '')" |
401 | | - t-att-data-oe-id="line.attribute_id.id"> |
402 | | - <t t-call="website_product_configurator.config_custom_field"/> |
403 | | - </div> |
404 | | - </t> |
| 408 | + </div> |
405 | 409 | </t> |
406 | 410 | </t> |
407 | 411 | </xpath> |
|
0 commit comments