details: https://code.tryton.org/tryton/commit/81816f1873ba
branch: default
user: Cédric Krier <[email protected]>
date: Thu Oct 01 14:53:03 2026 +0200
description:
Trim trailing spaces in UNCL7161 codes
Closes #15135
diffstat:
modules/edocument_unece/product.py | 188 ++++++++++++++++++++----------------
1 files changed, 103 insertions(+), 85 deletions(-)
diffs (272 lines):
diff -r c68fa5b91d63 -r 81816f1873ba modules/edocument_unece/product.py
--- a/modules/edocument_unece/product.py Wed Sep 30 09:37:51 2026 +0200
+++ b/modules/edocument_unece/product.py Thu Oct 01 14:53:03 2026 +0200
@@ -1,8 +1,12 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
+
+from sql.functions import Trim
+
from trytond.model import fields
from trytond.pool import PoolMeta
from trytond.pyson import Eval
+from trytond.transaction import Transaction
UNCL5189 = [
('1', "Handling commission"),
@@ -224,12 +228,12 @@
('AEH', "Location differential"),
('AEI', "Aircraft refueling"),
('AEJ', "Fuel shipped into storage"),
- ('AG ', "Silver surcharge"),
- ('AJ ', "Adjustments"),
- ('AL ', "Aluminium surcharge"),
- ('AM ', "Additional material"),
- ('AU ', "Authentication charge"),
- ('CA ', "Cataloguing services"),
+ ('AG', "Silver surcharge"),
+ ('AJ', "Adjustments"),
+ ('AL', "Aluminium surcharge"),
+ ('AM', "Additional material"),
+ ('AU', "Authentication charge"),
+ ('CA', "Cataloguing services"),
('CAA', "Cancellation charge"),
('CAB', "Cartage"),
('CAC', "Cash discount"),
@@ -241,86 +245,86 @@
('CAI', "Cutting charge"),
('CAJ', "Consular costs"),
('CAK', "Customer collection rebate"),
- ('CB ', "Commission"),
- ('CD ', "Car loading"),
- ('CG ', "Cleaning charge"),
- ('CK ', "COD charge"),
- ('CL ', "Contract allowance"),
- ('CO ', "Cents off"),
- ('CP ', "Competitive price"),
- ('CS ', "Cigarette stamping"),
- ('CT ', "Count and recount"),
- ('CW ', "Container allowance"),
- ('DA ', "Defective allowance"),
+ ('CB', "Commission"),
+ ('CD', "Car loading"),
+ ('CG', "Cleaning charge"),
+ ('CK', "COD charge"),
+ ('CL', "Contract allowance"),
+ ('CO', "Cents off"),
+ ('CP', "Competitive price"),
+ ('CS', "Cigarette stamping"),
+ ('CT', "Count and recount"),
+ ('CW', "Container allowance"),
+ ('DA', "Defective allowance"),
('DAA', "Deficit freight"),
('DAB', "Layout/design"),
('DAD', "Driver assigned unloading"),
('DAE', "Distributor discount/allowance"),
- ('DI ', "Discount"),
- ('DL ', "Delivery"),
- ('DM ', "Demurrage"),
+ ('DI', "Discount"),
+ ('DL', "Delivery"),
+ ('DM', "Demurrage"),
('EAA', "Early buy allowance"),
('EAB', "Early payment allowance"),
- ('EG ', "Engraving"),
- ('EP ', "Expediting premium"),
- ('ER ', "Exchange rate guarantee charge"),
- ('EX ', "Export shipping charge"),
- ('FA ', "Freight allowance"),
+ ('EG', "Engraving"),
+ ('EP', "Expediting premium"),
+ ('ER', "Exchange rate guarantee charge"),
+ ('EX', "Export shipping charge"),
+ ('FA', "Freight allowance"),
('FAA', "Fabrication charge"),
('FAB', "Freight equalization"),
('FAC', "Freight surcharge"),
- ('FC ', "Freight charge"),
- ('FG ', "Free goods"),
- ('FH ', "Filling/handling charge"),
- ('FI ', "Finance charge"),
- ('FN ', "Special finish charge"),
- ('FR ', "Flat rate"),
+ ('FC', "Freight charge"),
+ ('FG', "Free goods"),
+ ('FH', "Filling/handling charge"),
+ ('FI', "Finance charge"),
+ ('FN', "Special finish charge"),
+ ('FR', "Flat rate"),
('GAA', "Grinding"),
('HAA', "Hose charge"),
- ('HD ', "Handling"),
- ('HH ', "Hoisting and hauling"),
- ('IA ', "Invoice adjustment"),
+ ('HD', "Handling"),
+ ('HH', "Hoisting and hauling"),
+ ('IA', "Invoice adjustment"),
('IAA', "Installation"),
('IAB', "Installation and warranty"),
- ('ID ', "Inside delivery charge"),
- ('IF ', "Inspection fee"),
- ('IN ', "Insurance"),
- ('IR ', "Installation and training"),
- ('IS ', "Invoice services"),
- ('KO ', "Koshering"),
- ('L1 ', "Shipper load, carrier count"),
- ('LA ', "Labelling"),
+ ('ID', "Inside delivery charge"),
+ ('IF', "Inspection fee"),
+ ('IN', "Insurance"),
+ ('IR', "Installation and training"),
+ ('IS', "Invoice services"),
+ ('KO', "Koshering"),
+ ('L1', "Shipper load, carrier count"),
+ ('LA', "Labelling"),
('LAA', "Labour charge"),
('LAB', "Labour (repair and return orders)"),
('LAC', "License fee"),
- ('LF ', "Legalisation fee"),
- ('LS ', "Local sales tax"),
- ('MA ', "Material allowance (special materials)"),
+ ('LF', "Legalisation fee"),
+ ('LS', "Local sales tax"),
+ ('MA', "Material allowance (special materials)"),
('MAA', "Mileage or travel"),
('MAB', "Mileage fee (for repair and return)"),
('MAC', "Minimum order/minimum billing charge"),
('MAD', "Monthly rental"),
('MAE', "Mounting"),
- ('MC ', "Material surcharge (special materials)"),
- ('MI ', "Mail invoice"),
- ('ML ', "Mail invoice to each location"),
+ ('MC', "Material surcharge (special materials)"),
+ ('MI', "Mail invoice"),
+ ('ML', "Mail invoice to each location"),
('NAA', "Non-returnable containers"),
- ('OA ', "Outside cable connectors"),
+ ('OA', "Outside cable connectors"),
('OAA', "Overtime loading"),
- ('PA ', "Pack invoice with shipment"),
+ ('PA', "Pack invoice with shipment"),
('PAA', "Phosphatizing (steel treatment)"),
('PAB', "Postage charge"),
('PAC', "Premium charge"),
('PAD', "Promotional allowance"),
('PAE', "Promotional discount"),
- ('PC ', "Packing"),
- ('PD ', "Palladium surcharge"),
- ('PI ', "Pick-up allowance"),
- ('PL ', "Palletizing"),
- ('PN ', "Pallet charge"),
- ('PO ', "Per order charge"),
+ ('PC', "Packing"),
+ ('PD', "Palladium surcharge"),
+ ('PI', "Pick-up allowance"),
+ ('PL', "Palletizing"),
+ ('PN', "Pallet charge"),
+ ('PO', "Per order charge"),
('QAA', "Quantity surcharge"),
- ('QD ', "Quantity discount"),
+ ('QD', "Quantity discount"),
('RAA', "Rebate"),
('RAB', "Repack charge"),
('RAC', "Repair"),
@@ -329,13 +333,13 @@
('RAF', "Restocking charge"),
('RAG', "Roll rebate"),
('RAH', "Road/rail tanker rebate"),
- ('RE ', "Re-delivery charge"),
- ('RF ', "Refurbishing charge"),
- ('RH ', "Rail wagon hire"),
- ('RO ', "Roe allowance/charge"),
- ('RP ', "Repair charge"),
- ('RV ', "Freight charge/costs of loading"),
- ('SA ', "Salvage"),
+ ('RE', "Re-delivery charge"),
+ ('RF', "Refurbishing charge"),
+ ('RH', "Rail wagon hire"),
+ ('RO', "Roe allowance/charge"),
+ ('RP', "Repair charge"),
+ ('RV', "Freight charge/costs of loading"),
+ ('SA', "Salvage"),
('SAA', "Shipping and handling"),
('SAB', "Special allowance"),
('SAC', "Special credit"),
@@ -346,35 +350,35 @@
('SAH', "Surcharge (percentage)"),
('SAI', "Shipper load, consignee unload"),
('SAJ', "Small packages charge"),
- ('SC ', "Surcharge"),
- ('SD ', "Shrinkage allowance"),
- ('SF ', "Special rebate"),
- ('SG ', "Shrink-wrap charge"),
- ('SH ', "Special handling service"),
- ('SM ', "Special finish"),
- ('ST ', "Stamp duties"),
- ('SU ', "Set-up"),
- ('SZ ', "Steel surcharge"),
+ ('SC', "Surcharge"),
+ ('SD', "Shrinkage allowance"),
+ ('SF', "Special rebate"),
+ ('SG', "Shrink-wrap charge"),
+ ('SH', "Special handling service"),
+ ('SM', "Special finish"),
+ ('ST', "Stamp duties"),
+ ('SU', "Set-up"),
+ ('SZ', "Steel surcharge"),
('TAA', "Telephone charge"),
('TAB', "Tank rental"),
('TAC', "Testing charge"),
('TAD', "Testing allowance"),
('TAE', "Truckload discount"),
- ('TD ', "Trade discount"),
- ('TS ', "State tax"),
- ('TT ', "Transportation - third party billing"),
- ('TV ', "Transportation - vendor provided"),
- ('TX ', "Tax"),
- ('TZ ', "Temporary allowance"),
- ('UM ', "Unsaleable merchandise allowance"),
- ('V1 ', "Drop yard"),
- ('V2 ', "Drop dock"),
+ ('TD', "Trade discount"),
+ ('TS', "State tax"),
+ ('TT', "Transportation - third party billing"),
+ ('TV', "Transportation - vendor provided"),
+ ('TX', "Tax"),
+ ('TZ', "Temporary allowance"),
+ ('UM', "Unsaleable merchandise allowance"),
+ ('V1', "Drop yard"),
+ ('V2', "Drop dock"),
('VAA', "Vendor freight"),
('VAB', "Volume discount"),
- ('VL ', "Vehicle load allowance"),
- ('WH ', "Warehousing"),
+ ('VL', "Vehicle load allowance"),
+ ('WH', "Warehousing"),
('XAA', "Combine all same day shipment"),
- ('YY ', "Split pickup"),
+ ('YY', "Split pickup"),
('ZZZ', "Mutually defined"),
]
@@ -410,6 +414,20 @@
help="Standard code of "
"the United Nations Economic Commission for Europe.")
+ @classmethod
+ def __register__(cls, module):
+ cursor = Transaction().connection.cursor()
+ table = cls.__table__()
+
+ super().__register__(module)
+
+ # Migration from 8.0: strip UNCL7161 code
+ cursor.execute(*table.update(
+ [table.unece_special_service_code],
+ [Trim(table.unece_special_service_code)],
+ where=table.unece_special_service_code
+ != Trim(table.unece_special_service_code)))
+
class Product(metaclass=PoolMeta):
__name__ = 'product.product'