Browse Source

Allow to use many2one and many2many fields for query variables

pull/1080/head
Florian da Costa 7 years ago
parent
commit
72f6271147
  1. 7
      sql_export/wizard/wizard_file.py

7
sql_export/wizard/wizard_file.py

@ -79,7 +79,12 @@ class SqlFileWizard(models.TransientModel):
date = today_tz.strftime(DEFAULT_SERVER_DATETIME_FORMAT)
if sql_export.field_ids:
for field in sql_export.field_ids:
variable_dict[field.name] = self[field.name]
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
if "%(user_id)s" in sql_export.query:

Loading…
Cancel
Save