mirror of
https://github.com/OCA/reporting-engine.git
synced 2025-02-16 16:30:38 +02:00
[IMP] Add back the variable feature in sql_export
Refactore to use the new properties field
This commit is contained in:
committed by
David Beal
parent
8df404eff2
commit
3cb3fae1f6
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user