Browse Source

[FIX] Bug Fixed 'pos_product_creation'

dependabot/npm_and_yarn/odoo_website_helpdesk/static/src/cdn/minimist-1.2.8
AjmalCybro 2 years ago
parent
commit
fef53f6dbe
  1. 3
      pos_product_creation/controllers/main.py
  2. 15
      pos_product_creation/static/src/js/product_create_button.js
  3. 3
      pos_product_creation/static/src/js/product_create_popup.js
  4. 9
      pos_product_creation/static/src/xml/product_create_popup.xml

3
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,
})

15
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) {});
}
}

3
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
}
}

9
pos_product_creation/static/src/xml/product_create_popup.xml

@ -80,6 +80,15 @@
</select>
</div>
</div>
<br/>
<div class="row">
<div>
<span>Barcode</span>
</div>
<div style="margin-top: 10px;">
<input class="barcode" type="text" t-model="state.barcodeValue"/>
</div>
</div>
</main>
<footer class="footer">
<div style="color: white;background: #6EC89B;border-color: transparent;" class="button confirm"

Loading…
Cancel
Save