odoo如何自定义扫码中特殊处理,如金额、重量、折扣等

The Point of Sale only supports the EAN13 Barcode Encoding. Wich means that products are identified by a 13 digit number. These numbers can be used to encode much more than the ID of a product. Here is how it works.

Prefixes

The first two (from the left) or three numbers of the barcode are used to tell the point of sale what kind of data / action is associated with the barcode. Any barcode not matching any prefix is assumed to be a product identifiying barcode.

Actions

Weight

The barcodes starting by 21 and with the following format : 21 XXXXX WWWWW C can be used to encode a product with a specific weight or quantity. The quantity is encoded as a 5 digit number with three decimals in the WWWWWpart of the barcode. For the product to be identified it must have an EAN13 barcode matching the 21 XXXXX part of the barcode used to encode weight, the rest is ignored. For your information, C is the checksum used to prevent decoding errors and depends of the 12 previous digits.

Price

The barcodes starting by 23 and with the following format : 23 XXXXX PPPPP C can be used to encode a product with a specific price. It works exactly the same as the Weight barcodes except PPPPP encodes the prices as a 5 digit number with two decimals.

Discount

The barcodes starting by 22 and with the following format : 22 XXXXX DDDDD C can be used to encode a percentage discount that will be applied on the previously ordered product, if the identified product match the product encoded in the discount barcode. The discount is encoded as a 5 digit number with two decimals, and should be between 0.00 and 100.00. Discount barcodes are activated by default. If you use the Point of Sale in self checkout mode, a client with this knowledge could forge discount barcodes and cheat the system. So you may want to disable them in those cases.

Cashier

Barcodes starting with 041 will log any Employee with a matching EAN as the current cashier for the transaction. Cashier badges can also be used in Self-Checkout mode to go back to regular mode and solve any issues.

Client

Barcodes starting with 042 will log any user with a matching EAN as the current Client for the transaction.

Customizing Actions

If this doesn't work for you and you want to change the prefixes, or disable some kind of barcodes, you will have to change the javascript code of the point of sale by extending and overriding the parse_ean() method of the point_of_sale.BarcodeReader class located in addons/point_of_sale/static/src/js/devices.js

I advise you to do this in a new module.

 欧度智能: Odoo成功100%
Odoo专业开发实施,原广州尚鹏
  • Odoo项目100%海内外成功交付
  • Odoo官网下载第一,服务上千企业
  • Odoo官网销量第一的中国公司
  • 钉钉、企业微信认证服务商
  • 微软中国ChatGPT服务商,Ai中心
  • 百度千帆、阿里通义千问服务商
  • 十年专注Odoo,服务智能制造
  • Odoo中文应用商店,海量模块 
odoo如何自定义扫码中特殊处理,如金额、重量、折扣等
odooAi广州欧度, 欧度超管
2018年6月18日
2024年12月3日
4,170
评论:
0
标签
存档
登录 留下评论
使用pycharm搭建odoo18/17/16等全版本的开发调试环境