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 51d65c1a9..dca14f783 100644
--- a/pos_product_creation/__manifest__.py
+++ b/pos_product_creation/__manifest__.py
@@ -22,7 +22,7 @@
{
'name': 'Create Products From POS',
- 'version': '16.0.1.0.0',
+ 'version': '16.0.1.0.1',
'category': 'Point of Sale',
'summary': 'Create Products From POS Interface',
'author': 'Cybrosys Techno Solutions',
@@ -30,8 +30,7 @@
'maintainer': 'Cybrosys Techno Solutions',
'website': 'https://www.cybrosys.com',
'depends': ['point_of_sale'],
- 'data': [
- ],
+ 'data': [],
'assets': {
'point_of_sale.assets': [
'pos_product_creation/static/src/js/product_create_popup.js',
diff --git a/pos_product_creation/controllers/main.py b/pos_product_creation/controllers/main.py
index c16bf3f26..e4c3a6c6c 100644
--- a/pos_product_creation/controllers/main.py
+++ b/pos_product_creation/controllers/main.py
@@ -26,7 +26,8 @@ from odoo.http import request
class PosProductCreation(http.Controller):
@http.route('/create_product', type="json", auth="user")
- def create_product(self, category, name, price, product_reference, unit_measure, product_categories, barcode, **kwargs):
+ def create_product(self, category, image, name, price, product_reference, unit_measure,
+ product_categories, barcode, **kwargs):
product_category = ''
if category == 'Consumable':
product_category = 'consu'
@@ -38,6 +39,7 @@ class PosProductCreation(http.Controller):
product_category = ''
res = 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..dfd0ea72f
--- /dev/null
+++ b/pos_product_creation/doc/RELEASE_NOTES.md
@@ -0,0 +1,6 @@
+## Module
+
+#### 13.04.2023
+#### Version 16.0.1.0.1
+#### UPDATE
+Updated the product image field.
\ No newline at end of file
diff --git a/pos_product_creation/static/description/assets/screenshots/hero.gif b/pos_product_creation/static/description/assets/screenshots/hero.gif
index d78902d6e..7ba0b59e3 100644
Binary files a/pos_product_creation/static/description/assets/screenshots/hero.gif and b/pos_product_creation/static/description/assets/screenshots/hero.gif differ
diff --git a/pos_product_creation/static/description/index.html b/pos_product_creation/static/description/index.html
index b005d314a..d86ae97bd 100644
--- a/pos_product_creation/static/description/index.html
+++ b/pos_product_creation/static/description/index.html
@@ -92,7 +92,7 @@
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important; line-height: 30px !important;">
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.
@@ -132,7 +132,7 @@
Enter the details of products.
- 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 3a3fa4f39..c28188d69 100644
--- a/pos_product_creation/static/src/js/product_create_button.js
+++ b/pos_product_creation/static/src/js/product_create_button.js
@@ -6,7 +6,6 @@ odoo.define('pos_product_creation.product_create_button', function(require) {
const Registries = require('point_of_sale.Registries');
const ajax = require('web.ajax');
-
class ProductCreateButton extends PosComponent {
setup() {
super.setup();
@@ -22,34 +21,43 @@ odoo.define('pos_product_creation.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'),
- });
- }
- if (!unit_measure){
- 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 self.showPopup('ErrorPopup', {
+ title: _('Product Name Is Required'),
+ });
+ }
+ if (!unit_measure){
+ return self.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,
+ })
+ }
- 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 7f0e87644..186d60ce1 100644
--- a/pos_product_creation/static/src/js/product_create_popup.js
+++ b/pos_product_creation/static/src/js/product_create_popup.js
@@ -11,13 +11,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;
@@ -25,6 +27,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 10db1bfdc..e8196db8d 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
+
+
+
+
+
-
Barcode
diff --git a/pos_product_creation/views/assets.xml b/pos_product_creation/views/assets.xml
deleted file mode 100644
index ced8a5a22..000000000
--- a/pos_product_creation/views/assets.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file