[minor] enhance BOM view

This commit is contained in:
Rushabh Mehta 2017-02-01 18:17:35 +05:30
parent 98595dff0b
commit 3714626dd0
9 changed files with 74 additions and 78 deletions

View File

@ -360,9 +360,10 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
this.party_field.make_input();
setTimeout(this.set_focus.bind(this), 500);
this.wrapper.find(".btn-more").on("click", function() {
me.page_len += 20;
me.items = me.get_items();
me.make_item_list();
})
},
@ -476,7 +477,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
me.delete_records();
me.render_list_customers();
})
})
})
},
set_focus: function () {
@ -574,21 +575,21 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
new_customer: function () {
var me = this;
if (!this.connection_status) return;
this.customer_doc = new frappe.ui.Dialog({
'title': 'Customer',
fields: [
{
"label": __("Full Name"),
"label": __("Full Name"),
"fieldname": "full_name",
"fieldtype": "Data",
"reqd": 1
"reqd": 1
},
{
"fieldtype": "Section Break"
},
{
"label": __("Email Id"),
"label": __("Email Id"),
"fieldname": "email_id",
"fieldtype": "Data"
},
@ -596,7 +597,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
"fieldtype": "Column Break"
},
{
"label": __("Contact Number"),
"label": __("Contact Number"),
"fieldname": "contact_no",
"fieldtype": "Data"
},
@ -604,12 +605,12 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
"fieldtype": "Section Break"
},
{
"label": __("Address Line 1"),
"label": __("Address Line 1"),
"fieldname": "address_line1",
"fieldtype": "Data"
},
{
"label": __("Address Line 2"),
"label": __("Address Line 2"),
"fieldname": "address_line2",
"fieldtype": "Data"
},
@ -617,31 +618,31 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
"fieldtype": "Column Break"
},
{
"label": __("City"),
"label": __("City"),
"fieldname": "city",
"fieldtype": "Data"
},
{
"label": __("State"),
"label": __("State"),
"fieldname": "state",
"fieldtype": "Data"
},
{
"label": __("ZIP Code"),
"label": __("ZIP Code"),
"fieldname": "zip_code",
"fieldtype": "Data"
}
]
})
this.customer_doc.show()
this.customer_doc.set_primary_action(__("Save"), function () {
me.make_offline_customer();
me.pos_bill.show();
});
},
make_offline_customer: function() {
this.frm.doc.customer = this.customer_doc.get_values().full_name;
this.frm.doc.contact_details = JSON.stringify(this.customer_doc.get_values());
@ -709,7 +710,8 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
}
});
} else {
$("<h4>Searching record not found.</h4>").appendTo($wrap)
$("<p class='text-muted small' style='padding-left: 10px'>"
+__("Not items found")+"</p>").appendTo($wrap)
}
if (this.items.length == 1
@ -744,7 +746,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
}
})
}
this.items_list = this.apply_category();
key = this.serach_item.$input.val().toLowerCase().replace(/[&\/\\#,+()\[\]$~.'":*?<>{}]/g, '\\$&');
@ -776,7 +778,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
return this.items_list;
}
},
apply_category: function() {
var me = this;
category = this.search_item_group.$input.val();

View File

@ -49,6 +49,11 @@ def get_data():
"name": "Stock Projected Qty",
"doctype": "Item",
},
{
"type": "page",
"name": "stock-balance",
"label": _("Stock Summary")
},
{
"type": "report",
"is_query_report": True,

View File

@ -21,7 +21,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Item",
@ -51,7 +50,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Item Name",
@ -81,7 +79,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Quantity",
@ -110,7 +107,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
@ -137,7 +133,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Is Active",
@ -167,7 +162,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Is Default",
@ -197,7 +191,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "With Operations",
@ -224,7 +217,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Rate Of Materials Based On",
@ -253,7 +245,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Price List",
@ -281,7 +272,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "",
@ -309,7 +299,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Currency",
@ -338,7 +327,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
@ -365,7 +353,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Conversion Rate",
@ -395,7 +382,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Operations",
@ -423,7 +409,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Operations",
@ -453,7 +438,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Materials",
@ -481,7 +465,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Items",
@ -511,7 +494,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Scrap",
@ -539,7 +521,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Scrap Items",
@ -568,7 +549,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Costing",
@ -596,7 +576,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Operating Cost",
@ -624,7 +603,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Raw Material Cost",
@ -652,7 +630,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Scrap Material Cost",
@ -681,7 +658,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
@ -707,7 +683,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Operating Cost (Company Currency)",
@ -736,7 +711,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Raw Material Cost(Company Currency)",
@ -765,7 +739,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Scrap Material Cost(Company Currency)",
@ -794,7 +767,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
@ -821,7 +793,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Total Cost",
@ -849,7 +820,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
@ -876,7 +846,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Total Cost(Company Currency)",
@ -905,7 +874,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "",
@ -932,7 +900,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Project",
@ -962,7 +929,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Company",
@ -991,7 +957,6 @@
"hidden": 0,
"ignore_user_permissions": 1,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Amended From",
@ -1019,7 +984,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
@ -1045,7 +1009,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Item UOM",
@ -1073,7 +1036,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
@ -1100,7 +1062,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Item Description",
@ -1127,7 +1088,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
@ -1154,7 +1114,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Image",
@ -1182,7 +1141,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Image View",
@ -1212,7 +1170,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Materials Required (Exploded)",
@ -1239,7 +1196,6 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Exploded_items",
@ -1271,8 +1227,8 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-11-21 17:06:49.349654",
"modified_by": "rohit@erpnext.com",
"modified": "2017-02-01 14:27:17.949390",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "BOM",
"owner": "Administrator",
@ -1287,7 +1243,6 @@
"export": 1,
"if_owner": 0,
"import": 0,
"is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@ -1308,7 +1263,6 @@
"export": 0,
"if_owner": 0,
"import": 0,
"is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@ -1329,7 +1283,6 @@
"export": 0,
"if_owner": 0,
"import": 0,
"is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@ -1347,5 +1300,6 @@
"search_fields": "item",
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 0,
"track_seen": 0
}

