Properties Handling When Exporting

Open Beginner friendly
#1,190 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@parabol123654 is already working on this.

Since Oct 29, 2026.

  • #1226 by @parabol123654 — open

Assessment

Difficulty
2/5
Estimated time
Under an hour
Newbie friendliness
85/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python
Domain
backend

Research direction

The issue targets sql_export/wizard/wizard_file.py; first adjust the property validation block at lines 31-37 to skip the required value check for boolean-type properties, then update the property value lookup at lines 44-51 to add a handler for selection-type properties that maps the stored option hash to the human-readable label from the prop["selection"] tuple list. Verify the fix by running the existing export wizard tests for boolean and selection property types.

Written by the indexing model from the issue text.

Description

bug

Some types of Properties are not handled properly when Exporting from the Execute Query wizard

Module

sql__export

Describe the bug

When executing an SQL Export with Propeties of types checkbox and selection there are some problems, from user point of view:

  • Boolean (checkbox) Property cannot be set to False because it will fail the bad_props check where the value of te Property is required to evaluate to True (see below).
  • Selection value is returned as the hash of the option, which is not intuitive as the hash is not user-defined and not visible during the Property setting. User only see the "label" of the option. The hash values can only be ontained through debugging, or by exporting the values of various Options - not convenient.

To Reproduce

Versions Affected: 16.0, 17.0, 18.0 (basically all versions to date since the inclusion of Properties field):

Steps to reproduce the behavior:

  1. Create a working SQL Export with Properties of those types, (e.g. Boolean Test with Checkbox type, and Selecttion Test with Selection type - create a few Options for the Selection) exporting the value of the Properties into the result. (e.g. SELECT %(Selection Test)s::TEXT AS "Selection", %(Boolean Test)s::TEXT AS "Boolean")
  2. Validate the SQL Export by clicking the "Validate SQL Expression" button, then execute it by clicking the "Execute Query" button that appears.
  3. To test the Boolean type Property case, uncheck the Boolean Test Property, then click the "Export" button in the wizard. It will prompt an error "Please enter a values for the following properties : Boolean Test"
  4. Close the error message by clicking the "OK" button, then check the Boolean Test Property
  5. To test the Selection type Property case, select an Option in the Selection Test Property, and, keeping any checkboxes checked, click the "Export" button. Save and open the resulting file. Observe the value of the Selection column, it is a unknown hash value instead of the selected Option's label.

Expected behavior
At step 3, the wizard should not prompt error as it may be intentional.
At step 5, the value of Selection should be something that the user can recognise, which, presently, only the Option's label is available.

Additional context
The issue with the Selection value also happened for Properties of type Tags. However instead of unknown hash, the value is set to the Tag Label's value in lower case. So, it is still manageable though may not be intuitive.

Here is the code that blocks non-True values:
https://github.com/OCA/reporting-engine/blob/52e03a544f25b789ed34a0e842603ce0b80f36aa/sql_export/wizard/wizard_file.py#L31-L37

Line 31 shold exclude evaluation if prop["type"] == "boolean".

Here is the code that returns the value of Properties:
https://github.com/OCA/reporting-engine/blob/52e03a544f25b789ed34a0e842603ce0b80f36aa/sql_export/wizard/wizard_file.py#L44-L51

There should be a special handler for prop["type"] == "selection", something in the line of:

elif prop["type"] == "selection":
    _sel_dict = dict(prop["selection"])
    variable_dict[prop["string"]] = _sel_dict.get(prop["value"], "")

similar treatment may be preferred if prop["type"] == "tags", getting the list of Tags from tags key of the prop variable. However it cannot use the same approach as selection as the value of the tags key is a list of tuple of 3 values, not 2 values such as Selection.

Some aspects of this issue has been discussed in https://github.com/OCA/reporting-engine/issues/1085

Dominant language
HTML
Stars
435
Forks
929
Avg merge
6d 18h
Merged PRs (30d)
2

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OCA/reporting-engine

All issues in OCA/reporting-engine

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.