-
Notifications
You must be signed in to change notification settings - Fork 140
[ENH] - Default Values based on domains. #87
base: 10.0
Are you sure you want to change the base?
[ENH] - Default Values based on domains. #87
Conversation
f879279
to
a0ffee7
Compare
@PCatinean This (and my other PR's) have been rebased... |
b837159
to
8ceb23c
Compare
Codecov Report
@@ Coverage Diff @@
## 10.0 #87 +/- ##
==========================================
+ Coverage 61.11% 65.13% +4.02%
==========================================
Files 14 14
Lines 1368 1440 +72
==========================================
+ Hits 836 938 +102
+ Misses 532 502 -30
Continue to review full report at Codecov.
|
Can you provide a description about this feature? |
When an onchange has completed, or when the template is first parsed, any values which are blank will be examined to see if they can be populated with a default. The default can be domain based. Eg |
continue | ||
available_val_ids = domains[k][0][2] | ||
if isinstance(v, list): | ||
value_ids = list(set(v[0][2]) & set(available_val_ids)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
value_ids
could be reduced to nothing, in which case you'd want the default value.
lambda x: x.id == cfg_step_id) | ||
except: | ||
cfg_step = self.env['product.config.step.line'] | ||
vals = wiz.get_form_vals(dynamic_field_vals, domains, cfg_step) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you create a condition-free default, it will be set here but changes will not cascade.
# pick one at random... | ||
return ( | ||
set(default_line.value_ids.ids) & set(selectable_value_ids) | ||
).pop() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will not work for multi, the client expects a list. For instance, adding options:armrest will cause a js error in AbstractManyField.set_value()
No description provided.