fix: don't create debit/credit note automatically (#19185)
This commit is contained in:
parent
5ef26b42a8
commit
3564ac7c88
@ -85,26 +85,13 @@ frappe.ui.form.on("Delivery Note", {
|
||||
refresh: function(frm) {
|
||||
if (frm.doc.docstatus === 1 && frm.doc.is_return === 1 && frm.doc.per_billed !== 100) {
|
||||
frm.add_custom_button(__('Credit Note'), function() {
|
||||
frappe.confirm(__("Are you sure you want to make credit note?"),
|
||||
function() {
|
||||
frm.trigger("make_credit_note");
|
||||
}
|
||||
);
|
||||
frappe.model.open_mapped_doc({
|
||||
method: "erpnext.stock.doctype.delivery_note.delivery_note.make_sales_invoice",
|
||||
frm: cur_frm,
|
||||
})
|
||||
}, __('Create'));
|
||||
|
||||
frm.page.set_inner_btn_group_as_primary(__('Create'));
|
||||
}
|
||||
},
|
||||
|
||||
make_credit_note: function(frm) {
|
||||
frm.call({
|
||||
method: "make_return_invoice",
|
||||
doc: frm.doc,
|
||||
freeze: true,
|
||||
callback: function() {
|
||||
frm.reload_doc();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -458,6 +458,9 @@ def make_sales_invoice(source_name, target_doc=None):
|
||||
doc = get_mapped_doc("Delivery Note", source_name, {
|
||||
"Delivery Note": {
|
||||
"doctype": "Sales Invoice",
|
||||
"field_map": {
|
||||
"is_return": "is_return"
|
||||
},
|
||||
"validation": {
|
||||
"docstatus": ["=", 1]
|
||||
}
|
||||
|
@ -41,28 +41,15 @@ frappe.ui.form.on("Purchase Receipt", {
|
||||
|
||||
if (frm.doc.docstatus === 1 && frm.doc.is_return === 1 && frm.doc.per_billed !== 100) {
|
||||
frm.add_custom_button(__('Debit Note'), function() {
|
||||
frappe.confirm(__("Are you sure you want to make debit note?"),
|
||||
function() {
|
||||
frm.trigger("make_debit_note");
|
||||
}
|
||||
);
|
||||
frappe.model.open_mapped_doc({
|
||||
method: "erpnext.stock.doctype.purchase_receipt.purchase_receipt.make_purchase_invoice",
|
||||
frm: cur_frm,
|
||||
})
|
||||
}, __('Create'));
|
||||
|
||||
frm.page.set_inner_btn_group_as_primary(__('Create'));
|
||||
}
|
||||
},
|
||||
|
||||
make_debit_note: function(frm) {
|
||||
frm.call({
|
||||
method: "make_return_invoice",
|
||||
doc: frm.doc,
|
||||
freeze: true,
|
||||
callback: function() {
|
||||
frm.reload_doc();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
company: function(frm) {
|
||||
frm.trigger("toggle_display_account_head");
|
||||
},
|
||||
|
@ -426,16 +426,6 @@ class PurchaseReceipt(BuyingController):
|
||||
|
||||
self.load_from_db()
|
||||
|
||||
def make_return_invoice(self):
|
||||
return_invoice = make_purchase_invoice(self.name)
|
||||
return_invoice.is_return = True
|
||||
return_invoice.save()
|
||||
return_invoice.submit()
|
||||
|
||||
debit_note_link = frappe.utils.get_link_to_form('Purchase Invoice', return_invoice.name)
|
||||
|
||||
frappe.msgprint(_("Debit Note {0} has been created automatically").format(debit_note_link))
|
||||
|
||||
def update_billed_amount_based_on_po(po_detail, update_modified=True):
|
||||
# Billed against Sales Order directly
|
||||
billed_against_po = frappe.db.sql("""select sum(amount) from `tabPurchase Invoice Item`
|
||||
@ -510,7 +500,8 @@ def make_purchase_invoice(source_name, target_doc=None):
|
||||
"Purchase Receipt": {
|
||||
"doctype": "Purchase Invoice",
|
||||
"field_map": {
|
||||
"supplier_warehouse":"supplier_warehouse"
|
||||
"supplier_warehouse":"supplier_warehouse",
|
||||
"is_return": "is_return"
|
||||
},
|
||||
"validation": {
|
||||
"docstatus": ["=", 1],
|
||||
|
Loading…
x
Reference in New Issue
Block a user