chore: whitespace trimming
This commit is contained in:
@@ -31,7 +31,7 @@ class ERPNextAddress(Address):
|
||||
customers = frappe.db.get_all("Customer", filters=filters, as_list=True)
|
||||
for customer_name in customers:
|
||||
frappe.db.set_value("Customer", customer_name[0], "primary_address", address_display)
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_shipping_address(company, address = None):
|
||||
filters = [
|
||||
|
||||
@@ -21,7 +21,7 @@ class BankTransaction(StatusUpdater):
|
||||
self.update_allocations()
|
||||
self.clear_linked_payment_entries()
|
||||
self.set_status(update=True)
|
||||
|
||||
|
||||
def on_cancel(self):
|
||||
self.clear_linked_payment_entries(for_cancel=True)
|
||||
self.set_status(update=True)
|
||||
@@ -45,7 +45,7 @@ class BankTransaction(StatusUpdater):
|
||||
frappe.db.set_value(self.doctype, self.name, "status", "Reconciled")
|
||||
|
||||
self.reload()
|
||||
|
||||
|
||||
def clear_linked_payment_entries(self, for_cancel=False):
|
||||
for payment_entry in self.payment_entries:
|
||||
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):
|
||||
reconciled_bank_transactions = frappe.get_all(
|
||||
'Bank Transaction Payments',
|
||||
'Bank Transaction Payments',
|
||||
filters = {
|
||||
'payment_entry': payment_entry.payment_entry
|
||||
},
|
||||
|
||||
@@ -10,14 +10,14 @@ class PartyLink(Document):
|
||||
if self.primary_role not in ['Customer', 'Supplier']:
|
||||
frappe.throw(_("Allowed primary roles are 'Customer' and 'Supplier'. Please select one of these roles only."),
|
||||
title=_("Invalid Primary Role"))
|
||||
|
||||
|
||||
existing_party_link = frappe.get_all('Party Link', {
|
||||
'primary_party': self.secondary_party
|
||||
}, pluck="primary_role")
|
||||
if existing_party_link:
|
||||
frappe.throw(_('{} {} is already linked with another {}')
|
||||
.format(self.secondary_role, self.secondary_party, existing_party_link[0]))
|
||||
|
||||
|
||||
existing_party_link = frappe.get_all('Party Link', {
|
||||
'secondary_party': self.primary_party
|
||||
}, pluck="primary_role")
|
||||
|
||||
@@ -484,7 +484,7 @@ class PaymentEntry(AccountsController):
|
||||
|
||||
def validate_amounts(self):
|
||||
self.validate_received_amount()
|
||||
|
||||
|
||||
def validate_received_amount(self):
|
||||
if self.paid_from_account_currency == self.paid_to_account_currency:
|
||||
if self.paid_amount != self.received_amount:
|
||||
|
||||
@@ -54,7 +54,7 @@ class PeriodClosingVoucher(AccountsController):
|
||||
if gl_entries:
|
||||
from erpnext.accounts.general_ledger import make_gl_entries
|
||||
make_gl_entries(gl_entries)
|
||||
|
||||
|
||||
def get_gl_entries(self):
|
||||
gl_entries = []
|
||||
pl_accounts = self.get_pl_balances()
|
||||
@@ -77,7 +77,7 @@ class PeriodClosingVoucher(AccountsController):
|
||||
gl_entries += gle_for_net_pl_bal
|
||||
|
||||
return gl_entries
|
||||
|
||||
|
||||
def get_pnl_gl_entry(self, pl_accounts):
|
||||
company_cost_center = frappe.db.get_value("Company", self.company, "cost_center")
|
||||
gl_entries = []
|
||||
|
||||
@@ -932,7 +932,7 @@ class SalesInvoice(SellingController):
|
||||
|
||||
if asset.calculate_depreciation:
|
||||
self.reset_depreciation_schedule(asset)
|
||||
|
||||
|
||||
else:
|
||||
fixed_asset_gl_entries = get_gl_entries_on_asset_disposal(asset,
|
||||
item.base_net_amount, item.finance_book)
|
||||
@@ -946,7 +946,7 @@ class SalesInvoice(SellingController):
|
||||
gl_entries.append(self.get_gl_dict(gle, item=item))
|
||||
|
||||
self.set_asset_status(asset)
|
||||
|
||||
|
||||
else:
|
||||
# Do not book income for transfer within same company
|
||||
if not self.is_internal_transfer():
|
||||
@@ -979,7 +979,7 @@ class SalesInvoice(SellingController):
|
||||
asset = frappe.get_doc("Asset", item.asset)
|
||||
else:
|
||||
frappe.throw(_(
|
||||
"Row #{0}: You must select an Asset for Item {1}.").format(item.idx, item.item_name),
|
||||
"Row #{0}: You must select an Asset for Item {1}.").format(item.idx, item.item_name),
|
||||
title=_("Missing Asset")
|
||||
)
|
||||
|
||||
@@ -996,7 +996,7 @@ class SalesInvoice(SellingController):
|
||||
asset.flags.ignore_validate_update_after_submit = True
|
||||
asset.prepare_depreciation_data(self.posting_date)
|
||||
asset.save()
|
||||
|
||||
|
||||
post_depreciation_entries(self.posting_date)
|
||||
|
||||
def reset_depreciation_schedule(self, asset):
|
||||
@@ -1036,7 +1036,7 @@ class SalesInvoice(SellingController):
|
||||
finance_book = schedule.finance_book
|
||||
else:
|
||||
row += 1
|
||||
|
||||
|
||||
if schedule.schedule_date == posting_date_of_original_invoice:
|
||||
if not self.sale_was_made_on_original_schedule_date(asset, schedule, row, posting_date_of_original_invoice):
|
||||
reverse_journal_entry = make_reverse_journal_entry(schedule.journal_entry)
|
||||
@@ -1046,13 +1046,13 @@ class SalesInvoice(SellingController):
|
||||
def get_posting_date_of_sales_invoice(self):
|
||||
return frappe.db.get_value('Sales Invoice', self.return_against, 'posting_date')
|
||||
|
||||
# if the invoice had been posted on the date the depreciation was initially supposed to happen, the depreciation shouldn't be undone
|
||||
# if the invoice had been posted on the date the depreciation was initially supposed to happen, the depreciation shouldn't be undone
|
||||
def sale_was_made_on_original_schedule_date(self, asset, schedule, row, posting_date_of_original_invoice):
|
||||
for finance_book in asset.get('finance_books'):
|
||||
if schedule.finance_book == finance_book.finance_book:
|
||||
orginal_schedule_date = add_months(finance_book.depreciation_start_date,
|
||||
row * cint(finance_book.frequency_of_depreciation))
|
||||
|
||||
|
||||
if orginal_schedule_date == posting_date_of_original_invoice:
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -1118,9 +1118,9 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
'qty': 1
|
||||
})
|
||||
pi.set_missing_values()
|
||||
|
||||
|
||||
asset = create_asset(item_code="Macbook Pro")
|
||||
|
||||
|
||||
si = create_sales_invoice(item_code="Macbook Pro", asset=asset.name, qty=1, rate=90000)
|
||||
return_si = create_sales_invoice(is_return=1, return_against=si.name, item_code="Macbook Pro", asset=asset.name, qty=-1, rate=90000)
|
||||
|
||||
@@ -1128,7 +1128,7 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
|
||||
# Asset value is 100,000 but it was sold for 90,000, so there should be a loss of 10,000
|
||||
loss_for_si = frappe.get_all(
|
||||
"GL Entry",
|
||||
"GL Entry",
|
||||
filters = {
|
||||
"voucher_no": si.name,
|
||||
"account": disposal_account
|
||||
@@ -1137,7 +1137,7 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
)[0]
|
||||
|
||||
loss_for_return_si = frappe.get_all(
|
||||
"GL Entry",
|
||||
"GL Entry",
|
||||
filters = {
|
||||
"voucher_no": return_si.name,
|
||||
"account": disposal_account
|
||||
|
||||
@@ -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):
|
||||
tds_amount = 0
|
||||
invoice_filters = {
|
||||
'name': ('in', vouchers),
|
||||
'name': ('in', vouchers),
|
||||
'docstatus': 1,
|
||||
'apply_tds': 1
|
||||
}
|
||||
|
||||
@@ -321,10 +321,10 @@ class Asset(AccountsController):
|
||||
def get_from_date(self, finance_book):
|
||||
if not self.get('schedules'):
|
||||
return self.available_for_use_date
|
||||
|
||||
|
||||
if len(self.finance_books) == 1:
|
||||
return self.schedules[-1].schedule_date
|
||||
|
||||
|
||||
from_date = ""
|
||||
for schedule in self.get('schedules'):
|
||||
if schedule.finance_book == finance_book:
|
||||
|
||||
@@ -146,7 +146,7 @@ class LinkedInSettings(Document):
|
||||
|
||||
except Exception as e:
|
||||
self.api_error(response)
|
||||
|
||||
|
||||
return response
|
||||
|
||||
def get_headers(self):
|
||||
@@ -168,7 +168,7 @@ class LinkedInSettings(Document):
|
||||
raise
|
||||
except Exception:
|
||||
self.api_error(response)
|
||||
|
||||
|
||||
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)
|
||||
|
||||
@@ -176,7 +176,7 @@ class LinkedInSettings(Document):
|
||||
response = requests.get(url=url, headers=self.get_headers())
|
||||
if response.status_code !=200:
|
||||
raise
|
||||
|
||||
|
||||
except Exception:
|
||||
self.api_error(response)
|
||||
|
||||
|
||||
@@ -80,10 +80,10 @@ frappe.ui.form.on('Social Media Post', {
|
||||
|
||||
refresh: function(frm) {
|
||||
frm.trigger('text');
|
||||
|
||||
|
||||
if (frm.doc.docstatus === 1) {
|
||||
if (!['Posted', 'Deleted'].includes(frm.doc.post_status)) {
|
||||
frm.trigger('add_post_btn');
|
||||
frm.trigger('add_post_btn');
|
||||
}
|
||||
if (frm.doc.post_status !='Deleted') {
|
||||
frm.add_custom_button(('Delete Post'), function() {
|
||||
|
||||
@@ -53,10 +53,10 @@ class TwitterSettings(Document):
|
||||
frappe.throw(_('Invalid Consumer Key or Consumer Secret Key'))
|
||||
|
||||
def get_api(self):
|
||||
# authentication of consumer key and secret
|
||||
auth = tweepy.OAuthHandler(self.consumer_key, self.get_password(fieldname="consumer_secret"))
|
||||
# authentication of access token and secret
|
||||
auth.set_access_token(self.access_token, self.access_token_secret)
|
||||
# authentication of consumer key and secret
|
||||
auth = tweepy.OAuthHandler(self.consumer_key, self.get_password(fieldname="consumer_secret"))
|
||||
# authentication of access token and secret
|
||||
auth.set_access_token(self.access_token, self.access_token_secret)
|
||||
|
||||
return tweepy.API(auth)
|
||||
|
||||
@@ -90,20 +90,20 @@ class TwitterSettings(Document):
|
||||
|
||||
def delete_tweet(self, tweet_id):
|
||||
api = self.get_api()
|
||||
try:
|
||||
try:
|
||||
api.destroy_status(tweet_id)
|
||||
except TweepError as e:
|
||||
self.api_error(e)
|
||||
|
||||
def get_tweet(self, tweet_id):
|
||||
api = self.get_api()
|
||||
try:
|
||||
try:
|
||||
response = api.get_status(tweet_id, trim_user=True, include_entities=True)
|
||||
except TweepError as e:
|
||||
self.api_error(e)
|
||||
|
||||
|
||||
return response._json
|
||||
|
||||
|
||||
def api_error(self, e):
|
||||
content = json.loads(e.response.content)
|
||||
content = content["errors"][0]
|
||||
|
||||
@@ -31,7 +31,7 @@ class TestTherapyPlan(unittest.TestCase):
|
||||
self.assertEqual(frappe.db.get_value('Therapy Plan', plan.name, 'status'), 'Completed')
|
||||
|
||||
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 = frappe.get_doc(session)
|
||||
|
||||
@@ -18,7 +18,7 @@ class TestEmployeeReminders(unittest.TestCase):
|
||||
# Create a test holiday list
|
||||
test_holiday_dates = cls.get_test_holiday_dates()
|
||||
test_holiday_list = make_holiday_list(
|
||||
'TestHolidayRemindersList',
|
||||
'TestHolidayRemindersList',
|
||||
holiday_dates=[
|
||||
{'holiday_date': test_holiday_dates[0], 'description': 'test holiday1'},
|
||||
{'holiday_date': test_holiday_dates[1], 'description': 'test holiday2'},
|
||||
@@ -49,8 +49,8 @@ class TestEmployeeReminders(unittest.TestCase):
|
||||
def get_test_holiday_dates(cls):
|
||||
today_date = getdate()
|
||||
return [
|
||||
today_date,
|
||||
today_date-timedelta(days=4),
|
||||
today_date,
|
||||
today_date-timedelta(days=4),
|
||||
today_date-timedelta(days=3),
|
||||
today_date+timedelta(days=1),
|
||||
today_date+timedelta(days=3),
|
||||
@@ -63,7 +63,7 @@ class TestEmployeeReminders(unittest.TestCase):
|
||||
|
||||
def test_is_holiday(self):
|
||||
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, date=self.test_holiday_dates[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)
|
||||
self.assertTrue("Subject: Work Anniversary Reminder" in email_queue[0].message)
|
||||
|
||||
|
||||
def test_send_holidays_reminder_in_advance(self):
|
||||
from erpnext.hr.utils import get_holidays_for_employee
|
||||
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(
|
||||
self.test_employee.get('name'),
|
||||
getdate(), getdate() + timedelta(days=3),
|
||||
only_non_weekly=True,
|
||||
only_non_weekly=True,
|
||||
raise_exception=False
|
||||
)
|
||||
|
||||
|
||||
send_holidays_reminder_in_advance(
|
||||
self.test_employee.get('name'),
|
||||
holidays
|
||||
@@ -158,7 +158,7 @@ class TestEmployeeReminders(unittest.TestCase):
|
||||
|
||||
email_queue = frappe.db.sql("""select * from `tabEmail Queue`""", as_dict=True)
|
||||
self.assertTrue(len(email_queue) > 0)
|
||||
|
||||
|
||||
def test_advance_holiday_reminders_weekly(self):
|
||||
from erpnext.hr.doctype.employee.employee_reminders import send_reminders_in_advance_weekly
|
||||
# Get HR settings and enable advance holiday reminders
|
||||
|
||||
@@ -144,20 +144,20 @@ class TestExpenseClaim(unittest.TestCase):
|
||||
expense_claim = make_expense_claim(payable_account, 5500, 5500, "_Test Company", "Travel Expenses - _TC")
|
||||
expense_claim.save()
|
||||
expense_claim.submit()
|
||||
|
||||
|
||||
# Payment entry 1: paying 500
|
||||
make_payment_entry(expense_claim, payable_account,500)
|
||||
outstanding_amount, total_amount_reimbursed = get_outstanding_and_total_reimbursed_amounts(expense_claim)
|
||||
self.assertEqual(outstanding_amount, 5000)
|
||||
self.assertEqual(total_amount_reimbursed, 500)
|
||||
|
||||
|
||||
# Payment entry 1: paying 2000
|
||||
make_payment_entry(expense_claim, payable_account,2000)
|
||||
outstanding_amount, total_amount_reimbursed = get_outstanding_and_total_reimbursed_amounts(expense_claim)
|
||||
self.assertEqual(outstanding_amount, 3000)
|
||||
self.assertEqual(total_amount_reimbursed, 2500)
|
||||
|
||||
# Payment entry 1: paying 3000
|
||||
|
||||
# Payment entry 1: paying 3000
|
||||
make_payment_entry(expense_claim, payable_account,3000)
|
||||
outstanding_amount, total_amount_reimbursed = get_outstanding_and_total_reimbursed_amounts(expense_claim)
|
||||
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")) - \
|
||||
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
|
||||
|
||||
def make_payment_entry(expense_claim, payable_account, amt):
|
||||
@@ -234,5 +234,5 @@ def make_payment_entry(expense_claim, payable_account, amt):
|
||||
pe.paid_to = payable_account
|
||||
pe.references[0].allocated_amount = amt
|
||||
pe.insert()
|
||||
pe.submit()
|
||||
|
||||
pe.submit()
|
||||
|
||||
|
||||
@@ -450,9 +450,9 @@ def get_sal_slip_total_benefit_given(employee, payroll_period, component=False):
|
||||
|
||||
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 only date
|
||||
holidays = get_holidays_for_employee(employee, start_date, end_date)
|
||||
|
||||
# return only date
|
||||
holidays = get_holidays_for_employee(employee, start_date, end_date)
|
||||
|
||||
return [cstr(h.holiday_date) for h in holidays]
|
||||
|
||||
|
||||
@@ -465,7 +465,7 @@ def get_holidays_for_employee(employee, start_date, end_date, raise_exception=Tr
|
||||
`raise_exception` (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)
|
||||
|
||||
@@ -481,11 +481,11 @@ def get_holidays_for_employee(employee, start_date, end_date, raise_exception=Tr
|
||||
filters['weekly_off'] = False
|
||||
|
||||
holidays = frappe.get_all(
|
||||
'Holiday',
|
||||
'Holiday',
|
||||
fields=['description', 'holiday_date'],
|
||||
filters=filters
|
||||
)
|
||||
|
||||
|
||||
return holidays
|
||||
|
||||
@erpnext.allow_regional
|
||||
|
||||
@@ -7,17 +7,17 @@ def execute():
|
||||
try:
|
||||
# Rename the field
|
||||
rename_field('HR Settings', 'stop_birthday_reminders', 'send_birthday_reminders')
|
||||
|
||||
|
||||
# Reverse the value
|
||||
old_value = frappe.db.get_single_value('HR Settings', 'send_birthday_reminders')
|
||||
|
||||
frappe.db.set_value(
|
||||
'HR Settings',
|
||||
'HR Settings',
|
||||
'send_birthday_reminders',
|
||||
'HR Settings',
|
||||
'HR Settings',
|
||||
'send_birthday_reminders',
|
||||
1 if old_value == 0 else 0
|
||||
)
|
||||
|
||||
|
||||
except Exception as e:
|
||||
if e.args[0] != 1054:
|
||||
raise
|
||||
@@ -35,10 +35,10 @@ def get_reconciled_bank_transactions(intra_company_pe):
|
||||
|
||||
for payment_entry in intra_company_pe:
|
||||
reconciled_bank_transactions[payment_entry] = frappe.get_all(
|
||||
'Bank Transaction Payments',
|
||||
'Bank Transaction Payments',
|
||||
filters = {
|
||||
'payment_entry': payment_entry
|
||||
},
|
||||
},
|
||||
pluck='parent'
|
||||
)
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model import data_field_options
|
||||
from frappe.model import data_field_options
|
||||
|
||||
def execute():
|
||||
|
||||
for field in frappe.get_all('Custom Field',
|
||||
for field in frappe.get_all('Custom Field',
|
||||
fields = ['name'],
|
||||
filters = {
|
||||
'fieldtype': 'Data',
|
||||
@@ -16,7 +16,7 @@ def execute():
|
||||
|
||||
if field not in data_field_options:
|
||||
frappe.db.sql("""
|
||||
UPDATE
|
||||
UPDATE
|
||||
`tabCustom Field`
|
||||
SET
|
||||
options=NULL
|
||||
|
||||
@@ -86,9 +86,9 @@ $.extend(erpnext, {
|
||||
|
||||
proceed_save_with_reminders_frequency_change: () => {
|
||||
frappe.ui.hide_open_dialog();
|
||||
|
||||
|
||||
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: () => {
|
||||
cur_frm.save();
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ def get_transactions(filters, as_dict=1):
|
||||
def run(params_method, filters):
|
||||
extra_fields, extra_joins, extra_filters = params_method(filters)
|
||||
return run_query(filters, extra_fields, extra_joins, extra_filters, as_dict=as_dict)
|
||||
|
||||
|
||||
def sort_by(row):
|
||||
# "Belegdatum" is in the fifth column when list format is used
|
||||
return row["Belegdatum" if as_dict else 5]
|
||||
@@ -361,7 +361,7 @@ def run_query(filters, extra_fields, extra_joins, extra_filters, as_dict=1):
|
||||
FROM `tabGL Entry` gl
|
||||
|
||||
/* Kontonummer */
|
||||
LEFT JOIN `tabAccount` acc
|
||||
LEFT JOIN `tabAccount` acc
|
||||
ON gl.account = acc.name
|
||||
|
||||
LEFT JOIN `tabParty Account` par
|
||||
|
||||
@@ -190,7 +190,7 @@ class VATAuditReport(object):
|
||||
row["posting_date"] = formatdate(inv_data.get("posting_date"), "dd-mm-yyyy")
|
||||
row["voucher_type"] = doctype
|
||||
row["voucher_no"] = inv
|
||||
row["party_type"] = "Customer" if doctype == "Sales Invoice" else "Supplier"
|
||||
row["party_type"] = "Customer" if doctype == "Sales Invoice" else "Supplier"
|
||||
row["party"] = inv_data.get("party")
|
||||
row["remarks"] = inv_data.get("remarks")
|
||||
row["gross_amount"]= item_details[0].get("gross_amount")
|
||||
|
||||
@@ -24,7 +24,7 @@ def make_custom_fields(update=True):
|
||||
'Sales Invoice Item': is_zero_rated,
|
||||
'Purchase Invoice Item': is_zero_rated
|
||||
}
|
||||
|
||||
|
||||
create_custom_fields(custom_fields, update=update)
|
||||
|
||||
def add_permissions():
|
||||
@@ -36,7 +36,7 @@ def add_permissions():
|
||||
add_permission(doctype, role, 0)
|
||||
update_permission_property(doctype, role, 0, 'write', 1)
|
||||
update_permission_property(doctype, role, 0, 'create', 1)
|
||||
|
||||
|
||||
|
||||
if not frappe.db.get_value('Custom Role', dict(report="VAT Audit Report")):
|
||||
frappe.get_doc(dict(
|
||||
|
||||
@@ -92,7 +92,7 @@ def get_query_args(filters: Filters) -> QueryArgs:
|
||||
|
||||
def run_query(query_args: QueryArgs) -> Data:
|
||||
return frappe.db.sql("""
|
||||
SELECT
|
||||
SELECT
|
||||
wo.name, wo.status, wo.production_item, wo.qty,
|
||||
wo.produced_qty, wo.process_loss_qty,
|
||||
(wo.produced_qty - wo.process_loss_qty) as actual_produced_qty,
|
||||
|
||||
@@ -533,7 +533,7 @@ def set_first_response_time(communication, method):
|
||||
|
||||
def is_first_response(issue):
|
||||
responses = frappe.get_all('Communication', filters = {'reference_name': issue.name, 'sent_or_received': 'Sent'})
|
||||
if len(responses) == 1:
|
||||
if len(responses) == 1:
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -562,7 +562,7 @@ def calculate_first_response_time(issue, first_responded_on):
|
||||
# both issue creation and first response were after working hours
|
||||
else:
|
||||
return 1.0 # this should ideally be zero, but it gets reset when the next response is sent if the value is zero
|
||||
|
||||
|
||||
else:
|
||||
return 1.0
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ class TestIssue(TestSetUp):
|
||||
|
||||
issue.reload()
|
||||
self.assertEqual(flt(issue.total_hold_time, 2), 2700)
|
||||
self.assertEqual(issue.resolution_by, get_datetime("2020-03-04 16:45"))
|
||||
self.assertEqual(issue.resolution_by, get_datetime("2020-03-04 16:45"))
|
||||
|
||||
creation = get_datetime("2020-03-04 5:05")
|
||||
create_communication(issue.name, "test@admin.com", "Sent", creation)
|
||||
@@ -176,7 +176,7 @@ class TestFirstResponseTime(TestSetUp):
|
||||
# issue creation and first response are on consecutive days
|
||||
def test_first_response_time_case6(self):
|
||||
"""
|
||||
Test frt when the issue was created before working hours and the first response is also sent before working hours, but on the next day.
|
||||
Test frt when the issue was created before working hours and the first response is also sent before working hours, but on the next day.
|
||||
"""
|
||||
issue = create_issue_and_communication(get_datetime("06-28-2021 6:00"), get_datetime("06-29-2021 6:00"))
|
||||
self.assertEqual(issue.first_response_time, 28800.0)
|
||||
@@ -198,7 +198,7 @@ class TestFirstResponseTime(TestSetUp):
|
||||
def test_first_response_time_case9(self):
|
||||
"""
|
||||
Test frt when the issue was created before working hours and the first response is sent on the next day, which is not a work day.
|
||||
"""
|
||||
"""
|
||||
issue = create_issue_and_communication(get_datetime("06-25-2021 6:00"), get_datetime("06-26-2021 11:00"))
|
||||
self.assertEqual(issue.first_response_time, 28800.0)
|
||||
|
||||
@@ -226,7 +226,7 @@ class TestFirstResponseTime(TestSetUp):
|
||||
def test_first_response_time_case13(self):
|
||||
"""
|
||||
Test frt when the issue was created during working hours and the first response is sent on the next day, which is not a work day.
|
||||
"""
|
||||
"""
|
||||
issue = create_issue_and_communication(get_datetime("06-25-2021 12:00"), get_datetime("06-26-2021 11:00"))
|
||||
self.assertEqual(issue.first_response_time, 21600.0)
|
||||
|
||||
@@ -342,7 +342,7 @@ class TestFirstResponseTime(TestSetUp):
|
||||
"""
|
||||
issue = create_issue_and_communication(get_datetime("06-25-2021 20:00"), get_datetime("06-27-2021 11:00"))
|
||||
self.assertEqual(issue.first_response_time, 1.0)
|
||||
|
||||
|
||||
def create_issue_and_communication(issue_creation, first_responded_on):
|
||||
issue = make_issue(issue_creation, index=1)
|
||||
sender = create_user("test@admin.com")
|
||||
|
||||
Reference in New Issue
Block a user