diff --git a/web_widget_one2many_product_picker/README.rst b/web_widget_one2many_product_picker/README.rst index a85d535d1..c17add2aa 100644 --- a/web_widget_one2many_product_picker/README.rst +++ b/web_widget_one2many_product_picker/README.rst @@ -47,7 +47,6 @@ You need to define the view fields. The view must be of ``form`` type. Widget options: ~~~~~~~~~~~~~~~ -* records_per_page > Integer -> Used to control the load more behaviour (16 by default) * groups > Array of dictionaries -> Declare the groups * name -> The group name @@ -58,6 +57,9 @@ Widget options: * name -> The field name to order * asc -> Flag to use 'asc' order + * records_per_page > Integer -> Used to control the load more behaviour (16 by default) + * active -> Boolean -> Select the default group to use ('false' by default = 'All' group) + * currency_field > Model field used to format monetary values ('currency_id' by default) * field_map > Dictionary: @@ -68,7 +70,7 @@ Widget options: * price_unit -> The field that represent a price_unit ('price_unit' by default) * discount -> The field that represent a discount ('discount' by default) -* search > Array of dictionaries or Array of 'triplets' ([[field_map.name, 'ilike', '$search']] by default) +* search > Array of dictionaries (defines to use name_search by default) * name -> The name to display * domain -> The domain to use @@ -76,11 +78,15 @@ Widget options: * $search -> Replaces it with the current value of the searchbox * $number_search -> Replaces all the leaf with the current value of the searchbox as a number + * name_search_value -> Enables the use of 'name_search' instead of 'search_read' and defines the value to search ('$search' by default) + * operator -> Operator used in 'name_search' ('ilike' by default) + * edit_discount > Enable/Disable discount edits (False by default) * edit_price > Enable/Disable price edits (True by default) * show_discount > Enable/Disable display discount (False by default) * show_subtotal > Enable/Disable show subtotal (True by default) * auto_save > Enable/Disable auto save (False by default) +* auto_save_delay > The time (in milliseconds) to wait after the last interaction before launching the autosave (1500 by default) * all_domain > The domain used in 'All' section ([] by default) If using auto save feature, you should keep in mind that the "Save" and "Discard" buttons @@ -88,7 +94,9 @@ Widget options: modify/create a record with the widget. * ignore_warning > Enable/Disable display onchange warnings (False by default) +* instant_search > Enable/Disable instant search mode (False by default) * trigger_refresh_fields > Fields in the main record that dispatch a widget refresh (["partner_id", "currency_id"] by default) +* auto_focus > Keep the focus on the search box after performing a search (True by default) All widget options are optional. Notice that you can call '_' method to use translations. This only can be used with this widget. @@ -209,7 +217,8 @@ Known issues / Roadmap ====================== * Translations in the xml 'options' attribute of the field that use the widget can't be exported automatically to be translated -* The product card animations can be improved. Currently the card is recreated, so we lost some elements to apply correct effects. +* The product card animations can be improved. Currently the card is recreated, so we lost some elements to apply correct effects +* sale.order onchanges that affects to "order_line" subfields will be ommitted to increase the performance Bug Tracker =========== diff --git a/web_widget_one2many_product_picker/__manifest__.py b/web_widget_one2many_product_picker/__manifest__.py index 49ee0fac7..8206062bc 100644 --- a/web_widget_one2many_product_picker/__manifest__.py +++ b/web_widget_one2many_product_picker/__manifest__.py @@ -2,23 +2,16 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { - 'name': 'Web Widget One2Many Product Picker', - 'summary': 'Widget to select products on one2many fields', - 'version': '12.0.2.4.2', - 'category': 'Website', - 'author': "Tecnativa, " - "Odoo Community Association (OCA)", - 'website': 'https://www.tecnativa.com', - 'license': 'AGPL-3', - 'depends': [ - 'product', - ], - 'data': [ - 'templates/assets.xml', - ], - 'qweb': [ - 'static/src/xml/one2many_product_picker.xml', - ], - 'installable': True, - 'auto_install': False, + "name": "Web Widget One2Many Product Picker", + "summary": "Widget to select products on one2many fields", + "version": "12.0.2.4.2", + "category": "Website", + "author": "Tecnativa, " "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/web", + "license": "AGPL-3", + "depends": ["product"], + "data": ["templates/assets.xml"], + "qweb": ["static/src/xml/one2many_product_picker.xml"], + "installable": True, + "auto_install": False, } diff --git a/web_widget_one2many_product_picker/i18n/ca.po b/web_widget_one2many_product_picker/i18n/ca.po index 32e58b425..fc6ba21ff 100644 --- a/web_widget_one2many_product_picker/i18n/ca.po +++ b/web_widget_one2many_product_picker/i18n/ca.po @@ -25,7 +25,7 @@ msgstr "Afegir" #. module: web_widget_one2many_product_picker #. openerp-web -#: code:addons/web_widget_one2many_product_picker/static/src/js/widgets/field_one2many_product_picker.js:208 +#: code:addons/web_widget_one2many_product_picker/static/src/js/widgets/field_one2many_product_picker.js:193 #, python-format msgid "All" msgstr "Tot" @@ -114,7 +114,7 @@ msgstr "Imatge variant mitjana ( calculada)" #. module: web_widget_one2many_product_picker #. openerp-web -#: code:addons/web_widget_one2many_product_picker/static/src/js/views/One2ManyProductPicker/record.js:361 +#: code:addons/web_widget_one2many_product_picker/static/src/js/views/One2ManyProductPicker/record.js:341 #, python-format msgid "[No widget %s]" msgstr "[Sense widget %s]" diff --git a/web_widget_one2many_product_picker/i18n/es.po b/web_widget_one2many_product_picker/i18n/es.po index 1f0d60167..f7e54ea7c 100644 --- a/web_widget_one2many_product_picker/i18n/es.po +++ b/web_widget_one2many_product_picker/i18n/es.po @@ -6,58 +6,97 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-05-04 13:10+0000\n" -"PO-Revision-Date: 2021-05-04 17:17+0200\n" -"Last-Translator: claudiagn \n" -"Language-Team: none\n" +"POT-Creation-Date: 2022-01-25 18:49+0000\n" +"PO-Revision-Date: 2022-01-25 19:51+0100\n" +"Last-Translator: <>\n" +"Language-Team: \n" "Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Poedit 2.4.1\n" +"Plural-Forms: \n" +"X-Generator: Poedit 3.0\n" #. module: web_widget_one2many_product_picker #. openerp-web -#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker_quick_create.xml:6 +#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker_quick_create.xml:9 +#, python-format +msgid "Accept" +msgstr "Aceptar" + +#. module: web_widget_one2many_product_picker +#. openerp-web +#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker_quick_create.xml:5 #, python-format msgid "Add" msgstr "Añadir" #. module: web_widget_one2many_product_picker #. openerp-web -#: code:addons/web_widget_one2many_product_picker/static/src/js/widgets/field_one2many_product_picker.js:208 +#: code:addons/web_widget_one2many_product_picker/static/src/js/widgets/field_one2many_product_picker.js:258 #, python-format msgid "All" msgstr "Todo" #. module: web_widget_one2many_product_picker #. openerp-web -#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker.xml:35 +#: code:addons/web_widget_one2many_product_picker/static/src/js/widgets/field_one2many_product_picker.js:72 +#, python-format +msgid "By Name" +msgstr "Por Nombre" + +#. module: web_widget_one2many_product_picker +#. openerp-web +#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker_quick_create.xml:12 +#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker_quick_create.xml:20 +#, python-format +msgid "Discard" +msgstr "Descartar" + +#. module: web_widget_one2many_product_picker +#. openerp-web +#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker.xml:61 #, python-format msgid "Groups" msgstr "Grupos" +#. module: web_widget_one2many_product_picker +#: model:ir.model,name:web_widget_one2many_product_picker.model_ir_http +msgid "HTTP Routing" +msgstr "Ruta HTTP" + #. module: web_widget_one2many_product_picker #. openerp-web -#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker.xml:43 +#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker.xml:207 +#, python-format +msgid "LOADING..." +msgstr "CARGANDO..." + +#. module: web_widget_one2many_product_picker +#. openerp-web +#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker.xml:73 #, python-format msgid "Lines" msgstr "Líneas" #. module: web_widget_one2many_product_picker #. openerp-web -#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker.xml:67 +#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker.xml:92 #, python-format msgid "Load More" msgstr "Cargar más" #. module: web_widget_one2many_product_picker #. openerp-web -#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker_quick_modif_price.xml:11 +#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker_quick_modif_price.xml:4 #, python-format -msgid "Price:" -msgstr "Precio:" +msgid "Price" +msgstr "Precio" + +#. module: web_widget_one2many_product_picker +#: model:ir.model,name:web_widget_one2many_product_picker.model_product_pricelist_item +msgid "Pricelist Item" +msgstr "Item de Lista de precios" #. module: web_widget_one2many_product_picker #: model:ir.model,name:web_widget_one2many_product_picker.model_product_product @@ -66,62 +105,28 @@ msgstr "Producto" #. module: web_widget_one2many_product_picker #. openerp-web -#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker_quick_create.xml:13 +#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker_quick_create.xml:18 #, python-format msgid "Remove" msgstr "Eliminar" #. module: web_widget_one2many_product_picker #. openerp-web -#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker.xml:23 +#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker.xml:41 #, python-format msgid "Search..." msgstr "Buscar..." #. module: web_widget_one2many_product_picker #. openerp-web -#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker.xml:58 +#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker.xml:81 #, python-format msgid "Subtotal:" msgstr "Subtotal:" -#. module: web_widget_one2many_product_picker -#: model:ir.model.fields,help:web_widget_one2many_product_picker.field_product_product__image_variant_medium -msgid "" -"This field holds the image used as image for the product variantor product " -"image medium, limited to 512x512px." -msgstr "" -"Aquest camp conté la imatge que s'utilitza com a imatge per al mitjà " -"d'imatge del producte que varia el producte, limitada a 512x512px." - -#. module: web_widget_one2many_product_picker -#: model:ir.model.fields,help:web_widget_one2many_product_picker.field_product_product__image_variant_big -msgid "" -"This field holds the image used as image for the product variantor product " -"image, limited to 1024x1024px." -msgstr "" -"Aquest camp conté la imatge que s'utilitza com a imatge per al mitjà " -"d'imatge del producte que varia el producte, limitada a 1024x1024px." - -#. module: web_widget_one2many_product_picker -#: model:ir.model.fields,field_description:web_widget_one2many_product_picker.field_product_product__image_variant_big -msgid "Variant Image Big (Computed)" -msgstr "Imagen variante grande (calculada)" - -#. module: web_widget_one2many_product_picker -#: model:ir.model.fields,field_description:web_widget_one2many_product_picker.field_product_product__image_variant_medium -msgid "Variant Image Medium (Computed)" -msgstr "Imagen variante media (calculada)" - #. module: web_widget_one2many_product_picker #. openerp-web -#: code:addons/web_widget_one2many_product_picker/static/src/js/views/One2ManyProductPicker/record.js:361 +#: code:addons/web_widget_one2many_product_picker/static/src/js/views/One2ManyProductPicker/record.js:606 #, python-format msgid "[No widget %s]" msgstr "[Sin widget %s]" - -#~ msgid "HTTP Routing" -#~ msgstr "Enrutamiento HTTP" - -#~ msgid "Pricelist Item" -#~ msgstr "Elemento de tarifa" diff --git a/web_widget_one2many_product_picker/i18n/pt_BR.po b/web_widget_one2many_product_picker/i18n/pt_BR.po index dab981a98..d977eaa14 100644 --- a/web_widget_one2many_product_picker/i18n/pt_BR.po +++ b/web_widget_one2many_product_picker/i18n/pt_BR.po @@ -23,7 +23,7 @@ msgstr "" #. module: web_widget_one2many_product_picker #. openerp-web -#: code:addons/web_widget_one2many_product_picker/static/src/js/widgets/field_one2many_product_picker.js:208 +#: code:addons/web_widget_one2many_product_picker/static/src/js/widgets/field_one2many_product_picker.js:193 #, python-format msgid "All" msgstr "" @@ -108,7 +108,7 @@ msgstr "" #. module: web_widget_one2many_product_picker #. openerp-web -#: code:addons/web_widget_one2many_product_picker/static/src/js/views/One2ManyProductPicker/record.js:361 +#: code:addons/web_widget_one2many_product_picker/static/src/js/views/One2ManyProductPicker/record.js:341 #, python-format msgid "[No widget %s]" msgstr "" diff --git a/web_widget_one2many_product_picker/i18n/web_widget_one2many_product_picker.pot b/web_widget_one2many_product_picker/i18n/web_widget_one2many_product_picker.pot index 78fdfcf13..f6bf0d5c7 100644 --- a/web_widget_one2many_product_picker/i18n/web_widget_one2many_product_picker.pot +++ b/web_widget_one2many_product_picker/i18n/web_widget_one2many_product_picker.pot @@ -6,6 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-01-25 18:49+0000\n" +"PO-Revision-Date: 2022-01-25 18:49+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -15,44 +17,83 @@ msgstr "" #. module: web_widget_one2many_product_picker #. openerp-web -#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker_quick_create.xml:6 +#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker_quick_create.xml:9 +#, python-format +msgid "Accept" +msgstr "" + +#. module: web_widget_one2many_product_picker +#. openerp-web +#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker_quick_create.xml:5 #, python-format msgid "Add" msgstr "" #. module: web_widget_one2many_product_picker #. openerp-web -#: code:addons/web_widget_one2many_product_picker/static/src/js/widgets/field_one2many_product_picker.js:208 +#: code:addons/web_widget_one2many_product_picker/static/src/js/widgets/field_one2many_product_picker.js:258 #, python-format msgid "All" msgstr "" #. module: web_widget_one2many_product_picker #. openerp-web -#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker.xml:35 +#: code:addons/web_widget_one2many_product_picker/static/src/js/widgets/field_one2many_product_picker.js:72 +#, python-format +msgid "By Name" +msgstr "" + +#. module: web_widget_one2many_product_picker +#. openerp-web +#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker_quick_create.xml:12 +#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker_quick_create.xml:20 +#, python-format +msgid "Discard" +msgstr "" + +#. module: web_widget_one2many_product_picker +#. openerp-web +#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker.xml:61 #, python-format msgid "Groups" msgstr "" +#. module: web_widget_one2many_product_picker +#: model:ir.model,name:web_widget_one2many_product_picker.model_ir_http +msgid "HTTP Routing" +msgstr "" + #. module: web_widget_one2many_product_picker #. openerp-web -#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker.xml:43 +#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker.xml:207 +#, python-format +msgid "LOADING..." +msgstr "" + +#. module: web_widget_one2many_product_picker +#. openerp-web +#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker.xml:73 #, python-format msgid "Lines" msgstr "" #. module: web_widget_one2many_product_picker #. openerp-web -#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker.xml:67 +#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker.xml:92 #, python-format msgid "Load More" msgstr "" #. module: web_widget_one2many_product_picker #. openerp-web -#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker_quick_modif_price.xml:11 +#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker_quick_modif_price.xml:4 #, python-format -msgid "Price:" +msgid "Price" +msgstr "" + +#. module: web_widget_one2many_product_picker +#: model:ir.model,name:web_widget_one2many_product_picker.model_product_pricelist_item +msgid "Pricelist Item" msgstr "" #. module: web_widget_one2many_product_picker @@ -62,48 +103,28 @@ msgstr "" #. module: web_widget_one2many_product_picker #. openerp-web -#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker_quick_create.xml:13 +#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker_quick_create.xml:18 #, python-format msgid "Remove" msgstr "" #. module: web_widget_one2many_product_picker #. openerp-web -#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker.xml:23 +#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker.xml:41 #, python-format msgid "Search..." msgstr "" #. module: web_widget_one2many_product_picker #. openerp-web -#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker.xml:58 +#: code:addons/web_widget_one2many_product_picker/static/src/xml/one2many_product_picker.xml:81 #, python-format msgid "Subtotal:" msgstr "" -#. module: web_widget_one2many_product_picker -#: model:ir.model.fields,help:web_widget_one2many_product_picker.field_product_product__image_variant_medium -msgid "This field holds the image used as image for the product variantor product image medium, limited to 512x512px." -msgstr "" - -#. module: web_widget_one2many_product_picker -#: model:ir.model.fields,help:web_widget_one2many_product_picker.field_product_product__image_variant_big -msgid "This field holds the image used as image for the product variantor product image, limited to 1024x1024px." -msgstr "" - -#. module: web_widget_one2many_product_picker -#: model:ir.model.fields,field_description:web_widget_one2many_product_picker.field_product_product__image_variant_big -msgid "Variant Image Big (Computed)" -msgstr "" - -#. module: web_widget_one2many_product_picker -#: model:ir.model.fields,field_description:web_widget_one2many_product_picker.field_product_product__image_variant_medium -msgid "Variant Image Medium (Computed)" -msgstr "" - #. module: web_widget_one2many_product_picker #. openerp-web -#: code:addons/web_widget_one2many_product_picker/static/src/js/views/One2ManyProductPicker/record.js:361 +#: code:addons/web_widget_one2many_product_picker/static/src/js/views/One2ManyProductPicker/record.js:606 #, python-format msgid "[No widget %s]" msgstr "" diff --git a/web_widget_one2many_product_picker/models/__init__.py b/web_widget_one2many_product_picker/models/__init__.py index 3d1f7c9ef..0e4444933 100644 --- a/web_widget_one2many_product_picker/models/__init__.py +++ b/web_widget_one2many_product_picker/models/__init__.py @@ -1,2 +1 @@ -# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). -from . import product_product +from . import base diff --git a/web_widget_one2many_product_picker/models/base.py b/web_widget_one2many_product_picker/models/base.py new file mode 100644 index 000000000..90c4049cf --- /dev/null +++ b/web_widget_one2many_product_picker/models/base.py @@ -0,0 +1,76 @@ +# Copyright 2022 Tecnativa - Alexandre D. Díaz +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) +from odoo import _, api, models +from odoo.exceptions import ValidationError + + +class BaseModel(models.BaseModel): + _inherit = "base" + + @api.model_create_multi + def create(self, vals_list): + """Avoid create lines that have a product currently used when use the product + picker""" + relation = self.env.context.get("product_picker_relation") + if relation == self._name and len(vals_list): + product_field = self.env.context.get("product_picker_product_field") + product_ids = [ + values[product_field] for values in vals_list if product_field in values + ] + if len(product_ids) != len(set(product_ids)): + raise ValidationError( + _("Can't create the %s: Duplicated product! (Inside query)") + % relation + ) + relation_field = self.env.context.get("product_picker_relation_field") + # All records have the same 'relation id' when created with the product + # picker + relation_id = vals_list[0][relation_field] + has_product = ( + self.search( + [ + (relation_field, "=", relation_id), + (product_field, "in", product_ids), + ], + count=True, + limit=1, + ) + != 0 + ) + if has_product: + raise ValidationError( + _("Can't create the %s: Duplicated product! (Already in database)") + % relation + ) + return super().create(vals_list) + + def write(self, values): + """Avoid write lines that have a product currently used when use the product + picker""" + relation = self.env.context.get("product_picker_relation") + product_field = self.env.context.get("product_picker_product_field") + if relation == self._name and product_field in values: + relation_field = self.env.context.get("product_picker_relation_field") + relation_id = ( + values[relation_field] + if relation_field in values + else self.get(relation_field) + ) + product_id = values[product_field] + has_product = ( + self.search( + [ + (relation_field, "=", relation_id), + (product_field, "=", product_id), + ], + count=True, + limit=1, + ) + != 0 + ) + if has_product: + raise ValidationError( + _("Can't write the %s: Duplicated product! (Already in database)") + % relation + ) + return super().write(values) diff --git a/web_widget_one2many_product_picker/models/product_product.py b/web_widget_one2many_product_picker/models/product_product.py deleted file mode 100644 index 6beab967a..000000000 --- a/web_widget_one2many_product_picker/models/product_product.py +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2020 Tecnativa - Alexandre D. Díaz -# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). -from odoo import api, fields, models, tools - - -class ProductProduct(models.Model): - _inherit = 'product.product' - - image_variant_medium = fields.Binary( - "Variant Image Medium (Computed)", - compute='_compute_variant_image', - help="This field holds the image used as image for the product variant" - "or product image medium, limited to 512x512px.", - ) - - image_variant_big = fields.Binary( - "Variant Image Big (Computed)", - compute='_compute_variant_image', - help="This field holds the image used as image for the product variant" - "or product image, limited to 1024x1024px.", - ) - - @api.depends('image_variant', 'product_tmpl_id.image') - def _compute_variant_image(self): - for record in self: - if record.image_variant: - resized_images = tools.image_get_resized_images( - record.image_variant, - return_big=False, - return_small=False, - avoid_resize_medium=True) - record.image_variant_medium = resized_images['image_medium'] - record.image_variant_big = record.image_variant - else: - record.image_variant_medium = record.product_tmpl_id.image_medium - record.image_variant_big = record.product_tmpl_id.image diff --git a/web_widget_one2many_product_picker/readme/CONFIGURE.rst b/web_widget_one2many_product_picker/readme/CONFIGURE.rst index 50209889a..46f18715d 100644 --- a/web_widget_one2many_product_picker/readme/CONFIGURE.rst +++ b/web_widget_one2many_product_picker/readme/CONFIGURE.rst @@ -5,7 +5,6 @@ You need to define the view fields. The view must be of ``form`` type. Widget options: ~~~~~~~~~~~~~~~ -* records_per_page > Integer -> Used to control the load more behaviour (16 by default) * groups > Array of dictionaries -> Declare the groups * name -> The group name @@ -16,6 +15,9 @@ Widget options: * name -> The field name to order * asc -> Flag to use 'asc' order + * records_per_page > Integer -> Used to control the load more behaviour (16 by default) + * active -> Boolean -> Select the default group to use ('false' by default = 'All' group) + * currency_field > Model field used to format monetary values ('currency_id' by default) * field_map > Dictionary: @@ -26,7 +28,7 @@ Widget options: * price_unit -> The field that represent a price_unit ('price_unit' by default) * discount -> The field that represent a discount ('discount' by default) -* search > Array of dictionaries or Array of 'triplets' ([[field_map.name, 'ilike', '$search']] by default) +* search > Array of dictionaries (defines to use name_search by default) * name -> The name to display * domain -> The domain to use @@ -34,11 +36,15 @@ Widget options: * $search -> Replaces it with the current value of the searchbox * $number_search -> Replaces all the leaf with the current value of the searchbox as a number + * name_search_value -> Enables the use of 'name_search' instead of 'search_read' and defines the value to search ('$search' by default) + * operator -> Operator used in 'name_search' ('ilike' by default) + * edit_discount > Enable/Disable discount edits (False by default) * edit_price > Enable/Disable price edits (True by default) * show_discount > Enable/Disable display discount (False by default) * show_subtotal > Enable/Disable show subtotal (True by default) * auto_save > Enable/Disable auto save (False by default) +* auto_save_delay > The time (in milliseconds) to wait after the last interaction before launching the autosave (1500 by default) * all_domain > The domain used in 'All' section ([] by default) If using auto save feature, you should keep in mind that the "Save" and "Discard" buttons @@ -46,7 +52,9 @@ Widget options: modify/create a record with the widget. * ignore_warning > Enable/Disable display onchange warnings (False by default) +* instant_search > Enable/Disable instant search mode (False by default) * trigger_refresh_fields > Fields in the main record that dispatch a widget refresh (["partner_id", "currency_id"] by default) +* auto_focus > Keep the focus on the search box after performing a search (True by default) All widget options are optional. Notice that you can call '_' method to use translations. This only can be used with this widget. diff --git a/web_widget_one2many_product_picker/readme/ROADMAP.rst b/web_widget_one2many_product_picker/readme/ROADMAP.rst index 0e3fe6e62..47177187e 100644 --- a/web_widget_one2many_product_picker/readme/ROADMAP.rst +++ b/web_widget_one2many_product_picker/readme/ROADMAP.rst @@ -1,2 +1,3 @@ * Translations in the xml 'options' attribute of the field that use the widget can't be exported automatically to be translated -* The product card animations can be improved. Currently the card is recreated, so we lost some elements to apply correct effects. +* The product card animations can be improved. Currently the card is recreated, so we lost some elements to apply correct effects +* sale.order onchanges that affects to "order_line" subfields will be ommitted to increase the performance diff --git a/web_widget_one2many_product_picker/static/description/index.html b/web_widget_one2many_product_picker/static/description/index.html index 06b268975..332ce9aa5 100644 --- a/web_widget_one2many_product_picker/static/description/index.html +++ b/web_widget_one2many_product_picker/static/description/index.html @@ -3,7 +3,7 @@ - + Web Widget One2Many Product Picker