-
Notifications
You must be signed in to change notification settings - Fork 2.3k
[ADD] barcode_scan: Added barcode scanning in SO/PO #849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 18.0
Are you sure you want to change the base?
Conversation
Added barcode scanning functionality in product_catalog In Sale Order and Purchase Order. After scanning the barcode of any product, if the product is available in The catalog, then the quantity will be updated by 1 unit, and if the product is not available, then the notification of warning will be shown to the user
barcode_scan/__manifest__.py
Outdated
'product', | ||
'barcodes', | ||
'sale_management', | ||
'web', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to add it in the depends.
[["order_id", "=", this.props.context.order_id], | ||
["product_id", "=", product.id]], | ||
["id", productQuantity, "product_id"] | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not { limit: 1 } ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If in any case there are more than 1 order line for any specific product, and if the limit: 1 is used, then the total quantity of the product will be shown wrong.
|
||
export class CustomProductCatalogKanbanModel extends ProductCatalogKanbanModel { | ||
async _loadUngroupedList(config) { | ||
const totalProducts = await this.orm.search(config.resModel, config.domain); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use meaningful variable names like ProductIds
barcode_scan/__manifest__.py
Outdated
'stock_barcode', | ||
'purchase' | ||
], | ||
'sequence': 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why sequence 1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sequence is used to add this module at the first position in AppList to manually upgrade it easily.
let productQuantity; | ||
if (this.resModel == "sale.order") { | ||
productQuantity = "product_uom_qty"; | ||
} else if (this.resModel == "purchase.order") { | ||
productQuantity = "product_qty"; | ||
} else { | ||
console.error("Model not found"); | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also improve this. Because If there is more model then we have to write more else if.It will reduce code readability.
d307ea8
to
71320ff
Compare
On barcode scanning of any product, the product is added to the first page on a catalog based on the quantity added to a sale or purchase order.
71320ff
to
54a4756
Compare
On scanning the barcode of any product, if the product is available in
The catalog, then the quantity will be updated by 1 unit, and if the product
is not available, then the notification of warning will be shown to the user and
The product is added to the first page of the catalog based on the quantity.