Skip to content

Commit

Permalink
feat: add doctype Incoterm
Browse files Browse the repository at this point in the history
(cherry picked from commit 1a1bfc8)
  • Loading branch information
barredterra authored and mergify[bot] committed Nov 27, 2022
1 parent 956b052 commit b711931
Show file tree
Hide file tree
Showing 6 changed files with 170 additions and 0 deletions.
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) {

// },
// });
117 changes: 117 additions & 0 deletions erpnext/setup/doctype/incoterm/incoterm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
{
"actions": [],
"allow_rename": 1,
"autoname": "field:code",
"creation": "2022-11-17 15:17:34.717467",
"default_view": "List",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"code",
"title",
"description"
],
"fields": [
{
"fieldname": "code",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Code",
"length": 3,
"reqd": 1,
"unique": 1
},
{
"fieldname": "title",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Title",
"reqd": 1
},
{
"fieldname": "description",
"fieldtype": "Long Text",
"label": "Description"
}
],
"links": [],
"modified": "2022-11-17 17:31:49.113954",
"modified_by": "Administrator",
"module": "Setup",
"name": "Incoterm",
"naming_rule": "By fieldname",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Accounts Manager",
"share": 1,
"write": 1
},
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Sales Manager",
"share": 1,
"write": 1
},
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Purchase Manager",
"share": 1,
"write": 1
},
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Stock Manager",
"share": 1,
"write": 1
},
{
"read": 1,
"role": "Purchase User"
},
{
"read": 1,
"role": "Sales User"
},
{
"read": 1,
"role": "Accounts User"
},
{
"read": 1,
"role": "Stock User"
}
],
"show_title_field_in_link": 1,
"sort_field": "name",
"sort_order": "ASC",
"states": [],
"title_field": "title",
"translated_doctype": 1
}
24 changes: 24 additions & 0 deletions erpnext/setup/doctype/incoterm/incoterm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt

import frappe
from frappe.model.document import Document


class Incoterm(Document):
pass


def create_incoterms():
"""Create Incoterm records from incoterms.csv."""
import os
from csv import DictReader

with open(os.path.join(os.path.dirname(__file__), "incoterms.csv"), "r") as f:
for incoterm in DictReader(f):
if frappe.db.exists("Incoterm", incoterm["code"]):
continue

doc = frappe.new_doc("Incoterm")
doc.update(incoterm)
doc.save()
12 changes: 12 additions & 0 deletions erpnext/setup/doctype/incoterm/incoterms.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
code,title
EXW,Ex Works
FCA,Free Carrier
FAS,Free Alongside Ship
FOB,Free On Board
CPT,Carriage Paid To
CIP,Carriage and Insurance Paid to
CFR,Cost and Freight
CIF,"Cost, Insurance and Freight"
DAP,Delivered At Place
DPU,Delivered At Place Unloaded
DDP,Delivered Duty Paid
9 changes: 9 additions & 0 deletions erpnext/setup/doctype/incoterm/test_incoterm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt

# import frappe
from frappe.tests.utils import FrappeTestCase


class TestIncoterm(FrappeTestCase):
pass

0 comments on commit b711931

Please sign in to comment.