You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
2.4 KiB

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Copyright (C) 2017 - Today: GRAP (http://www.grap.coop)
  4. @author Sylvain LE GAL (https://twitter.com/legalsylvain)
  5. License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  6. -->
  7. <odoo>
  8. <record id="date_field_variable_sql" model="ir.model.fields">
  9. <field name="name">x_date</field>
  10. <field name="field_description">Date</field>
  11. <field name="ttype">date</field>
  12. <field name="model_id" ref="sql_export.model_sql_file_wizard"/>
  13. <field name="model">sql.file.wizard</field>
  14. <field name="state">manual</field>
  15. </record>
  16. <record id="integer_field_variable_sql" model="ir.model.fields">
  17. <field name="name">x_id</field>
  18. <field name="field_description">x_ID</field>
  19. <field name="ttype">integer</field>
  20. <field name="model_id" ref="sql_export.model_sql_file_wizard"/>
  21. <field name="model">sql.file.wizard</field>
  22. <field name="state">manual</field>
  23. </record>
  24. <record id="m2m_field_variable_sql" model="ir.model.fields">
  25. <field name="name">x_partner_categ_ids</field>
  26. <field name="field_description">Partner Categories</field>
  27. <field name="ttype">many2many</field>
  28. <field name="model_id" ref="sql_export.model_sql_file_wizard"/>
  29. <field name="model">sql.file.wizard</field>
  30. <field name="state">manual</field>
  31. <field name="relation">res.partner.category</field>
  32. </record>
  33. <record id="sql_export_partner" model="sql.export">
  34. <field name="name">Export Partners (Demo Data)</field>
  35. <field name="query">SELECT name, street FROM res_partner;</field>
  36. </record>
  37. <function model="sql.export" name="button_validate_sql_expression" eval="([ref('sql_export.sql_export_partner')])"/>
  38. <record id="sql_export_partner_with_variables" model="sql.export">
  39. <field name="name">Export Partners With Variables (Demo Data)</field>
  40. <field name="query">SELECT p.id FROM res_partner p LEFT JOIN res_partner_res_partner_category_rel rel ON rel.partner_id = p.id WHERE create_date &lt; %(x_date)s AND id = %(x_id)s AND rel.category_id in %(x_partner_categ_ids)s</field>
  41. <field eval="[(6, 0, [ref('date_field_variable_sql'), ref('integer_field_variable_sql'), ref('m2m_field_variable_sql')])]" name="field_ids"/>
  42. </record>
  43. <function model="sql.export" name="button_validate_sql_expression" eval="([ref('sql_export.sql_export_partner_with_variables')])"/>
  44. </odoo>