chore: whitespace / eof fixes

This commit is contained in:
Ankush Menat 2021-09-01 16:45:57 +05:30
parent 65279c2471
commit b147b85e6a
No known key found for this signature in database
GPG Key ID: 8EA82E09BBD13AAF
44 changed files with 86 additions and 98 deletions

View File

@ -31,7 +31,7 @@ class ERPNextAddress(Address):
customers = frappe.db.get_all("Customer", filters=filters, as_list=True) customers = frappe.db.get_all("Customer", filters=filters, as_list=True)
for customer_name in customers: for customer_name in customers:
frappe.db.set_value("Customer", customer_name[0], "primary_address", address_display) frappe.db.set_value("Customer", customer_name[0], "primary_address", address_display)
@frappe.whitelist() @frappe.whitelist()
def get_shipping_address(company, address = None): def get_shipping_address(company, address = None):
filters = [ filters = [

View File

@ -21,7 +21,7 @@ class BankTransaction(StatusUpdater):
self.update_allocations() self.update_allocations()
self.clear_linked_payment_entries() self.clear_linked_payment_entries()
self.set_status(update=True) self.set_status(update=True)
def on_cancel(self): def on_cancel(self):
self.clear_linked_payment_entries(for_cancel=True) self.clear_linked_payment_entries(for_cancel=True)
self.set_status(update=True) self.set_status(update=True)
@ -45,7 +45,7 @@ class BankTransaction(StatusUpdater):
frappe.db.set_value(self.doctype, self.name, "status", "Reconciled") frappe.db.set_value(self.doctype, self.name, "status", "Reconciled")
self.reload() self.reload()
def clear_linked_payment_entries(self, for_cancel=False): def clear_linked_payment_entries(self, for_cancel=False):
for payment_entry in self.payment_entries: for payment_entry in self.payment_entries:
if payment_entry.payment_document in ["Payment Entry", "Journal Entry", "Purchase Invoice", "Expense Claim"]: if payment_entry.payment_document in ["Payment Entry", "Journal Entry", "Purchase Invoice", "Expense Claim"]:
@ -77,7 +77,7 @@ class BankTransaction(StatusUpdater):
def get_reconciled_bank_transactions(payment_entry): def get_reconciled_bank_transactions(payment_entry):
reconciled_bank_transactions = frappe.get_all( reconciled_bank_transactions = frappe.get_all(
'Bank Transaction Payments', 'Bank Transaction Payments',
filters = { filters = {
'payment_entry': payment_entry.payment_entry 'payment_entry': payment_entry.payment_entry
}, },

View File

@ -40,4 +40,4 @@ def create_finance_book():
else: else:
finance_book = frappe.get_doc("Finance Book", "_Test Finance Book") finance_book = frappe.get_doc("Finance Book", "_Test Finance Book")
return finance_book return finance_book

View File

@ -10,14 +10,14 @@ class PartyLink(Document):
if self.primary_role not in ['Customer', 'Supplier']: if self.primary_role not in ['Customer', 'Supplier']:
frappe.throw(_("Allowed primary roles are 'Customer' and 'Supplier'. Please select one of these roles only."), frappe.throw(_("Allowed primary roles are 'Customer' and 'Supplier'. Please select one of these roles only."),
title=_("Invalid Primary Role")) title=_("Invalid Primary Role"))
existing_party_link = frappe.get_all('Party Link', { existing_party_link = frappe.get_all('Party Link', {
'primary_party': self.secondary_party 'primary_party': self.secondary_party
}, pluck="primary_role") }, pluck="primary_role")
if existing_party_link: if existing_party_link:
frappe.throw(_('{} {} is already linked with another {}') frappe.throw(_('{} {} is already linked with another {}')
.format(self.secondary_role, self.secondary_party, existing_party_link[0])) .format(self.secondary_role, self.secondary_party, existing_party_link[0]))
existing_party_link = frappe.get_all('Party Link', { existing_party_link = frappe.get_all('Party Link', {
'secondary_party': self.primary_party 'secondary_party': self.primary_party
}, pluck="primary_role") }, pluck="primary_role")

View File

@ -484,7 +484,7 @@ class PaymentEntry(AccountsController):
def validate_amounts(self): def validate_amounts(self):
self.validate_received_amount() self.validate_received_amount()
def validate_received_amount(self): def validate_received_amount(self):
if self.paid_from_account_currency == self.paid_to_account_currency: if self.paid_from_account_currency == self.paid_to_account_currency:
if self.paid_amount != self.received_amount: if self.paid_amount != self.received_amount:

View File

@ -54,7 +54,7 @@ class PeriodClosingVoucher(AccountsController):
if gl_entries: if gl_entries:
from erpnext.accounts.general_ledger import make_gl_entries from erpnext.accounts.general_ledger import make_gl_entries
make_gl_entries(gl_entries) make_gl_entries(gl_entries)
def get_gl_entries(self): def get_gl_entries(self):
gl_entries = [] gl_entries = []
pl_accounts = self.get_pl_balances() pl_accounts = self.get_pl_balances()
@ -77,7 +77,7 @@ class PeriodClosingVoucher(AccountsController):
gl_entries += gle_for_net_pl_bal gl_entries += gle_for_net_pl_bal
return gl_entries return gl_entries
def get_pnl_gl_entry(self, pl_accounts): def get_pnl_gl_entry(self, pl_accounts):
company_cost_center = frappe.db.get_value("Company", self.company, "cost_center") company_cost_center = frappe.db.get_value("Company", self.company, "cost_center")
gl_entries = [] gl_entries = []

View File

@ -4,4 +4,3 @@
cur_frm.cscript.tax_table = "Sales Taxes and Charges"; cur_frm.cscript.tax_table = "Sales Taxes and Charges";
{% include "erpnext/public/js/controllers/accounts.js" %} {% include "erpnext/public/js/controllers/accounts.js" %}

View File

@ -240,7 +240,7 @@ def get_deducted_tax(taxable_vouchers, fiscal_year, tax_details):
def get_tds_amount(ldc, parties, inv, tax_details, fiscal_year_details, tax_deducted, vouchers): def get_tds_amount(ldc, parties, inv, tax_details, fiscal_year_details, tax_deducted, vouchers):
tds_amount = 0 tds_amount = 0
invoice_filters = { invoice_filters = {
'name': ('in', vouchers), 'name': ('in', vouchers),
'docstatus': 1, 'docstatus': 1,
'apply_tds': 1 'apply_tds': 1
} }

View File

@ -686,7 +686,7 @@ class calculate_taxes_and_totals(object):
'mode_of_payment': default_mode_of_payment.mode_of_payment, 'mode_of_payment': default_mode_of_payment.mode_of_payment,
'amount': total_amount_to_pay, 'amount': total_amount_to_pay,
'default': 1 'default': 1
}) })
def get_itemised_tax_breakup_html(doc): def get_itemised_tax_breakup_html(doc):
if not doc.taxes: if not doc.taxes:

