-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow VAT ID Check for Customers
- Loading branch information
1 parent
9b12af5
commit 70571e3
Showing
7 changed files
with
171 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
[pre_model_sync] | ||
|
||
[post_model_sync] | ||
execute:from erpnext_germany.install import after_install; after_install() # 7 | ||
erpnext_germany.patches.add_tax_exemption_reason_fields | ||
execute:from erpnext_germany.install import insert_custom_records; insert_custom_records() | ||
erpnext_germany.patches.dynamic_party_in_vat_id_check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import frappe | ||
from frappe.model.utils.rename_field import rename_field | ||
|
||
|
||
def execute(): | ||
"""Copy data to renamed fields in VAT ID Check. | ||
party_type -> "Customer", | ||
customer -> party, | ||
customer_vat_id -> party_vat_id, | ||
customer_address -> party_address, | ||
Add link to Supplier connections. | ||
Update link in Customer connections. | ||
""" | ||
dt = "VAT ID Check" | ||
|
||
frappe.db.sql("UPDATE `tabVAT ID Check` SET party_type = 'Customer'") | ||
|
||
rename_field(dt, "customer", "party") | ||
rename_field(dt, "customer_vat_id", "party_vat_id") | ||
rename_field(dt, "customer_address", "party_address") | ||
|
||
# Add link to Supplier connections | ||
frappe.get_doc( | ||
{ | ||
"doctype": "DocType Link", | ||
"parent": "Supplier", | ||
"parentfield": "links", | ||
"parenttype": "Customize Form", | ||
"group": "Vendor Evaluation", | ||
"link_doctype": dt, | ||
"link_fieldname": "party", | ||
"custom": 1, | ||
} | ||
).insert(ignore_if_duplicate=True) | ||
|
||
# Update link in Customer connections | ||
customer_link = frappe.db.exists("DocType Link", {"link_doctype": dt, "link_fieldname": "customer"}) | ||
if customer_link: | ||
frappe.db.set_value("DocType Link", customer_link, "link_fieldname", "party") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters