Commit 21d8ef0
committed
fix(odoo-spo): read selection_add + merge across classes (codex #530)
Odoo addons extend an existing Selection field's domain via
`_inherit` + `fields.Selection(selection_add=[('reviewed','Reviewed')])`
WITHOUT redeclaring the base list. `_extract_selection_values` only read
the base `selection=` arg, so the emitted `selection_value` set was
incomplete and a downstream `ASSERT $value IN [...]` would reject records
in legal extension-added states.
Two fixes:
1. `_extract_selection_values` now reads BOTH the base list (positional
arg 0 or `selection=`) AND `selection_add=`, unioning base-first with
order-preserving dedup (factored into `_selection_tuple_keys`).
2. `_scan_file` binding MERGES selection keys per (model, field) instead
of last-write-wins — the base declaration and the `selection_add`
extension live in DIFFERENT classes, so the field's value set must
accumulate across scans, not overwrite.
Tests (53 -> 57):
- selection_add kwarg alone -> added keys
- base + selection_add -> union, base first
- selection_add dedups against base
- cross-class merge: base in _name class + selection_add in _inherit
class -> accumulated [draft, posted, reviewed]
python3 -m unittest tests.test_spo_enrich : 57/57 OK1 parent 502a255 commit 21d8ef0
2 files changed
Lines changed: 91 additions & 30 deletions
Lines changed: 52 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
76 | | - | |
77 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
78 | 82 | | |
79 | 83 | | |
80 | 84 | | |
| |||
162 | 166 | | |
163 | 167 | | |
164 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
165 | 185 | | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
175 | 197 | | |
176 | | - | |
| 198 | + | |
| 199 | + | |
177 | 200 | | |
178 | 201 | | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
186 | 207 | | |
187 | 208 | | |
188 | 209 | | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
| 210 | + | |
| 211 | + | |
196 | 212 | | |
197 | 213 | | |
198 | 214 | | |
| |||
449 | 465 | | |
450 | 466 | | |
451 | 467 | | |
452 | | - | |
453 | | - | |
454 | | - | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
455 | 477 | | |
456 | 478 | | |
457 | 479 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
655 | 655 | | |
656 | 656 | | |
657 | 657 | | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
658 | 679 | | |
659 | 680 | | |
660 | 681 | | |
| |||
683 | 704 | | |
684 | 705 | | |
685 | 706 | | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
686 | 725 | | |
687 | 726 | | |
688 | 727 | | |
| |||
0 commit comments