diff --git a/pos_product_creation/README.rst b/pos_product_creation/README.rst new file mode 100644 index 000000000..3b14388f0 --- /dev/null +++ b/pos_product_creation/README.rst @@ -0,0 +1,40 @@ +Create Products From POS +================================= +This module helps you create products directly from POS. + +Configuration +============= +* No additional configurations needed + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +* Developers: Cybrosys Techno Solutions odoo@cybrosys.com + + +Contacts +-------- +* Mail Contact : odoo@cybrosys.com +* Website : https://cybrosys.com + +Bug Tracker +----------- +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Maintainer +========== +.. image:: https://cybrosys.com/images/logo.png + :target: https://cybrosys.com + +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit `Our Website `__ + +Further information +=================== +HTML Description: ``__ + + diff --git a/pos_product_creation/__manifest__.py b/pos_product_creation/__manifest__.py index 22cf8d7dd..9df19d16a 100644 --- a/pos_product_creation/__manifest__.py +++ b/pos_product_creation/__manifest__.py @@ -22,7 +22,7 @@ { 'name': 'Create Products From POS', - 'version': '14.0.1.0.0', + 'version': '14.0.1.0.1', 'category': 'Point of Sale', 'summary': 'Create Products From POS Interface', 'author': 'Cybrosys Techno Solutions', diff --git a/pos_product_creation/controllers/main.py b/pos_product_creation/controllers/main.py index 5b6492440..6ea007aa3 100644 --- a/pos_product_creation/controllers/main.py +++ b/pos_product_creation/controllers/main.py @@ -27,7 +27,7 @@ from odoo.http import request class PosProductCreation(http.Controller): @http.route('/create_product', type="json", auth="none") - def create_product(self, category, name, price, product_reference, + def create_product(self, category, image, name, price, product_reference, unit_measure, product_categories, barcode, **kwargs): product_category = '' if category == 'Consumable': @@ -40,6 +40,7 @@ class PosProductCreation(http.Controller): product_category = '' request.env['product.template'].sudo().create({ 'name': name, + 'image_1920': image, 'type': product_category, 'default_code': product_reference, 'list_price': float(price), diff --git a/pos_product_creation/doc/RELEASE_NOTES.md b/pos_product_creation/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..9afecf447 --- /dev/null +++ b/pos_product_creation/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 13.04.2023 +#### Version 14.0.1.0.1 +#### UPDATE +Updated the product image field. \ No newline at end of file diff --git a/pos_product_creation/static/description/images/1pos.png b/pos_product_creation/static/description/images/1pos.png index d15561119..fec6f6204 100644 Binary files a/pos_product_creation/static/description/images/1pos.png and b/pos_product_creation/static/description/images/1pos.png differ diff --git a/pos_product_creation/static/description/images/2pos.png b/pos_product_creation/static/description/images/2pos.png index 67f2ef85f..7cac19d07 100644 Binary files a/pos_product_creation/static/description/images/2pos.png and b/pos_product_creation/static/description/images/2pos.png differ diff --git a/pos_product_creation/static/description/images/hero.gif b/pos_product_creation/static/description/images/hero.gif new file mode 100644 index 000000000..0c9e7a161 Binary files /dev/null and b/pos_product_creation/static/description/images/hero.gif differ diff --git a/pos_product_creation/static/description/images/hero.png b/pos_product_creation/static/description/images/hero.png deleted file mode 100644 index 26fda032b..000000000 Binary files a/pos_product_creation/static/description/images/hero.png and /dev/null differ diff --git a/pos_product_creation/static/description/index.html b/pos_product_creation/static/description/index.html index 0a3a0c354..1f0f6ea79 100644 --- a/pos_product_creation/static/description/index.html +++ b/pos_product_creation/static/description/index.html @@ -32,7 +32,7 @@ style="color: #212529 !important; font-size: 1.5rem !important; letter-spacing: 1px !important;"> Create Products From POS

- + @@ -47,7 +47,7 @@

The module provisions the end user to create products directly from Point of Sale. The new button "Create Product", shall enable the end user to add details such as - product name, internal reference, price, type, category and more from POS. Upon clicking the + product name, product image, internal reference, price, type, category, barcode and more from POS. Upon clicking the confirm button, a new product shall be created based on provided details.

