feat: add doctype Incoterm
This commit is contained in:
parent
cbe8fa7fd2
commit
1a1bfc8db9
0
erpnext/setup/doctype/incoterm/__init__.py
Normal file
0
erpnext/setup/doctype/incoterm/__init__.py
Normal file
8
erpnext/setup/doctype/incoterm/incoterm.js
Normal file
8
erpnext/setup/doctype/incoterm/incoterm.js
Normal 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) {
|
||||
|
||||
// },
|
||||
// });
|
117
erpnext/setup/doctype/incoterm/incoterm.json
Normal file
117
erpnext/setup/doctype/incoterm/incoterm.json
Normal 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
|
||||
}
|
24
erpnext/setup/doctype/incoterm/incoterm.py
Normal file
24
erpnext/setup/doctype/incoterm/incoterm.py
Normal 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()
|
12
erpnext/setup/doctype/incoterm/incoterms.csv
Normal file
12
erpnext/setup/doctype/incoterm/incoterms.csv
Normal 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
|
|
9
erpnext/setup/doctype/incoterm/test_incoterm.py
Normal file
9
erpnext/setup/doctype/incoterm/test_incoterm.py
Normal 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
|
Loading…
x
Reference in New Issue
Block a user