[FIX] project_average_acceptable_time: use on_account_update hook #37
Reference in New Issue
Block a user
No description provided.
Delete Branch "18.0-project-average-acceptable-time-portal-fix"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The portal override validated the submitted data a second time after
super().account()returned. When the partner cannot edit its VAT (childcontact or issued invoices), the country select is disabled and not
submitted; Odoo core injects the missing
country_idin its own copy ofthe posted data, but the raw payload re-validated by the module still
lacked it, raising
KeyError: 'country_id'and a 500 on save.Move the default-project update to
on_account_update(), which Odoocalls after a successful validation, and drop the duplicate validation.
Add a regression test with a child contact whose country field is disabled.
revue faite par Claude Opus 5.5 (réflexion au niveau par défaut), qui a lu le code sans lancer les tests :
Diagnostic confirmé par Opus : quand
can_edit_vat()est faux, le core Odoo 18 ajoutecountry_iddans sa propre copie de post (portal.py l.189-190). La copie re-validée par le module ne l'a pas, d'où le KeyError.Passer par
on_account_update()lui paraît la bonne approche : le core ne l'appelle qu'après une validation réussie (l.204), etaverage_acceptable_timeest bien dans values via_get_optional_fields().Le test de non-régression (contact rattaché à une société, sans
country_id) couvre le cas.Verdict d'Opus : OK pour merger.