@@ -98,7 +98,7 @@

- Enter the details of products right from the POS. + Enter the details of products right from the POS. Only .jpeg format image is supported as the product image.

diff --git a/pos_product_creation/static/src/js/product_create_button.js b/pos_product_creation/static/src/js/product_create_button.js index 835596423..e83214150 100644 --- a/pos_product_creation/static/src/js/product_create_button.js +++ b/pos_product_creation/static/src/js/product_create_button.js @@ -24,32 +24,41 @@ odoo.define('owl_tutorials.product_create_button', function(require) { body: this.env._t('You can Create The product.'), }); if (confirmed) { - var product_category = payload[0]; - var product_name = payload[1]; - var product_reference = payload[2]; - var product_price = payload[3]; - var unit_measure = payload[4]; - var product_categories = payload[5]; - var barcode = payload[6]; - if (!product_name){ - return this.showPopup('ErrorPopup', { - title: _('A Unit Of Measure Is Required'), - }); + var product_image; + var image = $('#product-image')[0].files[0] + var reader = new FileReader(); + await reader.readAsDataURL(image); + reader.onload = function(){ + product_image = reader.result + var image = product_image.slice(23); + var product_category = payload[0]; + var product_name = payload[1]; + var product_reference = payload[3]; + var product_price = payload[4]; + var unit_measure = payload[5]; + var product_categories = payload[6]; + var barcode = payload[7]; + if (!product_name){ + return this.showPopup('ErrorPopup', { + title: _('A Unit Of Measure Is Required'), + }); + } + if (!unit_measure){ + return this.showPopup('ErrorPopup', { + title: _('A Unit Of Measure Is Required'), + }); + } + ajax.jsonRpc('/create_product', 'call', { + 'category': product_category, + 'image': image, + 'name': product_name, + 'price': product_price, + 'product_reference': product_reference, + 'unit_measure': unit_measure, + 'product_categories': product_categories, + 'barcode': barcode, + }).then(function(response) {}); } - if (!unit_measure){ - return this.showPopup('ErrorPopup', { - title: _('A Unit Of Measure Is Required'), - }); - } - ajax.jsonRpc('/create_product', 'call', { - 'category': product_category, - 'name': product_name, - 'price': product_price, - 'product_reference': product_reference, - 'unit_measure': unit_measure, - 'product_categories': product_categories, - 'barcode': barcode, - }).then(function(response) {}); } } } diff --git a/pos_product_creation/static/src/js/product_create_popup.js b/pos_product_creation/static/src/js/product_create_popup.js index 42e9e0131..a9bf9acf4 100644 --- a/pos_product_creation/static/src/js/product_create_popup.js +++ b/pos_product_creation/static/src/js/product_create_popup.js @@ -15,13 +15,15 @@ odoo.define('pos_product_creation.product_create_popup', function(require) { typeValue: this.props.startingValue, productValue: this.props.startingValue, priceValue: this.props.priceValue, - productRef: this.props.startingValue + productRef: this.props.startingValue, + productImg: this.props.productImage, }); } getPayload() { var selected_vals = []; var category = this.state.typeValue; var product = this.state.productValue; + var image = this.state.productImg; var product_reference = this.state.productRef; var price = this.state.priceValue; var unit = this.state.unitValue; @@ -29,6 +31,7 @@ odoo.define('pos_product_creation.product_create_popup', function(require) { var barcode = this.state.barcodeValue; selected_vals.push(category); selected_vals.push(product); + selected_vals.push(image); selected_vals.push(product_reference); selected_vals.push(price); selected_vals.push(unit); diff --git a/pos_product_creation/static/src/xml/product_create_popup.xml b/pos_product_creation/static/src/xml/product_create_popup.xml index 031f2f1bb..e0e4a69c9 100644 --- a/pos_product_creation/static/src/xml/product_create_popup.xml +++ b/pos_product_creation/static/src/xml/product_create_popup.xml @@ -18,6 +18,15 @@ +
+
+
+ Product Image +
+
+ +
+