mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 19:29:10 +00:00
Merge branch 'develop' into fix/supplier-portal/make-pi-btn
This commit is contained in:
@@ -212,21 +212,15 @@ def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=Fals
|
|||||||
meta = frappe.get_meta(doctype, cached=True)
|
meta = frappe.get_meta(doctype, cached=True)
|
||||||
searchfields = meta.get_search_fields()
|
searchfields = meta.get_search_fields()
|
||||||
|
|
||||||
# these are handled separately
|
|
||||||
ignored_search_fields = ("item_name", "description")
|
|
||||||
for ignored_field in ignored_search_fields:
|
|
||||||
if ignored_field in searchfields:
|
|
||||||
searchfields.remove(ignored_field)
|
|
||||||
|
|
||||||
columns = ""
|
columns = ""
|
||||||
extra_searchfields = [
|
extra_searchfields = [field for field in searchfields if not field in ["name", "description"]]
|
||||||
field
|
|
||||||
for field in searchfields
|
|
||||||
if not field in ["name", "item_group", "description", "item_name"]
|
|
||||||
]
|
|
||||||
|
|
||||||
if extra_searchfields:
|
if extra_searchfields:
|
||||||
columns = ", " + ", ".join(extra_searchfields)
|
columns += ", " + ", ".join(extra_searchfields)
|
||||||
|
|
||||||
|
if "description" in searchfields:
|
||||||
|
columns += """, if(length(tabItem.description) > 40, \
|
||||||
|
concat(substr(tabItem.description, 1, 40), "..."), description) as description"""
|
||||||
|
|
||||||
searchfields = searchfields + [
|
searchfields = searchfields + [
|
||||||
field
|
field
|
||||||
@@ -266,12 +260,10 @@ def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=Fals
|
|||||||
if frappe.db.count(doctype, cache=True) < 50000:
|
if frappe.db.count(doctype, cache=True) < 50000:
|
||||||
# scan description only if items are less than 50000
|
# scan description only if items are less than 50000
|
||||||
description_cond = "or tabItem.description LIKE %(txt)s"
|
description_cond = "or tabItem.description LIKE %(txt)s"
|
||||||
|
|
||||||
return frappe.db.sql(
|
return frappe.db.sql(
|
||||||
"""select
|
"""select
|
||||||
tabItem.name, tabItem.item_name, tabItem.item_group,
|
tabItem.name {columns}
|
||||||
if(length(tabItem.description) > 40, \
|
|
||||||
concat(substr(tabItem.description, 1, 40), "..."), description) as description
|
|
||||||
{columns}
|
|
||||||
from tabItem
|
from tabItem
|
||||||
where tabItem.docstatus < 2
|
where tabItem.docstatus < 2
|
||||||
and tabItem.disabled=0
|
and tabItem.disabled=0
|
||||||
|
|||||||
@@ -841,7 +841,7 @@ def make_rm_stock_entry(
|
|||||||
for fg_item_code in fg_item_code_list:
|
for fg_item_code in fg_item_code_list:
|
||||||
for rm_item in rm_items:
|
for rm_item in rm_items:
|
||||||
|
|
||||||
if rm_item.get("main_item_code") or rm_item.get("item_code") == fg_item_code:
|
if rm_item.get("main_item_code") == fg_item_code or rm_item.get("item_code") == fg_item_code:
|
||||||
rm_item_code = rm_item.get("rm_item_code")
|
rm_item_code = rm_item.get("rm_item_code")
|
||||||
|
|
||||||
items_dict = {
|
items_dict = {
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ def execute():
|
|||||||
"mode_of_payment": loan.mode_of_payment,
|
"mode_of_payment": loan.mode_of_payment,
|
||||||
"loan_account": loan.loan_account,
|
"loan_account": loan.loan_account,
|
||||||
"payment_account": loan.payment_account,
|
"payment_account": loan.payment_account,
|
||||||
|
"disbursement_account": loan.payment_account,
|
||||||
"interest_income_account": loan.interest_income_account,
|
"interest_income_account": loan.interest_income_account,
|
||||||
"penalty_income_account": loan.penalty_income_account,
|
"penalty_income_account": loan.penalty_income_account,
|
||||||
},
|
},
|
||||||
@@ -190,6 +191,7 @@ def create_loan_type(loan, loan_type_name, penalty_account):
|
|||||||
loan_type_doc.company = loan.company
|
loan_type_doc.company = loan.company
|
||||||
loan_type_doc.mode_of_payment = loan.mode_of_payment
|
loan_type_doc.mode_of_payment = loan.mode_of_payment
|
||||||
loan_type_doc.payment_account = loan.payment_account
|
loan_type_doc.payment_account = loan.payment_account
|
||||||
|
loan_type_doc.disbursement_account = loan.payment_account
|
||||||
loan_type_doc.loan_account = loan.loan_account
|
loan_type_doc.loan_account = loan.loan_account
|
||||||
loan_type_doc.interest_income_account = loan.interest_income_account
|
loan_type_doc.interest_income_account = loan.interest_income_account
|
||||||
loan_type_doc.penalty_income_account = penalty_account
|
loan_type_doc.penalty_income_account = penalty_account
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
|
from frappe.custom.doctype.property_setter.property_setter import make_property_setter
|
||||||
from frappe.test_runner import make_test_objects
|
from frappe.test_runner import make_test_objects
|
||||||
from frappe.tests.utils import FrappeTestCase, change_settings
|
from frappe.tests.utils import FrappeTestCase, change_settings
|
||||||
from frappe.utils import add_days, today
|
from frappe.utils import add_days, today
|
||||||
@@ -816,6 +817,30 @@ class TestItem(FrappeTestCase):
|
|||||||
item.reload()
|
item.reload()
|
||||||
self.assertEqual(item.is_stock_item, 1)
|
self.assertEqual(item.is_stock_item, 1)
|
||||||
|
|
||||||
|
def test_serach_fields_for_item(self):
|
||||||
|
from erpnext.controllers.queries import item_query
|
||||||
|
|
||||||
|
make_property_setter("Item", None, "search_fields", "item_name", "Data", for_doctype="Doctype")
|
||||||
|
|
||||||
|
item = make_item(properties={"item_name": "Test Item", "description": "Test Description"})
|
||||||
|
data = item_query(
|
||||||
|
"Item", "Test Item", "", 0, 20, filters={"item_name": "Test Item"}, as_dict=True
|
||||||
|
)
|
||||||
|
self.assertEqual(data[0].name, item.name)
|
||||||
|
self.assertEqual(data[0].item_name, item.item_name)
|
||||||
|
self.assertTrue("description" not in data[0])
|
||||||
|
|
||||||
|
make_property_setter(
|
||||||
|
"Item", None, "search_fields", "item_name, description", "Data", for_doctype="Doctype"
|
||||||
|
)
|
||||||
|
data = item_query(
|
||||||
|
"Item", "Test Item", "", 0, 20, filters={"item_name": "Test Item"}, as_dict=True
|
||||||
|
)
|
||||||
|
self.assertEqual(data[0].name, item.name)
|
||||||
|
self.assertEqual(data[0].item_name, item.item_name)
|
||||||
|
self.assertEqual(data[0].description, item.description)
|
||||||
|
self.assertTrue("description" in data[0])
|
||||||
|
|
||||||
|
|
||||||
def set_item_variant_settings(fields):
|
def set_item_variant_settings(fields):
|
||||||
doc = frappe.get_doc("Item Variant Settings")
|
doc = frappe.get_doc("Item Variant Settings")
|
||||||
|
|||||||
@@ -12,8 +12,8 @@
|
|||||||
<!-- title: Book an appointment -->
|
<!-- title: Book an appointment -->
|
||||||
<div id="select-date-time">
|
<div id="select-date-time">
|
||||||
<div class="text-center mt-5">
|
<div class="text-center mt-5">
|
||||||
<h3>Book an appointment</h3>
|
<h3>{{ _("Book an appointment") }}</h3>
|
||||||
<p class="lead text-muted" id="lead-text">Select the date and your timezone</p>
|
<p class="lead text-muted" id="lead-text">{{ _("Select the date and your timezone") }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="row justify-content-center mt-3">
|
<div class="row justify-content-center mt-3">
|
||||||
<div class="col-md-6 align-self-center ">
|
<div class="col-md-6 align-self-center ">
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row justify-content-center mt-3">
|
<div class="row justify-content-center mt-3">
|
||||||
<div class="col-md-4 mb-3">
|
<div class="col-md-4 mb-3">
|
||||||
<button class="btn btn-primary form-control" id="next-button">Next</button>
|
<button class="btn btn-primary form-control" id="next-button">{{ _("Next") }}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -39,24 +39,24 @@
|
|||||||
<!--Enter Details-->
|
<!--Enter Details-->
|
||||||
<div id="enter-details" class="mb-5">
|
<div id="enter-details" class="mb-5">
|
||||||
<div class="text-center mt-5">
|
<div class="text-center mt-5">
|
||||||
<h3>Add details</h3>
|
<h3>{{ _("Add details") }}</h3>
|
||||||
<p class="lead text-muted">Selected date is <span class="date-span"></span> at <span class="time-span">
|
<p class="lead text-muted">{{ _("Selected date is") }} <span class="date-span"></span> {{ _("at") }} <span class="time-span">
|
||||||
</span></p>
|
</span></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="row justify-content-center mt-3">
|
<div class="row justify-content-center mt-3">
|
||||||
<div class="col-md-4 align-items-center">
|
<div class="col-md-4 align-items-center">
|
||||||
<form id="customer-form" action='#'>
|
<form id="customer-form" action='#'>
|
||||||
<input class="form-control mt-3" type="text" name="customer_name" id="customer_name" placeholder="Your Name (required)" required>
|
<input class="form-control mt-3" type="text" name="customer_name" id="customer_name" placeholder="{{ _('Your Name (required)') }}" required>
|
||||||
<input class="form-control mt-3" type="tel" name="customer_number" id="customer_number" placeholder="+910000000000">
|
<input class="form-control mt-3" type="tel" name="customer_number" id="customer_number" placeholder="+910000000000">
|
||||||
<input class="form-control mt-3" type="text" name="customer_skype" id="customer_skype" placeholder="Skype">
|
<input class="form-control mt-3" type="text" name="customer_skype" id="customer_skype" placeholder="Skype">
|
||||||
<input class="form-control mt-3"type="email" name="customer_email" id="customer_email" placeholder="Email Address (required)" required>
|
<input class="form-control mt-3"type="email" name="customer_email" id="customer_email" placeholder="{{ _('Email Address (required)') }}" required>
|
||||||
|
|
||||||
<textarea class="form-control mt-3" name="customer_notes" id="customer_notes" cols="30" rows="10"
|
<textarea class="form-control mt-3" name="customer_notes" id="customer_notes" cols="30" rows="10"
|
||||||
placeholder="Notes"></textarea>
|
placeholder="{{ _('Notes') }}"></textarea>
|
||||||
</form>
|
</form>
|
||||||
<div class="row mt-3 " id="submit-button-area">
|
<div class="row mt-3 " id="submit-button-area">
|
||||||
<div class="col-md mt-3" style="grid-area: back;"><button class="btn btn-dark form-control" onclick="initialise_select_date()">Go back</button></div>
|
<div class="col-md mt-3" style="grid-area: back;"><button class="btn btn-dark form-control" onclick="initialise_select_date()">{{ _("Go back") }}</button></div>
|
||||||
<div class="col-md mt-3" style="grid-area: submit;"><button class="btn btn-primary form-control " onclick="submit()" id="submit-button">Submit</button></div>
|
<div class="col-md mt-3" style="grid-area: submit;"><button class="btn btn-primary form-control " onclick="submit()" id="submit-button">{{ _("Submit") }}</button></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ function on_date_or_timezone_select() {
|
|||||||
window.selected_timezone = timezone.value;
|
window.selected_timezone = timezone.value;
|
||||||
update_time_slots(date_picker.value, timezone.value);
|
update_time_slots(date_picker.value, timezone.value);
|
||||||
let lead_text = document.getElementById('lead-text');
|
let lead_text = document.getElementById('lead-text');
|
||||||
lead_text.innerHTML = "Select Time"
|
lead_text.innerHTML = __("Select Time")
|
||||||
}
|
}
|
||||||
|
|
||||||
async function get_time_slots(date, timezone) {
|
async function get_time_slots(date, timezone) {
|
||||||
@@ -89,7 +89,7 @@ async function update_time_slots(selected_date, selected_timezone) {
|
|||||||
clear_time_slots();
|
clear_time_slots();
|
||||||
if (window.slots.length <= 0) {
|
if (window.slots.length <= 0) {
|
||||||
let message_div = document.createElement('p');
|
let message_div = document.createElement('p');
|
||||||
message_div.innerHTML = "There are no slots available on this date";
|
message_div.innerHTML = __("There are no slots available on this date");
|
||||||
timeslot_container.appendChild(message_div);
|
timeslot_container.appendChild(message_div);
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -128,7 +128,7 @@ function get_slot_layout(time) {
|
|||||||
let start_time_string = moment(time).tz(timezone).format("LT");
|
let start_time_string = moment(time).tz(timezone).format("LT");
|
||||||
let end_time = moment(time).tz(timezone).add(window.appointment_settings.appointment_duration, 'minutes');
|
let end_time = moment(time).tz(timezone).add(window.appointment_settings.appointment_duration, 'minutes');
|
||||||
let end_time_string = end_time.format("LT");
|
let end_time_string = end_time.format("LT");
|
||||||
return `<span style="font-size: 1.2em;">${start_time_string}</span><br><span class="text-muted small">to ${end_time_string}</span>`;
|
return `<span style="font-size: 1.2em;">${start_time_string}</span><br><span class="text-muted small">${__("to") } ${end_time_string}</span>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function select_time() {
|
function select_time() {
|
||||||
@@ -227,9 +227,9 @@ async function submit() {
|
|||||||
},
|
},
|
||||||
callback: (response)=>{
|
callback: (response)=>{
|
||||||
if (response.message.status == "Unverified") {
|
if (response.message.status == "Unverified") {
|
||||||
frappe.show_alert("Please check your email to confirm the appointment")
|
frappe.show_alert(__("Please check your email to confirm the appointment"))
|
||||||
} else {
|
} else {
|
||||||
frappe.show_alert("Appointment Created Successfully");
|
frappe.show_alert(__("Appointment Created Successfully"));
|
||||||
}
|
}
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
let redirect_url = "/";
|
let redirect_url = "/";
|
||||||
@@ -239,7 +239,7 @@ async function submit() {
|
|||||||
window.location.href = redirect_url;},5000)
|
window.location.href = redirect_url;},5000)
|
||||||
},
|
},
|
||||||
error: (err)=>{
|
error: (err)=>{
|
||||||
frappe.show_alert("Something went wrong please try again");
|
frappe.show_alert(__("Something went wrong please try again"));
|
||||||
button.disabled = false;
|
button.disabled = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,11 +8,11 @@
|
|||||||
|
|
||||||
{% if success==True %}
|
{% if success==True %}
|
||||||
<div class="alert alert-success">
|
<div class="alert alert-success">
|
||||||
Your email has been verified and your appointment has been scheduled
|
{{ _("Your email has been verified and your appointment has been scheduled") }}
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="alert alert-danger">
|
<div class="alert alert-danger">
|
||||||
Verification failed please check the link
|
{{ _("Verification failed please check the link") }}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock%}
|
{% endblock%}
|
||||||
|
|||||||
Reference in New Issue
Block a user