2021-07-15 10:06:54 +00:00
|
|
|
# Copyright (c) 2021, Frappe and Contributors
|
|
|
|
# License: GNU General Public License v3. See license.txt
|
|
|
|
|
2021-09-03 05:48:24 +00:00
|
|
|
import frappe
|
2021-07-15 10:06:54 +00:00
|
|
|
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
|
|
|
|
|
2021-09-03 16:27:38 +00:00
|
|
|
|
2021-07-15 10:06:54 +00:00
|
|
|
def execute():
|
2021-09-03 07:10:13 +00:00
|
|
|
frappe.reload_doc("accounts", "doctype", "advance_taxes_and_charges")
|
2021-09-02 16:31:24 +00:00
|
|
|
frappe.reload_doc("accounts", "doctype", "payment_entry")
|
|
|
|
|
2021-11-27 21:46:13 +00:00
|
|
|
if frappe.db.exists("Company", {"country": "India"}):
|
|
|
|
custom_fields = {
|
|
|
|
"Payment Entry": [
|
|
|
|
dict(
|
|
|
|
fieldname="gst_section",
|
|
|
|
label="GST Details",
|
|
|
|
fieldtype="Section Break",
|
|
|
|
insert_after="deductions",
|
|
|
|
print_hide=1,
|
|
|
|
collapsible=1,
|
|
|
|
),
|
|
|
|
dict(
|
|
|
|
fieldname="company_address",
|
|
|
|
label="Company Address",
|
|
|
|
fieldtype="Link",
|
|
|
|
insert_after="gst_section",
|
|
|
|
print_hide=1,
|
|
|
|
options="Address",
|
|
|
|
),
|
|
|
|
dict(
|
|
|
|
fieldname="company_gstin",
|
|
|
|
label="Company GSTIN",
|
|
|
|
fieldtype="Data",
|
|
|
|
insert_after="company_address",
|
|
|
|
fetch_from="company_address.gstin",
|
|
|
|
print_hide=1,
|
|
|
|
read_only=1,
|
|
|
|
),
|
|
|
|
dict(
|
|
|
|
fieldname="place_of_supply",
|
|
|
|
label="Place of Supply",
|
|
|
|
fieldtype="Data",
|
|
|
|
insert_after="company_gstin",
|
|
|
|
print_hide=1,
|
|
|
|
read_only=1,
|
|
|
|
),
|
|
|
|
dict(
|
|
|
|
fieldname="customer_address",
|
|
|
|
label="Customer Address",
|
|
|
|
fieldtype="Link",
|
|
|
|
insert_after="place_of_supply",
|
|
|
|
print_hide=1,
|
|
|
|
options="Address",
|
|
|
|
depends_on='eval:doc.party_type == "Customer"',
|
|
|
|
),
|
|
|
|
dict(
|
|
|
|
fieldname="customer_gstin",
|
|
|
|
label="Customer GSTIN",
|
|
|
|
fieldtype="Data",
|
|
|
|
insert_after="customer_address",
|
|
|
|
fetch_from="customer_address.gstin",
|
|
|
|
print_hide=1,
|
|
|
|
read_only=1,
|
2022-03-28 13:22:46 +00:00
|
|
|
),
|
2021-11-27 21:46:13 +00:00
|
|
|
]
|
|
|
|
}
|
2021-07-15 10:06:54 +00:00
|
|
|
|
2021-11-27 21:46:13 +00:00
|
|
|
create_custom_fields(custom_fields, update=True)
|
|
|
|
else:
|
|
|
|
fields = [
|
|
|
|
"gst_section",
|
|
|
|
"company_address",
|
|
|
|
"company_gstin",
|
|
|
|
"place_of_supply",
|
|
|
|
"customer_address",
|
|
|
|
"customer_gstin",
|
|
|
|
]
|
|
|
|
for field in fields:
|
|
|
|
frappe.delete_doc_if_exists("Custom Field", f"Payment Entry-{field}")
|