默认条形码命名法

*条形码术语*定义了条形码的识别和分类方式。扫描条形码时,条形码会与具有匹配模式的**首**条规则相关联。模式语法在 Odoo 的命名列表中使用正则表达式进行描述,如果条形码的前缀和/或长度与条形码规则中定义的前缀和/或长度匹配,Odoo 就能成功读取条形码。

例如,在 POS <…/…/…/sales/point_of_sale>`站点,欧洲商品编号(EAN)格式的产品重量条形码(以 `21 开头并有五位数字指定重量)用于称重产品并生成描述重量和价格的条形码。 21 和五位数重量是用于识别条形码的条形码模式,可进行自定义,以确保 Odoo 能正确解释企业的所有条形码。

注解

条形码也常用于 Odoo 的 库存条形码 应用程序。

Odoo 条形码 支持 EAN、通用产品代码(UPC)和 GS1 格式。本文档只关注 Odoo 中的默认规则和模式,其中使用 UPCEAN 编码。

重要

要在整个供应链中使用 UPCEAN 条形码唯一标识产品,它们 必须 从GS1 <https://www.gs1.org/standards/get-barcodes>`_购买。

在 Odoo 中,可定义自定义条形码模式以识别公司特定的条形码。如果条码仅在公司内部使用,则无需购买,例如在 示例 中,条形码以 EAN 格式书写。

配置

要使用默认术语,请导航至 库存应用程序 ‣ 配置 ‣ 设置。在 条形码 部分,勾选 条形码扫描仪 复选框。这样就会在数据库中安装 条形码 应用程序。

然后,在 条形码命名法 字段中,确保选择 默认命名法。然后,点击 保存

启用条形码设置,选择默认命名法。

安装 条形码 模块并选择 默认术语 后,可使用条码操作 UPCEAN,详情请参见 默认术语列表。默认情况下,Odoo 会自动处理 UPC/EAN 转换。

例如:产品重量条形码

为了更好地理解在 Odoo 中如何使用条形码命名法来识别产品,本例中使用了 EAN 格式的产品重量条形码,以允许 POS 业务自动打印条形码,并使用项目重量计算价格。

要为加权产品设置条形码,需要使用以下规则:

规则名称

条形码模式

Odoo 中的字段

Weighted Barcodes 3 Decimals

(21)….{NNDDD}

:guilabel:产品表单上的`条形码`字段

Example

To better understand the barcode pattern for weighted products, consider the barcode, 2112345000008:

  • 21: code that identifies this a barcode for weighted products.

  • 12345: five digits (denoted by ..... in the table above) that identify the product.

  • 00000: five digits (denoted by {NNDDD} in the table) representing the weight of the product. On the product form, the five weight values must be 00000. The first two digits are whole number values, and the last three digits are decimal values. For example, “13.5 grams” in the {NNDDD} format is 13500.

  • 8: check digit for 211234500000.

Together, these components make up a 13-character EAN - 13 barcode.

To configure the product barcode for Pasta Bolognese, the EAN barcode for weighted products, 2112345000008, is entered in the Barcode field on the product form (accessible by going to Inventory app ‣ Products ‣ Products, and selecting the desired product). In addition, the Unit of Measure is set to kg.

Barcode field on the product form.

Next, a customer’s bowl of pasta is weighed to be 1.5 kilograms. This generates a new barcode for the pasta, according to the weight: 211234501500, which has a check digit of 2. The new barcode is 2112345015002.

Generated barcode that includes a weight of 1.5 kg.

Ensure the products scan properly, by navigating to the Barcode app ‣ Operations. Next, click any operation type, such as Receipts. Then, click the New button to create a draft stock move. Scan the product weight barcode, such as 2112345015002, and if the intended product appears, the barcode setup is correct.

Show successfully scanned barcode.

创建规则

重要

Adding new rules is necessary for UPC and EAN formats that are not in Odoo’s default list, since barcodes cannot be read successfully if there are unknown fields.

While new rules can be created, Odoo fields do not auto-populate with information from these rules. Custom development is required for this functionality.

To create a rule, first enable developer mode. Then, navigate to Inventory app ‣ Configuration ‣ Barcode Nomenclatures, and select Default Nomenclature.

On this page, configure the following optional fields:

  • UPC/EAN Conversion: determines if a UPC/EAN barcode should be automatically converted when matching a rule with another encoding. Options include Always (the default option), Never, EAN-13 to UPC-A, and UPC-A to EAN-13.

  • Is GS1 Nomenclature: ensure this checkbox is not ticked, as the Default Nomenclature uses UPC and EAN encoding, not GS1 encoding.

默认命名法页面设置字段。

默认命名法 页面,点击表格底部的 添加行,弹出 创建规则 窗口,创建新规则。

内部使用 规则名称 字段来标识条形码所代表的内容。

:guilabel:`序列`字段表示规则的优先级,即值越小,规则在表格中出现的位置越靠前。

条形码 类型 字段表示系统可理解的不同信息分类(如 包装批次位置优惠券 等)。

编码 字段指定条形码使用的编码。只有当条形码使用该特定编码时,本规则 适用。可用的 编码 选项有:EAN-13EAN-8UPC-AGS1-28

条形码图案 字段表示系统如何识别包含产品信息的字母或数字序列。有时,当需要一定数量的数字时,会显示 . 的数字。N 代表整数位数,D 代表小数位数。

Example

1... 表示任何以 1 开头的四位数。 NNDD 表示带有两个小数点的两位数。例如,14.25 表示 1425。

填写信息后,点击 保存和新建 按钮保存规则,并立即开始创建另一条规则。或者,点击 保存并关闭 保存规则,并返回规则表。

默认术语清单

下表包含 Odoo 的 默认命名法 规则列表。条形码模式以正则表达式编写。

规则名称

类型

编码

条形码模式

Price Barcodes 2 Decimals

标价产品

EAN-13

23…..{NNNDD}

Discount Barcodes

折扣的产品

任意

22{NN}

Weight Barcodes 3 Decimals

称重的产品

EAN-13

21…..{NNDDD}

Customer Barcodes

客户端

任意

042

Coupon & Gift Card Barcodes

优惠券

任意

043|044

Cashier Barcodes

收银员

任意

041

位置条形码

位置

任意

414

包装条形码

服务包

任意

PACK

Lot barcodes

批次

任意

10

Magnetic Credit Card

信用卡

任意

%.*

产品条码

单位产品

任意

.*

注解

When the Barcode Pattern contains .*, it means it can contain any number or type of characters.