Initial commit: Odoo 18.0-20251222 extra-addons
This commit is contained in:
BIN
web_m2x_options/static/description/icon.png
Executable file
BIN
web_m2x_options/static/description/icon.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
559
web_m2x_options/static/description/index.html
Executable file
559
web_m2x_options/static/description/index.html
Executable file
@@ -0,0 +1,559 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
|
||||
<title>README.rst</title>
|
||||
<style type="text/css">
|
||||
|
||||
/*
|
||||
:Author: David Goodger (goodger@python.org)
|
||||
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
|
||||
:Copyright: This stylesheet has been placed in the public domain.
|
||||
|
||||
Default cascading style sheet for the HTML output of Docutils.
|
||||
Despite the name, some widely supported CSS2 features are used.
|
||||
|
||||
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
|
||||
customize this style sheet.
|
||||
*/
|
||||
|
||||
/* used to remove borders from tables and images */
|
||||
.borderless, table.borderless td, table.borderless th {
|
||||
border: 0 }
|
||||
|
||||
table.borderless td, table.borderless th {
|
||||
/* Override padding for "table.docutils td" with "! important".
|
||||
The right padding separates the table cells. */
|
||||
padding: 0 0.5em 0 0 ! important }
|
||||
|
||||
.first {
|
||||
/* Override more specific margin styles with "! important". */
|
||||
margin-top: 0 ! important }
|
||||
|
||||
.last, .with-subtitle {
|
||||
margin-bottom: 0 ! important }
|
||||
|
||||
.hidden {
|
||||
display: none }
|
||||
|
||||
.subscript {
|
||||
vertical-align: sub;
|
||||
font-size: smaller }
|
||||
|
||||
.superscript {
|
||||
vertical-align: super;
|
||||
font-size: smaller }
|
||||
|
||||
a.toc-backref {
|
||||
text-decoration: none ;
|
||||
color: black }
|
||||
|
||||
blockquote.epigraph {
|
||||
margin: 2em 5em ; }
|
||||
|
||||
dl.docutils dd {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Uncomment (and remove this text!) to get bold-faced definition list terms
|
||||
dl.docutils dt {
|
||||
font-weight: bold }
|
||||
*/
|
||||
|
||||
div.abstract {
|
||||
margin: 2em 5em }
|
||||
|
||||
div.abstract p.topic-title {
|
||||
font-weight: bold ;
|
||||
text-align: center }
|
||||
|
||||
div.admonition, div.attention, div.caution, div.danger, div.error,
|
||||
div.hint, div.important, div.note, div.tip, div.warning {
|
||||
margin: 2em ;
|
||||
border: medium outset ;
|
||||
padding: 1em }
|
||||
|
||||
div.admonition p.admonition-title, div.hint p.admonition-title,
|
||||
div.important p.admonition-title, div.note p.admonition-title,
|
||||
div.tip p.admonition-title {
|
||||
font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
div.attention p.admonition-title, div.caution p.admonition-title,
|
||||
div.danger p.admonition-title, div.error p.admonition-title,
|
||||
div.warning p.admonition-title, .code .error {
|
||||
color: red ;
|
||||
font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
/* Uncomment (and remove this text!) to get reduced vertical space in
|
||||
compound paragraphs.
|
||||
div.compound .compound-first, div.compound .compound-middle {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
div.compound .compound-last, div.compound .compound-middle {
|
||||
margin-top: 0.5em }
|
||||
*/
|
||||
|
||||
div.dedication {
|
||||
margin: 2em 5em ;
|
||||
text-align: center ;
|
||||
font-style: italic }
|
||||
|
||||
div.dedication p.topic-title {
|
||||
font-weight: bold ;
|
||||
font-style: normal }
|
||||
|
||||
div.figure {
|
||||
margin-left: 2em ;
|
||||
margin-right: 2em }
|
||||
|
||||
div.footer, div.header {
|
||||
clear: both;
|
||||
font-size: smaller }
|
||||
|
||||
div.line-block {
|
||||
display: block ;
|
||||
margin-top: 1em ;
|
||||
margin-bottom: 1em }
|
||||
|
||||
div.line-block div.line-block {
|
||||
margin-top: 0 ;
|
||||
margin-bottom: 0 ;
|
||||
margin-left: 1.5em }
|
||||
|
||||
div.sidebar {
|
||||
margin: 0 0 0.5em 1em ;
|
||||
border: medium outset ;
|
||||
padding: 1em ;
|
||||
background-color: #ffffee ;
|
||||
width: 40% ;
|
||||
float: right ;
|
||||
clear: right }
|
||||
|
||||
div.sidebar p.rubric {
|
||||
font-family: sans-serif ;
|
||||
font-size: medium }
|
||||
|
||||
div.system-messages {
|
||||
margin: 5em }
|
||||
|
||||
div.system-messages h1 {
|
||||
color: red }
|
||||
|
||||
div.system-message {
|
||||
border: medium outset ;
|
||||
padding: 1em }
|
||||
|
||||
div.system-message p.system-message-title {
|
||||
color: red ;
|
||||
font-weight: bold }
|
||||
|
||||
div.topic {
|
||||
margin: 2em }
|
||||
|
||||
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
|
||||
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
|
||||
margin-top: 0.4em }
|
||||
|
||||
h1.title {
|
||||
text-align: center }
|
||||
|
||||
h2.subtitle {
|
||||
text-align: center }
|
||||
|
||||
hr.docutils {
|
||||
width: 75% }
|
||||
|
||||
img.align-left, .figure.align-left, object.align-left, table.align-left {
|
||||
clear: left ;
|
||||
float: left ;
|
||||
margin-right: 1em }
|
||||
|
||||
img.align-right, .figure.align-right, object.align-right, table.align-right {
|
||||
clear: right ;
|
||||
float: right ;
|
||||
margin-left: 1em }
|
||||
|
||||
img.align-center, .figure.align-center, object.align-center {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
table.align-center {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.align-left {
|
||||
text-align: left }
|
||||
|
||||
.align-center {
|
||||
clear: both ;
|
||||
text-align: center }
|
||||
|
||||
.align-right {
|
||||
text-align: right }
|
||||
|
||||
/* reset inner alignment in figures */
|
||||
div.align-right {
|
||||
text-align: inherit }
|
||||
|
||||
/* div.align-center * { */
|
||||
/* text-align: left } */
|
||||
|
||||
.align-top {
|
||||
vertical-align: top }
|
||||
|
||||
.align-middle {
|
||||
vertical-align: middle }
|
||||
|
||||
.align-bottom {
|
||||
vertical-align: bottom }
|
||||
|
||||
ol.simple, ul.simple {
|
||||
margin-bottom: 1em }
|
||||
|
||||
ol.arabic {
|
||||
list-style: decimal }
|
||||
|
||||
ol.loweralpha {
|
||||
list-style: lower-alpha }
|
||||
|
||||
ol.upperalpha {
|
||||
list-style: upper-alpha }
|
||||
|
||||
ol.lowerroman {
|
||||
list-style: lower-roman }
|
||||
|
||||
ol.upperroman {
|
||||
list-style: upper-roman }
|
||||
|
||||
p.attribution {
|
||||
text-align: right ;
|
||||
margin-left: 50% }
|
||||
|
||||
p.caption {
|
||||
font-style: italic }
|
||||
|
||||
p.credits {
|
||||
font-style: italic ;
|
||||
font-size: smaller }
|
||||
|
||||
p.label {
|
||||
white-space: nowrap }
|
||||
|
||||
p.rubric {
|
||||
font-weight: bold ;
|
||||
font-size: larger ;
|
||||
color: maroon ;
|
||||
text-align: center }
|
||||
|
||||
p.sidebar-title {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold ;
|
||||
font-size: larger }
|
||||
|
||||
p.sidebar-subtitle {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold }
|
||||
|
||||
p.topic-title {
|
||||
font-weight: bold }
|
||||
|
||||
pre.address {
|
||||
margin-bottom: 0 ;
|
||||
margin-top: 0 ;
|
||||
font: inherit }
|
||||
|
||||
pre.literal-block, pre.doctest-block, pre.math, pre.code {
|
||||
margin-left: 2em ;
|
||||
margin-right: 2em }
|
||||
|
||||
pre.code .ln { color: gray; } /* line numbers */
|
||||
pre.code, code { background-color: #eeeeee }
|
||||
pre.code .comment, code .comment { color: #5C6576 }
|
||||
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
|
||||
pre.code .literal.string, code .literal.string { color: #0C5404 }
|
||||
pre.code .name.builtin, code .name.builtin { color: #352B84 }
|
||||
pre.code .deleted, code .deleted { background-color: #DEB0A1}
|
||||
pre.code .inserted, code .inserted { background-color: #A3D289}
|
||||
|
||||
span.classifier {
|
||||
font-family: sans-serif ;
|
||||
font-style: oblique }
|
||||
|
||||
span.classifier-delimiter {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold }
|
||||
|
||||
span.interpreted {
|
||||
font-family: sans-serif }
|
||||
|
||||
span.option {
|
||||
white-space: nowrap }
|
||||
|
||||
span.pre {
|
||||
white-space: pre }
|
||||
|
||||
span.problematic, pre.problematic {
|
||||
color: red }
|
||||
|
||||
span.section-subtitle {
|
||||
/* font-size relative to parent (h1..h6 element) */
|
||||
font-size: 80% }
|
||||
|
||||
table.citation {
|
||||
border-left: solid 1px gray;
|
||||
margin-left: 1px }
|
||||
|
||||
table.docinfo {
|
||||
margin: 2em 4em }
|
||||
|
||||
table.docutils {
|
||||
margin-top: 0.5em ;
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
table.footnote {
|
||||
border-left: solid 1px black;
|
||||
margin-left: 1px }
|
||||
|
||||
table.docutils td, table.docutils th,
|
||||
table.docinfo td, table.docinfo th {
|
||||
padding-left: 0.5em ;
|
||||
padding-right: 0.5em ;
|
||||
vertical-align: top }
|
||||
|
||||
table.docutils th.field-name, table.docinfo th.docinfo-name {
|
||||
font-weight: bold ;
|
||||
text-align: left ;
|
||||
white-space: nowrap ;
|
||||
padding-left: 0 }
|
||||
|
||||
/* "booktabs" style (no vertical lines) */
|
||||
table.docutils.booktabs {
|
||||
border: 0px;
|
||||
border-top: 2px solid;
|
||||
border-bottom: 2px solid;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table.docutils.booktabs * {
|
||||
border: 0px;
|
||||
}
|
||||
table.docutils.booktabs th {
|
||||
border-bottom: thin solid;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
|
||||
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
|
||||
font-size: 100% }
|
||||
|
||||
ul.auto-toc {
|
||||
list-style-type: none }
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="document">
|
||||
|
||||
|
||||
<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
|
||||
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
|
||||
</a>
|
||||
<div class="section" id="web-m2x-options">
|
||||
<h1>web_m2x_options</h1>
|
||||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:881a75e6602b8037ae91fff6ff77e99caff9cba4b1ccda3dff174f64f4e42824
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external image-reference" 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 image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/web/tree/18.0/web_m2x_options"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/web-18-0/web-18-0-web_m2x_options"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This modules modifies “many2one” and “many2manytags” form widgets so as
|
||||
to add some new display control options.</p>
|
||||
<p>Options provided includes possibility to remove “Create…” and/or
|
||||
“Create and Edit…” entries drop down. You can also change default
|
||||
number of proposition appearing in the drop-down.</p>
|
||||
<p>If not specified, the module will avoid proposing any of the create
|
||||
options if the current user has no permission rights to create the
|
||||
related object.</p>
|
||||
<p><strong>Table of contents</strong></p>
|
||||
<div class="contents local topic" id="contents">
|
||||
<ul class="simple">
|
||||
<li><a class="reference internal" href="#usage" id="toc-entry-1">Usage</a><ul>
|
||||
<li><a class="reference internal" href="#in-the-field-s-options-dict" id="toc-entry-2">in the field’s options dict</a></li>
|
||||
<li><a class="reference internal" href="#ir-config-parameter-options" id="toc-entry-3">ir.config_parameter options</a></li>
|
||||
<li><a class="reference internal" href="#example" id="toc-entry-4">Example</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#known-issues-roadmap" id="toc-entry-5">Known issues / Roadmap</a></li>
|
||||
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-6">Bug Tracker</a></li>
|
||||
<li><a class="reference internal" href="#credits" id="toc-entry-7">Credits</a><ul>
|
||||
<li><a class="reference internal" href="#authors" id="toc-entry-8">Authors</a></li>
|
||||
<li><a class="reference internal" href="#contributors" id="toc-entry-9">Contributors</a></li>
|
||||
<li><a class="reference internal" href="#other-credits" id="toc-entry-10">Other credits</a></li>
|
||||
<li><a class="reference internal" href="#maintainers" id="toc-entry-11">Maintainers</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="usage">
|
||||
<h2><a class="toc-backref" href="#toc-entry-1">Usage</a></h2>
|
||||
<div class="section" id="in-the-field-s-options-dict">
|
||||
<h3><a class="toc-backref" href="#toc-entry-2">in the field’s options dict</a></h3>
|
||||
<p><tt class="docutils literal">limit</tt> <em>int</em> (Default: odoo default value is <tt class="docutils literal">8</tt>)</p>
|
||||
<blockquote>
|
||||
Number of displayed record in drop-down panel</blockquote>
|
||||
<p><tt class="docutils literal">search_more</tt> <em>boolean</em></p>
|
||||
<blockquote>
|
||||
Used to force disable/enable search more button.</blockquote>
|
||||
<p><tt class="docutils literal">field_color</tt> <em>string</em></p>
|
||||
<blockquote>
|
||||
A string to define the field used to define color. This option has to
|
||||
be used with colors.</blockquote>
|
||||
<p><tt class="docutils literal">colors</tt> <em>dictionary</em></p>
|
||||
<blockquote>
|
||||
A dictionary to link field value with a HTML color. This option has
|
||||
to be used with field_color.</blockquote>
|
||||
</div>
|
||||
<div class="section" id="ir-config-parameter-options">
|
||||
<h3><a class="toc-backref" href="#toc-entry-3">ir.config_parameter options</a></h3>
|
||||
<p>Now you can disable “Create…” and “Create and Edit…” entry for all
|
||||
widgets in the odoo instance. If you disable one option, you can enable
|
||||
it for particular field by setting “create: True” option directly on the
|
||||
field definition.</p>
|
||||
<p><tt class="docutils literal">web_m2x_options.create</tt> <em>boolean</em> (Default: depends if user have
|
||||
create rights)</p>
|
||||
<blockquote>
|
||||
Whether to display the “Create…” entry in dropdown panel for all
|
||||
fields in the odoo instance.</blockquote>
|
||||
<p><tt class="docutils literal">web_m2x_options.create_edit</tt> <em>boolean</em> (Default: depends if user have
|
||||
create rights)</p>
|
||||
<blockquote>
|
||||
Whether to display “Create and Edit…” entry in dropdown panel for
|
||||
all fields in the odoo instance.</blockquote>
|
||||
<p><tt class="docutils literal">web_m2x_options.limit</tt> <em>int</em> (Default: odoo default value is <tt class="docutils literal">8</tt>)</p>
|
||||
<blockquote>
|
||||
Number of displayed record in drop-down panel for all fields in the
|
||||
odoo instance</blockquote>
|
||||
<p><tt class="docutils literal">web_m2x_options.search_more</tt> <em>boolean</em> (Default: default value is
|
||||
<tt class="docutils literal">False</tt>)</p>
|
||||
<blockquote>
|
||||
Whether the field should always show “Search more…” entry or not.</blockquote>
|
||||
<p><tt class="docutils literal">web_m2x_options.field_limit_entries</tt> <em>int</em></p>
|
||||
<blockquote>
|
||||
Number of displayed lines on all One2many fields</blockquote>
|
||||
<p>To add these parameters go to Configuration -> Technical -> Parameters
|
||||
-> System Parameters and add new parameters like:</p>
|
||||
<ul class="simple">
|
||||
<li>web_m2x_options.create: False</li>
|
||||
<li>web_m2x_options.create_edit: False</li>
|
||||
<li>web_m2x_options.limit: 10</li>
|
||||
<li>web_m2x_options.search_more: True</li>
|
||||
<li>web_m2x_options.field_limit_entries: 5</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="example">
|
||||
<h3><a class="toc-backref" href="#toc-entry-4">Example</a></h3>
|
||||
<p>Your XML form view definition could contain:</p>
|
||||
<pre class="code xml literal-block">
|
||||
...<span class="w">
|
||||
</span><span class="nt"><field</span><span class="w"> </span><span class="na">name=</span><span class="s">"partner_id"</span><span class="w"> </span><span class="na">options=</span><span class="s">"{'limit': 10, 'search_more': true, 'field_color':'type', 'colors':{'contact':'green', 'invoice': 'red', 'delivery': 'blue'}}"</span><span class="nt">/></span><span class="w">
|
||||
</span>...
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="known-issues-roadmap">
|
||||
<h2><a class="toc-backref" href="#toc-entry-5">Known issues / Roadmap</a></h2>
|
||||
<p>Double check that you have no inherited view that remove <tt class="docutils literal">options</tt> you
|
||||
set on a field ! If nothing works, add a debugger in the first line of
|
||||
<tt class="docutils literal">_search method</tt> and enable debug mode in Odoo. When you write
|
||||
something in a many2one field, javascript debugger should pause. If not
|
||||
verify your installation.</p>
|
||||
<ul class="simple">
|
||||
<li>Instead of making the tags rectangle clickable, I think it’s better to
|
||||
put the text as a clickable link, so we will get a consistent
|
||||
behaviour/aspect with other clickable elements (many2one…).</li>
|
||||
<li>Properly support web_m2x_options on Many2OneReferenceField.</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="bug-tracker">
|
||||
<h2><a class="toc-backref" href="#toc-entry-6">Bug Tracker</a></h2>
|
||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web/issues">GitHub Issues</a>.
|
||||
In case of trouble, please check there if your issue has already been reported.
|
||||
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
||||
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_m2x_options%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||
</div>
|
||||
<div class="section" id="credits">
|
||||
<h2><a class="toc-backref" href="#toc-entry-7">Credits</a></h2>
|
||||
<div class="section" id="authors">
|
||||
<h3><a class="toc-backref" href="#toc-entry-8">Authors</a></h3>
|
||||
<ul class="simple">
|
||||
<li>initOS GmbH</li>
|
||||
<li>ACSONE SA/NV</li>
|
||||
<li>0k.io</li>
|
||||
<li>Tecnativa</li>
|
||||
<li>Sygel</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="contributors">
|
||||
<h3><a class="toc-backref" href="#toc-entry-9">Contributors</a></h3>
|
||||
<ul class="simple">
|
||||
<li>David Coninckx <<a class="reference external" href="mailto:davconinckx@gmail.com">davconinckx@gmail.com</a>></li>
|
||||
<li>Emanuel Cino <<a class="reference external" href="mailto:ecino@compassion.ch">ecino@compassion.ch</a>></li>
|
||||
<li>Holger Brunn <<a class="reference external" href="mailto:hbrunn@therp.nl">hbrunn@therp.nl</a>></li>
|
||||
<li>Nicolas JEUDY <<a class="reference external" href="mailto:nicolas@sudokeys.com">nicolas@sudokeys.com</a>></li>
|
||||
<li>Yannick Vaucher <<a class="reference external" href="mailto:yannick.vaucher@camptocamp.com">yannick.vaucher@camptocamp.com</a>></li>
|
||||
<li>Zakaria Makrelouf <<a class="reference external" href="mailto:z.makrelouf@gmail.com">z.makrelouf@gmail.com</a>></li>
|
||||
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
|
||||
<li>Jairo Llopis <<a class="reference external" href="mailto:jairo.llopis@tecnativa.com">jairo.llopis@tecnativa.com</a>></li>
|
||||
<li>David Vidal <<a class="reference external" href="mailto:david.vidal@tecnativa.com">david.vidal@tecnativa.com</a>></li>
|
||||
<li>Ernesto Tejeda <<a class="reference external" href="mailto:ernesto.tejeda87@gmail.com">ernesto.tejeda87@gmail.com</a>></li>
|
||||
<li>Carlos Roca</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Bhavesh Odedra <<a class="reference external" href="mailto:bodedra@opensourceintegrators.com">bodedra@opensourceintegrators.com</a>></li>
|
||||
<li>Dhara Solanki <<a class="reference external" href="mailto:dhara.solanki@initos.com">dhara.solanki@initos.com</a>> (<a class="reference external" href="http://www.initos.com">http://www.initos.com</a>)</li>
|
||||
<li><a class="reference external" href="https://trobz.com">Trobz</a>:<ul>
|
||||
<li>Hoang Diep <<a class="reference external" href="mailto:hoang@trobz.com">hoang@trobz.com</a>></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference external" href="https://sygel.es">Sygel</a>:<ul>
|
||||
<li>Manuel Regidor <<a class="reference external" href="mailto:manuel.regidor@sygel.es">manuel.regidor@sygel.es</a>></li>
|
||||
<li>Valentín Vinagre <<a class="reference external" href="mailto:valentin.vinagre@sygel.es">valentin.vinagre@sygel.es</a>></li>
|
||||
<li>Harald Panten <<a class="reference external" href="mailto:harald.panten@sygel.es">harald.panten@sygel.es</a>></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference external" href="https://acsone.eu">ACSONE SA/NV</a>:<ul>
|
||||
<li>Souheil BEJAOUI <<a class="reference external" href="mailto:souheil.bejaoui@acsone.eu">souheil.bejaoui@acsone.eu</a>></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="other-credits">
|
||||
<h3><a class="toc-backref" href="#toc-entry-10">Other credits</a></h3>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
<h3><a class="toc-backref" href="#toc-entry-11">Maintainers</a></h3>
|
||||
<p>This module is maintained by the OCA.</p>
|
||||
<a class="reference external image-reference" href="https://odoo-community.org">
|
||||
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
|
||||
</a>
|
||||
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||
mission is to support the collaborative development of Odoo features and
|
||||
promote its widespread use.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/18.0/web_m2x_options">OCA/web</a> project on GitHub.</p>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
38
web_m2x_options/static/src/components/base.xml
Executable file
38
web_m2x_options/static/src/components/base.xml
Executable file
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!-- Copyright 2017 Jairo Llopis <jairo.llopis@tecnativa.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t
|
||||
t-name="web_m2x_options.AutoComplete"
|
||||
t-inherit="web.AutoComplete"
|
||||
t-inherit-mode="extension"
|
||||
>
|
||||
<xpath expr="//t[@t-foreach='source.options']/li/a" position="attributes">
|
||||
<attribute name="t-attf-style">{{ option.style }}</attribute>
|
||||
</xpath>
|
||||
</t>
|
||||
|
||||
<t
|
||||
t-name="web_m2x_options.Many2ManyTagsField"
|
||||
t-inherit="web.Many2ManyTagsField"
|
||||
t-inherit-mode="extension"
|
||||
>
|
||||
<xpath expr="//Many2XAutocomplete" position="attributes">
|
||||
<attribute name="searchLimit">props.searchLimit</attribute>
|
||||
<attribute name="fieldColor">props.fieldColor</attribute>
|
||||
<attribute name="fieldColorOptions">props.fieldColorOptions</attribute>
|
||||
</xpath>
|
||||
</t>
|
||||
|
||||
<t
|
||||
t-name="web_m2x_options.Many2ManyTagsAvatarFieldPopover"
|
||||
t-inherit="web.Many2ManyTagsAvatarField"
|
||||
t-inherit-mode="extension"
|
||||
>
|
||||
<Many2XAutocomplete position="attributes">
|
||||
<attribute name="noSearchMore">props.noSearchMore</attribute>
|
||||
</Many2XAutocomplete>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
328
web_m2x_options/static/src/components/form.esm.js
Executable file
328
web_m2x_options/static/src/components/form.esm.js
Executable file
@@ -0,0 +1,328 @@
|
||||
import {
|
||||
AvatarMany2XAutocomplete,
|
||||
Many2XAutocomplete,
|
||||
} from "@web/views/fields/relational_utils";
|
||||
import {Many2OneField, many2OneField} from "@web/views/fields/many2one/many2one_field";
|
||||
import {Many2OneReferenceField} from "@web/views/fields/many2one_reference/many2one_reference_field";
|
||||
import {FormController} from "@web/views/form/form_controller";
|
||||
import {evaluateBooleanExpr} from "@web/core/py_js/py";
|
||||
import {fieldColorProps} from "../views/fields/standard_field_props.esm";
|
||||
import {isX2Many} from "@web/views/utils";
|
||||
import {many2ManyTagsField} from "@web/views/fields/many2many_tags/many2many_tags_field";
|
||||
import {patch} from "@web/core/utils/patch";
|
||||
import {registry} from "@web/core/registry";
|
||||
import {session} from "@web/session";
|
||||
|
||||
AvatarMany2XAutocomplete.props = {
|
||||
...AvatarMany2XAutocomplete.props,
|
||||
...fieldColorProps,
|
||||
};
|
||||
Many2XAutocomplete.props = {
|
||||
...Many2XAutocomplete.props,
|
||||
...fieldColorProps,
|
||||
};
|
||||
|
||||
function evaluateSystemParameterDefaultTrue(option) {
|
||||
const isOptionSet = session.web_m2x_options[`web_m2x_options.${option}`];
|
||||
return isOptionSet ? evaluateBooleanExpr(isOptionSet) : true;
|
||||
}
|
||||
|
||||
patch(many2OneField, {
|
||||
m2o_options_props_create(props, attrs, options) {
|
||||
const canQuickCreate = evaluateSystemParameterDefaultTrue("create");
|
||||
if (options.no_quick_create) {
|
||||
props.canQuickCreate = false;
|
||||
} else if ("no_quick_create" in options) {
|
||||
props.canQuickCreate = attrs.can_create
|
||||
? evaluateBooleanExpr(attrs.can_create)
|
||||
: true;
|
||||
} else if (!canQuickCreate && props.canQuickCreate) {
|
||||
props.canQuickCreate = false;
|
||||
} else if (canQuickCreate && !props.canQuickCreate) {
|
||||
props.canQuickCreate = attrs.can_create
|
||||
? evaluateBooleanExpr(attrs.can_create)
|
||||
: true;
|
||||
}
|
||||
return props;
|
||||
},
|
||||
|
||||
m2o_options_props_create_edit(props, attrs, options) {
|
||||
const canCreateEdit = evaluateSystemParameterDefaultTrue("create_edit");
|
||||
if (options.no_create_edit) {
|
||||
props.canCreateEdit = false;
|
||||
} else if ("no_create_edit" in options) {
|
||||
// Same condition set in web/views/fields/many2one/many2one_field
|
||||
props.canCreateEdit = attrs.can_create
|
||||
? evaluateBooleanExpr(attrs.can_create)
|
||||
: true;
|
||||
} else if (!canCreateEdit && props.canCreateEdit) {
|
||||
props.canCreateEdit = false;
|
||||
} else if (canCreateEdit && !props.canCreateEdit) {
|
||||
// Same condition set in web/views/fields/many2one/many2one_field
|
||||
props.canCreateEdit = attrs.can_create
|
||||
? evaluateBooleanExpr(attrs.can_create)
|
||||
: true;
|
||||
}
|
||||
return props;
|
||||
},
|
||||
|
||||
m2o_options_props_limit(props, attrs, options) {
|
||||
const ir_options = session.web_m2x_options;
|
||||
if (Number(options.limit)) {
|
||||
props.searchLimit = Number(options.limit);
|
||||
} else if (Number(ir_options["web_m2x_options.limit"])) {
|
||||
props.searchLimit = Number(ir_options["web_m2x_options.limit"]);
|
||||
}
|
||||
return props;
|
||||
},
|
||||
|
||||
m2o_options_props_search_more(props, attrs, options) {
|
||||
const noSearchMore = !evaluateSystemParameterDefaultTrue("search_more");
|
||||
if (options.search_more) {
|
||||
props.noSearchMore = false;
|
||||
} else if ("search_more" in options) {
|
||||
props.noSearchMore = true;
|
||||
} else if (!noSearchMore && props.noSearchMore) {
|
||||
props.noSearchMore = false;
|
||||
} else if (noSearchMore) {
|
||||
props.noSearchMore = true;
|
||||
}
|
||||
return props;
|
||||
},
|
||||
|
||||
m2o_options_props_open(props, attrs, options) {
|
||||
if (!("no_open" in options)) {
|
||||
props.canOpen = evaluateSystemParameterDefaultTrue("open");
|
||||
}
|
||||
return props;
|
||||
},
|
||||
|
||||
m2o_options_props(props, attrs, options) {
|
||||
let newProps = props;
|
||||
newProps = this.m2o_options_props_create(newProps, attrs, options);
|
||||
newProps = this.m2o_options_props_create_edit(newProps, attrs, options);
|
||||
newProps = this.m2o_options_props_limit(newProps, attrs, options);
|
||||
newProps = this.m2o_options_props_search_more(newProps, attrs, options);
|
||||
newProps = this.m2o_options_props_open(newProps, attrs, options);
|
||||
newProps.fieldColor = options.field_color;
|
||||
newProps.fieldColorOptions = options.colors;
|
||||
return newProps;
|
||||
},
|
||||
extractProps({attrs, context, decorations, options, string}, dynamicInfo) {
|
||||
const props = super.extractProps(
|
||||
{attrs, context, decorations, options, string},
|
||||
dynamicInfo
|
||||
);
|
||||
return this.m2o_options_props(props, attrs, options);
|
||||
},
|
||||
});
|
||||
|
||||
// FIXME: Many2OneReferenceField does not support m2o_options_props.
|
||||
// This no-op prevents crashes, but proper option support is still missing.
|
||||
// See roadmap note in PR #3191
|
||||
patch(Many2OneReferenceField, {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
m2o_options_props(props, attrs, options) {
|
||||
return props;
|
||||
},
|
||||
});
|
||||
|
||||
patch(Many2OneField.prototype, {
|
||||
get Many2XAutocompleteProps() {
|
||||
const search_limit = this.props.searchLimit;
|
||||
const no_search_more = this.props.noSearchMore;
|
||||
const field_color = this.props.fieldColor;
|
||||
const field_color_options = this.props.fieldColorOptions;
|
||||
const props = super.Many2XAutocompleteProps;
|
||||
const ret_props = {...props};
|
||||
if (Number(search_limit) && Number(search_limit) > 1) {
|
||||
ret_props.searchLimit = search_limit - 1;
|
||||
}
|
||||
if (no_search_more) {
|
||||
ret_props.noSearchMore = no_search_more;
|
||||
}
|
||||
if (field_color && field_color_options) {
|
||||
ret_props.fieldColor = field_color;
|
||||
ret_props.fieldColorOptions = field_color_options;
|
||||
}
|
||||
return ret_props;
|
||||
},
|
||||
});
|
||||
|
||||
patch(many2ManyTagsField, {
|
||||
m2m_options_props_create(props, attrs, options) {
|
||||
const canQuickCreate = evaluateSystemParameterDefaultTrue("create");
|
||||
// Create option already available for m2m fields
|
||||
if (!options.no_quick_create) {
|
||||
if (!canQuickCreate && props.canQuickCreate) {
|
||||
props.canQuickCreate = false;
|
||||
} else if (canQuickCreate && !props.canQuickCreate) {
|
||||
props.canQuickCreate = attrs.can_create
|
||||
? evaluateBooleanExpr(attrs.can_create)
|
||||
: true;
|
||||
}
|
||||
}
|
||||
return props;
|
||||
},
|
||||
|
||||
m2m_options_props_create_edit(props, attrs, options) {
|
||||
const canCreateEdit = evaluateSystemParameterDefaultTrue("create_edit");
|
||||
if (options.no_create_edit) {
|
||||
props.canCreateEdit = false;
|
||||
} else if ("no_create_edit" in options) {
|
||||
// Same condition set in web/views/fields/many2one/many2one_field
|
||||
props.canCreateEdit = attrs.can_create
|
||||
? evaluateBooleanExpr(attrs.can_create)
|
||||
: true;
|
||||
} else if (!canCreateEdit && props.canCreateEdit) {
|
||||
props.canCreateEdit = false;
|
||||
} else if (canCreateEdit && !props.canCreateEdit) {
|
||||
// Same condition set in web/views/fields/many2one/many2one_field
|
||||
props.canCreateEdit = attrs.can_create
|
||||
? evaluateBooleanExpr(attrs.can_create)
|
||||
: true;
|
||||
}
|
||||
return props;
|
||||
},
|
||||
|
||||
m2m_options_props_limit(props, attrs, options) {
|
||||
const ir_options = session.web_m2x_options;
|
||||
if (Number(options.limit) && options.limit > 1) {
|
||||
props.searchLimit = Number(options.limit) - 1;
|
||||
} else if (
|
||||
Number(ir_options["web_m2x_options.limit"]) &&
|
||||
ir_options["web_m2x_options.limit"] > 1
|
||||
) {
|
||||
props.searchLimit = Number(ir_options["web_m2x_options.limit"]) - 1;
|
||||
}
|
||||
return props;
|
||||
},
|
||||
|
||||
m2m_options_props_search_more(props, attrs, options) {
|
||||
const noSearchMore = !evaluateSystemParameterDefaultTrue("search_more");
|
||||
if (options.search_more) {
|
||||
props.noSearchMore = false;
|
||||
} else if ("search_more" in options) {
|
||||
props.noSearchMore = true;
|
||||
} else if (!noSearchMore && props.noSearchMore) {
|
||||
props.noSearchMore = false;
|
||||
} else if (noSearchMore) {
|
||||
props.noSearchMore = true;
|
||||
}
|
||||
return props;
|
||||
},
|
||||
|
||||
m2m_options_props(props, attrs, options) {
|
||||
let newProps = props;
|
||||
newProps = this.m2m_options_props_create(newProps, attrs, options);
|
||||
newProps = this.m2m_options_props_create_edit(newProps, attrs, options);
|
||||
newProps = this.m2m_options_props_limit(newProps, attrs, options);
|
||||
newProps = this.m2m_options_props_search_more(newProps, attrs, options);
|
||||
newProps.fieldColor = options.field_color;
|
||||
newProps.fieldColorOptions = options.colors;
|
||||
return newProps;
|
||||
},
|
||||
extractProps({attrs, options, string}, dynamicInfo) {
|
||||
const props = super.extractProps({attrs, options, string}, dynamicInfo);
|
||||
return this.m2m_options_props(props, attrs, options);
|
||||
},
|
||||
});
|
||||
|
||||
patch(Many2XAutocomplete.prototype, {
|
||||
async loadOptionsSource(request) {
|
||||
var options = await super.loadOptionsSource(request);
|
||||
this.field_color = this.props.fieldColor;
|
||||
this.colors = this.props.fieldColorOptions;
|
||||
if (this.colors && this.field_color) {
|
||||
var value_ids = options.map((result) => result.value);
|
||||
const objects = await this.orm.call(
|
||||
this.props.resModel,
|
||||
"search_read",
|
||||
[],
|
||||
{
|
||||
domain: [["id", "in", value_ids]],
|
||||
fields: [this.field_color],
|
||||
}
|
||||
);
|
||||
for (var index in objects) {
|
||||
for (var index_value in options) {
|
||||
if (options[index_value].value === objects[index].id) {
|
||||
// Find value in values by comparing ids
|
||||
var option = options[index_value];
|
||||
// Find color with field value as key
|
||||
var color =
|
||||
this.colors[objects[index][this.field_color]] || "black";
|
||||
option.style = "color:" + color;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return options;
|
||||
},
|
||||
});
|
||||
|
||||
patch(FormController.prototype, {
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
setup() {
|
||||
super.setup(...arguments);
|
||||
this._setSubViewLimit();
|
||||
},
|
||||
/**
|
||||
* @override
|
||||
* add more method to add subview limit on formview
|
||||
*/
|
||||
async _setSubViewLimit() {
|
||||
const ir_options = session.web_m2x_options || {};
|
||||
const activeFields = this.archInfo.fieldNodes,
|
||||
isSmall = this.user;
|
||||
|
||||
var limit = ir_options["web_m2x_options.field_limit_entries"];
|
||||
if (!(typeof limit === "undefined")) {
|
||||
limit = parseInt(limit, 10);
|
||||
}
|
||||
for (const fieldName in activeFields) {
|
||||
const field = activeFields[fieldName];
|
||||
if (!isX2Many(field)) {
|
||||
// What follows only concerns x2many fields
|
||||
continue;
|
||||
}
|
||||
// Const fieldInfo = activeFields[fieldName];
|
||||
if (field.invisible) {
|
||||
// No need to fetch the sub view if the field is always invisible
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!field.field.useSubView) {
|
||||
// The FieldComponent used to render the field doesn't need a sub view
|
||||
continue;
|
||||
}
|
||||
let viewType = field.viewMode || "list,kanban";
|
||||
viewType = viewType.replace("tree", "list");
|
||||
if (viewType.includes(",")) {
|
||||
viewType = isSmall ? "kanban" : "list";
|
||||
}
|
||||
field.viewMode = viewType;
|
||||
if (field.views && field.views[viewType] && limit) {
|
||||
field.views[viewType].limit = limit;
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
// O.W.L. v18+: schema is validated in dev mode on adding to registry
|
||||
patch(registry.category("fields").validationSchema, {
|
||||
m2o_options_props_create: {type: Function, optional: true},
|
||||
m2o_options_props_create_edit: {type: Function, optional: true},
|
||||
m2o_options_props_limit: {type: Function, optional: true},
|
||||
m2o_options_props_search_more: {type: Function, optional: true},
|
||||
m2o_options_props_open: {type: Function, optional: true},
|
||||
m2o_options_props: {type: Function, optional: true},
|
||||
m2m_options_props_create: {type: Function, optional: true},
|
||||
m2m_options_props_create_edit: {type: Function, optional: true},
|
||||
m2m_options_props_limit: {type: Function, optional: true},
|
||||
m2m_options_props_search_more: {type: Function, optional: true},
|
||||
m2m_options_props: {type: Function, optional: true},
|
||||
});
|
||||
13
web_m2x_options/static/src/views/fields/standard_field_props.esm.js
Executable file
13
web_m2x_options/static/src/views/fields/standard_field_props.esm.js
Executable file
@@ -0,0 +1,13 @@
|
||||
import {patch} from "@web/core/utils/patch";
|
||||
import {standardFieldProps} from "@web/views/fields/standard_field_props";
|
||||
|
||||
export const fieldColorProps = {
|
||||
fieldColor: {type: String, optional: true},
|
||||
fieldColorOptions: {type: Object, optional: true},
|
||||
};
|
||||
|
||||
patch(standardFieldProps, {
|
||||
...fieldColorProps,
|
||||
noSearchMore: {type: Boolean, optional: true},
|
||||
searchLimit: {type: Number, optional: true},
|
||||
});
|
||||
Reference in New Issue
Block a user