brotherton-erpnext/erpnext/patches/v14_0/create_incoterms_and_migrate_shipment.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
723 B
Python
Raw Normal View History

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