Browse Source

Merge pull request #1080 from akretion/8.0-fix-many2x-variables

[8.0][sql_export] Allow to use many2one and many2many fields for query variables
pull/913/merge
beau sebastien 6 years ago
committed by GitHub
parent
commit
de97b5856b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      sql_export/wizard/wizard_file.py

5
sql_export/wizard/wizard_file.py

@ -79,6 +79,11 @@ class SqlFileWizard(models.TransientModel):
date = today_tz.strftime(DEFAULT_SERVER_DATETIME_FORMAT)
if sql_export.field_ids:
for field in sql_export.field_ids:
if field.ttype == 'many2one':
variable_dict[field.name] = self[field.name].id
elif field.ttype == 'many2many':
variable_dict[field.name] = tuple(self[field.name].ids)
else:
variable_dict[field.name] = self[field.name]
if "%(company_id)s" in sql_export.query:
variable_dict['company_id'] = self.env.user.company_id.id

Loading…
Cancel
Save