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.

412 lines
11 KiB

  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.12: http://docutils.sourceforge.net/" />
  7. <title>Add new options for many2one field</title>
  8. <style type="text/css">
  9. /*
  10. :Author: David Goodger (goodger@python.org)
  11. :Id: $Id: html4css1.css 7614 2013-02-21 15:55:51Z 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. a.toc-backref {
  32. text-decoration: none ;
  33. color: black }
  34. blockquote.epigraph {
  35. margin: 2em 5em ; }
  36. dl.docutils dd {
  37. margin-bottom: 0.5em }
  38. object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
  39. overflow: hidden;
  40. }
  41. /* Uncomment (and remove this text!) to get bold-faced definition list terms
  42. dl.docutils dt {
  43. font-weight: bold }
  44. */
  45. div.abstract {
  46. margin: 2em 5em }
  47. div.abstract p.topic-title {
  48. font-weight: bold ;
  49. text-align: center }
  50. div.admonition, div.attention, div.caution, div.danger, div.error,
  51. div.hint, div.important, div.note, div.tip, div.warning {
  52. margin: 2em ;
  53. border: medium outset ;
  54. padding: 1em }
  55. div.admonition p.admonition-title, div.hint p.admonition-title,
  56. div.important p.admonition-title, div.note p.admonition-title,
  57. div.tip p.admonition-title {
  58. font-weight: bold ;
  59. font-family: sans-serif }
  60. div.attention p.admonition-title, div.caution p.admonition-title,
  61. div.danger p.admonition-title, div.error p.admonition-title,
  62. div.warning p.admonition-title, .code .error {
  63. color: red ;
  64. font-weight: bold ;
  65. font-family: sans-serif }
  66. /* Uncomment (and remove this text!) to get reduced vertical space in
  67. compound paragraphs.
  68. div.compound .compound-first, div.compound .compound-middle {
  69. margin-bottom: 0.5em }
  70. div.compound .compound-last, div.compound .compound-middle {
  71. margin-top: 0.5em }
  72. */
  73. div.dedication {
  74. margin: 2em 5em ;
  75. text-align: center ;
  76. font-style: italic }
  77. div.dedication p.topic-title {
  78. font-weight: bold ;
  79. font-style: normal }
  80. div.figure {
  81. margin-left: 2em ;
  82. margin-right: 2em }
  83. div.footer, div.header {
  84. clear: both;
  85. font-size: smaller }
  86. div.line-block {
  87. display: block ;
  88. margin-top: 1em ;
  89. margin-bottom: 1em }
  90. div.line-block div.line-block {
  91. margin-top: 0 ;
  92. margin-bottom: 0 ;
  93. margin-left: 1.5em }
  94. div.sidebar {
  95. margin: 0 0 0.5em 1em ;
  96. border: medium outset ;
  97. padding: 1em ;
  98. background-color: #ffffee ;
  99. width: 40% ;
  100. float: right ;
  101. clear: right }
  102. div.sidebar p.rubric {
  103. font-family: sans-serif ;
  104. font-size: medium }
  105. div.system-messages {
  106. margin: 5em }
  107. div.system-messages h1 {
  108. color: red }
  109. div.system-message {
  110. border: medium outset ;
  111. padding: 1em }
  112. div.system-message p.system-message-title {
  113. color: red ;
  114. font-weight: bold }
  115. div.topic {
  116. margin: 2em }
  117. h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
  118. h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
  119. margin-top: 0.4em }
  120. h1.title {
  121. text-align: center }
  122. h2.subtitle {
  123. text-align: center }
  124. hr.docutils {
  125. width: 75% }
  126. img.align-left, .figure.align-left, object.align-left {
  127. clear: left ;
  128. float: left ;
  129. margin-right: 1em }
  130. img.align-right, .figure.align-right, object.align-right {
  131. clear: right ;
  132. float: right ;
  133. margin-left: 1em }
  134. img.align-center, .figure.align-center, object.align-center {
  135. display: block;
  136. margin-left: auto;
  137. margin-right: auto;
  138. }
  139. .align-left {
  140. text-align: left }
  141. .align-center {
  142. clear: both ;
  143. text-align: center }
  144. .align-right {
  145. text-align: right }
  146. /* reset inner alignment in figures */
  147. div.align-right {
  148. text-align: inherit }
  149. /* div.align-center * { */
  150. /* text-align: left } */
  151. ol.simple, ul.simple {
  152. margin-bottom: 1em }
  153. ol.arabic {
  154. list-style: decimal }
  155. ol.loweralpha {
  156. list-style: lower-alpha }
  157. ol.upperalpha {
  158. list-style: upper-alpha }
  159. ol.lowerroman {
  160. list-style: lower-roman }
  161. ol.upperroman {
  162. list-style: upper-roman }
  163. p.attribution {
  164. text-align: right ;
  165. margin-left: 50% }
  166. p.caption {
  167. font-style: italic }
  168. p.credits {
  169. font-style: italic ;
  170. font-size: smaller }
  171. p.label {
  172. white-space: nowrap }
  173. p.rubric {
  174. font-weight: bold ;
  175. font-size: larger ;
  176. color: maroon ;
  177. text-align: center }
  178. p.sidebar-title {
  179. font-family: sans-serif ;
  180. font-weight: bold ;
  181. font-size: larger }
  182. p.sidebar-subtitle {
  183. font-family: sans-serif ;
  184. font-weight: bold }
  185. p.topic-title {
  186. font-weight: bold }
  187. pre.address {
  188. margin-bottom: 0 ;
  189. margin-top: 0 ;
  190. font: inherit }
  191. pre.literal-block, pre.doctest-block, pre.math, pre.code {
  192. margin-left: 2em ;
  193. margin-right: 2em }
  194. pre.code .ln { color: grey; } /* line numbers */
  195. pre.code, code { background-color: #eeeeee }
  196. pre.code .comment, code .comment { color: #5C6576 }
  197. pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
  198. pre.code .literal.string, code .literal.string { color: #0C5404 }
  199. pre.code .name.builtin, code .name.builtin { color: #352B84 }
  200. pre.code .deleted, code .deleted { background-color: #DEB0A1}
  201. pre.code .inserted, code .inserted { background-color: #A3D289}
  202. span.classifier {
  203. font-family: sans-serif ;
  204. font-style: oblique }
  205. span.classifier-delimiter {
  206. font-family: sans-serif ;
  207. font-weight: bold }
  208. span.interpreted {
  209. font-family: sans-serif }
  210. span.option {
  211. white-space: nowrap }
  212. span.pre {
  213. white-space: pre }
  214. span.problematic {
  215. color: red }
  216. span.section-subtitle {
  217. /* font-size relative to parent (h1..h6 element) */
  218. font-size: 80% }
  219. table.citation {
  220. border-left: solid 1px gray;
  221. margin-left: 1px }
  222. table.docinfo {
  223. margin: 2em 4em }
  224. table.docutils {
  225. margin-top: 0.5em ;
  226. margin-bottom: 0.5em }
  227. table.footnote {
  228. border-left: solid 1px black;
  229. margin-left: 1px }
  230. table.docutils td, table.docutils th,
  231. table.docinfo td, table.docinfo th {
  232. padding-left: 0.5em ;
  233. padding-right: 0.5em ;
  234. vertical-align: top }
  235. table.docutils th.field-name, table.docinfo th.docinfo-name {
  236. font-weight: bold ;
  237. text-align: left ;
  238. white-space: nowrap ;
  239. padding-left: 0 }
  240. /* "booktabs" style (no vertical lines) */
  241. table.docutils.booktabs {
  242. border: 0px;
  243. border-top: 2px solid;
  244. border-bottom: 2px solid;
  245. border-collapse: collapse;
  246. }
  247. table.docutils.booktabs * {
  248. border: 0px;
  249. }
  250. table.docutils.booktabs th {
  251. border-bottom: thin solid;
  252. text-align: left;
  253. }
  254. h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
  255. h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
  256. font-size: 100% }
  257. ul.auto-toc {
  258. list-style-type: none }
  259. </style>
  260. </head>
  261. <body>
  262. <div class="document" id="add-new-options-for-many2one-field">
  263. <h1 class="title">Add new options for many2one field</h1>
  264. <div class="section" id="description">
  265. <h1>Description</h1>
  266. <p>This modules modifies &quot;many2one&quot; and &quot;many2manytags&quot; form widgets so as to add some new display
  267. control options.</p>
  268. <p><strong>New: support many2manytags widget !</strong></p>
  269. <p><strong>New: support global option management with ir.config_parameter !</strong></p>
  270. <p>Options provided includes possibility to remove &quot;Create...&quot; and/or &quot;Create and
  271. Edit...&quot; entries from many2one drop down. You can also change default number of
  272. proposition appearing in the drop-down. Or prevent the dialog box poping in
  273. case of validation error.</p>
  274. <p>If not specified, the module will avoid proposing any of the create options
  275. if the current user have no permission rights to create the related object.</p>
  276. </div>
  277. <div class="section" id="requirements">
  278. <h1>Requirements</h1>
  279. <p>Was tested on openerp 8.0, trunk, saas-5 branch. New way to import js file. (thanks to tfossoul)</p>
  280. </div>
  281. <div class="section" id="new-options">
  282. <h1>New options</h1>
  283. <p><tt class="docutils literal">create</tt> <em>boolean</em> (Default: depends if user have create rights)</p>
  284. <blockquote>
  285. Whether to display the &quot;Create...&quot; entry in dropdown panel.</blockquote>
  286. <p><tt class="docutils literal">create_edit</tt> <em>boolean</em> (Default: depends if user have create rights)</p>
  287. <blockquote>
  288. Whether to display &quot;Create and Edit...&quot; entry in dropdown panel</blockquote>
  289. <p><tt class="docutils literal">m2o_dialog</tt> <em>boolean</em> (Default: depends if user have create rights)</p>
  290. <blockquote>
  291. Whether to display the many2one dialog in case of validation error.</blockquote>
  292. <p><tt class="docutils literal">limit</tt> <em>int</em> (Default: openerp default value is <tt class="docutils literal">7</tt>)</p>
  293. <blockquote>
  294. Number of displayed record in drop-down panel</blockquote>
  295. </div>
  296. <div class="section" id="ir-config-parameter-options">
  297. <h1>ir.config_parameter options</h1>
  298. <p>Now you can disable &quot;Create...&quot; and &quot;Create and Edit...&quot; entry for all widgets in the odoo instance.
  299. If you disable one option, you can enable it for particular field by setting &quot;create: True&quot; option directly on the field definition.</p>
  300. <p><tt class="docutils literal">web_m2x_options.create</tt> <em>boolean</em> (Default: depends if user have create rights)</p>
  301. <blockquote>
  302. Whether to display the &quot;Create...&quot; entry in dropdown panel for all fields in the odoo instance.</blockquote>
  303. <p><tt class="docutils literal">web_m2x_options.create_edit</tt> <em>boolean</em> (Default: depends if user have create rights)</p>
  304. <blockquote>
  305. Whether to display &quot;Create and Edit...&quot; entry in dropdown panel for all fields in the odoo instance.</blockquote>
  306. <p><tt class="docutils literal">web_m2x_options.limit</tt> <em>int</em> (Default: openerp default value is <tt class="docutils literal">7</tt>)</p>
  307. <blockquote>
  308. Number of displayed record in drop-down panel for all fields in the odoo instance</blockquote>
  309. <p>To add these parameters go to Configuration -&gt; Technical -&gt; Parameters -&gt; System Parameters and add new parameters like:</p>
  310. <ul class="simple">
  311. <li>web_m2x_options.create: False</li>
  312. <li>web_m2x_options.create_edit: False</li>
  313. <li>web_m2x_options.limit: 10</li>
  314. </ul>
  315. </div>
  316. <div class="section" id="example">
  317. <h1>Example</h1>
  318. <p>Your XML form view definition could contain:</p>
  319. <pre class="literal-block">
  320. ...
  321. &lt;field name=&quot;partner_id&quot; options=&quot;{'limit': 10, 'create': false, 'create_edit': false}&quot;/&gt;
  322. ...
  323. </pre>
  324. </div>
  325. <div class="section" id="note">
  326. <h1>Note</h1>
  327. <p>Double check that you have no inherited view that remote <tt class="docutils literal">options</tt> you set on a field !
  328. If nothing work, add a debugger in the first ligne of <tt class="docutils literal">get_search_result method</tt> and enable debug mode in OpenERP. When you write something in a many2one field, javascript debugger should pause. If not verify your installation.</p>
  329. </div>
  330. </div>
  331. </body>
  332. </html>