Skip to content
This repository has been archived by the owner on Apr 28, 2022. It is now read-only.

[12.0] product_configurator: field should not be readonly #179

Open
matt454357 opened this issue Sep 14, 2020 · 2 comments
Open

[12.0] product_configurator: field should not be readonly #179

matt454357 opened this issue Sep 14, 2020 · 2 comments

Comments

@matt454357
Copy link
Contributor

Impacted versions: 12.0

Steps to reproduce:

  • create config template:
  • create attributes
    • attr-1 (not required)
      • value-1.1
      • value-1.2
    • attr-2 (not required)
      • value-2.1
      • value-2.2
    • attr-3 (not required)
      • value-3.1
      • value-3.2
  • create restrictions
    • attr-3, value-3.1, attr-1 not in value-1.1
    • attr-3, value-3.2, attr-2 not in value-2.1
  • Configure Product

Current behavior:
The attr-3 field is readonly. Although none of the fields are required, the user must specify a value for both attr-1 and attr-2, in order to select a value for attr-3.

Expected behavior:
The attr-3 field should never be readonly, unless the user has specified attr-1=value-1.1 and attr-2=value-2.1.

Screenshots
Annotation 2020-09-14 172804

Annotation 2020-09-14 172826

@matt454357
Copy link
Contributor Author

The problem is, we require a value to be selected for the dependee, here:

elif domain_line.condition == 'not in':
val_ids = attr_lines.filtered(
lambda l: l.attribute_id.id == attr_id).value_ids
val_ids = val_ids - domain_line.value_ids
attr_depends[attr_field] |= set(val_ids.ids)

This addition seems to fix it:

elif domain_line.condition == 'not in':
	val_ids = attr_lines.filtered(
		lambda l: l.attribute_id.id == attr_id).value_ids
	val_ids = val_ids - domain_line.value_ids
	attr_depends[attr_field] |= set(val_ids.ids)
	# this fixes the readonly problem
	if not attr_lines.filtered(
	        lambda l: l.attribute_id.id == attr_id).required:
	    attr_depends[attr_field] |= {False}

@matt454357
Copy link
Contributor Author

My solution exposes another issue:
Configure a product, and specify attr-1=value-1.1.
The attr-3 field changes to not required.
The attr-3 field should be required unless the user has specified attr-1=value-1.1 and attr-2=value-2.1.

matt454357 added a commit to asphaltzipper/odoo-product-configurator that referenced this issue Sep 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant