Files
schuetz3-erpnext/erpnext/patches/v14_0/create_incoterms_and_migrate_shipment.py
Raffael Meyer 978924a7e4 fix: remove obsolete comment
(cherry picked from commit 491857b3c8)
2022-11-27 15:24:20 +00:00

32 lines
723 B
Python

import frappe
from erpnext.setup.doctype.incoterm.incoterm import create_incoterms
def execute():
create_incoterms()
migrate_shipments()
def migrate_shipments():
if not frappe.db.count("Shipment"):
return
OLD_VALUES = [
"EXW (Ex Works)",
"FCA (Free Carrier)",
"FOB (Free On Board)",
"FAS (Free Alongside Ship)",
"CPT (Carriage Paid To)",
"CIP (Carriage and Insurance Paid to)",
"CFR (Cost and Freight)",
"DPU (Delivered At Place Unloaded)",
"DAP (Delivered At Place)",
"DDP (Delivered Duty Paid)",
]
shipment = frappe.qb.DocType("Shipment")
for old_value in OLD_VALUES:
frappe.qb.update(shipment).set(shipment.incoterm, old_value[:3]).where(
shipment.incoterm == old_value
).run()