Merge pull request #4742 from nabinhait/multifixes1

Multi fixes
This commit is contained in:
Rushabh Mehta 2016-02-08 10:55:48 +05:30
commit 57fb74f262
5 changed files with 56 additions and 26 deletions

View File

@ -95,7 +95,7 @@ cur_frm.cscript.refresh = function(doc,cdt,cdn){
if(doc.docstatus==0 && doc.exp_approver==user && doc.approval_status=="Approved")
cur_frm.savesubmit();
if(doc.docstatus==1 && frappe.model.can_create("Journal Entry") &&
if(doc.docstatus==1 && frappe.model.can_create("Journal Entry") && doc.approval_status=="Approved" &&
cint(doc.total_amount_reimbursed) < cint(doc.total_sanctioned_amount))
cur_frm.add_custom_button(__("Bank Entry"),
cur_frm.cscript.make_bank_entry, __("Make"));

View File

@ -243,7 +243,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
company: function() {
var me = this;
var fn = function() {
var set_pricing = function() {
if(me.frm.doc.company && me.frm.fields_dict.currency) {
var company_currency = me.get_company_currency();
var company_doc = frappe.get_doc(":Company", me.frm.doc.company);
@ -271,9 +271,39 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
}
}
var set_party_account = function(set_pricing) {
if (in_list(["Sales Invoice", "Purchase Invoice"], me.frm.doc.doctype)) {
if(me.frm.doc.doctype=="Sales Invoice") {
var party_type = "Customer";
var party_account_field = 'debit_to';
} else {
var party_type = "Supplier";
var party_account_field = 'credit_to';
}
return frappe.call({
method: "erpnext.accounts.party.get_party_account",
args: {
company: me.frm.doc.company,
party_type: party_type,
party: me.frm.doc[frappe.model.scrub(party_type)]
},
callback: function(r) {
if(!r.exc && r.message) {
me.frm.set_value(party_account_field, r.message);
set_pricing();
}
}
});
} else {
set_pricing();
}
}
if (this.frm.doc.posting_date) var date = this.frm.doc.posting_date;
else var date = this.frm.doc.transaction_date;
erpnext.get_fiscal_year(this.frm.doc.company, date, fn);
erpnext.get_fiscal_year(this.frm.doc.company, date, function() { set_party_account(set_pricing); });
if(this.frm.doc.company) {
erpnext.last_selected_company = this.frm.doc.company;

View File

@ -27,12 +27,6 @@ cur_frm.fields_dict['parent_sales_person'].get_query = function(doc, cdt, cdn) {
}
}
cur_frm.fields_dict['targets'].grid.get_field("item_group").get_query = function(doc, cdt, cdn) {
return {
filters: { 'is_group': "No" }
}
}
cur_frm.fields_dict.employee.get_query = function(doc, cdt, cdn) {
return { query: "erpnext.controllers.queries.employee_query" }
}

View File

@ -26,11 +26,3 @@ cur_frm.fields_dict['parent_territory'].get_query = function(doc,cdt,cdn) {
]
}
}
// ******************** ITEM Group ********************************
cur_frm.fields_dict['targets'].grid.get_field("item_group").get_query = function(doc, cdt, cdn) {
return{
filters:{ 'is_group': "No"}
}
}

View File

@ -35,11 +35,25 @@ def execute(filters=None):
def get_columns(filters):
"""return columns based on filters"""
columns = ["Item:Link/Item:100", "Item Name::150", "Item Group::100", "Brand::90", \
"Description::140", "Warehouse:Link/Warehouse:100", "Stock UOM:Link/UOM:90", "Opening Qty:Float:100", \
"Opening Value:Float:110", "In Qty:Float:80", "In Value:Float:80", "Out Qty:Float:80", \
"Out Value:Float:80", "Balance Qty:Float:100", "Balance Value:Float:100", \
"Valuation Rate:Float:90", "Company:Link/Company:100"]
columns = [
_("Item")+":Link/Item:100",
_("Item Name")+"::150",
_("Item Group")+"::100",
_("Brand")+"::90",
_("Description")+"::140",
_("Warehouse")+":Link/Warehouse:100",
_("Stock UOM")+":Link/UOM:90",
_("Opening Qty")+":Float:100",
_("Opening Value")+":Float:110",
_("In Qty")+":Float:80",
_("In Value")+":Float:80",
_("Out Qty")+":Float:80",
_("Out Value")+":Float:80",
_("Balance Qty")+":Float:100",
_("Balance Value")+":Float:100",
_("Valuation Rate")+":Float:90",
_("Company")+":Link/Company:100"
]
return columns