[fix] [mapper] from delivery note to sales invoice, only map unbilled items

This commit is contained in:
Anand Doshi
2013-08-01 15:45:23 +05:30
parent 49154c790e
commit 17350b899f
6 changed files with 66 additions and 14 deletions

View File

@@ -93,12 +93,18 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
wn.model.map_current_doc({
method: "stock.doctype.delivery_note.delivery_note.make_sales_invoice",
source_doctype: "Delivery Note",
get_query_filters: {
docstatus: 1,
customer: cur_frm.doc.customer || undefined,
company: cur_frm.doc.company
get_query: function() {
var filters = {
docstatus: 1,
company: cur_frm.doc.company
};
if(cur_frm.doc.customer) filters["customer"] = cur_frm.doc.customer;
return {
query: "controllers.queries.get_delivery_notes_to_be_billed",
filters: filters
};
}
})
});
});
// cur_frm.add_custom_button(wn._("POS View"), function() {

View File

@@ -1001,10 +1001,12 @@ def make_delivery_note(source_name, target_doclist=None):
bean = webnotes.bean(target)
bean.run_method("onload_post_render")
def update_item(obj, target, source_parent):
target.amount = (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.basic_rate)
target.export_amount = (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.export_rate)
target.qty = flt(obj.qty) - flt(obj.delivered_qty)
def update_item(source_doc, target_doc, source_parent):
target_doc.amount = (flt(source_doc.qty) - flt(source_doc.delivered_qty)) * \
flt(source_doc.basic_rate)
target_doc.export_amount = (flt(source_doc.qty) - flt(source_doc.delivered_qty)) * \
flt(source_doc.export_rate)
target_doc.qty = flt(source_doc.qty) - flt(source_doc.delivered_qty)
doclist = get_mapped_doclist("Sales Invoice", source_name, {
"Sales Invoice": {