View File

@ -371,4 +371,3 @@ def add_lead_to_prospect(lead, prospect):
prospect.save(ignore_permissions=True) prospect.save(ignore_permissions=True)
frappe.msgprint(_('Lead {0} has been added to prospect {1}.').format(frappe.bold(lead), frappe.bold(prospect.name)), frappe.msgprint(_('Lead {0} has been added to prospect {1}.').format(frappe.bold(lead), frappe.bold(prospect.name)),
title=_('Lead Added'), indicator='green') title=_('Lead Added'), indicator='green')

View File

@ -146,7 +146,7 @@ class LinkedInSettings(Document):
except Exception as e: except Exception as e:
self.api_error(response) self.api_error(response)
return response return response
def get_headers(self): def get_headers(self):
@ -168,7 +168,7 @@ class LinkedInSettings(Document):
raise raise
except Exception: except Exception:
self.api_error(response) self.api_error(response)
def get_post(self, post_id): def get_post(self, post_id):
url = "https://api.linkedin.com/v2/organizationalEntityShareStatistics?q=organizationalEntity&organizationalEntity=urn:li:organization:{0}&shares[0]=urn:li:share:{1}".format(self.company_id, post_id) url = "https://api.linkedin.com/v2/organizationalEntityShareStatistics?q=organizationalEntity&organizationalEntity=urn:li:organization:{0}&shares[0]=urn:li:share:{1}".format(self.company_id, post_id)
@ -176,7 +176,7 @@ class LinkedInSettings(Document):
response = requests.get(url=url, headers=self.get_headers()) response = requests.get(url=url, headers=self.get_headers())
if response.status_code !=200: if response.status_code !=200:
raise raise
except Exception: except Exception:
self.api_error(response) self.api_error(response)

View File

@ -15,7 +15,7 @@ class Prospect(Document):
def on_update(self): def on_update(self):
self.link_with_lead_contact_and_address() self.link_with_lead_contact_and_address()
def on_trash(self): def on_trash(self):
self.unlink_dynamic_links() self.unlink_dynamic_links()

View File

