OCA reporting engine fork for dev and update.
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.

543 lines
18 KiB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
  7. <title>BI SQL Editor</title>
  8. <style type="text/css">
  9. /*
  10. :Author: David Goodger (goodger@python.org)
  11. :Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
  12. :Copyright: This stylesheet has been placed in the public domain.
  13. Default cascading style sheet for the HTML output of Docutils.
  14. See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
  15. customize this style sheet.
  16. */
  17. /* used to remove borders from tables and images */
  18. .borderless, table.borderless td, table.borderless th {
  19. border: 0 }
  20. table.borderless td, table.borderless th {
  21. /* Override padding for "table.docutils td" with "! important".
  22. The right padding separates the table cells. */
  23. padding: 0 0.5em 0 0 ! important }
  24. .first {
  25. /* Override more specific margin styles with "! important". */
  26. margin-top: 0 ! important }
  27. .last, .with-subtitle {
  28. margin-bottom: 0 ! important }
  29. .hidden {
  30. display: none }
  31. .subscript {
  32. vertical-align: sub;
  33. font-size: smaller }
  34. .superscript {
  35. vertical-align: super;
  36. font-size: smaller }
  37. a.toc-backref {
  38. text-decoration: none ;
  39. color: black }
  40. blockquote.epigraph {
  41. margin: 2em 5em ; }
  42. dl.docutils dd {
  43. margin-bottom: 0.5em }
  44. object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
  45. overflow: hidden;
  46. }
  47. /* Uncomment (and remove this text!) to get bold-faced definition list terms
  48. dl.docutils dt {
  49. font-weight: bold }
  50. */
  51. div.abstract {
  52. margin: 2em 5em }
  53. div.abstract p.topic-title {
  54. font-weight: bold ;
  55. text-align: center }
  56. div.admonition, div.attention, div.caution, div.danger, div.error,
  57. div.hint, div.important, div.note, div.tip, div.warning {
  58. margin: 2em ;
  59. border: medium outset ;
  60. padding: 1em }
  61. div.admonition p.admonition-title, div.hint p.admonition-title,
  62. div.important p.admonition-title, div.note p.admonition-title,
  63. div.tip p.admonition-title {
  64. font-weight: bold ;
  65. font-family: sans-serif }
  66. div.attention p.admonition-title, div.caution p.admonition-title,
  67. div.danger p.admonition-title, div.error p.admonition-title,
  68. div.warning p.admonition-title, .code .error {
  69. color: red ;
  70. font-weight: bold ;
  71. font-family: sans-serif }
  72. /* Uncomment (and remove this text!) to get reduced vertical space in
  73. compound paragraphs.
  74. div.compound .compound-first, div.compound .compound-middle {
  75. margin-bottom: 0.5em }
  76. div.compound .compound-last, div.compound .compound-middle {
  77. margin-top: 0.5em }
  78. */
  79. div.dedication {
  80. margin: 2em 5em ;
  81. text-align: center ;
  82. font-style: italic }
  83. div.dedication p.topic-title {
  84. font-weight: bold ;
  85. font-style: normal }
  86. div.figure {
  87. margin-left: 2em ;
  88. margin-right: 2em }
  89. div.footer, div.header {
  90. clear: both;
  91. font-size: smaller }
  92. div.line-block {
  93. display: block ;
  94. margin-top: 1em ;
  95. margin-bottom: 1em }
  96. div.line-block div.line-block {
  97. margin-top: 0 ;
  98. margin-bottom: 0 ;
  99. margin-left: 1.5em }
  100. div.sidebar {
  101. margin: 0 0 0.5em 1em ;
  102. border: medium outset ;
  103. padding: 1em ;
  104. background-color: #ffffee ;
  105. width: 40% ;
  106. float: right ;
  107. clear: right }
  108. div.sidebar p.rubric {
  109. font-family: sans-serif ;
  110. font-size: medium }
  111. div.system-messages {
  112. margin: 5em }
  113. div.system-messages h1 {
  114. color: red }
  115. div.system-message {
  116. border: medium outset ;
  117. padding: 1em }
  118. div.system-message p.system-message-title {
  119. color: red ;
  120. font-weight: bold }
  121. div.topic {
  122. margin: 2em }
  123. h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
  124. h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
  125. margin-top: 0.4em }
  126. h1.title {
  127. text-align: center }
  128. h2.subtitle {
  129. text-align: center }
  130. hr.docutils {
  131. width: 75% }
  132. img.align-left, .figure.align-left, object.align-left, table.align-left {
  133. clear: left ;
  134. float: left ;
  135. margin-right: 1em }
  136. img.align-right, .figure.align-right, object.align-right, table.align-right {
  137. clear: right ;
  138. float: right ;
  139. margin-left: 1em }
  140. img.align-center, .figure.align-center, object.align-center {
  141. display: block;
  142. margin-left: auto;
  143. margin-right: auto;
  144. }
  145. table.align-center {
  146. margin-left: auto;
  147. margin-right: auto;
  148. }
  149. .align-left {
  150. text-align: left }
  151. .align-center {
  152. clear: both ;
  153. text-align: center }
  154. .align-right {
  155. text-align: right }
  156. /* reset inner alignment in figures */
  157. div.align-right {
  158. text-align: inherit }
  159. /* div.align-center * { */
  160. /* text-align: left } */
  161. .align-top {
  162. vertical-align: top }
  163. .align-middle {
  164. vertical-align: middle }
  165. .align-bottom {
  166. vertical-align: bottom }
  167. ol.simple, ul.simple {
  168. margin-bottom: 1em }
  169. ol.arabic {
  170. list-style: decimal }
  171. ol.loweralpha {
  172. list-style: lower-alpha }
  173. ol.upperalpha {
  174. list-style: upper-alpha }
  175. ol.lowerroman {
  176. list-style: lower-roman }
  177. ol.upperroman {
  178. list-style: upper-roman }
  179. p.attribution {
  180. text-align: right ;
  181. margin-left: 50% }
  182. p.caption {
  183. font-style: italic }
  184. p.credits {
  185. font-style: italic ;
  186. font-size: smaller }
  187. p.label {
  188. white-space: nowrap }
  189. p.rubric {
  190. font-weight: bold ;
  191. font-size: larger ;
  192. color: maroon ;
  193. text-align: center }
  194. p.sidebar-title {
  195. font-family: sans-serif ;
  196. font-weight: bold ;
  197. font-size: larger }
  198. p.sidebar-subtitle {
  199. font-family: sans-serif ;
  200. font-weight: bold }
  201. p.topic-title {
  202. font-weight: bold }
  203. pre.address {
  204. margin-bottom: 0 ;
  205. margin-top: 0 ;
  206. font: inherit }
  207. pre.literal-block, pre.doctest-block, pre.math, pre.code {
  208. margin-left: 2em ;
  209. margin-right: 2em }
  210. pre.code .ln { color: grey; } /* line numbers */
  211. pre.code, code { background-color: #eeeeee }
  212. pre.code .comment, code .comment { color: #5C6576 }
  213. pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
  214. pre.code .literal.string, code .literal.string { color: #0C5404 }
  215. pre.code .name.builtin, code .name.builtin { color: #352B84 }
  216. pre.code .deleted, code .deleted { background-color: #DEB0A1}
  217. pre.code .inserted, code .inserted { background-color: #A3D289}
  218. span.classifier {
  219. font-family: sans-serif ;
  220. font-style: oblique }
  221. span.classifier-delimiter {
  222. font-family: sans-serif ;
  223. font-weight: bold }
  224. span.interpreted {
  225. font-family: sans-serif }
  226. span.option {
  227. white-space: nowrap }
  228. span.pre {
  229. white-space: pre }
  230. span.problematic {
  231. color: red }
  232. span.section-subtitle {
  233. /* font-size relative to parent (h1..h6 element) */
  234. font-size: 80% }
  235. table.citation {
  236. border-left: solid 1px gray;
  237. margin-left: 1px }
  238. table.docinfo {
  239. margin: 2em 4em }
  240. table.docutils {
  241. margin-top: 0.5em ;
  242. margin-bottom: 0.5em }
  243. table.footnote {
  244. border-left: solid 1px black;
  245. margin-left: 1px }
  246. table.docutils td, table.docutils th,
  247. table.docinfo td, table.docinfo th {
  248. padding-left: 0.5em ;
  249. padding-right: 0.5em ;
  250. vertical-align: top }
  251. table.docutils th.field-name, table.docinfo th.docinfo-name {
  252. font-weight: bold ;
  253. text-align: left ;
  254. white-space: nowrap ;
  255. padding-left: 0 }
  256. /* "booktabs" style (no vertical lines) */
  257. table.docutils.booktabs {
  258. border: 0px;
  259. border-top: 2px solid;
  260. border-bottom: 2px solid;
  261. border-collapse: collapse;
  262. }
  263. table.docutils.booktabs * {
  264. border: 0px;
  265. }
  266. table.docutils.booktabs th {
  267. border-bottom: thin solid;
  268. text-align: left;
  269. }
  270. h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
  271. h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
  272. font-size: 100% }
  273. ul.auto-toc {
  274. list-style-type: none }
  275. </style>
  276. </head>
  277. <body>
  278. <div class="document" id="bi-sql-editor">
  279. <h1 class="title">BI SQL Editor</h1>
  280. <!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  281. !! This file is generated by oca-gen-addon-readme !!
  282. !! changes will be overwritten. !!
  283. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
  284. <p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/12.0/bi_sql_editor"><img alt="OCA/reporting-engine" src="https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/reporting-engine-12-0/reporting-engine-12-0-bi_sql_editor"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/143/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
  285. <p>This module extends the functionality of reporting, to support creation
  286. of extra custom reports.
  287. It allows user to write a custom SQL request. (Generally, admin users)</p>
  288. <p>Once written, a new model is generated, and user can map the selected field
  289. with odoo fields.
  290. Then user ends the process, creating new menu, action and graph view.</p>
  291. <p>Technically, the module create SQL View (or materialized view, if option is
  292. checked). Materialized view duplicates datas, but request are fastest. If
  293. materialized view is enabled, this module will create a cron task to refresh
  294. the data).</p>
  295. <p>By default, users member of ‘SQL Request / User’ can see all the views.
  296. You can specify extra groups that have the right to access to a specific view.</p>
  297. <div class="section" id="warning">
  298. <h1>Warning</h1>
  299. <p>This module is intended for technician people in a company and for Odoo integrators.</p>
  300. <p>It requires the user to know SQL syntax and Odoo models.</p>
  301. <p>If you don’t have such skills, do not try to use this module specially on a production
  302. environment.</p>
  303. </div>
  304. <div class="section" id="use-cases">
  305. <h1>Use Cases</h1>
  306. <p>this module is interesting for the following use cases</p>
  307. <ul class="simple">
  308. <li>You want to realize technical SQL requests, that Odoo framework doesn’t allow
  309. (For exemple, UNION with many SELECT) A typical use case is if you want to have
  310. Sale Orders and PoS Orders datas in a same table</li>
  311. <li>You want to customize an Odoo report, removing some useless fields and adding
  312. some custom ones. In that case, you can simply select the fields of the original
  313. report (sale.report model for exemple), and add your custom fields</li>
  314. <li>You have a lot of data, and classical SQL Views have very bad performance.
  315. In that case, MATERIALIZED VIEW will be a good solution to reduce display duration</li>
  316. </ul>
  317. <p><strong>Table of contents</strong></p>
  318. <div class="contents local topic" id="contents">
  319. <ul class="simple">
  320. <li><a class="reference internal" href="#installation" id="id1">Installation</a></li>
  321. <li><a class="reference internal" href="#configuration" id="id2">Configuration</a></li>
  322. <li><a class="reference internal" href="#usage" id="id3">Usage</a></li>
  323. <li><a class="reference internal" href="#bug-tracker" id="id4">Bug Tracker</a></li>
  324. <li><a class="reference internal" href="#credits" id="id5">Credits</a><ul>
  325. <li><a class="reference internal" href="#authors" id="id6">Authors</a></li>
  326. <li><a class="reference internal" href="#contributors" id="id7">Contributors</a></li>
  327. <li><a class="reference internal" href="#maintainers" id="id8">Maintainers</a></li>
  328. </ul>
  329. </li>
  330. </ul>
  331. </div>
  332. <div class="section" id="installation">
  333. <h2><a class="toc-backref" href="#id1">Installation</a></h2>
  334. <ul class="simple">
  335. <li>You must put this module as <cite>server_wide_modules</cite> in your odoo configuration file
  336. or add ‘–load=bi_sql_editor’ if you start odoo in command line.</li>
  337. </ul>
  338. </div>
  339. <div class="section" id="configuration">
  340. <h2><a class="toc-backref" href="#id2">Configuration</a></h2>
  341. <p>To configure this module, you need to:</p>
  342. <ul>
  343. <li><p class="first">Go to Settings / Technical / Database Structure / SQL Views</p>
  344. </li>
  345. <li><p class="first">tip your SQL request</p>
  346. <div class="figure">
  347. <img alt="https://raw.githubusercontent.com/OCA/reporting-engine/12.0/bi_sql_editor/static/description/01_sql_request.png" src="https://raw.githubusercontent.com/OCA/reporting-engine/12.0/bi_sql_editor/static/description/01_sql_request.png" style="width: 800px;" />
  348. </div>
  349. </li>
  350. <li><p class="first">Select the group(s) that could have access to the view</p>
  351. <div class="figure">
  352. <img alt="https://raw.githubusercontent.com/OCA/reporting-engine/12.0/bi_sql_editor/static/description/02_security_access.png" src="https://raw.githubusercontent.com/OCA/reporting-engine/12.0/bi_sql_editor/static/description/02_security_access.png" style="width: 800px;" />
  353. </div>
  354. </li>
  355. <li><p class="first">Click on the button ‘Clean and Check Request’</p>
  356. </li>
  357. <li><p class="first">Once the sql request checked, the module analyses the column of the view,
  358. and propose field mapping. For each field, you can decide to create an index
  359. and set if it will be displayed on the pivot graph as a column, a row or a
  360. measure.</p>
  361. <div class="figure">
  362. <img alt="https://raw.githubusercontent.com/OCA/reporting-engine/12.0/bi_sql_editor/static/description/03_field_mapping.png" src="https://raw.githubusercontent.com/OCA/reporting-engine/12.0/bi_sql_editor/static/description/03_field_mapping.png" style="width: 800px;" />
  363. </div>
  364. </li>
  365. <li><p class="first">Click on the button ‘Create SQL View, Indexes and Models’. (this step could
  366. take a while, if view is materialized)</p>
  367. </li>
  368. <li><p class="first">If it’s a MATERIALIZED view:</p>
  369. <blockquote>
  370. <ul class="simple">
  371. <li>a cron task is created to refresh
  372. the view. You can so define the frequency of the refresh.</li>
  373. <li>the size of view (and the indexes is displayed)</li>
  374. </ul>
  375. </blockquote>
  376. <div class="figure">
  377. <img alt="https://raw.githubusercontent.com/OCA/reporting-engine/12.0/bi_sql_editor/static/description/04_materialized_view_setting.png" src="https://raw.githubusercontent.com/OCA/reporting-engine/12.0/bi_sql_editor/static/description/04_materialized_view_setting.png" style="width: 800px;" />
  378. </div>
  379. </li>
  380. <li><p class="first">Finally, click on ‘Create UI’, to create new menu, action, graph view and
  381. search view.</p>
  382. </li>
  383. </ul>
  384. </div>
  385. <div class="section" id="usage">
  386. <h2><a class="toc-backref" href="#id3">Usage</a></h2>
  387. <p>To use this module, you need to:</p>
  388. <ol class="arabic simple">
  389. <li>Go to ‘Reporting’ / ‘Custom Reports’</li>
  390. <li>Select the desired report</li>
  391. </ol>
  392. <blockquote>
  393. <div class="figure">
  394. <img alt="https://raw.githubusercontent.com/OCA/reporting-engine/12.0/bi_sql_editor/static/description/05_reporting_pivot.png" src="https://raw.githubusercontent.com/OCA/reporting-engine/12.0/bi_sql_editor/static/description/05_reporting_pivot.png" style="width: 800px;" />
  395. </div>
  396. </blockquote>
  397. <ul>
  398. <li><p class="first">You can switch to ‘Pie’ chart or ‘Line Chart’ as any report,</p>
  399. <div class="figure">
  400. <img alt="https://raw.githubusercontent.com/OCA/reporting-engine/12.0/bi_sql_editor/static/description/05_reporting_pie.png" src="https://raw.githubusercontent.com/OCA/reporting-engine/12.0/bi_sql_editor/static/description/05_reporting_pie.png" style="width: 800px;" />
  401. </div>
  402. </li>
  403. </ul>
  404. </div>
  405. <div class="section" id="bug-tracker">
  406. <h2><a class="toc-backref" href="#id4">Bug Tracker</a></h2>
  407. <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/reporting-engine/issues">GitHub Issues</a>.
  408. In case of trouble, please check there if your issue has already been reported.
  409. If you spotted it first, help us smashing it by providing a detailed and welcomed
  410. <a class="reference external" href="https://github.com/OCA/reporting-engine/issues/new?body=module:%20bi_sql_editor%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
  411. <p>Do not contact contributors directly about support or help with technical issues.</p>
  412. </div>
  413. <div class="section" id="credits">
  414. <h2><a class="toc-backref" href="#id5">Credits</a></h2>
  415. <div class="section" id="authors">
  416. <h3><a class="toc-backref" href="#id6">Authors</a></h3>
  417. <ul class="simple">
  418. <li>GRAP</li>
  419. </ul>
  420. </div>
  421. <div class="section" id="contributors">
  422. <h3><a class="toc-backref" href="#id7">Contributors</a></h3>
  423. <ul class="simple">
  424. <li>Sylvain LE GAL (<a class="reference external" href="https://twitter.com/legalsylvain">https://twitter.com/legalsylvain</a>)</li>
  425. <li><dl class="first docutils">
  426. <dt>This module is highly inspired by the work of</dt>
  427. <dd><ul class="first last">
  428. <li>Onestein: (<a class="reference external" href="http://www.onestein.nl/">http://www.onestein.nl/</a>)
  429. Module: OCA/server-tools/bi_view_editor.
  430. Link: <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/9.0/bi_view_editor">https://github.com/OCA/reporting-engine/tree/9.0/bi_view_editor</a></li>
  431. <li>Anybox: (<a class="reference external" href="https://anybox.fr/">https://anybox.fr/</a>)
  432. Module : OCA/server-tools/materialized_sql_view
  433. link: <a class="reference external" href="https://github.com/OCA/server-tools/pull/110">https://github.com/OCA/server-tools/pull/110</a></li>
  434. <li>GRAP, Groupement Régional Alimentaire de Proximité: (<a class="reference external" href="http://www.grap.coop/">http://www.grap.coop/</a>)
  435. Module: grap/odoo-addons-misc/pos_sale_reporting
  436. link: <a class="reference external" href="https://github.com/grap/odoo-addons-misc/tree/7.0/pos_sale_reporting">https://github.com/grap/odoo-addons-misc/tree/7.0/pos_sale_reporting</a></li>
  437. </ul>
  438. </dd>
  439. </dl>
  440. </li>
  441. </ul>
  442. </div>
  443. <div class="section" id="maintainers">
  444. <h3><a class="toc-backref" href="#id8">Maintainers</a></h3>
  445. <p>This module is maintained by the OCA.</p>
  446. <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
  447. <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
  448. mission is to support the collaborative development of Odoo features and
  449. promote its widespread use.</p>
  450. <p>This module is part of the <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/12.0/bi_sql_editor">OCA/reporting-engine</a> project on GitHub.</p>
  451. <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
  452. </div>
  453. </div>
  454. </div>
  455. </div>
  456. </body>
  457. </html>