Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Nabin Hait 2012-12-28 16:46:48 +05:30
commit e606e7850a
10 changed files with 78 additions and 55 deletions

View File

@ -87,5 +87,5 @@ def update_feed(controller, method=None):
doc = controller.doc
if method in ['on_update', 'on_submit']:
subject, color = feed_dict.get(doc.doctype, [None, None])
if subject:
if subject:
make_feed('', doc.doctype, doc.name, doc.owner, subject % doc.fields, color)

View File

@ -1,4 +1,14 @@
erpnext.updates = [
["28th December 2012", [
"Workflow: Added System for Multi-level approval before Submission. \
<br>See video at <a href='https://www.youtube.com/watch?v=zuGv59_wJKw' \
target='_blank'>https://www.youtube.com/watch?v=zuGv59_wJKw</a>.",
"Stock Level Report: New report to see available and estimated qty of stock",
]],
["27th December 2012", [
"Website: Added auto-generated Contact Us and About Us Pages",
"Website: Added option to create slideshows and add them to Pages, Products and Product Groups",
]],
["25th December 2012", [
"Stock Balance Report: Inflow, outflow and balance of stock within a defined period",
"Stock Reports: Added Brand filter on some of the reports"

View File

@ -32,6 +32,11 @@ class DocType:
def validate(self):
# if self.doc.exp_approver == self.doc.owner:
# webnotes.msgprint("""Self Approval is not allowed.""", raise_exception=1)
if self.doc.status not in ("Draft", "Approved", "Rejected"):
webnotes.msgprint("Status must be one of 'Draft', 'Approved' or 'Rejected'",
raise_exception=True)
self.validate_fiscal_year()
self.validate_exp_details()

View File

@ -47,20 +47,22 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
} else {
cur_frm.set_intro("This Leave Application is pending approval. Only the Leave Apporver can update status.")
cur_frm.toggle_enable("status", false);
if(!doc.__islocal) cur_frm.frm_head.appframe.buttons.Submit.remove();
if(!doc.__islocal) {
if(cur_frm.frm_head.appframe.buttons.Submit)
cur_frm.frm_head.appframe.buttons.Submit.remove();
}
}
} else {
if(doc.status=="Approved") {
cur_frm.set_intro("Leave application has been approved.");
if(cur_frm.doc.docstatus==0) {
cur_frm.set_intro("Please submit to update Leave Balance.");
}
} else if(doc.status=="Rejected") {
cur_frm.set_intro("Leave application has been rejected.");
}
}
}
if(doc.status=="Approved" && doc.docstatus==0) {
cur_frm.savesubmit()
}
}
}
cur_frm.cscript.employee = function (doc, dt, dn){

View File

@ -33,6 +33,9 @@ class DocType:
def validate(self):
# if self.doc.leave_approver == self.doc.owner:
# webnotes.msgprint("""Self Approval is not allowed.""", raise_exception=1)
if self.doc.status not in ("Open", "Approved", "Rejected"):
webnotes.msgprint("Status must be one of 'Open', 'Approved' or 'Rejected'",
raise_exception=True)
self.validate_to_date()
self.validate_balance_leaves()

View File

@ -28,7 +28,7 @@
<div class="section-item">
<a class="section-link"
title = "BOM Replace Tool"
href="#!Form/BOM Replace Tool">BOM Replace Tool</a>
href="#Form/BOM Replace Tool">BOM Replace Tool</a>
</div>
</div>
</div>

View File

@ -4,45 +4,49 @@
<div class="setup-column">
<h3>Company</h3>
<p>
<b><a href="#!List/Company">Companies</a></b><br>
<b><a href="#List/Company">Companies</a></b><br>
<span class="help">List of companies (not customers / suppliers)</span>
</p>
<p>
<b><a href="#!List/Fiscal Year">Fiscal Years</a></b><br>
<b><a href="#List/Fiscal Year">Fiscal Years</a></b><br>
<span class="help">Financial Years for books of accounts</span>
</p>
<p>
<b><a href="#!List/Currency">Currencies</a></b><br>
<b><a href="#List/Currency">Currencies</a></b><br>
<span class="help">Currency Master</span>
</p>
</div>
<div class="setup-column">
<h3>Users and Permissions</h3>
<p>
<b><a href="#!List/Profile">Users</a></b><br>
<b><a href="#List/Profile">Users</a></b><br>
<span class="help">Add/remove users, set roles, passwords etc</span>
</p>
<p>
<b><a href="#!Permission Engine">Permission Manager</a></b><br>
<b><a href="#Permission Engine">Permission Manager</a></b><br>
<span class="help">Set permissions on transactions / masters</span>
</p>
<p>
<b><a href="#!List/Authorization Rule">Amount based Authorization Rules</a></b><br>
<b><a href="#List/Workflow">Workflow Manager</a></b><br>
<span class="help">Set workflow rules.</span>
</p>
<p>
<b><a href="#List/Authorization Rule">Amount based Authorization Rules</a></b><br>
<span class="help">Restrict submission rights based on amount</span>
</p>
</div>
<div class="setup-column">
<h3>Data</h3>
<p>
<b><a href="#!data-import-tool">Data Import Tool</a></b><br>
<b><a href="#data-import-tool">Data Import Tool</a></b><br>
<span class="help">Import data from spreadsheet (csv) files</span>
</p>
<p>
<b><a href="#!Form/Global Defaults/Global Defaults">Global Defaults</a></b><br>
<b><a href="#Form/Global Defaults/Global Defaults">Global Defaults</a></b><br>
<span class="help">Set default values for entry</span>
</p>
<p>
<b><a href="#!Trash">Recycle Bin</a></b><br>
<b><a href="#Trash">Recycle Bin</a></b><br>
<span class="help">Un-trash items</span>
</p>
<p>
@ -53,75 +57,75 @@
<div class="setup-column">
<h3>Email and Notifications</h3>
<p>
<b><a href="#!Form/Email Settings/Email Settings">Email Settings</a></b><br>
<b><a href="#Form/Email Settings/Email Settings">Email Settings</a></b><br>
<span class="help">Out going mail server and support ticket mailbox</span>
</p>
<p>
<b><a href="#!Form/Notification Control/Notification Control">Auto Notifications</a></b><br>
<b><a href="#Form/Notification Control/Notification Control">Auto Notifications</a></b><br>
<span class="help">Automatic email sending to customers and suppliers</span>
</p>
<p>
<b><a href="#!List/Email Digest">Email Digests</a></b><br>
<b><a href="#List/Email Digest">Email Digests</a></b><br>
<span class="help">Daily, weekly, monthly email Digests</span>
</p>
<p>
<b><a href="#!Form/SMS Settings/SMS Settings">SMS Setup</a></b><br>
<b><a href="#Form/SMS Settings/SMS Settings">SMS Setup</a></b><br>
<span class="help">Setup outgoing SMS via your bulk SMS provider</span>
</p>
<p>
<b><a href="#!Form/SMS Center/SMS Center">Send Bulk SMS</a></b><br>
<b><a href="#Form/SMS Center/SMS Center">Send Bulk SMS</a></b><br>
<span class="help">Send bulk SMS to leads, customers, contacts</span>
</p>
</div>
<div class="setup-column">
<h3>Customize ERPNext</h3>
<p>
<b><a href="#!Form/Customize Form/Customize Form">Customize Forms</a></b><br>
<b><a href="#Form/Customize Form/Customize Form">Customize Forms</a></b><br>
<span class="help">Change entry properties (hide fields, make mandatory etc)</span>
</p>
<p>
<b><a href="#!List/Custom Field">Custom Fields</a></b><br>
<b><a href="#List/Custom Field">Custom Fields</a></b><br>
<span class="help">Add fields to forms</span>
</p>
<p>
<b><a href="#!List/Custom Script">Custom Scripts</a></b><br>
<b><a href="#List/Custom Script">Custom Scripts</a></b><br>
<span class="help">Add custom code to forms</span>
</p>
<p>
<b><a href="#!Form/Features Setup/Features Setup">Disable Features</a></b><br>
<b><a href="#Form/Features Setup/Features Setup">Disable Features</a></b><br>
<span class="help">Simplify entry forms by disabling features</span>
</p>
<p>
<b><a href="#!modules_setup">Modules Setup</a></b><br>
<b><a href="#modules_setup">Modules Setup</a></b><br>
<span class="help">Show, hide modules</span>
</p>
<p>
<b><a href="#!Form/Naming Series/Naming Series">Numbering Series</a></b><br>
<b><a href="#Form/Naming Series/Naming Series">Numbering Series</a></b><br>
<span class="help">Set multiple numbering series for transactions</span>
</p>
</div>
<div class="setup-column">
<h3>Branding and Printing</h3>
<p>
<b><a href="#!List/Letter Head">Letter Heads</a></b><br>
<b><a href="#List/Letter Head">Letter Heads</a></b><br>
<span class="help">Letter heads for print</span>
</p>
<p>
<b><a href="#!List/Print Format">Print Formats</a></b><br>
<b><a href="#List/Print Format">Print Formats</a></b><br>
<span class="help">HTML print formats for quotes, invoices etc</span>
</p>
<p>
<b><a href="#!List/Print Heading">Print Headings</a></b><br>
<b><a href="#List/Print Heading">Print Headings</a></b><br>
<span class="help">Add headers for standard print formats</span>
</p>
<!--
<p>
<b><a href="#!Form/Personalize/Personalize">Home Banner</a></b><br>
<b><a href="#Form/Personalize/Personalize">Home Banner</a></b><br>
<span class="help">Add a home page banner</span>
</p>
-->
<p>
<b><a href="#!Form/Style Settings/Style Settings">Style Settings</a></b><br>
<b><a href="#Form/Style Settings/Style Settings">Style Settings</a></b><br>
<span class="help">Change background fonts etc</span>
</p>
</div>

View File

@ -128,16 +128,19 @@ class DocType:
else:
check_list.append(d.tax_type)
def check_for_active_boms(self, check):
if check in ['Is Active', 'Is Purchase Item']:
def check_for_active_boms(self, field_label):
if field_label in ['Is Active', 'Is Purchase Item']:
bom_mat = sql("select distinct t1.parent from `tabBOM Item` t1, `tabBOM` t2 where t1.item_code ='%s' and (t1.bom_no = '' or t1.bom_no is NULL) and t2.name = t1.parent and t2.is_active = 1 and t2.docstatus = 1 and t1.docstatus =1 " % self.doc.name )
if bom_mat and bom_mat[0][0]:
msgprint("%s should be 'Yes'. As Item %s is present in one or many Active BOMs." % (cstr(check), cstr(self.doc.name)))
msgprint("%s should be 'Yes'. As Item %s is present in one or many Active BOMs." % (cstr(field_label), cstr(self.doc.name)))
raise Exception
if check == 'Is Active' or ( check == 'Is Manufactured Item' and self.doc.is_sub_contracted_item != 'Yes') or (check == 'Is Sub Contracted Item' and self.doc.is_manufactured_item != 'Yes') :
if ((field_label == 'Allow Production Order'
and self.doc.is_sub_contracted_item != 'Yes')
or (field_label == 'Is Sub Contracted Item'
and self.doc.is_manufactured_item != 'Yes')):
bom = sql("select name from `tabBOM` where item = '%s' and is_active = 1" % cstr(self.doc.name))
if bom and bom[0][0]:
msgprint("%s should be 'Yes'. As Item %s is present in one or many Active BOMs." % (cstr(check), cstr(self.doc.name)))
msgprint("%s should be 'Yes'. As Item %s is present in one or many Active BOMs." % (cstr(field_label), cstr(self.doc.name)))
raise Exception
def validate_barcode(self):
@ -147,24 +150,21 @@ class DocType:
msgprint("Barcode: %s already used in item: %s" % (self.doc.barcode, cstr(duplicate[0][0])), raise_exception = 1)
def validate(self):
fl = {'is_manufactured_item' :'Is Manufactured Item',
fl = {'is_manufactured_item' :'Allow Bill of Materials',
'is_sub_contracted_item':'Is Sub Contracted Item',
'is_purchase_item' :'Is Purchase Item',
'is_pro_applicable' :'Is Pro Applicable'}
'is_pro_applicable' :'Allow Production Order'}
for d in fl:
if cstr(self.doc.fields.get(d)) != 'Yes':
self.check_for_active_boms(check = fl[d])
self.check_for_active_boms(fl[d])
self.check_ref_rate_detail()
self.fill_customer_code()
self.check_item_tax()
self.validate_barcode()
if not self.doc.min_order_qty:
self.doc.min_order_qty = 0
self.check_non_asset_warehouse()
if self.doc.is_pro_applicable and self.doc.is_pro_applicable == 'Yes' and self.doc.is_manufactured_item and self.doc.is_manufactured_item != 'Yes':
msgprint("If making Production Order is allowed then, it should also allow to make Bill of Materials. Refer Manufacturing section.")
raise Exception
if cstr(self.doc.is_manufactured_item) == "No":
self.doc.is_pro_applicable = "No"
if self.doc.is_pro_applicable == 'Yes' and self.doc.is_stock_item == 'No':
msgprint("As Production Order can be made for this Item, then Is Stock Item Should be 'Yes' as we maintain it's stock. Refer Manufacturing and Inventory section.", raise_exception=1)

View File

@ -89,7 +89,7 @@ class SupportMailbox(POP3Mailbox):
st.doc.status = 'Open'
st.doc.save()
update_feed(st.doc, 'on_update')
update_feed(st, 'on_update')
# extract attachments
self.save_attachments(st.doc, mail.attachments)
return
@ -109,21 +109,20 @@ class SupportMailbox(POP3Mailbox):
d.naming_series = opts and opts.split("\n")[0] or 'SUP'
try:
d.save(1)
try:
# extract attachments
self.save_attachments(d, mail.attachments)
except Exception, e:
self.description += "\n\n[Did not pull attachment]"
except:
d.description = 'Unable to extract message'
d.save(1)
else:
# update feed
update_feed(d, 'on_update')
# send auto reply
if cint(self.email_settings.send_autoreply):
if "mailer-daemon" not in d.raised_by.lower():
self.send_auto_reply(d)
# extract attachments
self.save_attachments(d, mail.attachments)
def save_attachments(self, doc, attachment_list=[]):
"""

View File

@ -50,11 +50,11 @@ class DocType(TransactionBase):
def close_ticket(self):
webnotes.conn.set(self.doc,'status','Closed')
update_feed(self.doc)
update_feed(self)
def reopen_ticket(self):
webnotes.conn.set(self.doc,'status','Open')
update_feed(self.doc)
update_feed(self)
def on_trash(self):
webnotes.conn.sql("""update `tabCommunication` set support_ticket=NULL