@ -80,10 +80,10 @@ frappe.ui.form.on('Social Media Post', {
refresh: function(frm) { refresh: function(frm) {
frm.trigger('text'); frm.trigger('text');
if (frm.doc.docstatus === 1) { if (frm.doc.docstatus === 1) {
if (!['Posted', 'Deleted'].includes(frm.doc.post_status)) { if (!['Posted', 'Deleted'].includes(frm.doc.post_status)) {
frm.trigger('add_post_btn'); frm.trigger('add_post_btn');
} }
if (frm.doc.post_status !='Deleted') { if (frm.doc.post_status !='Deleted') {
frm.add_custom_button(('Delete Post'), function() { frm.add_custom_button(('Delete Post'), function() {

View File

@ -53,10 +53,10 @@ class TwitterSettings(Document):
frappe.throw(_('Invalid Consumer Key or Consumer Secret Key')) frappe.throw(_('Invalid Consumer Key or Consumer Secret Key'))
def get_api(self): def get_api(self):
# authentication of consumer key and secret # authentication of consumer key and secret
auth = tweepy.OAuthHandler(self.consumer_key, self.get_password(fieldname="consumer_secret")) auth = tweepy.OAuthHandler(self.consumer_key, self.get_password(fieldname="consumer_secret"))
# authentication of access token and secret # authentication of access token and secret
auth.set_access_token(self.access_token, self.access_token_secret) auth.set_access_token(self.access_token, self.access_token_secret)
return tweepy.API(auth) return tweepy.API(auth)
@ -90,20 +90,20 @@ class TwitterSettings(Document):
def delete_tweet(self, tweet_id): def delete_tweet(self, tweet_id):
api = self.get_api() api = self.get_api()
try: try:
api.destroy_status(tweet_id) api.destroy_status(tweet_id)
except TweepError as e: except TweepError as e:
self.api_error(e) self.api_error(e)
def get_tweet(self, tweet_id): def get_tweet(self, tweet_id):
api = self.get_api() api = self.get_api()
try: try:
response = api.get_status(tweet_id, trim_user=True, include_entities=True) response = api.get_status(tweet_id, trim_user=True, include_entities=True)
except TweepError as e: except TweepError as e:
self.api_error(e) self.api_error(e)
return response._json return response._json
def api_error(self, e): def api_error(self, e):
content = json.loads(e.response.content) content = json.loads(e.response.content)
content = content["errors"][0] content = content["errors"][0]

View File

@ -15,7 +15,7 @@ SUPPORTED_COUNTRY_CODES = ["AT", "AU", "BE", "BG", "CA", "CY", "CZ", "DE", "DK",
"SE", "SI", "SK", "US"] "SE", "SI", "SK", "US"]
SUPPORTED_STATE_CODES = ['AL', 'AK', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'DC', 'FL', 'GA', 'HI', 'ID', 'IL', SUPPORTED_STATE_CODES = ['AL', 'AK', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'DC', 'FL', 'GA', 'HI', 'ID', 'IL',
'IN', 'IA', 'KS', 'KY', 'LA', 'ME', 'MD', 'MA', 'MI', 'MN', 'MS', 'MO', 'MT', 'NE', 'IN', 'IA', 'KS', 'KY', 'LA', 'ME', 'MD', 'MA', 'MI', 'MN', 'MS', 'MO', 'MT', 'NE',
'NV', 'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'OH', 'OK', 'OR', 'PA', 'RI', 'SC', 'SD', 'NV', 'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'OH', 'OK', 'OR', 'PA', 'RI', 'SC', 'SD',
'TN', 'TX', 'UT', 'VT', 'VA', 'WA', 'WV', 'WI', 'WY'] 'TN', 'TX', 'UT', 'VT', 'VA', 'WA', 'WV', 'WI', 'WY']
@ -66,7 +66,7 @@ def create_transaction(doc, method):
try: try:
if doc.is_return: if doc.is_return:
client.create_refund(tax_dict) client.create_refund(tax_dict)
else: else:
client.create_order(tax_dict) client.create_order(tax_dict)
except taxjar.exceptions.TaxJarResponseError as err: except taxjar.exceptions.TaxJarResponseError as err:
frappe.throw(_(sanitize_error_response(err))) frappe.throw(_(sanitize_error_response(err)))
@ -108,7 +108,7 @@ def get_tax_data(doc):
if to_shipping_state not in SUPPORTED_STATE_CODES: if to_shipping_state not in SUPPORTED_STATE_CODES:
to_shipping_state = get_state_code(to_address, 'Shipping') to_shipping_state = get_state_code(to_address, 'Shipping')
tax_dict = { tax_dict = {
'from_country': from_country_code, 'from_country': from_country_code,
'from_zip': from_address.pincode, 'from_zip': from_address.pincode,
@ -125,7 +125,7 @@ def get_tax_data(doc):
'plugin': 'erpnext', 'plugin': 'erpnext',
'line_items': line_items 'line_items': line_items
} }
return tax_dict return tax_dict
def get_state_code(address, location): def get_state_code(address, location):
if address is not None: if address is not None:
@ -134,16 +134,16 @@ def get_state_code(address, location):
frappe.throw(_("Please enter a valid State in the {0} Address").format(location)) frappe.throw(_("Please enter a valid State in the {0} Address").format(location))
else: else:
frappe.throw(_("Please enter a valid State in the {0} Address").format(location)) frappe.throw(_("Please enter a valid State in the {0} Address").format(location))
return state_code return state_code
def get_line_item_dict(item): def get_line_item_dict(item):
return dict( return dict(
id = item.get('idx'), id = item.get('idx'),
quantity = item.get('qty'), quantity = item.get('qty'),
unit_price = item.get('rate'), unit_price = item.get('rate'),
product_tax_code = item.get('product_tax_category') product_tax_code = item.get('product_tax_category')
) )
def set_sales_tax(doc, method): def set_sales_tax(doc, method):
if not TAXJAR_CALCULATE_TAX: if not TAXJAR_CALCULATE_TAX:
@ -202,7 +202,7 @@ def check_sales_tax_exemption(doc):
break break
doc.run_method("calculate_taxes_and_totals") doc.run_method("calculate_taxes_and_totals")
return True return True
else: else:
return False return False
def validate_tax_request(tax_dict): def validate_tax_request(tax_dict):

View File

@ -31,7 +31,7 @@ class TestTherapyPlan(unittest.TestCase):
self.assertEqual(frappe.db.get_value('Therapy Plan', plan.name, 'status'), 'Completed') self.assertEqual(frappe.db.get_value('Therapy Plan', plan.name, 'status'), 'Completed')
patient, practitioner = create_healthcare_docs() patient, practitioner = create_healthcare_docs()
appointment = create_appointment(patient, practitioner, nowdate()) appointment = create_appointment(patient, practitioner, nowdate())
session = make_therapy_session(plan.name, plan.patient, 'Basic Rehab', '_Test Company', appointment.name) session = make_therapy_session(plan.name, plan.patient, 'Basic Rehab', '_Test Company', appointment.name)
session = frappe.get_doc(session) session = frappe.get_doc(session)

View File

@ -452,4 +452,4 @@ class PatientHistory {
} }
}); });
} }
} }

View File

@ -18,4 +18,3 @@
<div class="patient-details"> <div class="patient-details">
</div> </div>
</div> </div>

View File

@ -18,7 +18,7 @@ class TestEmployeeReminders(unittest.TestCase):
# Create a test holiday list # Create a test holiday list
test_holiday_dates = cls.get_test_holiday_dates() test_holiday_dates = cls.get_test_holiday_dates()
test_holiday_list = make_holiday_list( test_holiday_list = make_holiday_list(
'TestHolidayRemindersList', 'TestHolidayRemindersList',
holiday_dates=[ holiday_dates=[
{'holiday_date': test_holiday_dates[0], 'description': 'test holiday1'}, {'holiday_date': test_holiday_dates[0], 'description': 'test holiday1'},
{'holiday_date': test_holiday_dates[1], 'description': 'test holiday2'}, {'holiday_date': test_holiday_dates[1], 'description': 'test holiday2'},
@ -49,8 +49,8 @@ class TestEmployeeReminders(unittest.TestCase):
def get_test_holiday_dates(cls): def get_test_holiday_dates(cls):
today_date = getdate() today_date = getdate()
return [ return [
today_date, today_date,
today_date-timedelta(days=4), today_date-timedelta(days=4),
today_date-timedelta(days=3), today_date-timedelta(days=3),
today_date+timedelta(days=1), today_date+timedelta(days=1),
today_date+timedelta(days=3), today_date+timedelta(days=3),
@ -63,7 +63,7 @@ class TestEmployeeReminders(unittest.TestCase):
def test_is_holiday(self): def test_is_holiday(self):
from erpnext.hr.doctype.employee.employee import is_holiday from erpnext.hr.doctype.employee.employee import is_holiday
self.assertTrue(is_holiday(self.test_employee.name)) self.assertTrue(is_holiday(self.test_employee.name))
self.assertTrue(is_holiday(self.test_employee.name, date=self.test_holiday_dates[1])) self.assertTrue(is_holiday(self.test_employee.name, date=self.test_holiday_dates[1]))
self.assertFalse(is_holiday(self.test_employee.name, date=getdate()-timedelta(days=1))) self.assertFalse(is_holiday(self.test_employee.name, date=getdate()-timedelta(days=1)))
@ -118,7 +118,7 @@ class TestEmployeeReminders(unittest.TestCase):
email_queue = frappe.db.sql("""select * from `tabEmail Queue`""", as_dict=True) email_queue = frappe.db.sql("""select * from `tabEmail Queue`""", as_dict=True)
self.assertTrue("Subject: Work Anniversary Reminder" in email_queue[0].message) self.assertTrue("Subject: Work Anniversary Reminder" in email_queue[0].message)
def test_send_holidays_reminder_in_advance(self): def test_send_holidays_reminder_in_advance(self):
from erpnext.hr.utils import get_holidays_for_employee from erpnext.hr.utils import get_holidays_for_employee
from erpnext.hr.doctype.employee.employee_reminders import send_holidays_reminder_in_advance from erpnext.hr.doctype.employee.employee_reminders import send_holidays_reminder_in_advance
@ -133,10 +133,10 @@ class TestEmployeeReminders(unittest.TestCase):
holidays = get_holidays_for_employee( holidays = get_holidays_for_employee(
self.test_employee.get('name'), self.test_employee.get('name'),
getdate(), getdate() + timedelta(days=3), getdate(), getdate() + timedelta(days=3),
only_non_weekly=True, only_non_weekly=True,
raise_exception=False raise_exception=False
) )
send_holidays_reminder_in_advance( send_holidays_reminder_in_advance(
self.test_employee.get('name'), self.test_employee.get('name'),
holidays holidays
@ -158,7 +158,7 @@ class TestEmployeeReminders(unittest.TestCase):
email_queue = frappe.db.sql("""select * from `tabEmail Queue`""", as_dict=True) email_queue = frappe.db.sql("""select * from `tabEmail Queue`""", as_dict=True)
self.assertTrue(len(email_queue) > 0) self.assertTrue(len(email_queue) > 0)
def test_advance_holiday_reminders_weekly(self): def test_advance_holiday_reminders_weekly(self):
from erpnext.hr.doctype.employee.employee_reminders import send_reminders_in_advance_weekly from erpnext.hr.doctype.employee.employee_reminders import send_reminders_in_advance_weekly
# Get HR settings and enable advance holiday reminders # Get HR settings and enable advance holiday reminders

View File

@ -144,20 +144,20 @@ class TestExpenseClaim(unittest.TestCase):
expense_claim = make_expense_claim(payable_account, 5500, 5500, "_Test Company", "Travel Expenses - _TC") expense_claim = make_expense_claim(payable_account, 5500, 5500, "_Test Company", "Travel Expenses - _TC")
expense_claim.save() expense_claim.save()
expense_claim.submit() expense_claim.submit()
# Payment entry 1: paying 500 # Payment entry 1: paying 500
make_payment_entry(expense_claim, payable_account,500) make_payment_entry(expense_claim, payable_account,500)
outstanding_amount, total_amount_reimbursed = get_outstanding_and_total_reimbursed_amounts(expense_claim) outstanding_amount, total_amount_reimbursed = get_outstanding_and_total_reimbursed_amounts(expense_claim)
self.assertEqual(outstanding_amount, 5000) self.assertEqual(outstanding_amount, 5000)
self.assertEqual(total_amount_reimbursed, 500) self.assertEqual(total_amount_reimbursed, 500)
# Payment entry 1: paying 2000 # Payment entry 1: paying 2000
make_payment_entry(expense_claim, payable_account,2000) make_payment_entry(expense_claim, payable_account,2000)
outstanding_amount, total_amount_reimbursed = get_outstanding_and_total_reimbursed_amounts(expense_claim) outstanding_amount, total_amount_reimbursed = get_outstanding_and_total_reimbursed_amounts(expense_claim)
self.assertEqual(outstanding_amount, 3000) self.assertEqual(outstanding_amount, 3000)
self.assertEqual(total_amount_reimbursed, 2500) self.assertEqual(total_amount_reimbursed, 2500)
# Payment entry 1: paying 3000 # Payment entry 1: paying 3000
make_payment_entry(expense_claim, payable_account,3000) make_payment_entry(expense_claim, payable_account,3000)
outstanding_amount, total_amount_reimbursed = get_outstanding_and_total_reimbursed_amounts(expense_claim) outstanding_amount, total_amount_reimbursed = get_outstanding_and_total_reimbursed_amounts(expense_claim)
self.assertEqual(outstanding_amount, 0) self.assertEqual(outstanding_amount, 0)
@ -221,7 +221,7 @@ def get_outstanding_and_total_reimbursed_amounts(expense_claim):
outstanding_amount = flt(frappe.db.get_value("Expense Claim", expense_claim.name, "total_sanctioned_amount")) - \ outstanding_amount = flt(frappe.db.get_value("Expense Claim", expense_claim.name, "total_sanctioned_amount")) - \
flt(frappe.db.get_value("Expense Claim", expense_claim.name, "total_amount_reimbursed")) flt(frappe.db.get_value("Expense Claim", expense_claim.name, "total_amount_reimbursed"))
total_amount_reimbursed = flt(frappe.db.get_value("Expense Claim", expense_claim.name, "total_amount_reimbursed")) total_amount_reimbursed = flt(frappe.db.get_value("Expense Claim", expense_claim.name, "total_amount_reimbursed"))
return outstanding_amount,total_amount_reimbursed return outstanding_amount,total_amount_reimbursed
def make_payment_entry(expense_claim, payable_account, amt): def make_payment_entry(expense_claim, payable_account, amt):
@ -234,5 +234,4 @@ def make_payment_entry(expense_claim, payable_account, amt):
pe.paid_to = payable_account pe.paid_to = payable_account
pe.references[0].allocated_amount = amt pe.references[0].allocated_amount = amt
pe.insert() pe.insert()
pe.submit() pe.submit()

View File

@ -337,9 +337,9 @@ def get_sal_slip_total_benefit_given(employee, payroll_period, component=False):
def get_holiday_dates_for_employee(employee, start_date, end_date): def get_holiday_dates_for_employee(employee, start_date, end_date):
"""return a list of holiday dates for the given employee between start_date and end_date""" """return a list of holiday dates for the given employee between start_date and end_date"""
# return only date # return only date
holidays = get_holidays_for_employee(employee, start_date, end_date) holidays = get_holidays_for_employee(employee, start_date, end_date)
return [cstr(h.holiday_date) for h in holidays] return [cstr(h.holiday_date) for h in holidays]
@ -352,7 +352,7 @@ def get_holidays_for_employee(employee, start_date, end_date, raise_exception=Tr
`raise_exception` (bool) `raise_exception` (bool)
`only_non_weekly` (bool) `only_non_weekly` (bool)
return: list of dicts with `holiday_date` and `description` return: list of dicts with `holiday_date` and `description`
""" """
holiday_list = get_holiday_list_for_employee(employee, raise_exception=raise_exception) holiday_list = get_holiday_list_for_employee(employee, raise_exception=raise_exception)
@ -368,11 +368,11 @@ def get_holidays_for_employee(employee, start_date, end_date, raise_exception=Tr
filters['weekly_off'] = False filters['weekly_off'] = False
holidays = frappe.get_all( holidays = frappe.get_all(
'Holiday', 'Holiday',
fields=['description', 'holiday_date'], fields=['description', 'holiday_date'],
filters=filters filters=filters
) )
return holidays return holidays
@erpnext.allow_regional @erpnext.allow_regional

View File

@ -714,4 +714,4 @@ function trigger_process_loss_qty_prompt(frm, cdt, cdn, item_code) {
__("Set Process Loss Item Quantity"), __("Set Process Loss Item Quantity"),
__("Set Quantity") __("Set Quantity")
); );
} }

View File

@ -29,4 +29,4 @@ frappe.tour['Operation'] = [
title: "Sub Operations", title: "Sub Operations",
description: __("If an operation is divided into sub operations, they can be added here.") description: __("If an operation is divided into sub operations, they can be added here.")
} }
]; ];

View File

@ -82,4 +82,3 @@ frappe.tour['Routing'] = [
description: __("Enter the Operation, the table will fetch the Operation details like Hourly Rate, Workstation automatically.\n\n After that, set the Operation Time in minutes and the table will calculate the Operation Costs based on the Hourly Rate and Operation Time.") description: __("Enter the Operation, the table will fetch the Operation details like Hourly Rate, Workstation automatically.\n\n After that, set the Operation Time in minutes and the table will calculate the Operation Costs based on the Hourly Rate and Operation Time.")
} }
]; ];

View File

@ -41,4 +41,4 @@ frappe.tour['Workstation'] = [
}, },
]; ];

