Delivery note to packing slip mapping

This commit is contained in:
Nabin Hait 2014-06-16 15:03:02 +05:30
parent e1b2b3e995
commit 539f352318
4 changed files with 22 additions and 6 deletions

View File

@ -118,10 +118,10 @@ cur_frm.fields_dict['transporter_name'].get_query = function(doc) {
}
cur_frm.cscript['Make Packing Slip'] = function() {
n = frappe.model.make_new_doc_and_get_name('Packing Slip');
ps = locals["Packing Slip"][n];
ps.delivery_note = cur_frm.doc.name;
loaddoc('Packing Slip', n);
frappe.model.open_mapped_doc({
method: "erpnext.stock.doctype.delivery_note.delivery_note.make_packing_slip",
frm: cur_frm
})
}
var set_print_hide= function(doc, cdt, cdn){

View File

@ -346,3 +346,19 @@ def make_installation_note(source_name, target_doc=None):
}, target_doc)
return doclist
@frappe.whitelist()
def make_packing_slip(source_name, target_doc=None):
doclist = get_mapped_doc("Delivery Note", source_name, {
"Delivery Note": {
"doctype": "Packing Slip",
"field_map": {
"name": "delivery_note"
},
"validation": {
"docstatus": ["=", 0]
}
}
}, target_doc)
return doclist

View File

@ -48,7 +48,7 @@ class MaterialRequest(BuyingController):
def validate_schedule_date(self):
for d in self.get('indent_details'):
if d.schedule_date < self.transaction_date:
if d.schedule_date and d.schedule_date < self.transaction_date:
frappe.throw(_("Expected Date cannot be before Material Request Date"))
# Validate

View File

@ -18,7 +18,7 @@ cur_frm.fields_dict['item_details'].grid.get_field('item_code').get_query =
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
if(doc.delivery_note && doc.__islocal) {
cur_frm.cscript.get_items(doc, cdt, cdn);
cur_frm.cscript.get_items(doc, cdt, cdn);
}
}