feat: add doctype Incoterm

This commit is contained in:
barredterra 2022-11-17 22:14:30 +01:00
parent cbe8fa7fd2
commit 1a1bfc8db9
6 changed files with 170 additions and 0 deletions

View File

@ -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) {
// },
// });

View File

@ -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
}

View File

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

View File

@ -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
1 code title
2 EXW Ex Works
3 FCA Free Carrier
4 FAS Free Alongside Ship
5 FOB Free On Board
6 CPT Carriage Paid To
7 CIP Carriage and Insurance Paid to
8 CFR Cost and Freight
9 CIF Cost, Insurance and Freight
10 DAP Delivered At Place
11 DPU Delivered At Place Unloaded
12 DDP Delivered Duty Paid

View File

@ -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