Skip to content

[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

Draft
wants to merge 2 commits into
base: 18.0
Choose a base branch
from

Conversation

hapt-odoo
Copy link

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.

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
@robodoo
Copy link

robodoo commented Jul 9, 2025

Pull request status dashboard

'product',
'barcodes',
'sale_management',
'web',

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"]
);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not { limit: 1 } ?

Copy link
Author

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

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

'stock_barcode',
'purchase'
],
'sequence': 1,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why sequence 1?

Copy link
Author

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.

Comment on lines 28 to 35
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;
}

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.

@hapt-odoo hapt-odoo force-pushed the 18.0-barcode-scan-hapt branch from d307ea8 to 71320ff Compare July 11, 2025 09:20
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.
@hapt-odoo hapt-odoo force-pushed the 18.0-barcode-scan-hapt branch from 71320ff to 54a4756 Compare July 11, 2025 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants