From fef53f6dbe7cdee6af4fed90285496bf739415d4 Mon Sep 17 00:00:00 2001 From: AjmalCybro Date: Tue, 11 Apr 2023 09:41:09 +0530 Subject: [PATCH] [FIX] Bug Fixed 'pos_product_creation' --- pos_product_creation/controllers/main.py | 3 ++- .../static/src/js/product_create_button.js | 15 +++------------ .../static/src/js/product_create_popup.js | 3 ++- .../static/src/xml/product_create_popup.xml | 9 +++++++++ 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/pos_product_creation/controllers/main.py b/pos_product_creation/controllers/main.py index 47706b415..c16bf3f26 100644 --- a/pos_product_creation/controllers/main.py +++ b/pos_product_creation/controllers/main.py @@ -26,7 +26,7 @@ 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, **kwargs): + def create_product(self, category, name, price, product_reference, unit_measure, product_categories, barcode, **kwargs): product_category = '' if category == 'Consumable': product_category = 'consu' @@ -45,5 +45,6 @@ class PosProductCreation(http.Controller): 'uom_po_id': int(unit_measure), 'pos_categ_id': int(product_categories), 'available_in_pos': True, + 'barcode': barcode, }) 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 a3bdadb8d..3a3fa4f39 100644 --- a/pos_product_creation/static/src/js/product_create_button.js +++ b/pos_product_creation/static/src/js/product_create_button.js @@ -28,11 +28,7 @@ odoo.define('pos_product_creation.product_create_button', function(require) { var product_price = payload[3]; var unit_measure = payload[4]; var product_categories = payload[5]; - console.log(product_category, 'product_category') - console.log(product_name, 'product_name') - console.log(product_reference, 'product_reference') - console.log(product_price, 'product_price') - console.log(unit_measure, 'unit_measure') + var barcode = payload[6]; if (!product_name){ return this.showPopup('ErrorPopup', { title: _('A Unit Of Measure Is Required'), @@ -43,12 +39,7 @@ odoo.define('pos_product_creation.product_create_button', function(require) { title: _('A Unit Of Measure Is Required'), }); } - console.log(product_category,'-product category in rpc') - console.log(product_name,'-product name in rpc') - console.log(product_price,'-product price in rpc') - console.log(product_reference,'-product product_reference in rpc') - console.log(unit_measure,'-product unit_measure in rpc') - console.log(product_categories,'-product product_categories in rpc') + ajax.jsonRpc('/create_product', 'call', { 'category': product_category, @@ -57,7 +48,7 @@ odoo.define('pos_product_creation.product_create_button', function(require) { '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 36aa8d9c5..7f0e87644 100644 --- a/pos_product_creation/static/src/js/product_create_popup.js +++ b/pos_product_creation/static/src/js/product_create_popup.js @@ -7,7 +7,6 @@ odoo.define('pos_product_creation.product_create_popup', function(require) { class ProductCreatePopup extends AbstractAwaitablePopup { setup() { super.setup(); - console.log(this.env.pos, '<<<<<<<<<<<<<<<') this.state = useState({ typeValue: this.props.startingValue, productValue: this.props.startingValue, @@ -23,12 +22,14 @@ odoo.define('pos_product_creation.product_create_popup', function(require) { var price = this.state.priceValue; var unit = this.state.unitValue; var product_category = this.state.categoryValue; + var barcode = this.state.barcodeValue; selected_vals.push(category); selected_vals.push(product); selected_vals.push(product_reference); selected_vals.push(price); selected_vals.push(unit); selected_vals.push(product_category); + selected_vals.push(barcode); return selected_vals } } 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 7e4695b97..10db1bfdc 100644 --- a/pos_product_creation/static/src/xml/product_create_popup.xml +++ b/pos_product_creation/static/src/xml/product_create_popup.xml @@ -80,6 +80,15 @@ +
+
+
+ Barcode +
+
+ +
+