mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-04 12:49:10 +00:00
fix(regional,italy): added state code on address, updated patch
moved state codes to init, rewired patch added logic to autoset state code on address validate handled multiple names for Italy refactored validate_address_italy to validate_address
This commit is contained in:
@@ -6,6 +6,7 @@ from erpnext.controllers.taxes_and_totals import get_itemised_tax
|
||||
from frappe import _
|
||||
from frappe.utils.file_manager import save_file, remove_file
|
||||
from frappe.desk.form.load import get_attachments
|
||||
from erpnext.regional.italy import state_codes
|
||||
|
||||
|
||||
def update_itemised_tax_data(doc):
|
||||
@@ -282,4 +283,11 @@ def get_progressive_name_and_number(doc):
|
||||
progressive_name = frappe.model.naming.make_autoname(company_tax_id + "_.#####")
|
||||
progressive_number = progressive_name.split("_")[1]
|
||||
|
||||
return progressive_name, progressive_number
|
||||
return progressive_name, progressive_number
|
||||
|
||||
def validate_address(doc, method):
|
||||
if not (hasattr(doc, "state_code") and doc.country in ["Italy", "Italia", "Italian Republic", "Repubblica Italiana"]):
|
||||
return
|
||||
|
||||
state_codes_lower = {key.lower():value for key,value in state_codes.items()}
|
||||
doc.state_code = state_codes_lower.get(doc.get('state','').lower())
|
||||
|
||||
Reference in New Issue
Block a user