Browse Source

Apr 19 : [UPDT] 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
478672cf58
  1. 40
      pos_product_creation/README.rst
  2. 5
      pos_product_creation/__manifest__.py
  3. 4
      pos_product_creation/controllers/main.py
  4. 6
      pos_product_creation/doc/RELEASE_NOTES.md
  5. BIN
      pos_product_creation/static/description/assets/screenshots/hero.gif
  6. 4
      pos_product_creation/static/description/index.html
  7. 62
      pos_product_creation/static/src/js/product_create_button.js
  8. 5
      pos_product_creation/static/src/js/product_create_popup.js
  9. 10
      pos_product_creation/static/src/xml/product_create_popup.xml
  10. 9
      pos_product_creation/views/assets.xml

40
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 <https://cybrosys.com/>`__
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 <https://cybrosys.com/>`__
Further information
===================
HTML Description: `<static/description/index.html>`__

5
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',

4
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),

6
pos_product_creation/doc/RELEASE_NOTES.md

@ -0,0 +1,6 @@
## Module <pos_product_creation>
#### 13.04.2023
#### Version 16.0.1.0.1
#### UPDATE
Updated the product image field.

BIN
pos_product_creation/static/description/assets/screenshots/hero.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 KiB

After

Width:  |  Height:  |  Size: 217 KiB

4
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 <strong>"Create Product"</strong>, 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.</p>
</div>
@ -132,7 +132,7 @@
Enter the details of products.</h4>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
Enter the details of products right from the POS.</p>
Enter the details of products right from the POS.Only .jpeg format image is supported as the product image.</p>
<img src="assets/screenshots/1.png" class="img-responsive img-thumbnail border" width="100%"
height="auto" />

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

5
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);

10
pos_product_creation/static/src/xml/product_create_popup.xml

@ -18,6 +18,15 @@
<input class="name" type="text" t-model="state.productValue" required=""/>
</div>
</div>
<br/>
<div class="row">
<div>
<span>Product Image</span>
</div>
<div style="margin-top: 10px;">
<input class="image" type="file" id="product-image" required=""/>
</div>
</div>
<br/>
<div class="row">
<div>
@ -80,7 +89,6 @@
</select>
</div>
</div>
<br/>
<div class="row">
<div>
<span>Barcode</span>

9
pos_product_creation/views/assets.xml

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="assets" inherit_id="point_of_sale.assets">
<xpath expr="." position="inside">
<script type="text/javascript" src="/pos_product_creation/static/src/js/product_create_popup.js"></script>
<script type="text/javascript" src="/pos_product_creation/static/src/js/product_create_button.js"></script>
</xpath>
</template>
</odoo>
Loading…
Cancel
Save