Skip to content

[18.0][FIX] sql_export: allow unchecked checkbox properties - #1226

Open
parabol123654 wants to merge 1 commit into
OCA:18.0from
parabol123654:18.0-fix-sql_export-boolean-property
Open

parabol123654 wants to merge 1 commit into
OCA:18.0from
parabol123654:18.0-fix-sql_export-boolean-property

Conversation

@parabol123654

Copy link
Copy Markdown

Fixes the checkbox part of #1190.

Steps: create an SQL Export whose query uses a checkbox property (e.g. SELECT name FROM res_partner WHERE active = %(Active)s with a checkbox property "Active"), validate it, click "Execute Query", leave the checkbox unchecked and click "Export".

Error: Please enter a values for the following properties : Active

Cause: export_sql reports every property whose value is falsy as missing (if not x["value"]), and an unchecked checkbox is False. So a query with a checkbox property can only be run with the box checked.

Fix: do not report checkbox properties as missing: False is a valid value for them.

Test: test_sql_query_with_unchecked_boolean_param runs such an export with the checkbox unchecked and checks that an archived partner is in the result. Without the fix it fails with the error above; with the fix it passes, along with the tests of sql_export, sql_export_mail, sql_export_delta and sql_export_excel (13 tests on Odoo 18.0).

The issue also reports that selection properties are passed to the query as the option's key instead of its label; that is a separate change and is left out of this PR. The same check is in 16.0 and 17.0; I can backport if wanted.

The Execute Query wizard rejected every property whose value is falsy
as missing, so a checkbox property could only be run checked:
"Please enter a values for the following properties : <name>".

An unchecked checkbox is a value (False): do not report it as missing.

Fixes OCA#1190 (checkbox part)
@OCA-git-bot

Copy link
Copy Markdown
Contributor

Hi @legalsylvain, @florian-dacosta,
some modules you are maintaining are being modified, check this out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants