feat: create incoterms and migrate shipments

(cherry picked from commit d2563ee973)

# Conflicts:
#	erpnext/patches.txt
This commit is contained in:
barredterra
2022-11-17 22:16:43 +01:00
committed by Mergify
parent b7119318a6
commit 014896a595
3 changed files with 43 additions and 4 deletions

View File

@@ -316,6 +316,11 @@ erpnext.patches.v14_0.create_accounting_dimensions_in_subcontracting_doctypes
erpnext.patches.v14_0.fix_subcontracting_receipt_gl_entries
erpnext.patches.v14_0.migrate_remarks_from_gl_to_payment_ledger
erpnext.patches.v14_0.create_accounting_dimensions_for_asset_capitalization
<<<<<<< HEAD
erpnext.patches.v13_0.update_schedule_type_in_loans
erpnext.patches.v14_0.update_partial_tds_fields
=======
erpnext.patches.v14_0.update_tds_fields
erpnext.patches.v14_0.create_incoterms_and_migrate_shipment
>>>>>>> d2563ee973 (feat: create incoterms and migrate shipments)

View File

@@ -0,0 +1,32 @@
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 = [
# old_value: (code, title),
"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()

View File

@@ -412,9 +412,9 @@
},
{
"fieldname": "incoterm",
"fieldtype": "Select",
"fieldtype": "Link",
"label": "Incoterm",
"options": "EXW (Ex Works)\nFCA (Free Carrier)\nCPT (Carriage Paid To)\nCIP (Carriage and Insurance Paid to)\nDPU (Delivered At Place Unloaded)\nDAP (Delivered At Place)\nDDP (Delivered Duty Paid)"
"options": "Incoterm"
},
{
"fieldname": "shipment_delivery_note",
@@ -433,10 +433,11 @@
],
"is_submittable": 1,
"links": [],
"modified": "2021-04-13 17:14:18.181818",
"modified": "2022-11-17 17:23:27.025802",
"modified_by": "Administrator",
"module": "Stock",
"name": "Shipment",
"naming_rule": "Expression (old style)",
"owner": "Administrator",
"permissions": [
{
@@ -470,5 +471,6 @@
],
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"track_changes": 1
}
}