View File

@ -500,10 +500,15 @@ def validate_bom_no(item, bom_no):
@frappe.whitelist()
def get_children():
if frappe.form_dict.parent:
return frappe.db.sql("""select item_code,
bom_no as value, qty,
if(ifnull(bom_no, "")!="", 1, 0) as expandable
from `tabBOM Item`
where parent=%s
order by idx
return frappe.db.sql("""select
bom_item.item_code,
bom_item.bom_no as value,
bom_item.qty,
if(ifnull(bom_item.bom_no, "")!="", 1, 0) as expandable,
item.image,
item.description
from `tabBOM Item` bom_item, tabItem item
where bom_item.parent=%s
and bom_item.item_code = item.name
order by bom_item.idx
""", frappe.form_dict.parent, as_dict=True)

View File

@ -0,0 +1,21 @@
<div style="padding: 15px;">
{% if data.image %}
<img class="responsive" src={{ data.image }}>
<hr style="margin: 15px -15px;">
{% endif %}
<h4>
{{ __("Description") }}
</h4>
<div style="padding-top: 10px;">
{{ data.description }}
</div>
<hr style="margin: 15px -15px;">
<p>
{% if data.value %}
<a style="margin-right: 7px; margin-bottom: 7px" class="btn btn-default btn-xs" href="#Form/BOM/{{ data.value }}">
{{ __("Open BOM {0}", [data.value.bold()]) }}</a>
{% endif %}
<a class="btn btn-default btn-xs" href="#Form/Item/{{ data.item_code }}">
{{ __("Open Item {0}", [data.item_code.bold()]) }}</a>
</p>
</div>

View File

@ -20,14 +20,14 @@ frappe.treeview_settings["BOM"] = {
}
},
toolbar: [
{toggle_btn: true},
{ toggle_btn: true },
{
label:__("Edit"),
condition: function(node) {
return node.expandable;
},
click: function(node) {
frappe.set_route("Form", "BOM", node.data.value);
}
}
@ -40,5 +40,6 @@ frappe.treeview_settings["BOM"] = {
},
condition: 'frappe.boot.user.can_create.indexOf("BOM") !== -1'
}
]
],
view_template: 'bom_item_preview'
}

View File

@ -7,7 +7,10 @@ frappe.views.calendar["Production Order"] = {
"end": "planned_end_date",
"id": "name",
"title": "name",
"allDay": "allDay"
"allDay": "allDay",
"progress": function(data) {
return flt(data.produced_qty) / data.qty * 100;
}
},
gantt: true,
get_css_class: function(data) {

View File

@ -7,7 +7,8 @@ frappe.views.calendar["Task"] = {
"end": "exp_end_date",
"id": "name",
"title": "subject",
"allDay": "allDay"
"allDay": "allDay",
"progress": "progress"
},
gantt: true,
filters: [

View File

@ -117,6 +117,10 @@ class StockReconciliation(StockController):
if buying_rate:
row.valuation_rate = buying_rate
else:
# get valuation rate from Item
row.valuation_rate = frappe.get_value('Item', row.item_code, 'valuation_rate')
# throw all validation messages
if self.validation_messages:
for msg in self.validation_messages: