Merge pull request #24186 from frappe/validate_regional_germany

fix: regional validation of sales invoice (germany)
This commit is contained in:
Deepesh Garg 2021-01-06 09:35:05 +05:30 committed by GitHub
commit 5e15a5d230
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 6 deletions

View File

@ -48,9 +48,6 @@ def validate_regional(doc):
def missing(field_label, regulation):
"""Notify the user that a required field is missing."""
context = 'Specific for Germany. Example: Remember to set Company Tax ID. It is required by § 14 Abs. 4 Nr. 2 UStG.'
msgprint(_('Remember to set {field_label}. It is required by {regulation}.', context=context).format(
field_label=frappe.bold(_(field_label)),
regulation=regulation
)
)
translated_msg = _('Remember to set {field_label}. It is required by {regulation}.', context='Specific for Germany. Example: Remember to set Company Tax ID. It is required by § 14 Abs. 4 Nr. 2 UStG.') # noqa: E501
formatted_msg = translated_msg.format(field_label=frappe.bold(_(field_label)), regulation=regulation)
msgprint(formatted_msg)

View File

@ -0,0 +1,12 @@
import frappe
import unittest
from erpnext.regional.germany.accounts_controller import validate_regional
class TestAccountsController(unittest.TestCase):
def setUp(self):
self.sales_invoice = frappe.get_last_doc('Sales Invoice')
def test_validate_regional(self):
validate_regional(self.sales_invoice)