Browse Source

[FIX] Bug Fixed 'pos_product_creation'

pull/254/head
AjmalCybro 2 years ago
parent
commit
339fd6c44c
  1. 3
      pos_product_creation/controllers/main.py
  2. 7
      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

@ -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, 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'
@ -46,5 +46,6 @@ class PosProductCreation(http.Controller):
'uom_po_id': int(unit_measure),
'categ_id': int(product_categories),
'available_in_pos': True,
'barcode': barcode,
})

7
pos_product_creation/static/src/js/product_create_button.js

@ -30,11 +30,7 @@ odoo.define('owl_tutorials.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'),
@ -52,6 +48,7 @@ odoo.define('owl_tutorials.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

@ -10,7 +10,6 @@ odoo.define('pos_product_creation.product_create_popup', function(require) {
class ProductCreatePopup extends AbstractAwaitablePopup {
constructor() {
super(...arguments);
console.log(this.env.pos, '<<<<<<<<<<<<<<<')
this.state = useState({
typeValue: this.props.startingValue,
productValue: this.props.startingValue,
@ -26,12 +25,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

@ -75,6 +75,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