[enhance] more editable grids
This commit is contained in:
parent
35047ac283
commit
532eedf411
@ -6,6 +6,15 @@ frappe.provide("erpnext.journal_entry");
|
|||||||
|
|
||||||
|
|
||||||
frappe.ui.form.on("Journal Entry", {
|
frappe.ui.form.on("Journal Entry", {
|
||||||
|
setup: function(frm) {
|
||||||
|
frm.get_field('accounts').grid.editable_fields = [
|
||||||
|
{fieldname: 'account', columns: 3},
|
||||||
|
{fieldname: 'party', columns: 4},
|
||||||
|
{fieldname: 'debit_in_account_currency', columns: 2},
|
||||||
|
{fieldname: 'credit_in_account_currency', columns: 2}
|
||||||
|
];
|
||||||
|
},
|
||||||
|
|
||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
erpnext.toggle_naming_series();
|
erpnext.toggle_naming_series();
|
||||||
frm.cscript.voucher_type(frm.doc);
|
frm.cscript.voucher_type(frm.doc);
|
||||||
@ -50,7 +59,7 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
load_defaults: function() {
|
load_defaults: function() {
|
||||||
this.frm.show_print_first = true;
|
//this.frm.show_print_first = true;
|
||||||
if(this.frm.doc.__islocal && this.frm.doc.company) {
|
if(this.frm.doc.__islocal && this.frm.doc.company) {
|
||||||
frappe.model.set_default_values(this.frm.doc);
|
frappe.model.set_default_values(this.frm.doc);
|
||||||
$.each(this.frm.doc.accounts || [], function(i, jvd) {
|
$.each(this.frm.doc.accounts || [], function(i, jvd) {
|
||||||
|
|||||||
@ -15,6 +15,11 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
|
|||||||
this.frm.set_df_property("credit_to", "print_hide", 0);
|
this.frm.set_df_property("credit_to", "print_hide", 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// formatter for material request item
|
||||||
|
this.frm.set_indicator_formatter('item_code',
|
||||||
|
function(doc) { return (doc.qty<=doc.received_qty) ? "green" : "orange" })
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
refresh: function(doc) {
|
refresh: function(doc) {
|
||||||
@ -369,4 +374,3 @@ frappe.ui.form.on("Purchase Invoice", {
|
|||||||
frm.toggle_reqd("supplier_warehouse", frm.doc.is_subcontracted==="Yes");
|
frm.toggle_reqd("supplier_warehouse", frm.doc.is_subcontracted==="Yes");
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -10,6 +10,16 @@ cur_frm.cscript.tax_table = "Purchase Taxes and Charges";
|
|||||||
cur_frm.email_field = "contact_email";
|
cur_frm.email_field = "contact_email";
|
||||||
|
|
||||||
erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
||||||
|
setup: function() {
|
||||||
|
this._super();
|
||||||
|
this.frm.get_field('items').grid.editable_fields = [
|
||||||
|
{fieldname: 'item_code', columns: 4},
|
||||||
|
{fieldname: 'qty', columns: 2},
|
||||||
|
{fieldname: 'rate', columns: 3},
|
||||||
|
{fieldname: 'amount', columns: 2}
|
||||||
|
];
|
||||||
|
},
|
||||||
|
|
||||||
onload: function() {
|
onload: function() {
|
||||||
this.setup_queries();
|
this.setup_queries();
|
||||||
this._super();
|
this._super();
|
||||||
|
|||||||
@ -8,6 +8,10 @@ frappe.ui.form.on("Sales Order", {
|
|||||||
erpnext.queries.setup_queries(frm, "Warehouse", function() {
|
erpnext.queries.setup_queries(frm, "Warehouse", function() {
|
||||||
return erpnext.queries.warehouse(frm.doc);
|
return erpnext.queries.warehouse(frm.doc);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// formatter for material request item
|
||||||
|
frm.set_indicator_formatter('item_code',
|
||||||
|
function(doc) { return (doc.qty<=doc.delivered_qty) ? "green" : "orange" })
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -10,12 +10,24 @@ cur_frm.email_field = "contact_email";
|
|||||||
|
|
||||||
frappe.provide("erpnext.selling");
|
frappe.provide("erpnext.selling");
|
||||||
erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||||
|
setup: function() {
|
||||||
|
this._super();
|
||||||
|
this.frm.get_field('items').grid.editable_fields = [
|
||||||
|
{fieldname: 'item_code', columns: 4},
|
||||||
|
{fieldname: 'qty', columns: 2},
|
||||||
|
{fieldname: 'rate', columns: 3},
|
||||||
|
{fieldname: 'amount', columns: 2}
|
||||||
|
];
|
||||||
|
},
|
||||||
|
|
||||||
onload: function() {
|
onload: function() {
|
||||||
this._super();
|
this._super();
|
||||||
this.setup_queries();
|
this.setup_queries();
|
||||||
},
|
},
|
||||||
|
|
||||||
setup_queries: function() {
|
setup_queries: function() {
|
||||||
|
|
||||||
|
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
this.frm.add_fetch("sales_partner", "commission_rate", "commission_rate");
|
this.frm.add_fetch("sales_partner", "commission_rate", "commission_rate");
|
||||||
@ -336,17 +348,21 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
|||||||
|
|
||||||
frappe.ui.form.on(cur_frm.doctype,"project", function(frm) {
|
frappe.ui.form.on(cur_frm.doctype,"project", function(frm) {
|
||||||
if(in_list(["Delivery Note", "Sales Invoice"], frm.doc.doctype)) {
|
if(in_list(["Delivery Note", "Sales Invoice"], frm.doc.doctype)) {
|
||||||
|
if(frm.doc.project) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method:'erpnext.projects.doctype.project.project.get_cost_center_name' ,
|
method:'erpnext.projects.doctype.project.project.get_cost_center_name' ,
|
||||||
args: { project: frm.doc.project },
|
args: { project: frm.doc.project },
|
||||||
callback: function(r, rt) {
|
callback: function(r, rt) {
|
||||||
if(!r.exc) {
|
if(!r.exc) {
|
||||||
$.each(frm.doc["items"] || [], function(i, row) {
|
$.each(frm.doc["items"] || [], function(i, row) {
|
||||||
|
if(r.message) {
|
||||||
frappe.model.set_value(row.doctype, row.name, "cost_center", r.message);
|
frappe.model.set_value(row.doctype, row.name, "cost_center", r.message);
|
||||||
msgprint(__("Cost Center For Item with Item Code '"+row.item_name+"' has been Changed to "+ r.message));
|
msgprint(__("Cost Center For Item with Item Code '"+row.item_name+"' has been Changed to "+ r.message));
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -7,20 +7,15 @@ frappe.ui.form.on('Material Request', {
|
|||||||
setup: function(frm) {
|
setup: function(frm) {
|
||||||
frm.get_field('items').grid.editable_fields = [
|
frm.get_field('items').grid.editable_fields = [
|
||||||
{fieldname: 'item_code', columns: 4},
|
{fieldname: 'item_code', columns: 4},
|
||||||
{fieldname: 'qty', columns: 3},
|
{fieldname: 'qty', columns: 2},
|
||||||
{fieldname: 'uom', columns: 2},
|
{fieldname: 'warehouse', columns: 3},
|
||||||
{fieldname: 'schedule_date', columns: 2},
|
{fieldname: 'schedule_date', columns: 2},
|
||||||
];
|
];
|
||||||
|
},
|
||||||
|
onload: function(frm) {
|
||||||
// formatter for material request item
|
// formatter for material request item
|
||||||
frappe.meta.set_formatter('Material Request Item', 'item_code', frm.doc.name,
|
frm.set_indicator_formatter('item_code',
|
||||||
function(value, df, options, doc) {
|
function(doc) { return (doc.qty<=doc.ordered_qty) ? "green" : "orange" })
|
||||||
return repl('<span class="indicator %(color)s">%(name)s</span>', {
|
|
||||||
color: (doc.qty<=doc.ordered_qty) ? "green" : "orange",
|
|
||||||
name: doc.item_code
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -49,6 +49,14 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.frm.get_field('items').grid.editable_fields = [
|
||||||
|
{fieldname: 'item_code', columns: 3},
|
||||||
|
{fieldname: 'qty', columns: 2},
|
||||||
|
{fieldname: 's_warehouse', columns: 3},
|
||||||
|
{fieldname: 't_warehouse', columns: 3}
|
||||||
|
];
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onload_post_render: function() {
|
onload_post_render: function() {
|
||||||
|
|||||||
@ -1,49 +0,0 @@
|
|||||||
{% var visible_columns = row.get_visible_columns(["item_code", "warehouse",
|
|
||||||
"item_name", "amount", "stock_uom", "uom", "qty", "schedule_date"]); %}
|
|
||||||
|
|
||||||
{% if(!doc) { %}
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm-4">{%= __("Item") %}</div>
|
|
||||||
<div class="col-sm-3">{%= __("Required On") %}</div>
|
|
||||||
<div class="col-sm-3">{%= __("Warehouse") %}</div>
|
|
||||||
<div class="col-sm-2 text-right">{%= __("Qty") %}</div>
|
|
||||||
</div>
|
|
||||||
{% } else { %}
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm-4">
|
|
||||||
<span class="indicator {%= (doc.qty<=doc.ordered_qty) ? "green" : "orange" %}">{%= doc.item_code %}</span>
|
|
||||||
{% if(doc.item_name != doc.item_code) { %}
|
|
||||||
<br>{%= doc.item_name %}{% } %}
|
|
||||||
<!-- {% if(doc.item_name != doc.description) { %}
|
|
||||||
<p>{%= doc.description %}</p>{% } %} -->
|
|
||||||
{% include "templates/form_grid/includes/visible_cols.html" %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="col-sm-3">
|
|
||||||
{% if(doc.schedule_date) { %}
|
|
||||||
<span title="{%= __("Reqd By Date") %}" class="{%=
|
|
||||||
(frappe.datetime.get_diff(doc.schedule_date, frappe.datetime.get_today()) < 0
|
|
||||||
&& doc.ordered_qty < doc.qty)
|
|
||||||
? "text-danger" : "text-muted" %}">
|
|
||||||
{%= doc.get_formatted("schedule_date") %}</span>
|
|
||||||
{% } %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- warehouse -->
|
|
||||||
<div class="col-sm-3">
|
|
||||||
{% if(doc.warehouse) { %}
|
|
||||||
<span class="label label-default" title="{%= __("For Warehouse") %}"
|
|
||||||
style="margin-right: 10px;">
|
|
||||||
{%= doc.warehouse %}
|
|
||||||
</span>
|
|
||||||
{% } %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- qty -->
|
|
||||||
<div class="col-sm-2 text-right">
|
|
||||||
{%= doc.get_formatted("qty") %}
|
|
||||||
<span class="small">{%= doc.uom || doc.stock_uom %}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% } %}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user