View File

@ -14,9 +14,9 @@ def execute():
'Sales Invoice Item': [ 'Sales Invoice Item': [
dict(fieldname='product_tax_category', fieldtype='Link', insert_after='description', options='Product Tax Category', dict(fieldname='product_tax_category', fieldtype='Link', insert_after='description', options='Product Tax Category',
label='Product Tax Category', fetch_from='item_code.product_tax_category'), label='Product Tax Category', fetch_from='item_code.product_tax_category'),
dict(fieldname='tax_collectable', fieldtype='Currency', insert_after='net_amount', dict(fieldname='tax_collectable', fieldtype='Currency', insert_after='net_amount',
label='Tax Collectable', read_only=1), label='Tax Collectable', read_only=1),
dict(fieldname='taxable_amount', fieldtype='Currency', insert_after='tax_collectable', dict(fieldname='taxable_amount', fieldtype='Currency', insert_after='tax_collectable',
label='Taxable Amount', read_only=1) label='Taxable Amount', read_only=1)
], ],
'Item': [ 'Item': [
@ -26,4 +26,4 @@ def execute():
} }
create_custom_fields(custom_fields, update=True) create_custom_fields(custom_fields, update=True)
add_permissions() add_permissions()
frappe.enqueue('erpnext.regional.united_states.setup.add_product_tax_categories', now=True) frappe.enqueue('erpnext.regional.united_states.setup.add_product_tax_categories', now=True)

