Author: |
Tecnativa, Odoo Community Association (OCA) |
License: |
AGPL-3 |
Branch: |
12.0-ocabot-merge-pr-1760-by-legalsylvain-bump-patch |
Repository: |
brain-tec/web |
Dependencies: |
product,
and
web |
Languages: |
HTML (437, 15.5%),
JavaScript (2008, 71.0%),
Python (21, 0.7%),
Sass (202, 7.1%),
and
XML (160, 5.7%) |
Other branches: |
12.0,
12.0-ocabot-merge-pr-1347-by-dreispt-bump-minor,
12.0-ocabot-merge-pr-1522-by-dreispt-bump-nobump,
12.0-ocabot-merge-pr-1523-by-dreispt-bump-nobump,
12.0-ocabot-merge-pr-1702-by-dreispt-bump-patch,
12.0-ocabot-merge-pr-1738-by-dreispt-bump-nobump,
12.0-ocabot-merge-pr-1827-by-dreispt-bump-patch,
12.0-ocabot-merge-pr-2026-by-dreispt-bump-minor,
12.0.project_MI_465,
13.0,
13.0-ocabot-merge-pr-1415-by-dreispt-bump-nobump,
and
13.0-ocabot-merge-pr-1814-by-dreispt-bump-nobump |
Other repositories: |
AntoniRomera/web,
AyoubZahid/web,
Change2improve/web,
Darknroses/web,
Digital5-Odoo/web,
Dobtor-OCA/web,
ERPLibre/web,
ForgeFlow/web,
GSLabIt/web,
Gabinete-Digital/web,
GlodoUK/oca-web,
Ingeos/web,
Jarsa/web,
KKamaa/web,
LevelPrime/web,
Martronic-SA/web,
OCA/web,
SimoRubi/web,
Studio73/web,
Tecnativa/web,
VanMoof/web,
Vauxoo/web,
aaltinisik/web,
acsone/web,
anhvu-sg/web,
antilhue/web,
aurestic/web,
blooparksystems/web,
brian10048/web,
camptocamp/web,
coopiteasy/web,
diggy128/web,
dingguijin/web,
eLBati/web,
ecosoft-odoo/web,
focusate/web-oca,
gfcapalbo/web,
gtorresemmanuel/web,
hbrunn/web,
i-vyshnevska/web,
jeroen7s/web,
kmee/web,
kos94ok-3D/web,
leanhtuan1996/web,
legalsylvain/web,
mharenz/web,
modoolar/oca-web,
mohamedhagag/web,
multidadosti-erp/web,
onurugur/web,
petrus-v/web,
praxigento/oca-web,
sergiocorato/web,
solvosci/web,
steingabelgaard/web,
sunflowerit/web,
takinobori/oca-web,
tegin/web,
tirix/web,
tirma-sa/web,
trevi-software/web,
trobz/web,
tvtma/web,
unitek-solusi/OCA-web,
ursais/web,
vialaurea/OCA-web,
wahello/oca-web,
xcgd/web,
zarumaru/web,
and
zcyuefan/web |
<h1 class="title">Web Widget One2Many Product Picker</h1>
<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/web/tree/12.0/web_widget_one2many_product_picker"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_widget_one2many_product_picker"><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/162/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>Adds the 'one2many_product_picker' friendly mobile widget to create one2many lines linked with product.product records.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#installation" id="id1">Installation</a></li>
<li><a class="reference internal" href="#usage" id="id2">Usage</a><ul>
<li><a class="reference internal" href="#default-context" id="id3">Default context:</a></li>
<li><a class="reference internal" href="#preview" id="id4">Preview:</a></li>
</ul>
</li>
<li><a class="reference internal" href="#known-issues-roadmap" id="id5">Known issues / Roadmap</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id6">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id7">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id8">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id9">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id10">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<a name="installation"></a>
<h2><a class="toc-backref" href="#id1">Installation</a></h2>
<p>It's advisable to install 'web_widget_numeric_step' to have a better usability on touch screens.</p>
<a name="usage"></a>
<h2><a class="toc-backref" href="#id2">Usage</a></h2>
<p>You need to define the view fields. The view must be of <code>form</code> type.
This is an example that uses the 'sale.order.line' fields:</p>
<pre>
<code lang="xml"><field
name="order_line"
attrs="{'readonly': [('state', 'in', ('done','cancel'))]}"
nolabel="1"
mode="form"
widget="one2many_product_picker"
options="{'search': [{'name': 'Test', 'domain': [['name', 'ilike', '$search']]}] ,'edit_discount': True, 'show_discount': True, 'groups': [{'name': 'desk', 'string': _('Desks'), 'domain': [('name', 'ilike', '%desk%')], 'order': [{'name': 'id', 'asc': true}]}, {'name': 'chair', 'string': _('Chairs'), 'domain': [('name', 'ilike', '%chair%')]}]}"
>
<form>
<field name="state" invisible="1" />
<field name="display_type" invisible="1" />
<field name="currency_id" invisible="1" />
<field name="discount" widget="numeric_step" options="{'max': 100}" invisible="1"/>
<field name="price_unit" widget="numeric_step" invisible="1"/>
<field name="name" invisible="1" />
<field name="product_id" invisible="1" />
<field name="order_id" invisible="1"/>
<field name="product_uom_qty" class="mb-1" widget="numeric_step" context="{
'partner_id': parent.partner_id,
'quantity': product_uom_qty,
'pricelist': parent.pricelist_id,
'uom': product_uom,
'company_id': parent.company_id
}" />
<field name="product_uom" force_save="1" attrs="{
'readonly': [('state', 'in', ('sale','done', 'cancel'))],
'required': [('display_type', '=', False)],
}" context="{'company_id': parent.company_id}" class="mb-2" options="{'no_open': True, 'no_create': True, 'no_edit': True}" />
</form>
</field></code>
</pre>
<p>Other example for 'purchase.order.line' fields:</p>
<pre>
<code lang="xml"><field
name="order_line"
attrs="{'readonly': [('state', 'in', ('done','cancel'))]}"
nolabel="1"
widget="one2many_product_picker"
mode="form"
options="{'search': [{'name': _('Name'), 'domain': [['name', 'ilike', '$search']]}, {'name': _('Price'), 'domain': [['list_price', '=', $number_search]]}], 'field_map': {'name': 'name', 'product': 'product_id', 'product_uom': 'product_uom', 'price': 'price_unit', 'parent_id': 'order_id', 'product_uom_qty': 'product_qty'}, 'groups': [{'name': _('Desk'), 'domain': [['name', 'ilike', 'desk']], 'order': {'name': 'id', 'asc': true}}, {'name': _('Chairs'), 'domain': [['name', 'ilike', 'chair']]}]}"
>
<form>
<field name="name" invisible="1" />
<field name="product_id" invisible="1" />
<field name="price_unit" invisible="1" />
<field name="currency_id" invisible="1" />
<field name="order_id" invisible="1" />
<field name="date_planned" class="mb-1" />
<field name="product_qty" class="mb-1" widget="numeric_step" required="1" />
<field name="product_uom" class="mb-2" options="{'no_open': True, 'no_create': True, 'no_edit': True}" />
</form>
</field></code>
</pre>
<p>** In this example we don't use 'field_map' option because the default match with the sale.order.line field names.</p>
<a name="default-context"></a>
<h3><a class="toc-backref" href="#id3">Default context:</a></h3>
<p>The widget sends a defaults context with the 'search_read' request:</p>
<blockquote>
<ul>
<li><p class="first">active_search_group_name > Contains the name of the active search group</p>
<blockquote>
<ul class="simple">
<li>'all' > Is the hard-coded name for the 'All' group</li>
<li>'main_lines' > Is the hard-coded name for the 'Lines' group</li>
</ul>
</blockquote>
</li>
</ul>
</blockquote>
<a name="preview"></a>
<h3><a class="toc-backref" href="#id4">Preview:</a></h3>
<blockquote>
<img alt="https://raw.githubusercontent.com/OCA/web/12.0/web_widget_one2many_product_picker/static/img/product_picker.gif" src="https://raw.githubusercontent.com/OCA/web/12.0/web_widget_one2many_product_picker/static/img/product_picker.gif" />
</blockquote>
<a name="known-issues-roadmap"></a>
<h2><a class="toc-backref" href="#id5">Known issues / Roadmap</a></h2>
<ul class="simple">
<li>Translations in the xml 'options' attribute of the field that use the widget can't be exported automatically to be translated</li>
<li>The product card animations can be improved. Currently the card is recreated, so we lost some states to apply correct effects.</li>
</ul>
<a name="bug-tracker"></a>
<h2><a class="toc-backref" href="#id6">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 smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_widget_one2many_product_picker%0Aversion:%2012.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>
<a name="credits"></a>
<h2><a class="toc-backref" href="#id7">Credits</a></h2>
<a name="authors"></a>
<h3><a class="toc-backref" href="#id8">Authors</a></h3>
<ul class="simple">
<li>Tecnativa</li>
</ul>
<a name="contributors"></a>
<h3><a class="toc-backref" href="#id9">Contributors</a></h3>
<ul>
<li><p class="first"><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:</p>
<blockquote>
<ul class="simple">
<li>Alexandre D. Díaz</li>
<li>Pedro M. Baeza</li>
<li>David Vidal</li>
</ul>
</blockquote>
</li>
</ul>
<a name="maintainers"></a>
<h3><a class="toc-backref" href="#id10">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/12.0/web_widget_one2many_product_picker">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>