Merge branch 'rebrand-ui' of https://github.com/frappe/erpnext into rebrand-ui
This commit is contained in:
commit
9a69c0e21e
10
.github/helper/translation.py
vendored
10
.github/helper/translation.py
vendored
@ -2,7 +2,7 @@ import re
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
errors_encounter = 0
|
errors_encounter = 0
|
||||||
pattern = re.compile(r"_\(([\"']{,3})(?P<message>((?!\1).)*)\1(\s*,\s*context\s*=\s*([\"'])(?P<py_context>((?!\5).)*)\5)*(\s*,\s*(.)*?\s*(,\s*([\"'])(?P<js_context>((?!\11).)*)\11)*)*\)")
|
pattern = re.compile(r"_\(([\"']{,3})(?P<message>((?!\1).)*)\1(\s*,\s*context\s*=\s*([\"'])(?P<py_context>((?!\5).)*)\5)*(\s*,(\s*?.*?\n*?)*(,\s*([\"'])(?P<js_context>((?!\11).)*)\11)*)*\)")
|
||||||
words_pattern = re.compile(r"_{1,2}\([\"'`]{1,3}.*?[a-zA-Z]")
|
words_pattern = re.compile(r"_{1,2}\([\"'`]{1,3}.*?[a-zA-Z]")
|
||||||
start_pattern = re.compile(r"_{1,2}\([f\"'`]{1,3}")
|
start_pattern = re.compile(r"_{1,2}\([f\"'`]{1,3}")
|
||||||
f_string_pattern = re.compile(r"_\(f[\"']")
|
f_string_pattern = re.compile(r"_\(f[\"']")
|
||||||
@ -28,7 +28,7 @@ for _file in files_to_scan:
|
|||||||
has_f_string = f_string_pattern.search(line)
|
has_f_string = f_string_pattern.search(line)
|
||||||
if has_f_string:
|
if has_f_string:
|
||||||
errors_encounter += 1
|
errors_encounter += 1
|
||||||
print(f'\nF-strings are not supported for translations at line number {line_number + 1}\n{line.strip()[:100]}')
|
print(f'\nF-strings are not supported for translations at line number {line_number}\n{line.strip()[:100]}')
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
@ -36,7 +36,7 @@ for _file in files_to_scan:
|
|||||||
match = pattern.search(line)
|
match = pattern.search(line)
|
||||||
error_found = False
|
error_found = False
|
||||||
|
|
||||||
if not match and line.endswith(',\n'):
|
if not match and line.endswith((',\n', '[\n')):
|
||||||
# concat remaining text to validate multiline pattern
|
# concat remaining text to validate multiline pattern
|
||||||
line = "".join(file_lines[line_number - 1:])
|
line = "".join(file_lines[line_number - 1:])
|
||||||
line = line[start_matches.start() + 1:]
|
line = line[start_matches.start() + 1:]
|
||||||
@ -44,11 +44,11 @@ for _file in files_to_scan:
|
|||||||
|
|
||||||
if not match:
|
if not match:
|
||||||
error_found = True
|
error_found = True
|
||||||
print(f'\nTranslation syntax error at line number {line_number + 1}\n{line.strip()[:100]}')
|
print(f'\nTranslation syntax error at line number {line_number}\n{line.strip()[:100]}')
|
||||||
|
|
||||||
if not error_found and not words_pattern.search(line):
|
if not error_found and not words_pattern.search(line):
|
||||||
error_found = True
|
error_found = True
|
||||||
print(f'\nTranslation is useless because it has no words at line number {line_number + 1}\n{line.strip()[:100]}')
|
print(f'\nTranslation is useless because it has no words at line number {line_number}\n{line.strip()[:100]}')
|
||||||
|
|
||||||
if error_found:
|
if error_found:
|
||||||
errors_encounter += 1
|
errors_encounter += 1
|
||||||
|
|||||||
@ -133,9 +133,10 @@ class Asset(AccountsController):
|
|||||||
if self.is_existing_asset: return
|
if self.is_existing_asset: return
|
||||||
|
|
||||||
if self.gross_purchase_amount and self.gross_purchase_amount != self.purchase_receipt_amount:
|
if self.gross_purchase_amount and self.gross_purchase_amount != self.purchase_receipt_amount:
|
||||||
frappe.throw(_("Gross Purchase Amount should be {} to purchase amount of one single Asset. {}\
|
error_message = _("Gross Purchase Amount should be <b>equal</b> to purchase amount of one single Asset.")
|
||||||
Please do not book expense of multiple assets against one single Asset.")
|
error_message += "<br>"
|
||||||
.format(frappe.bold("equal"), "<br>"), title=_("Invalid Gross Purchase Amount"))
|
error_message += _("Please do not book expense of multiple assets against one single Asset.")
|
||||||
|
frappe.throw(error_message, title=_("Invalid Gross Purchase Amount"))
|
||||||
|
|
||||||
def make_asset_movement(self):
|
def make_asset_movement(self):
|
||||||
reference_doctype = 'Purchase Receipt' if self.purchase_receipt else 'Purchase Invoice'
|
reference_doctype = 'Purchase Receipt' if self.purchase_receipt else 'Purchase Invoice'
|
||||||
|
|||||||
@ -50,8 +50,9 @@ class EmployeeTransfer(Document):
|
|||||||
employee = frappe.get_doc("Employee", self.employee)
|
employee = frappe.get_doc("Employee", self.employee)
|
||||||
if self.create_new_employee_id:
|
if self.create_new_employee_id:
|
||||||
if self.new_employee_id:
|
if self.new_employee_id:
|
||||||
frappe.throw(_("Please delete the Employee <a href='/app/Form/Employee/{0}'>{0}</a>\
|
frappe.throw(_("Please delete the Employee {0} to cancel this document").format(
|
||||||
to cancel this document").format(self.new_employee_id))
|
"<a href='/app/Form/Employee/{0}'>{0}</a>".format(self.new_employee_id)
|
||||||
|
))
|
||||||
#mark the employee as active
|
#mark the employee as active
|
||||||
employee.status = "Active"
|
employee.status = "Active"
|
||||||
employee.relieving_date = ''
|
employee.relieving_date = ''
|
||||||
|
|||||||
@ -89,8 +89,9 @@ class Company(NestedSet):
|
|||||||
frappe.throw(_("Account {0} does not belong to company: {1}").format(self.get(account[1]), self.name))
|
frappe.throw(_("Account {0} does not belong to company: {1}").format(self.get(account[1]), self.name))
|
||||||
|
|
||||||
if get_account_currency(self.get(account[1])) != self.default_currency:
|
if get_account_currency(self.get(account[1])) != self.default_currency:
|
||||||
frappe.throw(_("""{0} currency must be same as company's default currency.
|
error_message = _("{0} currency must be same as company's default currency. Please select another account.") \
|
||||||
Please select another account""").format(frappe.bold(account[0])))
|
.format(frappe.bold(account[0]))
|
||||||
|
frappe.throw(error_message)
|
||||||
|
|
||||||
def validate_currency(self):
|
def validate_currency(self):
|
||||||
if self.is_new():
|
if self.is_new():
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user