sales bom fixes and mandatory in table fields
This commit is contained in:
parent
4feae61b62
commit
357fb2640b
@ -116,7 +116,7 @@ cur_frm.cscript.add_to_rec_list = function(doc, tab, length) {
|
||||
}
|
||||
}
|
||||
doc.recipient_list = rec_list.join('\n');
|
||||
//console.log(doc.recipient_list);
|
||||
cur_frm.rec_dialog.hide();
|
||||
cur_frm.save();
|
||||
cur_frm.refresh_fields();
|
||||
}
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-03-27 14:36:20',
|
||||
'creation': '2012-07-03 13:30:54',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-03-27 14:36:20',
|
||||
'modified': '2012-07-12 16:29:08',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
@ -15,13 +15,14 @@
|
||||
'_last_update': u'1324556758',
|
||||
'autoname': u'Prompt',
|
||||
'colour': u'White:FFF',
|
||||
'description': u'Send regular summary reports via Email.',
|
||||
'doctype': 'DocType',
|
||||
'document_type': u'System',
|
||||
'module': u'Setup',
|
||||
'name': '__common__',
|
||||
'section_style': u'Simple',
|
||||
'show_in_menu': 0,
|
||||
'version': 81
|
||||
'version': 1
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
@ -70,7 +71,7 @@
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'settings',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'Settings',
|
||||
'label': u'Email Digest Settings',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
@ -144,16 +145,6 @@
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'addremove_recipients',
|
||||
'fieldtype': u'Button',
|
||||
'label': u'Add/Remove Recipients',
|
||||
'permlevel': 0,
|
||||
'trigger': u'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'description': u'Note: Email will not be sent to disabled users',
|
||||
@ -167,7 +158,19 @@
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'addremove_recipients',
|
||||
'fieldtype': u'Button',
|
||||
'label': u'Add/Remove Recipients',
|
||||
'permlevel': 0,
|
||||
'trigger': u'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'depends_on': u'eval:doc.use_standard',
|
||||
'description': u'Check all the items below that you want to send in this digest.',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'select_digest_content',
|
||||
'fieldtype': u'Section Break',
|
||||
@ -245,6 +248,14 @@
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'cb1',
|
||||
'fieldtype': u'Column Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'depends_on': u'eval:doc.use_standard',
|
||||
@ -323,35 +334,5 @@
|
||||
'hidden': 1,
|
||||
'label': u'Stock Items below re-order level',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'depends_on': u'eval:!doc.use_standard',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'enter_custom_code',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'Enter Custom Code',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'depends_on': u'eval:!doc.use_standard',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'custom_code',
|
||||
'fieldtype': u'Code',
|
||||
'label': u'Custom Python Code',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'depends_on': u'eval:!doc.use_standard',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'email_template',
|
||||
'fieldtype': u'Code',
|
||||
'label': u'Email Template',
|
||||
'permlevel': 0
|
||||
}
|
||||
]
|
@ -3,9 +3,9 @@
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-05-15 12:15:01',
|
||||
'creation': '2012-07-03 13:30:55',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-06-14 14:47:49',
|
||||
'modified': '2012-07-12 16:16:27',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'harshada@webnotestech.com'
|
||||
},
|
||||
@ -18,6 +18,7 @@
|
||||
'allow_print': 1,
|
||||
'colour': u'White:FFF',
|
||||
'default_print_format': u'Standard',
|
||||
'description': u'Email Settings for Outgoing and Incoming Emails.',
|
||||
'doctype': 'DocType',
|
||||
'in_create': 1,
|
||||
'issingle': 1,
|
||||
@ -70,6 +71,8 @@
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'Set your outgoing mail SMTP settings here. All system generated notifications, emails will go from this mail server. If you are not sure, leave this blank to use ERPNext servers (emails will still be sent from your email id) or contact your email provider.',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'outgoing_mails',
|
||||
'fieldtype': u'Section Break',
|
||||
@ -78,29 +81,14 @@
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'html1',
|
||||
'fieldtype': u'HTML',
|
||||
'label': u'1',
|
||||
'options': u'<div class="help_box">Set your outgoing mail settings here. All system generated notifications, emails will go from this mail server</div>'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'SMTP Server (e.g. smtp.gmail.com)',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'outgoing_mail_server',
|
||||
'fieldtype': u'Data',
|
||||
'label': u'Outgoing Mail Server'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'mail_port',
|
||||
'fieldtype': u'Int',
|
||||
'label': u'Mail Port'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
@ -111,6 +99,25 @@
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'If non standard port (e.g. 587)',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'mail_port',
|
||||
'fieldtype': u'Int',
|
||||
'label': u'Mail Port'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'cb0',
|
||||
'fieldtype': u'Column Break'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'Set Login and Password if authentication is required.',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'mail_login',
|
||||
'fieldtype': u'Data',
|
||||
@ -127,6 +134,8 @@
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'System generated mails will be sent from this email id.',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'auto_email_id',
|
||||
'fieldtype': u'Data',
|
||||
@ -144,19 +153,12 @@
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'html2',
|
||||
'fieldtype': u'HTML',
|
||||
'label': u'2',
|
||||
'options': u'<div class="help_box">To automatically create Support Tickets from your incoming mail, set your pop3 settings here.</div>'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'To automatically create Support Tickets from your incoming mail, set your POP3 settings here. You must ideally create a separate email id for the erp system so that all emails will be synced into the system from that mail id. If you are not sure, please contact your EMail Provider.',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'section_break0',
|
||||
'fieldtype': u'Section Break',
|
||||
'options': u'Simple'
|
||||
'label': u'Incoming Mail Setting'
|
||||
},
|
||||
|
||||
# DocField
|
||||
@ -216,7 +218,7 @@
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'column_break0',
|
||||
'fieldname': u'cb1',
|
||||
'fieldtype': u'Column Break'
|
||||
},
|
||||
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-05-03 16:16:21',
|
||||
'creation': '2012-07-03 13:30:56',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-05-03 16:23:29',
|
||||
'modified': '2012-07-12 16:20:36',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
@ -16,6 +16,7 @@
|
||||
'allow_email': 1,
|
||||
'allow_print': 1,
|
||||
'colour': u'White:FFF',
|
||||
'description': u'Send automatic emails to Contacts on Submitting transactions.',
|
||||
'doctype': 'DocType',
|
||||
'issingle': 1,
|
||||
'module': u'Setup',
|
||||
@ -70,10 +71,12 @@
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'When any of the checked transactions are "Submitted", an email is automatically sent to the associated "Contact" in that transaction, with the transaction as an attachment.',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'send_autonotification_for',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'Send Auto-notification for'
|
||||
'label': u'Send Email Automatically on Submission of'
|
||||
},
|
||||
|
||||
# DocField
|
||||
@ -152,6 +155,8 @@
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'Customize the introductory text that goes as a part of that email. Each transaction has a separate introductory text.',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'customize_the_notification',
|
||||
'fieldtype': u'Section Break',
|
||||
|
@ -30,4 +30,10 @@ cur_frm.fields_dict.new_item_code.get_query = function() {
|
||||
}
|
||||
cur_frm.fields_dict.new_item_code.query_description = 'Select Item where "Is Stock Item" is "No" \
|
||||
and "Is Sales Item" is "Yes" and there is no other Sales BOM';
|
||||
|
||||
|
||||
cur_frm.cscript.item_code = function(doc, dt, dn) {
|
||||
var d = locals[dt][dn];
|
||||
if (d.item_code){
|
||||
get_server_fields('get_item_details', d.item_code, 'sales_bom_items', doc ,dt, dn, 1);
|
||||
}
|
||||
}
|
@ -33,10 +33,22 @@ class DocType:
|
||||
def validate_main_item(self):
|
||||
"""main item must have Is Stock Item as No and Is Sales Item as Yes"""
|
||||
if not webnotes.conn.sql("""select name from tabItem where name=%s and
|
||||
ifnull(is_stock_item,'')='No' and ifnull(is_sales_item,'')='Yes'"""):
|
||||
ifnull(is_stock_item,'')='No' and ifnull(is_sales_item,'')='Yes'""", self.doc.new_item_code):
|
||||
webnotes.msgprint("""Parent Item %s is either a Stock Item or a not a Sales Item""",
|
||||
raise_exception=1)
|
||||
|
||||
def get_item_details(self, name):
|
||||
det = webnotes.conn.sql("""select description, stock_uom from `tabItem`
|
||||
where name = %s""", name)
|
||||
rate = webnotes.conn.sql("""select ref_rate from `tabItem Price`
|
||||
where price_list_name = %s and parent = %s
|
||||
and ref_currency = %s""", (self.doc.price_list, name, self.doc.currency))
|
||||
return {
|
||||
'description' : det and det[0][0] or '',
|
||||
'uom': det and det[0][1] or '',
|
||||
'rate': rate and flt(rate[0][0]) or 0.00
|
||||
}
|
||||
|
||||
def check_duplicate(self, finder=0):
|
||||
il = getlist(self.doclist, "sales_bom_items")
|
||||
if not il:
|
||||
@ -61,7 +73,6 @@ class DocType:
|
||||
if finder:
|
||||
webnotes.msgprint("There is no Sales BOM present with the following Combination.")
|
||||
|
||||
|
||||
def has_same_items(self, l1, l2):
|
||||
if len(l1)!=len(l2): return 0
|
||||
for l in l2:
|
||||
|
@ -5,7 +5,7 @@
|
||||
{
|
||||
'creation': '2012-07-03 13:30:44',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-07-11 19:17:51',
|
||||
'modified': '2012-07-12 18:00:16',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
@ -15,7 +15,7 @@
|
||||
'_last_update': u'1322549701',
|
||||
'allow_trash': 1,
|
||||
'colour': u'White:FFF',
|
||||
'description': u'Aggregate group of **Items** into another **Item**. This is useful if you are bundling a certain **Items** into a package and you maintain stock of the packed **Items** and not the packed **Item**. \n\nThe package **Item** will have "Is Stock Item" as "No" and "Is Sales Item" as "Yes".\n\nFor Example: If you are selling Laptops and Backpacks separately and have a special price if the customer buys both, then the Laptop + Backpack will be a new Sales BOM Item.\n\nNote: BOM = Bill of Materials',
|
||||
'description': u'Aggregate group of **Items** into another **Item**. This is useful if you are bundling a certain **Items** into a package and you maintain stock of the packed **Items** and not the aggregate **Item**. \n\nThe package **Item** will have "Is Stock Item" as "No" and "Is Sales Item" as "Yes".\n\nFor Example: If you are selling Laptops and Backpacks separately and have a special price if the customer buys both, then the Laptop + Backpack will be a new Sales BOM Item.\n\nNote: BOM = Bill of Materials',
|
||||
'doctype': 'DocType',
|
||||
'document_type': u'Master',
|
||||
'is_submittable': 0,
|
||||
|
@ -1376,7 +1376,8 @@ return;}
|
||||
var _save=function(){$c('webnotes.widgets.form.save.savedocs',{'docs':compress_doclist(doclist),'docname':dn,'action':save_action,'user':user},function(r,rtxt){if(f){f.savingflag=false;}
|
||||
if(r.saved){if(onsave)onsave(r);}else{if(onerr)onerr(r);}},function(){if(f){f.savingflag=false;}},0,(f?'Saving...':''));}
|
||||
if(doc.__islocal&&(doctype&&doctype.autoname&&doctype.autoname.toLowerCase()=='prompt')){var newname=prompt('Enter the name of the new '+dt,'');if(newname){doc.__newname=strip(newname);_save();}else{msgprint('Not Saved');onerr();}}else{_save();}}
|
||||
function check_required(dt,dn,parent_dt){var doc=locals[dt][dn];if(doc.docstatus>1)return true;var fl=wn.meta.docfield_list[dt];if(!fl)return true;var all_clear=true;var errfld=[];for(var i=0;i<fl.length;i++){var key=fl[i].fieldname;var v=doc[key];if(fl[i].reqd&&is_null(v)&&fl[i].fieldname){errfld[errfld.length]=fl[i].label;if(cur_frm){var f=cur_frm.fields_dict[fl[i].fieldname];if(f){if(f.set_as_error)f.set_as_error(1);if(!cur_frm.error_in_section&&f.parent_section){cur_frm.error_in_section=1;}}}
|
||||
function check_required(dt,dn,parent_dt){var doc=locals[dt][dn];if(doc.docstatus>1)return true;var fl=wn.meta.docfield_list[dt];if(!fl)return true;var all_clear=true;var errfld=[];for(var i=0;i<fl.length;i++){var key=fl[i].fieldname;var v=doc[key];if(fl[i].fieldtype=='Table'){var no_value=true;$.each(locals[fl[i].options],function(k,d){if(d.parent==doc.name&&d.parenttype==doc.doctype&&d.parentfield==fl[i].fieldname){no_value=false;}});}else{var no_value=is_null(v);}
|
||||
if(fl[i].reqd&&no_value&&fl[i].fieldname){errfld[errfld.length]=fl[i].label;if(cur_frm){var f=cur_frm.fields_dict[fl[i].fieldname];if(f){if(f.set_as_error)f.set_as_error(1);if(!cur_frm.error_in_section&&f.parent_section){cur_frm.error_in_section=1;}}}
|
||||
if(all_clear)all_clear=false;}}
|
||||
if(errfld.length)msgprint('<b>Mandatory fields required in '+
|
||||
(doc.parenttype?(wn.meta.docfield_map[doc.parenttype][doc.parentfield].label+' (Table)'):get_doctype_label(doc.doctype))+':</b>\n'+errfld.join('\n'));return all_clear;}
|
||||
@ -1813,10 +1814,7 @@ locals[this.doctype][this.docname].trash_reason=reason;}
|
||||
if(save_action=='Cancel'){var reason=prompt('Reason for cancellation (mandatory)','');if(!strip(reason)){msgprint('Reason is mandatory, not cancelled');return;}
|
||||
locals[this.doctype][this.docname].cancel_reason=reason;locals[this.doctype][this.docname].cancelled_on=dateutil.full_str();locals[this.doctype][this.docname].cancelled_by=user;}else if(save_action=='Update'){}else{validated=true;if(this.cscript.validate)
|
||||
this.runclientscript('validate',this.doctype,this.docname);if(!validated){this.savingflag=false;return'Error';}}
|
||||
var ret_fn=function(r){me.savingflag=false;if(user=='Guest'&&!r.exc){$dh(me.page_layout.wrapper);$ds(me.saved_wrapper);me.saved_wrapper.innerHTML='<div style="padding: 150px 16px; text-align: center; font-size: 14px;">'
|
||||
+(cur_frm.message_after_save?cur_frm.message_after_save:'Your information has been sent. Thank you!')
|
||||
+'</div>';return;}
|
||||
if(!me.meta.istable){me.refresh(r.docname);}
|
||||
var ret_fn=function(r){me.savingflag=false;if(!me.meta.istable&&r){me.refresh(r.docname);}
|
||||
if(call_back){call_back(r);}}
|
||||
var me=this;var ret_fn_err=function(r){var doc=locals[me.doctype][me.docname];me.savingflag=false;ret_fn(r);}
|
||||
this.savingflag=true;if(this.docname&&validated){scroll(0,0);return this.savedoc(save_action,ret_fn,ret_fn_err);}}
|
||||
|
@ -687,7 +687,8 @@ return;}
|
||||
var _save=function(){$c('webnotes.widgets.form.save.savedocs',{'docs':compress_doclist(doclist),'docname':dn,'action':save_action,'user':user},function(r,rtxt){if(f){f.savingflag=false;}
|
||||
if(r.saved){if(onsave)onsave(r);}else{if(onerr)onerr(r);}},function(){if(f){f.savingflag=false;}},0,(f?'Saving...':''));}
|
||||
if(doc.__islocal&&(doctype&&doctype.autoname&&doctype.autoname.toLowerCase()=='prompt')){var newname=prompt('Enter the name of the new '+dt,'');if(newname){doc.__newname=strip(newname);_save();}else{msgprint('Not Saved');onerr();}}else{_save();}}
|
||||
function check_required(dt,dn,parent_dt){var doc=locals[dt][dn];if(doc.docstatus>1)return true;var fl=wn.meta.docfield_list[dt];if(!fl)return true;var all_clear=true;var errfld=[];for(var i=0;i<fl.length;i++){var key=fl[i].fieldname;var v=doc[key];if(fl[i].reqd&&is_null(v)&&fl[i].fieldname){errfld[errfld.length]=fl[i].label;if(cur_frm){var f=cur_frm.fields_dict[fl[i].fieldname];if(f){if(f.set_as_error)f.set_as_error(1);if(!cur_frm.error_in_section&&f.parent_section){cur_frm.error_in_section=1;}}}
|
||||
function check_required(dt,dn,parent_dt){var doc=locals[dt][dn];if(doc.docstatus>1)return true;var fl=wn.meta.docfield_list[dt];if(!fl)return true;var all_clear=true;var errfld=[];for(var i=0;i<fl.length;i++){var key=fl[i].fieldname;var v=doc[key];if(fl[i].fieldtype=='Table'){var no_value=true;$.each(locals[fl[i].options],function(k,d){if(d.parent==doc.name&&d.parenttype==doc.doctype&&d.parentfield==fl[i].fieldname){no_value=false;}});}else{var no_value=is_null(v);}
|
||||
if(fl[i].reqd&&no_value&&fl[i].fieldname){errfld[errfld.length]=fl[i].label;if(cur_frm){var f=cur_frm.fields_dict[fl[i].fieldname];if(f){if(f.set_as_error)f.set_as_error(1);if(!cur_frm.error_in_section&&f.parent_section){cur_frm.error_in_section=1;}}}
|
||||
if(all_clear)all_clear=false;}}
|
||||
if(errfld.length)msgprint('<b>Mandatory fields required in '+
|
||||
(doc.parenttype?(wn.meta.docfield_map[doc.parenttype][doc.parentfield].label+' (Table)'):get_doctype_label(doc.doctype))+':</b>\n'+errfld.join('\n'));return all_clear;}
|
||||
|
Loading…
Reference in New Issue
Block a user