unlink reference on cancellation of any invoice

This commit is contained in:
Shreya 2018-04-20 14:20:49 +05:30
parent c804f424ab
commit b47302dd52
3 changed files with 2 additions and 36 deletions

View File

@ -110,38 +110,6 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
supplier: function() {
var me = this;
let internal;
frappe.db.get_value('Supplier', {name: this.frm.doc.supplier}, 'is_internal_supplier', (r) => {
if (r) {
internal = r.is_internal_supplier;
}
if (internal == 1) {
frappe.call({
method:"erpnext.accounts.doctype.sales_invoice.sales_invoice.get_allowed_companies",
args: {supplier: this.frm.doc.supplier},
callback: function(r){
if (r.message){
if (me.frm.doc.company) {
me.frm.set_value("company", r.message[0]);
}
me.frm.set_query('company', function() {
return {
"filters": {"name": ["in", r.message]}
}
}
);
}
}
});
}
else {
me.frm.set_query('company', function(){
return {
"filters": {"name": ["like", "%" + "" + "%"]}
}
});
}
});
if(this.frm.updating_party_details)
return;
erpnext.utils.get_party_details(this.frm, "erpnext.accounts.party.get_party_details",

View File

@ -663,4 +663,3 @@ var calculate_total_billing_amount = function(frm) {
refresh_field('total_billing_amount')
}

View File

@ -1030,7 +1030,7 @@ def get_inter_company_details(doc, doctype):
company = frappe.db.get_value("Customer", {"name": doc.get("customer")}, "represents_company")
else:
party = frappe.db.get_value("Customer", {"is_internal_customer":1, "represents_company": doc.get("company")}, "name")
company = frappe.db.get_value("Customer", {"name": doc.get("supplier")}, "represents_company")
company = frappe.db.get_value("Supplier", {"name": doc.get("supplier")}, "represents_company")
return {
"party": party,
@ -1067,6 +1067,7 @@ def validate_inter_company_invoice(doc):
company = details.get("company")
default_currency = frappe.db.get_value("Company", company, "default_currency")
if default_currency != doc.get("currency"):
frappe.throw(_("Company currencies of both the companies should match for Inter Company Transactions."))
@ -1106,8 +1107,6 @@ def make_inter_company_invoice(doctype, source_name, target_doc=None):
target_doc.expense_account = ""
target_doc.cost_center = ""
base_doc = "Sales Invoice"
target_doctype = "Purchase Invoice"
doclist = get_mapped_doc(doctype, source_name, {
doctype: {
"doctype": target_doctype,