Skip to content

Commit

Permalink
Merge pull request #33022 from barredterra/incoterms
Browse files Browse the repository at this point in the history
feat: Incoterms in buying and selling
  • Loading branch information
deepeshgarg007 authored Nov 27, 2022
2 parents 397a0e2 + 905a50c commit dedd722
Show file tree
Hide file tree
Showing 20 changed files with 347 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"tax_category",
"column_break_49",
"shipping_rule",
"incoterm",
"section_break_51",
"taxes",
"totals",
Expand Down Expand Up @@ -1534,13 +1535,19 @@
"oldfieldtype": "Section Break",
"options": "fa fa-file-text",
"print_hide": 1
},
{
"fieldname": "incoterm",
"fieldtype": "Link",
"label": "Incoterm",
"options": "Incoterm"
}
],
"icon": "fa fa-file-text",
"idx": 204,
"is_submittable": 1,
"links": [],
"modified": "2022-11-22 12:44:29.935567",
"modified": "2022-11-25 12:44:29.935567",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice",
Expand Down
9 changes: 8 additions & 1 deletion erpnext/accounts/doctype/sales_invoice/sales_invoice.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"taxes_and_charges",
"column_break_38",
"shipping_rule",
"incoterm",
"column_break_55",
"tax_category",
"section_break_40",
Expand Down Expand Up @@ -2114,6 +2115,12 @@
"label": "Repost Required",
"no_copy": 1,
"read_only": 1
},
{
"fieldname": "incoterm",
"fieldtype": "Link",
"label": "Incoterm",
"options": "Incoterm"
}
],
"icon": "fa fa-file-text",
Expand All @@ -2126,7 +2133,7 @@
"link_fieldname": "consolidated_invoice"
}
],
"modified": "2022-11-15 09:33:47.870616",
"modified": "2022-11-17 17:17:10.883487",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice",
Expand Down
9 changes: 8 additions & 1 deletion erpnext/buying/doctype/purchase_order/purchase_order.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"tax_category",
"column_break_50",
"shipping_rule",
"incoterm",
"section_break_52",
"taxes",
"totals",
Expand Down Expand Up @@ -1249,13 +1250,19 @@
{
"fieldname": "column_break_103",
"fieldtype": "Column Break"
},
{
"fieldname": "incoterm",
"fieldtype": "Link",
"label": "Incoterm",
"options": "Incoterm"
}
],
"icon": "fa fa-file-text",
"idx": 105,
"is_submittable": 1,
"links": [],
"modified": "2022-11-17 12:34:36.033363",
"modified": "2022-11-17 17:28:07.729943",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"sec_break_email_2",
"message_for_supplier",
"terms_section_break",
"incoterm",
"tc_name",
"terms",
"printing_settings",
Expand Down Expand Up @@ -271,13 +272,19 @@
"fieldname": "schedule_date",
"fieldtype": "Date",
"label": "Required Date"
},
{
"fieldname": "incoterm",
"fieldtype": "Link",
"label": "Incoterm",
"options": "Incoterm"
}
],
"icon": "fa fa-shopping-cart",
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2022-04-06 17:47:49.909000",
"modified": "2022-11-17 17:26:33.770993",
"modified_by": "Administrator",
"module": "Buying",
"name": "Request for Quotation",
Expand Down Expand Up @@ -345,5 +352,6 @@
"search_fields": "status, transaction_date",
"show_name_in_global_search": 1,
"sort_field": "modified",
"sort_order": "DESC"
}
"sort_order": "DESC",
"states": []
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"tax_category",
"column_break_36",
"shipping_rule",
"incoterm",
"section_break_38",
"taxes",
"totals",
Expand Down Expand Up @@ -823,14 +824,20 @@
{
"fieldname": "column_break_85",
"fieldtype": "Column Break"
},
{
"fieldname": "incoterm",
"fieldtype": "Link",
"label": "Incoterm",
"options": "Incoterm"
}
],
"icon": "fa fa-shopping-cart",
"idx": 29,
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2022-09-27 18:20:09.462037",
"modified": "2022-11-17 17:27:32.179686",
"modified_by": "Administrator",
"module": "Buying",
"name": "Supplier Quotation",
Expand Down
1 change: 1 addition & 0 deletions erpnext/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -317,3 +317,4 @@ erpnext.patches.v14_0.migrate_remarks_from_gl_to_payment_ledger
erpnext.patches.v13_0.update_schedule_type_in_loans
erpnext.patches.v14_0.create_accounting_dimensions_for_asset_capitalization
erpnext.patches.v14_0.update_partial_tds_fields
erpnext.patches.v14_0.create_incoterms_and_migrate_shipment
31 changes: 31 additions & 0 deletions erpnext/patches/v14_0/create_incoterms_and_migrate_shipment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
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()
9 changes: 8 additions & 1 deletion erpnext/selling/doctype/quotation/quotation.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"tax_category",
"column_break_34",
"shipping_rule",
"incoterm",
"section_break_36",
"taxes",
"section_break_39",
Expand Down Expand Up @@ -1052,13 +1053,19 @@
{
"fieldname": "column_break_108",
"fieldtype": "Column Break"
},
{
"fieldname": "incoterm",
"fieldtype": "Link",
"label": "Incoterm",
"options": "Incoterm"
}
],
"icon": "fa fa-shopping-cart",
"idx": 82,
"is_submittable": 1,
"links": [],
"modified": "2022-10-11 13:06:33.479650",
"modified": "2022-11-17 17:20:54.984348",
"modified_by": "Administrator",
"module": "Selling",
"name": "Quotation",
Expand Down
9 changes: 8 additions & 1 deletion erpnext/selling/doctype/sales_order/sales_order.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"tax_category",
"column_break_49",
"shipping_rule",
"incoterm",
"section_break_40",
"taxes",
"section_break_43",
Expand Down Expand Up @@ -1623,13 +1624,19 @@
{
"fieldname": "column_break_152",
"fieldtype": "Column Break"
},
{
"fieldname": "incoterm",
"fieldtype": "Link",
"label": "Incoterm",
"options": "Incoterm"
}
],
"icon": "fa fa-file-text",
"idx": 105,
"is_submittable": 1,
"links": [],
"modified": "2022-10-11 13:06:10.469796",
"modified": "2022-11-17 17:22:00.413878",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order",
Expand Down
Empty file.
8 changes: 8 additions & 0 deletions erpnext/setup/doctype/incoterm/incoterm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt

// frappe.ui.form.on("Incoterm", {
// refresh(frm) {

// },
// });
Loading

0 comments on commit dedd722

Please sign in to comment.