View File

@ -7,17 +7,17 @@ def execute():
try: try:
# Rename the field # Rename the field
rename_field('HR Settings', 'stop_birthday_reminders', 'send_birthday_reminders') rename_field('HR Settings', 'stop_birthday_reminders', 'send_birthday_reminders')
# Reverse the value # Reverse the value
old_value = frappe.db.get_single_value('HR Settings', 'send_birthday_reminders') old_value = frappe.db.get_single_value('HR Settings', 'send_birthday_reminders')
frappe.db.set_value( frappe.db.set_value(
'HR Settings', 'HR Settings',
'HR Settings', 'HR Settings',
'send_birthday_reminders', 'send_birthday_reminders',
1 if old_value == 0 else 0 1 if old_value == 0 else 0
) )
except Exception as e: except Exception as e:
if e.args[0] != 1054: if e.args[0] != 1054:
raise raise

View File

@ -35,11 +35,11 @@ def get_reconciled_bank_transactions(intra_company_pe):
for payment_entry in intra_company_pe: for payment_entry in intra_company_pe:
reconciled_bank_transactions[payment_entry] = frappe.get_all( reconciled_bank_transactions[payment_entry] = frappe.get_all(
'Bank Transaction Payments', 'Bank Transaction Payments',
filters = { filters = {
'payment_entry': payment_entry 'payment_entry': payment_entry
}, },
pluck='parent' pluck='parent'
) )
return reconciled_bank_transactions return reconciled_bank_transactions

