updates to attachment
This commit is contained in:
parent
24a69613e0
commit
38b6af97e5
@ -103,26 +103,19 @@ cur_frm.fields_dict['item_group'].get_query = function(doc,cdt,cdn) {
|
||||
// a table with both image and attachment in HTML
|
||||
// in the "alternate_description" field
|
||||
cur_frm.cscript.add_image = function(doc, dt, dn) {
|
||||
if(!doc.file_list) {
|
||||
msgprint('Please attach a file first!');
|
||||
if(!doc.image) {
|
||||
msgprint('Please select an "Image" first');
|
||||
return;
|
||||
}
|
||||
|
||||
var f = doc.file_list.split('\n')[0];
|
||||
var fname = f.split(',')[0];
|
||||
var fid = f.split(',')[1];
|
||||
if(!in_list(['jpg','jpeg','gif','png'], fname.split('.')[1].toLowerCase())) {
|
||||
msgprint('File must be of extension jpg, jpeg, gif or png'); return;
|
||||
}
|
||||
|
||||
doc.description_html = repl('<table style="width: 100%; table-layout: fixed;">'+
|
||||
'<tr><td style="width:110px"><img src="%(imgurl)s" width="100px"></td>'+
|
||||
'<td>%(desc)s</td></tr>'+
|
||||
'</table>', {imgurl: wn.urllib.get_file_url(fid), desc:doc.description});
|
||||
'</table>', {imgurl: wn.utils.get_file_link(doc.image), desc:doc.description});
|
||||
|
||||
refresh_field('description_html');
|
||||
}
|
||||
//===================== Quotation to validation - either customer or lead mandatory ====================
|
||||
// Quotation to validation - either customer or lead mandatory
|
||||
cur_frm.cscript.weight_to_validate = function(doc,cdt,cdn){
|
||||
|
||||
if((doc.nett_weight || doc.gross_weight) && !doc.weight_uom)
|
||||
@ -131,13 +124,11 @@ cur_frm.cscript.weight_to_validate = function(doc,cdt,cdn){
|
||||
validated=0;
|
||||
}
|
||||
}
|
||||
//===================validation function =================================
|
||||
|
||||
cur_frm.cscript.validate = function(doc,cdt,cdn){
|
||||
cur_frm.cscript.weight_to_validate(doc,cdt,cdn);
|
||||
}
|
||||
|
||||
//===========Fill Default Currency in "Item Prices====================
|
||||
cur_frm.fields_dict['ref_rate_details'].grid.onrowadd = function(doc, cdt, cdn){
|
||||
locals[cdt][cdn].ref_currency = sys_defaults.currency;
|
||||
refresh_field('ref_currency',cdn,'ref_rate_details');
|
||||
|
@ -2,9 +2,9 @@
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-12-06 15:57:02",
|
||||
"creation": "2012-12-11 15:58:47",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-12-11 15:56:37"
|
||||
"modified": "2012-12-11 16:08:49"
|
||||
},
|
||||
{
|
||||
"allow_attach": 1,
|
||||
@ -140,14 +140,21 @@
|
||||
"fieldtype": "Select",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Image View",
|
||||
"options": "image",
|
||||
"fieldname": "image_view",
|
||||
"fieldtype": "Image",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Text",
|
||||
"doctype": "DocField",
|
||||
"label": "Description",
|
||||
"oldfieldname": "description",
|
||||
"width": "300px",
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Text",
|
||||
"fieldtype": "Small Text",
|
||||
"search_index": 0,
|
||||
"reqd": 1,
|
||||
"permlevel": 0,
|
||||
@ -157,13 +164,13 @@
|
||||
"doctype": "DocField",
|
||||
"label": "Description HTML",
|
||||
"fieldname": "description_html",
|
||||
"fieldtype": "Text",
|
||||
"fieldtype": "Small Text",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"description": "Generates HTML to include image (1st attachment) in the description",
|
||||
"description": "Generates HTML to include selected image in the description",
|
||||
"doctype": "DocField",
|
||||
"label": "Add Image",
|
||||
"label": "Generate Description HTML",
|
||||
"fieldname": "add_image",
|
||||
"fieldtype": "Button",
|
||||
"permlevel": 0
|
||||
@ -789,11 +796,51 @@
|
||||
"fieldtype": "Text Editor",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 0,
|
||||
"write": 0,
|
||||
"cancel": 0,
|
||||
"role": "Material Manager",
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 0,
|
||||
"write": 0,
|
||||
"cancel": 0,
|
||||
"role": "Material Manager",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 0,
|
||||
"write": 0,
|
||||
"cancel": 0,
|
||||
"role": "Material User",
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 0,
|
||||
"write": 0,
|
||||
"cancel": 0,
|
||||
"role": "Material User",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"write": 1,
|
||||
"role": "System Manager",
|
||||
"role": "Material Master Manager",
|
||||
"cancel": 1,
|
||||
"permlevel": 0
|
||||
},
|
||||
@ -808,7 +855,7 @@
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"write": 1,
|
||||
"role": "Material Master Manager",
|
||||
"role": "System Manager",
|
||||
"cancel": 1,
|
||||
"permlevel": 0
|
||||
},
|
||||
@ -816,45 +863,5 @@
|
||||
"doctype": "DocPerm",
|
||||
"role": "System Manager",
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 0,
|
||||
"write": 0,
|
||||
"role": "Material Manager",
|
||||
"cancel": 0,
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 0,
|
||||
"write": 0,
|
||||
"role": "Material Manager",
|
||||
"cancel": 0,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 0,
|
||||
"write": 0,
|
||||
"role": "Material User",
|
||||
"cancel": 0,
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 0,
|
||||
"write": 0,
|
||||
"role": "Material User",
|
||||
"cancel": 0,
|
||||
"permlevel": 0
|
||||
}
|
||||
]
|
Loading…
Reference in New Issue
Block a user