[IMP] Add back the variable feature in sql_export

Refactore to use the new properties field
This commit is contained in:
Florian da Costa
2023-02-03 11:36:59 +01:00
committed by David Beal
parent 8df404eff2
commit 3cb3fae1f6
13 changed files with 109 additions and 232 deletions

View File

@@ -4,7 +4,6 @@
import base64
from odoo import fields
from odoo.exceptions import UserError
from odoo.tests.common import TransactionCase, tagged
@@ -61,15 +60,42 @@ class TestExportSqlQuery(TransactionCase):
sql_export.state, "sql_valid", "%s is a valid request" % (query)
)
def _test_sql_query_with_params(self):
def test_sql_query_with_params(self):
query = self.env.ref("sql_export.sql_export_partner_with_variables")
query.write({"state": "sql_valid"})
categ_id = self.env.ref("base.res_partner_category_0").id
wizard = self.wizard_obj.create(
{
"sql_export_id": query.id,
"x_date": fields.Date.today(),
"x_id": 1,
"x_partner_categ_ids": [(6, 0, [categ_id])],
}
)
wizard.write(
{
"query_properties": [
{
"name": "630eca383bc142e6",
"string": "Date",
"type": "date",
"default": "",
"value": "2023-02-03",
},
{
"name": "ec0556e22932334b",
"string": "Categories",
"type": "many2many",
"default": False,
"comodel": "res.partner.category",
"domain": False,
"value": [[categ_id, "Consulting Services"]],
},
{
"name": "907ac618eccbab74",
"string": "ID",
"type": "integer",
"default": False,
"value": 1,
},
]
}
)
wizard.export_sql()