Merge pull request #1686 from rmehta/develop

Fixes
This commit is contained in:
Nabin Hait 2014-05-26 13:36:28 +05:30
commit ff8f32ca80
4 changed files with 219 additions and 231 deletions

View File

@ -40,14 +40,7 @@ cur_frm.cscript.make_address = function() {
},
as_dict: 1,
no_results_message: __('No addresses created'),
render_row: function(wrapper, data) {
$(wrapper).css('padding','5px 0px');
var link = $ln(wrapper,cstr(data.name), function() { loaddoc("Address", this.dn); }, {fontWeight:'bold'});
link.dn = data.name
$a(wrapper,'span','',{marginLeft:'5px', color: '#666'},(data.is_primary_address ? '[Primary]' : '') + (data.is_shipping_address ? '[Shipping]' : ''));
$a(wrapper,'div','',{marginTop:'5px', color:'#555'}, data.address_line1 + '<br />' + (data.address_line2 ? data.address_line2 + '<br />' : '') + data.city + '<br />' + (data.state ? data.state + ', ' : '') + data.country + '<br />' + (data.pincode ? 'Pincode: ' + data.pincode + '<br />' : '') + (data.phone ? 'Tel: ' + data.phone + '<br />' : '') + (data.fax ? 'Fax: ' + data.fax + '<br />' : '') + (data.email_id ? 'Email: ' + data.email_id + '<br />' : ''));
}
render_row: cur_frm.cscript.render_address_row,
});
}
cur_frm.address_list.run();
@ -70,14 +63,7 @@ cur_frm.cscript.make_contact = function() {
},
as_dict: 1,
no_results_message: __('No contacts created'),
render_row: function(wrapper, data) {
$(wrapper).css('padding', '5px 0px');
var link = $ln(wrapper, cstr(data.name), function() { loaddoc("Contact", this.dn); }, {fontWeight:'bold'});
link.dn = data.name
$a(wrapper,'span','',{marginLeft:'5px', color: '#666'},(data.is_primary_contact ? '[Primary]' : ''));
$a(wrapper,'div', '',{marginTop:'5px', color:'#555'}, data.first_name + (data.last_name ? ' ' + data.last_name + '<br />' : '<br>') + (data.phone ? 'Tel: ' + data.phone + '<br />' : '') + (data.mobile_no ? 'Mobile: ' + data.mobile_no + '<br />' : '') + (data.email_id ? 'Email: ' + data.email_id + '<br />' : '') + (data.department ? 'Department: ' + data.department + '<br />' : '') + (data.designation ? 'Designation: ' + data.designation + '<br />' : ''));
}
render_row: cur_frm.cscript.render_contact_row,
});
}
cur_frm.contact_list.run();

View File

@ -88,7 +88,7 @@ cur_frm.cscript.validate_duplicate_items = function(doc, ps_detail) {
// Calculate Net Weight of Package
cur_frm.cscript.calc_net_total_pkg = function(doc, ps_detail) {
var net_weight_pkg = 0;
doc.net_weight_uom = ps_detail?ps_detail[0].weight_uom:'';
doc.net_weight_uom = (ps_detail && ps_detail.length) ? ps_detail[0].weight_uom : '';
doc.gross_weight_uom = doc.net_weight_uom;
for(var i=0; i<ps_detail.length; i++) {

View File

@ -20,7 +20,7 @@
"read_only": 0
},
{
"description": "Indicates that the package is a part of this delivery",
"description": "Indicates that the package is a part of this delivery (Only Draft)",
"fieldname": "delivery_note",
"fieldtype": "Link",
"in_list_view": 1,
@ -63,8 +63,8 @@
"description": "Identification of the package for the delivery (for print)",
"fieldname": "from_case_no",
"fieldtype": "Data",
"label": "From Package No.",
"in_list_view": 1,
"label": "From Package No.",
"no_copy": 1,
"permlevel": 0,
"read_only": 0,
@ -81,8 +81,8 @@
"description": "If more than one package of the same type (for print)",
"fieldname": "to_case_no",
"fieldtype": "Data",
"label": "To Package No.",
"in_list_view": 1,
"label": "To Package No.",
"no_copy": 1,
"permlevel": 0,
"read_only": 0,
@ -180,7 +180,7 @@
"icon": "icon-suitcase",
"idx": 1,
"is_submittable": 1,
"modified": "2014-05-06 08:20:35.134198",
"modified": "2014-05-26 03:19:59.409839",
"modified_by": "Administrator",
"module": "Stock",
"name": "Packing Slip",

View File

@ -54,10 +54,12 @@ class PackingSlip(Document):
res = frappe.db.sql("""SELECT name FROM `tabPacking Slip`
WHERE delivery_note = %(delivery_note)s AND docstatus = 1 AND
(from_case_no BETWEEN %(from_case_no)s AND %(to_case_no)s
OR to_case_no BETWEEN %(from_case_no)s AND %(to_case_no)s
OR %(from_case_no)s BETWEEN from_case_no AND to_case_no)
""", self.as_dict())
((from_case_no BETWEEN %(from_case_no)s AND %(to_case_no)s)
OR (to_case_no BETWEEN %(from_case_no)s AND %(to_case_no)s)
OR (%(from_case_no)s BETWEEN from_case_no AND to_case_no))
""", {"delivery_note":self.delivery_note,
"from_case_no":self.from_case_no,
"to_case_no":self.to_case_no})
if res:
frappe.throw(_("""Case No(s) already in use. Try from Case No {0}""").format(self.get_recommended_case_no()))