View File

@ -12,4 +12,4 @@ def execute():
WHERE WHERE
time_in_mins = 0 AND operating_cost > 0 time_in_mins = 0 AND operating_cost > 0
AND hour_rate > 0 AND docstatus = 1 AND parenttype = "BOM" AND hour_rate > 0 AND docstatus = 1 AND parenttype = "BOM"
''') ''')

View File

@ -3,11 +3,11 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe.model import data_field_options from frappe.model import data_field_options
def execute(): def execute():
for field in frappe.get_all('Custom Field', for field in frappe.get_all('Custom Field',
fields = ['name'], fields = ['name'],
filters = { filters = {
'fieldtype': 'Data', 'fieldtype': 'Data',
@ -16,7 +16,7 @@ def execute():
if field not in data_field_options: if field not in data_field_options:
frappe.db.sql(""" frappe.db.sql("""
UPDATE UPDATE
`tabCustom Field` `tabCustom Field`
SET SET
options=NULL options=NULL

View File

@ -6,4 +6,4 @@ def execute():
frappe.delete_doc('Report', 'E-Invoice Summary', ignore_missing=True) frappe.delete_doc('Report', 'E-Invoice Summary', ignore_missing=True)
frappe.delete_doc('Print Format', 'GST E-Invoice', ignore_missing=True) frappe.delete_doc('Print Format', 'GST E-Invoice', ignore_missing=True)
frappe.delete_doc('Custom Field', 'Sales Invoice-eway_bill_cancelled', ignore_missing=True) frappe.delete_doc('Custom Field', 'Sales Invoice-eway_bill_cancelled', ignore_missing=True)
frappe.delete_doc('Custom Field', 'Sales Invoice-irn_cancelled', ignore_missing=True) frappe.delete_doc('Custom Field', 'Sales Invoice-irn_cancelled', ignore_missing=True)

View File

@ -86,9 +86,9 @@ $.extend(erpnext, {
proceed_save_with_reminders_frequency_change: () => { proceed_save_with_reminders_frequency_change: () => {
frappe.ui.hide_open_dialog(); frappe.ui.hide_open_dialog();
frappe.call({ frappe.call({
method: 'erpnext.hr.doctype.hr_settings.hr_settings.set_proceed_with_frequency_change', method: 'erpnext.hr.doctype.hr_settings.hr_settings.set_proceed_with_frequency_change',
callback: () => { callback: () => {
cur_frm.save(); cur_frm.save();
} }

View File

@ -887,4 +887,3 @@ def delete_gst_settings_for_company(doc, method):
gst_settings.remove(d) gst_settings.remove(d)
gst_settings.save() gst_settings.save()

View File

@ -63,9 +63,9 @@ def make_custom_fields(update=True):
'Sales Invoice Item': [ 'Sales Invoice Item': [
dict(fieldname='product_tax_category', fieldtype='Link', insert_after='description', options='Product Tax Category', dict(fieldname='product_tax_category', fieldtype='Link', insert_after='description', options='Product Tax Category',
label='Product Tax Category', fetch_from='item_code.product_tax_category'), label='Product Tax Category', fetch_from='item_code.product_tax_category'),
dict(fieldname='tax_collectable', fieldtype='Currency', insert_after='net_amount', dict(fieldname='tax_collectable', fieldtype='Currency', insert_after='net_amount',
label='Tax Collectable', read_only=1), label='Tax Collectable', read_only=1),
dict(fieldname='taxable_amount', fieldtype='Currency', insert_after='tax_collectable', dict(fieldname='taxable_amount', fieldtype='Currency', insert_after='tax_collectable',
label='Taxable Amount', read_only=1) label='Taxable Amount', read_only=1)
], ],
'Item': [ 'Item': [

View File

@ -374,4 +374,4 @@ def create_internal_customer(customer_name, represents_company, allowed_to_inter
else: else:
customer_name = frappe.db.get_value("Customer", customer_name) customer_name = frappe.db.get_value("Customer", customer_name)
return customer_name return customer_name

View File

@ -55,10 +55,10 @@ frappe.ui.form.on("Company", {
{"fieldtype": "Button", "label": "Update", "fieldname": "update"}, {"fieldtype": "Button", "label": "Update", "fieldname": "update"},
] ]
}); });
dialog.fields_dict.update.$input.click(function() { dialog.fields_dict.update.$input.click(function() {
var args = dialog.get_values(); var args = dialog.get_values();
if (!args) return; if (!args) return;
frappe.show_alert(__("Update in progress. It might take a while.")); frappe.show_alert(__("Update in progress. It might take a while."));
return frappe.call({ return frappe.call({
method: "erpnext.setup.doctype.company.company.enqueue_replace_abbr", method: "erpnext.setup.doctype.company.company.enqueue_replace_abbr",

View File

@ -1101,4 +1101,3 @@ function check_should_not_attach_bom_items(bom_no) {
} }
$.extend(cur_frm.cscript, new erpnext.stock.StockEntry({frm: cur_frm})); $.extend(cur_frm.cscript, new erpnext.stock.StockEntry({frm: cur_frm}));

View File

@ -1582,7 +1582,7 @@ class StockEntry(StockController):
if material_request and material_request not in material_requests: if material_request and material_request not in material_requests:
material_requests.append(material_request) material_requests.append(material_request)
frappe.db.set_value('Material Request', material_request, 'transfer_status', status) frappe.db.set_value('Material Request', material_request, 'transfer_status', status)
def update_items_for_process_loss(self): def update_items_for_process_loss(self):
process_loss_dict = {} process_loss_dict = {}
for d in self.get("items"): for d in self.get("items"):

View File

@ -24,4 +24,3 @@ QUnit.test("test manufacture from bom", function(assert) {
() => done() () => done()
]); ]);
}); });

View File

@ -302,4 +302,3 @@ erpnext.stock.StockReconciliation = class StockReconciliation extends erpnext.st
}; };
cur_frm.cscript = new erpnext.stock.StockReconciliation({frm: cur_frm}); cur_frm.cscript = new erpnext.stock.StockReconciliation({frm: cur_frm});

View File

@ -15,4 +15,3 @@ frappe.ui.form.on('Stock Settings', {
frm.set_query("sample_retention_warehouse", filters); frm.set_query("sample_retention_warehouse", filters);
} }
}); });

View File

@ -86,4 +86,3 @@ function convert_to_group_or_ledger(frm){
}) })
} }

View File

@ -92,7 +92,7 @@ def get_query_args(filters: Filters) -> QueryArgs:
def run_query(query_args: QueryArgs) -> Data: def run_query(query_args: QueryArgs) -> Data:
return frappe.db.sql(""" return frappe.db.sql("""
SELECT SELECT
wo.name, wo.status, wo.production_item, wo.qty, wo.name, wo.status, wo.production_item, wo.qty,
wo.produced_qty, wo.process_loss_qty, wo.produced_qty, wo.process_loss_qty,
(wo.produced_qty - wo.process_loss_qty) as actual_produced_qty, (wo.produced_qty - wo.process_loss_qty) as actual_produced_qty,
@ -130,4 +130,3 @@ def get_filter_conditions(filters: Filters) -> QueryArgs:
{"work_order_filter": f"AND wo.name='{work_order_name}'"} {"work_order_filter": f"AND wo.name='{work_order_name}'"}
) )
return filter_conditions return filter_conditions

View File

@ -22,4 +22,4 @@
<span>{{ reminder_text }}</span> <span>{{ reminder_text }}</span>
<p class="text-muted">{{ message }}</p> <p class="text-muted">{{ message }}</p>
</div> </div>
</div> </div>