feat: create incoterms and migrate shipments
This commit is contained in:
parent
1a1bfc8db9
commit
d2563ee973
@ -318,3 +318,4 @@ erpnext.patches.v14_0.migrate_remarks_from_gl_to_payment_ledger
|
|||||||
erpnext.patches.v13_0.update_schedule_type_in_loans
|
erpnext.patches.v13_0.update_schedule_type_in_loans
|
||||||
erpnext.patches.v14_0.create_accounting_dimensions_for_asset_capitalization
|
erpnext.patches.v14_0.create_accounting_dimensions_for_asset_capitalization
|
||||||
erpnext.patches.v14_0.update_tds_fields
|
erpnext.patches.v14_0.update_tds_fields
|
||||||
|
erpnext.patches.v14_0.create_incoterms_and_migrate_shipment
|
||||||
|
|||||||
@ -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()
|
||||||
@ -412,9 +412,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "incoterm",
|
"fieldname": "incoterm",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Link",
|
||||||
"label": "Incoterm",
|
"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",
|
"fieldname": "shipment_delivery_note",
|
||||||
@ -433,10 +433,11 @@
|
|||||||
],
|
],
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-04-13 17:14:18.181818",
|
"modified": "2022-11-17 17:23:27.025802",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Shipment",
|
"name": "Shipment",
|
||||||
|
"naming_rule": "Expression (old style)",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
{
|
{
|
||||||
@ -470,5 +471,6 @@
|
|||||||
],
|
],
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
"sort_order": "DESC",
|
"sort_order": "DESC",
|
||||||
|
"states": [],
|
||||||
"track_changes": 1
|
"track_changes": 1
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user