Tuesday, August 16, 2022
1 change · master
Resolved issues and error corrections
This fix prevents Sign document fields from displaying the word "false" when placeholders are empty or when users are not in developer mode. It keeps existing placeholder text stable when field types change and updates demo data so sample Sign templates display correctly.
Original PR description
This PR is a followup on https://github.com/odoo/enterprise/pull/27676 where a fix was set in stable to manage the specific case of empty placeholders. However this fix was not stable and made…
This PR is a followup on https://github.com/odoo/enterprise/pull/27676 where a fix was set in stable to manage the specific case of empty placeholders. However this fix was not stable and made pre-existing default placeholder disappear and it was hence revert in https://github.com/odoo/enterprise/pull/28496 on stable versions. This fix in master completes the first fix to treat other issues like the case where the user is not in developer mode, the false that appear in the situation of empty placeholders and a confusion in the js logic where we could not differentiate the name of a sign item that was just created (and has a default value of false) and a sign item that had its placeholder set to false. We also add the placeholders in the demo data. The commits of this PR totally rewrite the first fix commit and can be seen as a minor behavior change (the name field of the sign item always has the value of its placeholder while previously it was only the placeholder when it was not false, this mean that changing the type placeholder won't change the previously existing item default placeholder like it was the case before). BUG1 Steps to reproduce: - Install sign - Put no developer mode on - Set a signature block on a document - Change if from customer to employee Current behavior: The block shows false Expected behavior: The block does not change Explanation: The bug was created after the fix commit 860ace5013d7f5cde1018f5eb1ec4fce1f6b3537 the fix did not take into consideration that the o_sign_name of the block form only appeared when the use is in developer mode (t-if="widget.debug" in xml). https://github.com/odoo/enterprise/blob/da1b8691f8edceac5a7ba794921a24657886618c/sign/static/src/xml/sign_backend.xml#L5-L9 So the name was always false when pulled in the form hide function. To fix that we only pull the name from o_sign_name if we are not in developer mode. BUG2 Steps to reproduce: - Install sign - Create a template and add a sign item - Set an empty placeholder with the developer mode on the sign item and save Expected behavior: The placeholder is empty Current behavior: The placeholder is false Explanation: It was thought in a previous fix https://github.com/odoo/enterprise/commit/860ace5013d7f5cde1018f5eb1ec4fce1f6b3537 that the false value was the expected behavior. But is was just inudced by an empty placeholder in the sign item type that returned the false value. To solve the issue we add || "" after the different places where the name is set so that if the type placeholder is false then the sign item placeholder is an empty string. BUG3 Steps to reproduce: - Create a sign item - Set an empty placeholder with developer mode - Refresh - Click on the sign item you just created Expected behavior: The placeholder is empty Current behavior: The placeholder is the sign item type default placeholder Explanation: The javascript is unabled to make the difference between the name of a sign item that was just created (and has a default value of false) and a sign item that had its placeholder set to false. We solve that in the backend by setting a default value for the sign item name at creation. It's cleaner than the current implementation as the default placeholder is only set once and it makes more sense. opw-2767417 opw-2877149