mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-27 17:04:47 +00:00
feat(tally): Create chart of accounts from tally master data
This commit is contained in:
@@ -328,6 +328,38 @@
|
|||||||
"precision": "",
|
"precision": "",
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
"print_hide_if_no_value": 0,
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 1,
|
||||||
|
"remember_last_selected_value": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"translatable": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_in_quick_entry": 0,
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
|
"fieldname": "chart_of_accounts",
|
||||||
|
"fieldtype": "Attach",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"in_standard_filter": 0,
|
||||||
|
"label": "Chart of Accounts",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"remember_last_selected_value": 0,
|
"remember_last_selected_value": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
@@ -348,7 +380,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2019-03-01 15:02:47.992385",
|
"modified": "2019-03-01 20:58:04.320605",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "ERPNext Integrations",
|
"module": "ERPNext Integrations",
|
||||||
"name": "Tally Migration",
|
"name": "Tally Migration",
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import zipfile
|
|||||||
import frappe
|
import frappe
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
from bs4 import BeautifulSoup as bs
|
from bs4 import BeautifulSoup as bs
|
||||||
|
from erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts import create_charts
|
||||||
|
|
||||||
PRIMARY_ACCOUNT = "Primary"
|
PRIMARY_ACCOUNT = "Primary"
|
||||||
|
|
||||||
@@ -19,6 +20,15 @@ class TallyMigration(Document):
|
|||||||
self.tally_company = company
|
self.tally_company = company
|
||||||
self.erpnext_company = company
|
self.erpnext_company = company
|
||||||
self.status = "Preprocessed"
|
self.status = "Preprocessed"
|
||||||
|
|
||||||
|
coa_file = frappe.get_doc({
|
||||||
|
"doctype": "File",
|
||||||
|
"file_name": "COA.json",
|
||||||
|
"attached_to_doctype": self.doctype,
|
||||||
|
"attached_to_name": self.name,
|
||||||
|
"content": json.dumps(chart_of_accounts_tree)
|
||||||
|
}).insert()
|
||||||
|
self.chart_of_accounts = coa_file.file_url
|
||||||
self.save()
|
self.save()
|
||||||
|
|
||||||
def _process_master_data(self):
|
def _process_master_data(self):
|
||||||
@@ -120,7 +130,19 @@ class TallyMigration(Document):
|
|||||||
frappe.enqueue_doc(self.doctype, self.name, "_preprocess")
|
frappe.enqueue_doc(self.doctype, self.name, "_preprocess")
|
||||||
|
|
||||||
def start_import(self):
|
def start_import(self):
|
||||||
pass
|
def create_company_and_coa(coa_file_url):
|
||||||
|
coa_file = frappe.get_doc("File", {"file_url": coa_file_url})
|
||||||
|
frappe.local.flags.ignore_chart_of_accounts = True
|
||||||
|
company = frappe.get_doc({
|
||||||
|
"doctype": "Company",
|
||||||
|
"company_name": self.erpnext_company,
|
||||||
|
"default_currency": "INR",
|
||||||
|
}).insert()
|
||||||
|
frappe.local.flags.ignore_chart_of_accounts = False
|
||||||
|
create_charts(company.name, json.loads(coa_file.get_content()))
|
||||||
|
|
||||||
|
create_company_and_coa(self.chart_of_accounts)
|
||||||
|
|
||||||
|
|
||||||
def sanitize(string):
|
def sanitize(string):
|
||||||
return re.sub("", "", string)
|
return re.sub("", "", string)
|
||||||
|
|||||||
Reference in New Issue
Block a user