diff --git a/web_widget_one2many_product_picker_sale_stock_available_info_popup/README.rst b/web_widget_one2many_product_picker_sale_stock_available_info_popup/README.rst new file mode 100644 index 000000000..c417f9ebd --- /dev/null +++ b/web_widget_one2many_product_picker_sale_stock_available_info_popup/README.rst @@ -0,0 +1,75 @@ +================================================================== +Web Widget One2Many Product Picker Sale Stock Available Info Popup +================================================================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github + :target: https://github.com/OCA/web/tree/v12/web_widget_one2many_product_picker_sale_stock_available_info_popup + :alt: OCA/web +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/web-v12/web-v12-web_widget_one2many_product_picker_sale_stock_available_info_popup + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/162/v12 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Adds support for 'sale_stock_available_info_popup' in the product picker + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +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 +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* `Tecnativa `_: + + * Alexandre D. Díaz + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +This module is part of the `OCA/web `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_widget_one2many_product_picker_sale_stock_available_info_popup/__init__.py b/web_widget_one2many_product_picker_sale_stock_available_info_popup/__init__.py new file mode 100644 index 000000000..d9d1f13de --- /dev/null +++ b/web_widget_one2many_product_picker_sale_stock_available_info_popup/__init__.py @@ -0,0 +1 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). diff --git a/web_widget_one2many_product_picker_sale_stock_available_info_popup/__manifest__.py b/web_widget_one2many_product_picker_sale_stock_available_info_popup/__manifest__.py new file mode 100644 index 000000000..ca4a4bf39 --- /dev/null +++ b/web_widget_one2many_product_picker_sale_stock_available_info_popup/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2020 Tecnativa - Alexandre D. Díaz +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Web Widget One2Many Product Picker Sale Stock Available Info Popup", + "summary": "Adds support for stock in the one2many product picker widget", + "version": "12.0.1.0.0", + "category": "Website", + "author": "Tecnativa, " "Odoo Community Association (OCA)", + "website": "https://www.tecnativa.com", + "license": "AGPL-3", + "depends": [ + "web_widget_one2many_product_picker_sale_stock", + "sale_stock_available_info_popup" + ], + "data": ["templates/assets.xml"], + "installable": True, + "auto_install": False, +} diff --git a/web_widget_one2many_product_picker_sale_stock_available_info_popup/readme/CONTRIBUTORS.rst b/web_widget_one2many_product_picker_sale_stock_available_info_popup/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..ff417a6ae --- /dev/null +++ b/web_widget_one2many_product_picker_sale_stock_available_info_popup/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* `Tecnativa `_: + + * Alexandre D. Díaz diff --git a/web_widget_one2many_product_picker_sale_stock_available_info_popup/readme/DESCRIPTION.rst b/web_widget_one2many_product_picker_sale_stock_available_info_popup/readme/DESCRIPTION.rst new file mode 100644 index 000000000..3f90d9e3a --- /dev/null +++ b/web_widget_one2many_product_picker_sale_stock_available_info_popup/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +Adds support for 'sale_stock_available_info_popup' in the product picker diff --git a/web_widget_one2many_product_picker_sale_stock_available_info_popup/static/description/icon.png b/web_widget_one2many_product_picker_sale_stock_available_info_popup/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/web_widget_one2many_product_picker_sale_stock_available_info_popup/static/description/icon.png differ diff --git a/web_widget_one2many_product_picker_sale_stock_available_info_popup/static/description/index.html b/web_widget_one2many_product_picker_sale_stock_available_info_popup/static/description/index.html new file mode 100644 index 000000000..617f41c89 --- /dev/null +++ b/web_widget_one2many_product_picker_sale_stock_available_info_popup/static/description/index.html @@ -0,0 +1,425 @@ + + + + + + +Web Widget One2Many Product Picker Sale Stock Available Info Popup + + + +
+

Web Widget One2Many Product Picker Sale Stock Available Info Popup

+ + +

Beta License: AGPL-3 OCA/web Translate me on Weblate Try me on Runbot

+

Adds support for ‘sale_stock_available_info_popup’ in the product picker

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +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 +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

This module is part of the OCA/web project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/web_widget_one2many_product_picker_sale_stock_available_info_popup/static/src/js/views/abstract_view.js b/web_widget_one2many_product_picker_sale_stock_available_info_popup/static/src/js/views/abstract_view.js new file mode 100644 index 000000000..b2124f16a --- /dev/null +++ b/web_widget_one2many_product_picker_sale_stock_available_info_popup/static/src/js/views/abstract_view.js @@ -0,0 +1,78 @@ +// Copyright 2020 Tecnativa - Alexandre Díaz +// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +odoo.define("web_widget_one2many_product_picker_sale_stock_available_info_popup.AbstractView", function( + require +) { + "use strict"; + + const AbstractView = require("web.AbstractView"); + require("web_widget_one2many_product_picker_sale_stock.AbstractView"); + + /** + * Helper function to create field view definitions + * + * @private + * @param {Object} params + * @returns {Object} + */ + function _constructFakeFieldDef(params) { + return _.extend( + { + change_default: false, + company_dependent: false, + manual: false, + views: {}, + searchable: true, + store: false, + readonly: true, + required: false, + sortable: false, + }, + params + ); + } + + /** + * This is pure hard-coded magic. Adds new fields to the widget form view. + */ + AbstractView.include({ + /** + * @private + * @param {Object} viewInfo + */ + _injectSaleStockFields: function(viewInfo) { + this._super.apply(this, arguments); + + const to_inject = { + immediately_usable_qty_today: _constructFakeFieldDef({ + depends: [ + "product_id", + "product_uom_qty", + ], + type: "float", + }), + }; + viewInfo.viewFields.order_line.views.form.fields = _.extend( + {}, + to_inject, + viewInfo.viewFields.order_line.views.form.fields + ); + + // Add fields to arch + const field_names = Object.keys(to_inject); + const $arch = $(viewInfo.viewFields.order_line.views.form.arch); + for (const index in field_names) { + var field_name = field_names[index]; + var $field = $arch.find("field[name='" + field_name + "']"); + if (!$field.length) { + $("", { + name: field_name, + invisible: 1, + modifiers: '{"invisible": true}', + }).appendTo($arch); + } + } + viewInfo.viewFields.order_line.views.form.arch = $arch[0].outerHTML; + }, + }); +}); diff --git a/web_widget_one2many_product_picker_sale_stock_available_info_popup/templates/assets.xml b/web_widget_one2many_product_picker_sale_stock_available_info_popup/templates/assets.xml new file mode 100644 index 000000000..8ba984d4b --- /dev/null +++ b/web_widget_one2many_product_picker_sale_stock_available_info_popup/templates/assets.xml @@ -0,0 +1,15 @@ + + +