[16.0][IMP] Add back the variable feature in sql_export - #718
Conversation
|
Hi @legalsylvain, |
legalsylvain
left a comment
There was a problem hiding this comment.
Really nice job !
I didn't know PropertiesDefinition. Looks great and more simple. (+114 / - 223 )
Partial code review & functional tests.
Question :
What is the objective of setting values in this view ?
I was expected it will be the default values, in the wizard, but it's not the case.
(But I just discover PropertiesDefinition, maybe my question is not relevant).
2 things :
-
could you make required field in the wizard ? if not, user can click on export, but then it raise an SQL error if one of the variable is empty.
psycopg2.errors.SyntaxError: syntax error at or near "false" LINE 7: AND rel.category_id in false) TO STDOUT WITH CSV HEADER DELI... -
could you put a variable per line ? (no blocking point, but I see it more usable).
| if rec.query_properties_definition: | ||
| rec.use_properties = True | ||
| else: | ||
| rec.use_properties = False |
There was a problem hiding this comment.
| if rec.query_properties_definition: | |
| rec.use_properties = True | |
| else: | |
| rec.use_properties = False | |
| rec.use_properties = bool(rec.query_properties_definition) |
a681d50 to
e675732
Compare
It is more simple (at least once you get how properties field work, but as it is a standard odoo field now, seems ok)
This is how properties field work. On one object, you can create the property fields and set values (we want the values on the wizard to use it in the query). And when adding the properties, Odoo will store it in the related PropertiesDefinition field. So the configuration of the properties have to be on the sql.file.wizard model.
Not sure I understood what you meant
Well, this is the major draw back with the use of this properties field. I don't think it is possible to put it as required.
Done |
|
For the required field question, IMO, we can put it in the known issues/ROADMAP that we don't manage optional fields, only required (even if not visible in the view) we raise is a property is empty, and if Odoo improve the properties field with the required property, then we'll improve it. |
| variable_dict[field.name] = self[field.name].id | ||
| elif field.ttype == "many2many": | ||
| variable_dict[field.name] = tuple(self[field.name].ids) | ||
| if self.query_properties: |
There was a problem hiding this comment.
useless line, as the following line is a for.
Well : step to reproduce.
|
|
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
Refactore to use the new properties field
e675732 to
741b22c
Compare
|
Hi @legalsylvain Would you mind updating your review ? @bguillot could you do a review on this one ? |
|
Hi @florian-dacosta. Just tested the module. all is great, except the error when user doesn't enter all the values : I made a PR against akretion branch. could you take a look ? |
…nagement-IMP 16 sql export fix variable management imp
|
Thanks for the improvement, it is merged! |
bealdav
left a comment
There was a problem hiding this comment.
LGTM
... on friday with accounting made, yeoh
enjoy
legalsylvain
left a comment
There was a problem hiding this comment.
It requires migration scripts. Dont you think ?
More or less.. But mainly for the fact that one have to re-write/re-check the query anyway and the complication to do the script make me think we should not bother on this one. |
|
Let's go ahead. /ocabot merge major |
|
This PR looks fantastic, let's merge it! |
|
Congratulations, your PR was merged at 24305cd. Thanks a lot for contributing to OCA. ❤️ |





This feature was removed during migration in order to migrate the module fast.
I add it back now, with a refactore, the module now uses the nice new "properties" field and we don't need to create manual fields anymore.
The use of the sql queries using variable should be easier
@bguillot @legalsylvain