mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-04 04:39:11 +00:00
Merge branch 'develop' into fix_print_bold
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
if((df.fieldname !== "description" && df.fieldname !== "item_name") && val) { %}
|
||||
<div class="row">
|
||||
<div class="col-xs-4 ellipsis">
|
||||
<strong title="{%= __(df.label) %}">{%= __(df.label) %}:</strong>
|
||||
<strong title="{%= __(df.label, null, df.parent) %}">{%= __(df.label, null, df.parent) %}:</strong>
|
||||
</div>
|
||||
<div class="col-xs-8">
|
||||
{%= doc.get_formatted(df.fieldname) %}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
actual_qty = (frm.doc.doctype==="Sales Order"
|
||||
? doc.projected_qty : doc.actual_qty);
|
||||
if(flt(frm.doc.per_delivered, 2) < 100
|
||||
&& in_list(["Sales Order Item", "Delivery Note Item"], doc.doctype)) {
|
||||
&& ["Sales Order Item", "Delivery Note Item"].includes(doc.doctype)) {
|
||||
if(actual_qty != undefined) {
|
||||
if(actual_qty >= doc.qty) {
|
||||
var color = "green";
|
||||
|
||||
@@ -8,18 +8,20 @@
|
||||
<div class="partner-content" itemscope itemtype="http://schema.org/Organization">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
{% if logo -%}
|
||||
{% if logo %}
|
||||
<img itemprop="brand" src="{{ logo }}" class="partner-logo"
|
||||
alt="{{ partner_name }}" title="{{ partner_name }}" />
|
||||
<br><br>
|
||||
{%- endif %}
|
||||
<address>
|
||||
{% if partner_website -%}<p><a href="{{ partner_website }}"
|
||||
target="_blank">{{ partner_website }}</a></p>{%- endif %}
|
||||
{% if partner_address -%}<p itemprop="address">{{ partner_address }}</p>{%- endif %}
|
||||
{% if phone -%}<p itemprop="telephone">{{ phone }}</p>{%- endif %}
|
||||
{% if email -%}<p itemprop="email"><span class="fa fa-envelope"></span> {{ email }}</p>{%- endif %}
|
||||
</address>
|
||||
{% endif %}
|
||||
{% if addresses %}
|
||||
{% for address in addresses %}
|
||||
<address>
|
||||
{% if address.partner_address %}<p itemprop="address">{{ address.partner_address }}</p>{% endif %}
|
||||
{% if address.phone %}<p itemprop="telephone">{{ address.phone }}</p>{% endif %}
|
||||
{% if address.email %}<p itemprop="email"><span class="fa fa-envelope"></span> {{ address.email }}</p>{% endif %}
|
||||
</address>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<p>{{ description }}</p>
|
||||
|
||||
@@ -1 +1 @@
|
||||
<a href="https://erpnext.com?source=website_footer" target="_blank" class="text-muted">Powered by ERPNext</a>
|
||||
{{ _("Powered by {0}").format('<a href="https://erpnext.com?source=website_footer" target="_blank" class="text-muted">ERPNext</a>') }}
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<p>
|
||||
<a href="/api/method/erpnext.accounts.doctype.payment_request.payment_request.make_payment_request?dn={{ doc.name }}&dt={{ doc.doctype }}&submit_doc=1&order_type=Shopping Cart"
|
||||
class="btn btn-primary btn-sm" id="pay-for-order">
|
||||
{{ _("Pay") }} {{doc.get_formatted("grand_total") }}
|
||||
{{ _("Pay") }} {{ pay_amount }}
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
import frappe
|
||||
from frappe import _
|
||||
|
||||
from erpnext.accounts.doctype.payment_request.payment_request import get_amount
|
||||
|
||||
|
||||
def get_context(context):
|
||||
context.no_cache = 1
|
||||
@@ -34,9 +36,7 @@ def get_context(context):
|
||||
context.available_loyalty_points = 0.0
|
||||
if context.doc.get("customer"):
|
||||
# check for the loyalty program of the customer
|
||||
customer_loyalty_program = frappe.db.get_value(
|
||||
"Customer", context.doc.customer, "loyalty_program"
|
||||
)
|
||||
customer_loyalty_program = frappe.db.get_value("Customer", context.doc.customer, "loyalty_program")
|
||||
|
||||
if customer_loyalty_program:
|
||||
from erpnext.accounts.doctype.loyalty_program.loyalty_program import (
|
||||
@@ -48,10 +48,7 @@ def get_context(context):
|
||||
)
|
||||
context.available_loyalty_points = int(loyalty_program_details.get("loyalty_points"))
|
||||
|
||||
context.show_pay_button = (
|
||||
"payments" in frappe.get_installed_apps()
|
||||
and frappe.db.get_single_value("Buying Settings", "show_pay_button")
|
||||
)
|
||||
context.show_pay_button, context.pay_amount = get_payment_details(context.doc)
|
||||
context.show_make_pi_button = False
|
||||
if context.doc.get("supplier"):
|
||||
# show Make Purchase Invoice button based on permission
|
||||
@@ -64,3 +61,17 @@ def get_attachments(dt, dn):
|
||||
fields=["name", "file_name", "file_url", "is_private"],
|
||||
filters={"attached_to_name": dn, "attached_to_doctype": dt, "is_private": 0},
|
||||
)
|
||||
|
||||
|
||||
def get_payment_details(doc):
|
||||
show_pay_button, amount = (
|
||||
(
|
||||
"payments" in frappe.get_installed_apps()
|
||||
and frappe.db.get_single_value("Buying Settings", "show_pay_button")
|
||||
),
|
||||
0,
|
||||
)
|
||||
if not show_pay_button:
|
||||
return show_pay_button, amount
|
||||
amount = get_amount(doc)
|
||||
return bool(amount), amount
|
||||
|
||||
@@ -1,120 +1,117 @@
|
||||
frappe.ready(function() {
|
||||
|
||||
$('.task-status-switch').on('click', function() {
|
||||
frappe.ready(function () {
|
||||
$(".task-status-switch").on("click", function () {
|
||||
var $btn = $(this);
|
||||
if($btn.attr('data-status')==='Open') {
|
||||
reload_items('completed', 'task', $btn);
|
||||
if ($btn.attr("data-status") === "Open") {
|
||||
reload_items("completed", "task", $btn);
|
||||
} else {
|
||||
reload_items('open', 'task', $btn);
|
||||
reload_items("open", "task", $btn);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
$('.issue-status-switch').on('click', function() {
|
||||
$(".issue-status-switch").on("click", function () {
|
||||
var $btn = $(this);
|
||||
if($btn.attr('data-status')==='Open') {
|
||||
reload_items('completed', 'issue', $btn);
|
||||
if ($btn.attr("data-status") === "Open") {
|
||||
reload_items("completed", "issue", $btn);
|
||||
} else {
|
||||
reload_items('open', 'issue', $btn);
|
||||
reload_items("open", "issue", $btn);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
var start = 10;
|
||||
$(".more-tasks").click(function() {
|
||||
more_items('task', true);
|
||||
$(".more-tasks").click(function () {
|
||||
more_items("task", true);
|
||||
});
|
||||
|
||||
$(".more-issues").click(function() {
|
||||
more_items('issue', true);
|
||||
$(".more-issues").click(function () {
|
||||
more_items("issue", true);
|
||||
});
|
||||
|
||||
$(".more-timelogs").click(function() {
|
||||
more_items('timelog', false);
|
||||
$(".more-timelogs").click(function () {
|
||||
more_items("timelog", false);
|
||||
});
|
||||
|
||||
$(".more-timelines").click(function() {
|
||||
more_items('timeline', false);
|
||||
$(".more-timelines").click(function () {
|
||||
more_items("timeline", false);
|
||||
});
|
||||
|
||||
$(".file-size").each(function() {
|
||||
$(".file-size").each(function () {
|
||||
$(this).text(frappe.form.formatters.FileSize($(this).text()));
|
||||
});
|
||||
|
||||
|
||||
var reload_items = function(item_status, item, $btn) {
|
||||
var reload_items = function (item_status, item, $btn) {
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
url: "/",
|
||||
dataType: "json",
|
||||
data: {
|
||||
cmd: "erpnext.templates.pages.projects.get_"+ item +"_html",
|
||||
project: '{{ doc.name }}',
|
||||
cmd: "erpnext.templates.pages.projects.get_" + item + "_html",
|
||||
project: "{{ doc.name }}",
|
||||
item_status: item_status,
|
||||
},
|
||||
success: function(data) {
|
||||
if(typeof data.message == 'undefined') {
|
||||
$('.project-'+ item).html("No "+ item_status +" "+ item);
|
||||
$(".more-"+ item).toggle(false);
|
||||
success: function (data) {
|
||||
if (typeof data.message == "undefined") {
|
||||
$(".project-" + item).html("No " + item_status + " " + item);
|
||||
$(".more-" + item).toggle(false);
|
||||
}
|
||||
$('.project-'+ item).html(data.message);
|
||||
$(".more-"+ item).toggle(true);
|
||||
$(".project-" + item).html(data.message);
|
||||
$(".more-" + item).toggle(true);
|
||||
|
||||
// update status
|
||||
if(item_status==='open') {
|
||||
$btn.html(__('Show Completed')).attr('data-status', 'Open');
|
||||
if (item_status === "open") {
|
||||
$btn.html(__("Show Completed")).attr("data-status", "Open");
|
||||
} else {
|
||||
$btn.html(__('Show Open')).attr('data-status', 'Completed');
|
||||
$btn.html(__("Show Open")).attr("data-status", "Completed");
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
var more_items = function(item, item_status){
|
||||
if(item_status) {
|
||||
item_status = $('.project-'+ item +'-section .btn-group .bold').hasClass('btn-completed-'+ item)
|
||||
? 'completed' : 'open';
|
||||
var more_items = function (item, item_status) {
|
||||
if (item_status) {
|
||||
item_status = $(".project-" + item + "-section .btn-group .bold").hasClass(
|
||||
"btn-completed-" + item
|
||||
)
|
||||
? "completed"
|
||||
: "open";
|
||||
}
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
url: "/",
|
||||
dataType: "json",
|
||||
data: {
|
||||
cmd: "erpnext.templates.pages.projects.get_"+ item +"_html",
|
||||
project: '{{ doc.name }}',
|
||||
cmd: "erpnext.templates.pages.projects.get_" + item + "_html",
|
||||
project: "{{ doc.name }}",
|
||||
start: start,
|
||||
item_status: item_status,
|
||||
},
|
||||
success: function(data) {
|
||||
|
||||
$(data.message).appendTo('.project-'+ item);
|
||||
if(typeof data.message == 'undefined') {
|
||||
$(".more-"+ item).toggle(false);
|
||||
success: function (data) {
|
||||
$(data.message).appendTo(".project-" + item);
|
||||
if (typeof data.message == "undefined") {
|
||||
$(".more-" + item).toggle(false);
|
||||
}
|
||||
start = start+10;
|
||||
}
|
||||
start = start + 10;
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var close_item = function(item, item_name){
|
||||
var close_item = function (item, item_name) {
|
||||
var args = {
|
||||
project: '{{ doc.name }}',
|
||||
project: "{{ doc.name }}",
|
||||
item_name: item_name,
|
||||
}
|
||||
};
|
||||
frappe.call({
|
||||
btn: this,
|
||||
type: "POST",
|
||||
method: "erpnext.templates.pages.projects.set_"+ item +"_status",
|
||||
method: "erpnext.templates.pages.projects.set_" + item + "_status",
|
||||
args: args,
|
||||
callback: function(r) {
|
||||
if(r.exc) {
|
||||
if(r._server_messages)
|
||||
frappe.msgprint(r._server_messages);
|
||||
callback: function (r) {
|
||||
if (r.exc) {
|
||||
if (r._server_messages) frappe.msgprint(r._server_messages);
|
||||
} else {
|
||||
$(this).remove();
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
});
|
||||
return false;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
@@ -12,9 +12,7 @@ def get_context(context):
|
||||
["user", "view_attachments"],
|
||||
as_dict=True,
|
||||
)
|
||||
if frappe.session.user != "Administrator" and (
|
||||
not project_user or frappe.session.user == "Guest"
|
||||
):
|
||||
if frappe.session.user != "Administrator" and (not project_user or frappe.session.user == "Guest"):
|
||||
raise frappe.PermissionError
|
||||
|
||||
context.no_cache = 1
|
||||
@@ -38,7 +36,7 @@ def get_context(context):
|
||||
def get_tasks(project, start=0, search=None, item_status=None):
|
||||
filters = {"project": project}
|
||||
if search:
|
||||
filters["subject"] = ("like", "%{0}%".format(search))
|
||||
filters["subject"] = ("like", f"%{search}%")
|
||||
tasks = frappe.get_all(
|
||||
"Task",
|
||||
filters=filters,
|
||||
@@ -83,7 +81,7 @@ def get_task_html(project, start=0, item_status=None):
|
||||
def get_timesheets(project, start=0, search=None):
|
||||
filters = {"project": project}
|
||||
if search:
|
||||
filters["activity_type"] = ("like", "%{0}%".format(search))
|
||||
filters["activity_type"] = ("like", f"%{search}%")
|
||||
|
||||
timesheets = frappe.get_all(
|
||||
"Timesheet Detail",
|
||||
|
||||
@@ -23,9 +23,7 @@ def get_context(context):
|
||||
|
||||
def get_supplier():
|
||||
doctype = frappe.form_dict.doctype
|
||||
parties_doctype = (
|
||||
"Request for Quotation Supplier" if doctype == "Request for Quotation" else doctype
|
||||
)
|
||||
parties_doctype = "Request for Quotation Supplier" if doctype == "Request for Quotation" else doctype
|
||||
customers, suppliers = get_customers_suppliers(parties_doctype, frappe.session.user)
|
||||
|
||||
return suppliers[0] if suppliers else ""
|
||||
@@ -44,7 +42,7 @@ def check_supplier_has_docname_access(supplier):
|
||||
|
||||
def unauthorized_user(supplier):
|
||||
status = check_supplier_has_docname_access(supplier) or False
|
||||
if status == False:
|
||||
if status is False:
|
||||
frappe.throw(_("Not Permitted"), frappe.PermissionError)
|
||||
|
||||
|
||||
@@ -53,9 +51,7 @@ def update_supplier_details(context):
|
||||
context.doc.currency = supplier_doc.default_currency or frappe.get_cached_value(
|
||||
"Company", context.doc.company, "default_currency"
|
||||
)
|
||||
context.doc.currency_symbol = frappe.db.get_value(
|
||||
"Currency", context.doc.currency, "symbol", cache=True
|
||||
)
|
||||
context.doc.currency_symbol = frappe.db.get_value("Currency", context.doc.currency, "symbol", cache=True)
|
||||
context.doc.number_format = frappe.db.get_value(
|
||||
"Currency", context.doc.currency, "number_format", cache=True
|
||||
)
|
||||
|
||||
@@ -47,9 +47,7 @@ def get_help_results_sections(text):
|
||||
|
||||
|
||||
def get_response(api, text):
|
||||
response = requests.get(
|
||||
api.base_url + "/" + api.query_route, data={api.search_term_param_name: text}
|
||||
)
|
||||
response = requests.get(api.base_url + "/" + api.query_route, data={api.search_term_param_name: text})
|
||||
|
||||
response.raise_for_status()
|
||||
return response.json()
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="col-xs-5 {%- if doc.align_labels_right %} text-right{%- endif -%}">
|
||||
<label>{{ _(df.label) }}</label></div>
|
||||
<label>{{ _(df.label, context=df.parent) }}</label></div>
|
||||
<div class="col-xs-7 text-right value">
|
||||
{{ doc.get_formatted("total", doc) }}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user