diff --git a/accounts/doctype/bank_reconciliation/bank_reconciliation.py b/accounts/doctype/bank_reconciliation/bank_reconciliation.py index 35db6fbd0e5..05c043265dc 100644 --- a/accounts/doctype/bank_reconciliation/bank_reconciliation.py +++ b/accounts/doctype/bank_reconciliation/bank_reconciliation.py @@ -42,7 +42,7 @@ class DocType: self.doc.total_amount = 0.0 for d in dl: - nl = addchild(self.doc, 'entries', 'Bank Reconciliation Detail', 1, self.doclist) + nl = addchild(self.doc, 'entries', 'Bank Reconciliation Detail', self.doclist) nl.posting_date = cstr(d[5]) nl.voucher_id = cstr(d[0]) nl.cheque_number = cstr(d[1]) diff --git a/accounts/doctype/budget_distribution/budget_distribution.py b/accounts/doctype/budget_distribution/budget_distribution.py index 081031892e4..976fa84c956 100644 --- a/accounts/doctype/budget_distribution/budget_distribution.py +++ b/accounts/doctype/budget_distribution/budget_distribution.py @@ -31,7 +31,8 @@ class DocType: 'October','November','December'] idx =1 for m in month_list: - mnth = addchild(self.doc,'budget_distribution_details','Budget Distribution Detail',1,self.doclist) + mnth = addchild(self.doc, 'budget_distribution_details', + 'Budget Distribution Detail', self.doclist) mnth.month = m or '' mnth.idx = idx idx += 1 diff --git a/accounts/doctype/gl_control/gl_control.py b/accounts/doctype/gl_control/gl_control.py index e4896d35bb3..44cab1e7a8f 100644 --- a/accounts/doctype/gl_control/gl_control.py +++ b/accounts/doctype/gl_control/gl_control.py @@ -223,7 +223,7 @@ class DocType: obj.doclist = obj.doc.clear_table(obj.doclist,table_field_name) # Create advance table for d in jv_detail: - add = addchild(obj.doc, table_field_name, table_name, 1, obj.doclist) + add = addchild(obj.doc, table_field_name, table_name, obj.doclist) add.journal_voucher = d[0] add.jv_detail_no = d[3] add.remarks = d[1] @@ -286,7 +286,7 @@ class DocType: webnotes.conn.sql("update `tabJournal Voucher Detail` set %s = '%s', %s = '%s' where name = '%s'" % (dr_or_cr, flt(allocate), doctype == "Purchase Invoice" and 'against_voucher' or 'against_invoice',cstr(against_document_no), jv_detail_no)) # new entry with balance amount - add = addchild(jv_obj.doc, 'entries', 'Journal Voucher Detail', 1, jv_obj.doclist) + add = addchild(jv_obj.doc, 'entries', 'Journal Voucher Detail', jv_obj.doclist) add.account = account_head add.cost_center = cstr(jvd[0][1]) add.balance = cstr(jvd[0][2]) @@ -353,7 +353,7 @@ class DocType: if d['allocated_amt'] < d['unadjusted_amt']: jvd = webnotes.conn.sql("select cost_center, balance, against_account, is_advance from `tabJournal Voucher Detail` where name = '%s'" % d['voucher_detail_no']) # new entry with balance amount - ch = addchild(jv_obj.doc, 'entries', 'Journal Voucher Detail', 1) + ch = addchild(jv_obj.doc, 'entries', 'Journal Voucher Detail') ch.account = d['account'] ch.cost_center = cstr(jvd[0][0]) ch.balance = cstr(jvd[0][1]) diff --git a/accounts/doctype/journal_voucher/journal_voucher.py b/accounts/doctype/journal_voucher/journal_voucher.py index 23c66a6a247..7c1dcfee8d7 100644 --- a/accounts/doctype/journal_voucher/journal_voucher.py +++ b/accounts/doctype/journal_voucher/journal_voucher.py @@ -174,7 +174,7 @@ class DocType: # Set the diff in a new row if flag == 0 and (flt(diff) != 0): - jd = addchild(self.doc, 'entries', 'Journal Voucher Detail', 1, self.doclist) + jd = addchild(self.doc, 'entries', 'Journal Voucher Detail', self.doclist) if diff>0: jd.credit = flt(diff) elif diff<0: @@ -256,7 +256,7 @@ class DocType: total = 0 for d in self.get_values(): total += flt(d[2]) - jd = addchild(self.doc, 'entries', 'Journal Voucher Detail', 1, self.doclist) + jd = addchild(self.doc, 'entries', 'Journal Voucher Detail', self.doclist) jd.account = cstr(d[1]) if self.doc.write_off_based_on == 'Accounts Receivable': jd.credit = flt(d[2]) @@ -265,7 +265,7 @@ class DocType: jd.debit = flt(d[2]) jd.against_voucher = cstr(d[0]) jd.save(1) - jd = addchild(self.doc, 'entries', 'Journal Voucher Detail', 1, self.doclist) + jd = addchild(self.doc, 'entries', 'Journal Voucher Detail', self.doclist) if self.doc.write_off_based_on == 'Accounts Receivable': jd.debit = total elif self.doc.write_off_based_on == 'Accounts Payable': diff --git a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py index 005b981335f..81b94a22c36 100644 --- a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py +++ b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py @@ -100,7 +100,7 @@ class DocType: #-------------------------------------------------- def create_payment_table(self, gle): for d in gle: - ch = addchild(self.doc, 'ir_payment_details', 'Payment to Invoice Matching Tool Detail', 1, self.doclist) + ch = addchild(self.doc, 'ir_payment_details', 'Payment to Invoice Matching Tool Detail', self.doclist) ch.voucher_no = d.get('voucher_no') ch.posting_date = d.get('posting_date') ch.amt_due = self.acc_type == 'debit' and flt(d.get('amt_due')) or -1*flt(d.get('amt_due')) diff --git a/buying/doctype/purchase_common/purchase_common.py b/buying/doctype/purchase_common/purchase_common.py index a59061ca11f..e8b725ed92c 100644 --- a/buying/doctype/purchase_common/purchase_common.py +++ b/buying/doctype/purchase_common/purchase_common.py @@ -612,7 +612,8 @@ class DocType(TransactionBase): idx = 0 for other in other_charge: - d = addchild(obj.doc, 'purchase_tax_details', 'Purchase Taxes and Charges', 1, obj.doclist) + d = addchild(obj.doc, 'purchase_tax_details', 'Purchase Taxes and Charges', + obj.doclist) d.category = other['category'] d.add_deduct_tax = other['add_deduct_tax'] d.charge_type = other['charge_type'] diff --git a/buying/doctype/purchase_order/purchase_order.py b/buying/doctype/purchase_order/purchase_order.py index 7182306b6d4..812f59c740f 100644 --- a/buying/doctype/purchase_order/purchase_order.py +++ b/buying/doctype/purchase_order/purchase_order.py @@ -314,7 +314,7 @@ class DocType(TransactionBase): for i in bom_det: if i and not sql("select name from `tabPurchase Order Item Supplied` where reference_name = '%s' and bom_detail_no = '%s' and parent = '%s' " %(d.name, i[6], self.doc.name)): - rm_child = addchild(self.doc, 'po_raw_material_details', 'Purchase Order Item Supplied', 1, self.doclist) + rm_child = addchild(self.doc, 'po_raw_material_details', 'Purchase Order Item Supplied', self.doclist) rm_child.reference_name = d.name rm_child.bom_detail_no = i and i[6] or '' diff --git a/buying/doctype/quality_inspection/quality_inspection.py b/buying/doctype/quality_inspection/quality_inspection.py index 981bf43e412..415524f32aa 100644 --- a/buying/doctype/quality_inspection/quality_inspection.py +++ b/buying/doctype/quality_inspection/quality_inspection.py @@ -41,7 +41,7 @@ class DocType: specification = sql("select specification, value from `tabItem Quality Inspection Parameter` \ where parent = '%s' order by idx" % (self.doc.item_code)) for d in specification: - child = addchild(self.doc, 'qa_specification_details', 'Quality Inspection Reading', 1, self.doclist) + child = addchild(self.doc, 'qa_specification_details', 'Quality Inspection Reading', self.doclist) child.specification = d[0] child.value = d[1] child.status = 'Accepted' diff --git a/controllers/tax_controller.py b/controllers/tax_controller.py index 009ab316285..617c4cc7df6 100644 --- a/controllers/tax_controller.py +++ b/controllers/tax_controller.py @@ -19,7 +19,7 @@ import webnotes import webnotes.model from webnotes import _, msgprint from webnotes.utils import cint, flt -from webnotes.model.utils import round_doc +from webnotes.model.utils import round_floats_in_doc import json from controllers.transaction_controller import TransactionController @@ -83,7 +83,7 @@ class TaxController(TransactionController): self.precision.item[base_field]) for item in self.item_doclist: - round_doc(item, self.precision.item) + round_floats_in_doc(item, self.precision.item) if item.fields.get(self.fmap.discount) == 100: if not item.fields.get(self.fmap.print_ref_rate): @@ -126,7 +126,7 @@ class TaxController(TransactionController): self.validate_included_tax(tax) # round relevant values - round_doc(tax, self.precision.tax) + round_floats_in_doc(tax, self.precision.tax) def calculate_net_total(self): self.doc.net_total = 0 diff --git a/home/page/attributions/attributions.css b/home/page/attributions/attributions.css index e69de29bb2d..68ec5160eed 100644 --- a/home/page/attributions/attributions.css +++ b/home/page/attributions/attributions.css @@ -0,0 +1,6 @@ +.layout-attributions table { + width: 70%; +} +.layout-attributions td:first-child { + width: 30%; +} \ No newline at end of file diff --git a/home/page/attributions/attributions.html b/home/page/attributions/attributions.html index ab879b7d48b..37ee25bae61 100644 --- a/home/page/attributions/attributions.html +++ b/home/page/attributions/attributions.html @@ -1,83 +1,99 @@ -
- × -

Attributions

+
+
+
+

ERPNext is made using these Awesome Open Source Projects


-

Source Code: - https://github.com/webnotes/erpnext

-

Website: - https://erpnext.com

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
wnframeworkThe full stack Python + Javascript web application framework on which ERPNext is built.
ERPNextWeb based, Open Source ERP.
Linux Operating SystemThe operating system that brought a revolution in Open Source software.
MySQL DatabaseThe world's most popular Open Source Database.
Apache HTTPD web serverThe Number One HTTP Server On The Internet.
Python Programming LanguageThe "batteries included" language that lets you write elegant code, quickly.

Python Libraries: +
    +
  • MySQLdb +
  • pytz +
  • jinja2 +
  • markdown2 +
  • dateutil +
  • termcolor +
  • python-memcached +
+
Git - Source Code ManagementGit is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

+ Kindly hosted on the web by GitHub: The service that makes it easier for individuals and teams to write better code, faster.
JQuery Javascript LibaryThe write less, do more Javascript Library.
JQuery UI - User Interface LibraryA curated set of user interface interactions, effects, widgets, and themes built on top of the jQuery JavaScript Library.
Bootstrap CSS FrameworkSleek, intuitive, and powerful front-end framework for faster and easier web development.
Font Awesome - IconsThe iconic font designed for use with Twitter Bootstrap.
TinyMCE Rich Text EditorTinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under LGPL by Moxiecode Systems AB.
SlickGridA lightning fast JavaScript grid/spreadsheet.
Flot Charting LibraryAttractive JavaScript plotting for jQuery.
Ace Code EditorHigh Performance Code Editor for the web.
JQuery.Gantt - Gantt ChartsDraw Gantt charts with the famous jQuery ease of development.
JSColor - Color PickerHTML/Javascript Color Picker.
Downloadify - Flash Download WidgetA tiny javascript + Flash library that enables the creation and download of text files without server interaction.
+
-

ERPNext is an Open Source project and is possible because of the work of - thousands of software developers, companies and designers who have contributed their - work to the community. We have tried to list as many projects as possible that are - used by ERPNext, but this list may not be exhaustive.

- - -

Server

-
    -
  • Linux (GNU)
  • -
  • Apache HTTPD server (web server)
  • -
  • MySQL (database, Percona build)
  • -
  • Git (source code control via Github)
  • -
- -

Programming Languages & Libraries

-
    -
  • Python
  • -
      -
    • Python-MySQL
    • -
    • pytz (timezones)
    • -
    • jinja2 (templating)
    • -
    • markdown2 (markdown parser)
    • -
    • jsmin (javascript minifier)
    • -
    -
  • Javascript
  • -
      -
    • JQuery
    • -
    • JQuery UI (datepicker, sortable)
    • -
    • TinyMCE - text editor
    • -
    • Twitter Bootstrap
    • -
    • Ace - code editor
    • -
    • Slick Grid - report grid
    • -
    • jQPlot - graphs
    • -
    • - JQuery.Gantt - Gantt Chart
    • -
    • JSON2 - JSON builder, parser
    • -
    • JSColor - color picker
    • -
    • - Downloadify - Export CSV files from the browser
    • -
    • - Chosen - a searchable select dropdown
    • -
    -
- -

CSS Frameworks

-
    -
  • Twitter Bootstrap
  • -
- -

Icons

-
    -
  • The Noun Project
  • -
  • Font Awesome: http://fortawesome.github.com/Font-Awesome
  • -
- -

Web Frameworks

-
    -
  • wnframework
  • -
- -

Web Browsers

-
    -
  • Mozilla Firefox
  • -
      -
    • Firebug (debugger)
    • -
    -
  • Apple Safari
  • -
  • Google Chorme
  • -
-
-

ERPNext License

+

ERPNext License: GNU/General Public License

+

ERPNext - Open Source, web based ERP

Copyright © 2008 onwards, Web Notes Technologies Pvt Ltd, India

@@ -92,6 +108,9 @@ GNU General Public License for more details.

For complete license see http://www.gnu.org/licenses/

+
+

Note: A link to this page must be easily accessible and all other ERPNext branding must remain as it is.


For more information please write to us at support@erpnext.com

+
\ No newline at end of file diff --git a/home/page/attributions/attributions.js b/home/page/attributions/attributions.js index fc567844311..29eb72f1719 100644 --- a/home/page/attributions/attributions.js +++ b/home/page/attributions/attributions.js @@ -1 +1,4 @@ -wn.pages['attributions'].onload = function(wrapper) { } \ No newline at end of file +wn.pages['attributions'].onload = function(wrapper) { + wrapper.appframe = new wn.ui.AppFrame($(wrapper).find(".layout-appframe"), + "Attributions"); +} \ No newline at end of file diff --git a/home/page/latest_updates/latest_updates.js b/home/page/latest_updates/latest_updates.js index 47d08c7c854..539d64d83e1 100644 --- a/home/page/latest_updates/latest_updates.js +++ b/home/page/latest_updates/latest_updates.js @@ -1,7 +1,7 @@ erpnext.updates = [ ["21st December 2012", [ "Manufacturing: For Material Transfer against Production Order, \ - fetch quantity pending to be transferred for each item." + fetch quantity pending to be transferred for each item.", "Desktop: New Icons and now sortable by dragging." ]], ["20th December 2012", [ diff --git a/hr/doctype/holiday_list/holiday_list.py b/hr/doctype/holiday_list/holiday_list.py index 63b1af425c1..43f99167df7 100644 --- a/hr/doctype/holiday_list/holiday_list.py +++ b/hr/doctype/holiday_list/holiday_list.py @@ -99,7 +99,7 @@ class DocType: yr_start_date, yr_end_date = self.get_fy_start_end_dates() date_list = self.get_weekly_off_date_list(yr_start_date, yr_end_date) for d in date_list: - ch = addchild(self.doc, 'holiday_list_details', 'Holiday', 1, self.doclist) + ch = addchild(self.doc, 'holiday_list_details', 'Holiday', self.doclist) ch.description = self.doc.weekly_off ch.holiday_date = d diff --git a/hr/doctype/salary_structure/salary_structure.py b/hr/doctype/salary_structure/salary_structure.py index d07be6eb07a..f310b7b4c8e 100644 --- a/hr/doctype/salary_structure/salary_structure.py +++ b/hr/doctype/salary_structure/salary_structure.py @@ -70,7 +70,7 @@ class DocType: def make_table(self, doct_name, tab_fname, tab_name): list1 = sql("select name from `tab%s` where docstatus != 2" % doct_name) for li in list1: - child = addchild(self.doc, tab_fname, tab_name, 1, self.doclist) + child = addchild(self.doc, tab_fname, tab_name, self.doclist) if(tab_fname == 'earning_details'): child.e_type = cstr(li[0]) child.modified_value = 0 diff --git a/manufacturing/doctype/bom/bom.py b/manufacturing/doctype/bom/bom.py index d874d3c643b..bc80bfe33be 100644 --- a/manufacturing/doctype/bom/bom.py +++ b/manufacturing/doctype/bom/bom.py @@ -357,7 +357,8 @@ class DocType: "Add items to Flat BOM table" self.doclist = self.doc.clear_table(self.doclist, 'flat_bom_details', 1) for d in self.cur_exploded_items: - ch = addchild(self.doc, 'flat_bom_details', 'BOM Explosion Item', 1, self.doclist) + ch = addchild(self.doc, 'flat_bom_details', 'BOM Explosion Item', + self.doclist) for i in d.keys(): ch.fields[i] = d[i] ch.docstatus = self.doc.docstatus diff --git a/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/manufacturing/doctype/production_planning_tool/production_planning_tool.py index 51cb3a76128..adc80918e15 100644 --- a/manufacturing/doctype/production_planning_tool/production_planning_tool.py +++ b/manufacturing/doctype/production_planning_tool/production_planning_tool.py @@ -101,7 +101,7 @@ class DocType: for r in open_so: if cstr(r['name']) not in so_list: pp_so = addchild(self.doc, 'pp_so_details', - 'Production Plan Sales Order', 1, self.doclist) + 'Production Plan Sales Order', self.doclist) pp_so.sales_order = r['name'] pp_so.sales_order_date = cstr(r['transaction_date']) pp_so.customer = cstr(r['customer']) @@ -150,7 +150,7 @@ class DocType: for p in items: item_details = sql("""select description, stock_uom, default_bom from tabItem where name=%s""", p['item_code']) - pi = addchild(self.doc, 'pp_details', 'Production Plan Item', 1, self.doclist) + pi = addchild(self.doc, 'pp_details', 'Production Plan Item', self.doclist) pi.sales_order = p['parent'] pi.item_code = p['item_code'] pi.description = item_details and item_details[0][0] or '' diff --git a/patches/april_2012/update_appraisal_permission.py b/patches/april_2012/update_appraisal_permission.py index 5afcdbba7a0..68002ba2aeb 100644 --- a/patches/april_2012/update_appraisal_permission.py +++ b/patches/april_2012/update_appraisal_permission.py @@ -7,7 +7,7 @@ def execute(): webnotes.conn.sql("delete from `tabDocPerm` where role = 'All' and permlevel = 0 and parent in ('Appraisal', 'Ticket', 'Project')") appr = get_obj('DocType', 'Appraisal', with_children=1) - ch = addchild(appr.doc, 'permissions', 'DocPerm', 0) + ch = addchild(appr.doc, 'permissions', 'DocPerm') ch.permlevel = 0 ch.role = 'Employee' ch.read = 1 diff --git a/patches/april_2012/update_role_in_address.py b/patches/april_2012/update_role_in_address.py index 3a65c30e1c7..788aa7bd490 100644 --- a/patches/april_2012/update_role_in_address.py +++ b/patches/april_2012/update_role_in_address.py @@ -11,7 +11,7 @@ def execute(): addr = get_obj('DocType', 'Address', with_children=1) for d in role1+role2: - ch = addchild(addr.doc, 'permissions', 'DocPerm', 0) + ch = addchild(addr.doc, 'permissions', 'DocPerm') ch.role = d ch.read = 1 ch.write = 1 diff --git a/projects/doctype/task/task.py b/projects/doctype/task/task.py index c390806f5a8..83f899586a3 100644 --- a/projects/doctype/task/task.py +++ b/projects/doctype/task/task.py @@ -24,8 +24,6 @@ from webnotes import msgprint sql = webnotes.conn.sql - - class DocType: def __init__(self,doc,doclist=[]): self.doc = doc @@ -37,7 +35,6 @@ class DocType: ret = {'customer': cust and cust[0][0] or '', 'customer_name': cust and cust[0][1] or ''} return ret - # TODO: Remove these? as the field customer doesn't exists def get_customer_details(self): cust = sql("select customer_name from `tabCustomer` where name=%s", self.doc.customer) if cust: diff --git a/projects/doctype/task/task.txt b/projects/doctype/task/task.txt index a7ada4b3d73..f47d2eb9d56 100644 --- a/projects/doctype/task/task.txt +++ b/projects/doctype/task/task.txt @@ -2,27 +2,18 @@ { "owner": "Administrator", "docstatus": 0, - "creation": "2012-09-18 11:05:48", + "creation": "2012-10-29 14:30:00", "modified_by": "Administrator", - "modified": "2012-10-29 14:24:55" + "modified": "2012-12-24 10:46:06" }, { - "section_style": "Tray", - "allow_attach": 1, - "tag_fields": "status", - "module": "Projects", - "server_code_error": " ", - "allow_trash": 1, - "doctype": "DocType", - "document_type": "Master", - "subject": "%(subject)s", "autoname": "TASK.#####", - "name": "__common__", - "colour": "White:FFF", - "_last_update": "1324880734", - "show_in_menu": 0, + "allow_attach": 1, + "doctype": "DocType", + "module": "Projects", "max_attachments": 5, - "version": 1 + "document_type": "Master", + "name": "__common__" }, { "name": "__common__", @@ -74,13 +65,13 @@ "reqd": 0 }, { - "search_index": 1, + "oldfieldtype": "Date", "doctype": "DocField", "label": "Expected End Date", "oldfieldname": "exp_end_date", "fieldname": "exp_end_date", "fieldtype": "Date", - "oldfieldtype": "Date", + "search_index": 1, "reqd": 0, "in_filter": 1 }, @@ -93,11 +84,9 @@ }, { "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", "label": "Project", "oldfieldname": "project", - "trigger": "Client", "fieldname": "project", "fieldtype": "Link", "options": "Project" @@ -105,23 +94,21 @@ { "no_copy": 1, "oldfieldtype": "Select", - "colour": "White:FFF", "doctype": "DocField", "label": "Status", "oldfieldname": "status", - "trigger": "Client", "fieldname": "status", "fieldtype": "Select", "options": "Open\nWorking\nPending Review\nClosed\nCancelled" }, { - "search_index": 1, + "oldfieldtype": "Select", "doctype": "DocField", "label": "Priority", "oldfieldname": "priority", "fieldname": "priority", "fieldtype": "Select", - "oldfieldtype": "Select", + "search_index": 1, "reqd": 0, "options": "Low\nMedium\nHigh\nUrgent", "in_filter": 1 @@ -217,13 +204,12 @@ }, { "doctype": "DocField", + "label": "More Details", "fieldname": "more_details", - "fieldtype": "Section Break", - "label": "More Details" + "fieldtype": "Section Break" }, { "oldfieldtype": "Date", - "colour": "White:FFF", "doctype": "DocField", "label": "Review Date", "oldfieldname": "review_date", @@ -234,7 +220,6 @@ }, { "oldfieldtype": "Date", - "colour": "White:FFF", "doctype": "DocField", "label": "Closing Date", "oldfieldname": "closing_date", @@ -260,7 +245,7 @@ "permlevel": 0 }, { - "permlevel": 1, - "doctype": "DocPerm" + "doctype": "DocPerm", + "permlevel": 1 } ] \ No newline at end of file diff --git a/public/js/toolbar.js b/public/js/toolbar.js index 71fb082c6d4..f1eddb0df6f 100644 --- a/public/js/toolbar.js +++ b/public/js/toolbar.js @@ -60,7 +60,7 @@ erpnext.toolbar.add_modules = function() { for(var i in modules_list) { var m = modules_list[i] - if(m!='Setup' && wn.boot.profile.allow_modules.indexOf(m)!=-1) { + if(m!='Setup' && wn.boot.profile.allow_modules.indexOf(m)!=-1 && wn.modules[m]) { args = { module: m, module_page: wn.modules[m].link, diff --git a/selling/doctype/opportunity/opportunity.py b/selling/doctype/opportunity/opportunity.py index 82a6e8e4c77..369fab72a1a 100644 --- a/selling/doctype/opportunity/opportunity.py +++ b/selling/doctype/opportunity/opportunity.py @@ -123,7 +123,7 @@ class DocType(TransactionBase): user_lst.append(chk[0][0]) for d in user_lst: - ch = addchild(ev, 'event_individuals', 'Event User', 0) + ch = addchild(ev, 'event_individuals', 'Event User') ch.person = d ch.save(1) diff --git a/selling/doctype/quotation/quotation.py b/selling/doctype/quotation/quotation.py index 0e7554497e7..3b452f18b7b 100644 --- a/selling/doctype/quotation/quotation.py +++ b/selling/doctype/quotation/quotation.py @@ -19,7 +19,7 @@ import webnotes from webnotes.utils import cstr, load_json from webnotes.model import db_exists -from webnotes.model.doc import Document, addchild +from webnotes.model.doc import Document from webnotes.model.wrapper import getlist, copy_doclist from webnotes.model.code import get_obj from webnotes import msgprint diff --git a/selling/doctype/sales_common/sales_common.py b/selling/doctype/sales_common/sales_common.py index e672abf0eb0..03280e28046 100644 --- a/selling/doctype/sales_common/sales_common.py +++ b/selling/doctype/sales_common/sales_common.py @@ -75,7 +75,7 @@ class DocType(TransactionBase): obj.doclist = obj.doc.clear_table(obj.doclist,'sales_team') idx = 0 for d in webnotes.conn.sql("select sales_person, allocated_percentage, allocated_amount, incentives from `tabSales Team` where parent = '%s'" % obj.doc.customer): - ch = addchild(obj.doc, 'sales_team', 'Sales Team', 1, obj.doclist) + ch = addchild(obj.doc, 'sales_team', 'Sales Team', obj.doclist) ch.sales_person = d and cstr(d[0]) or '' ch.allocated_percentage = d and flt(d[1]) or 0 ch.allocated_amount = d and flt(d[2]) or 0 @@ -265,8 +265,8 @@ class DocType(TransactionBase): for field in default_fields: if field in other: del other[field] - d = addchild(obj.doc, 'other_charges', 'Sales Taxes and Charges', 1, - obj.doclist) + d = addchild(obj.doc, 'other_charges', 'Sales Taxes and Charges', + obj.doclist) d.fields.update(other) d.rate = flt(d.rate) d.tax_amount = flt(d.tax_rate) @@ -481,7 +481,8 @@ class DocType(TransactionBase): break if not exists: - pi = addchild(obj.doc, 'packing_details', 'Delivery Note Packing Item', 1, obj.doclist) + pi = addchild(obj.doc, 'packing_details', 'Delivery Note Packing Item', + obj.doclist) pi.parent_item = line.item_code pi.item_code = packing_item_code diff --git a/setup/doctype/setup_control/setup_control.py b/setup/doctype/setup_control/setup_control.py index fb0b6944549..3c073dafc1f 100644 --- a/setup/doctype/setup_control/setup_control.py +++ b/setup/doctype/setup_control/setup_control.py @@ -239,13 +239,13 @@ class DocType: def add_roles(self, pr): roles_list = ['Accounts Manager', 'Accounts User', 'Blogger', 'HR Manager', 'HR User', 'Maintenance User', 'Maintenance Manager', 'Material Manager', 'Material User', 'Material Master Manager', 'Manufacturing Manager', 'Manufacturing User', 'Projects User', 'Purchase Manager', 'Purchase User', 'Purchase Master Manager', 'Quality Manager', 'Sales Manager', 'Sales User', 'Sales Master Manager', 'Support Manager', 'Support Team', 'System Manager', 'Website Manager'] for r in roles_list: - d = addchild(pr, 'userroles', 'UserRole', 1) + d = addchild(pr, 'userroles', 'UserRole') d.role = r d.save(1) # Add roles to Administrator profile pr = Document('Profile','Administrator') for r in roles_list: - d = addchild(pr,'userroles', 'UserRole', 1) + d = addchild(pr,'userroles', 'UserRole') d.role = r d.save(1) \ No newline at end of file diff --git a/stock/doctype/bin/bin.py b/stock/doctype/bin/bin.py index 5e3e74af504..d472e5fc4d6 100644 --- a/stock/doctype/bin/bin.py +++ b/stock/doctype/bin/bin.py @@ -350,7 +350,7 @@ class DocType: reaches re-order level when %s %s was created""" % (doc_type,doc_name) indent.save(1) indent_obj = get_obj('Purchase Request',indent.name,with_children=1) - indent_details_child = addchild(indent_obj.doc,'indent_details','Purchase Request Item',0) + indent_details_child = addchild(indent_obj.doc,'indent_details','Purchase Request Item') indent_details_child.item_code = self.doc.item_code indent_details_child.uom = self.doc.stock_uom indent_details_child.warehouse = self.doc.warehouse diff --git a/stock/doctype/item/item.py b/stock/doctype/item/item.py index a9f7ee7129d..e68ef7fad06 100644 --- a/stock/doctype/item/item.py +++ b/stock/doctype/item/item.py @@ -70,7 +70,8 @@ class DocType: raise Exception if not cstr(self.doc.stock_uom) in check_list : - child = addchild( self.doc, 'uom_conversion_details', 'UOM Conversion Detail', 1, self.doclist) + child = addchild( self.doc, 'uom_conversion_details', + 'UOM Conversion Detail', self.doclist) child.uom = self.doc.stock_uom child.conversion_factor = 1 child.save() diff --git a/stock/doctype/landed_cost_wizard/landed_cost_wizard.py b/stock/doctype/landed_cost_wizard/landed_cost_wizard.py index 4e8015d0f19..d5abb845961 100644 --- a/stock/doctype/landed_cost_wizard/landed_cost_wizard.py +++ b/stock/doctype/landed_cost_wizard/landed_cost_wizard.py @@ -51,7 +51,8 @@ class DocType: msgprint("Please enter date of shorter duration as there are too many purchase receipt, hence it cannot be loaded.", raise_exception=1) for i in pr: - ch = addchild(self.doc, 'lc_pr_details', 'Landed Cost Purchase Receipt', 1, self.doclist) + ch = addchild(self.doc, 'lc_pr_details', 'Landed Cost Purchase Receipt', + self.doclist) ch.purchase_receipt = i and i['name'] or '' ch.save() @@ -62,7 +63,8 @@ class DocType: idx = 0 landed_cost = sql("select account_head, description from `tabLanded Cost Master Detail` where parent=%s", (self.doc.landed_cost), as_dict = 1) for cost in landed_cost: - lct = addchild(self.doc, 'landed_cost_details', 'Landed Cost Item', 1, self.doclist) + lct = addchild(self.doc, 'landed_cost_details', 'Landed Cost Item', + self.doclist) lct.account_head = cost['account_head'] lct.description = cost['description'] @@ -100,7 +102,7 @@ class DocType: pr_oc_row = sql("select name from `tabPurchase Taxes and Charges` where parent = %s and category = 'Valuation' and add_deduct_tax = 'Add' and charge_type = 'Actual' and account_head = %s",(pr, lc.account_head)) if not pr_oc_row: # add if not exists - ch = addchild(pr_obj.doc, 'purchase_tax_details', 'Purchase Taxes and Charges', 1) + ch = addchild(pr_obj.doc, 'purchase_tax_details', 'Purchase Taxes and Charges') ch.category = 'Valuation' ch.add_deduct_tax = 'Add' ch.charge_type = 'Actual' diff --git a/stock/doctype/purchase_receipt/purchase_receipt.py b/stock/doctype/purchase_receipt/purchase_receipt.py index 4683abba666..e5e1fe110e4 100644 --- a/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/stock/doctype/purchase_receipt/purchase_receipt.py @@ -390,7 +390,7 @@ class DocType(TransactionBase): if i and not sql("select name from `tabPurchase Receipt Item Supplied` where reference_name = '%s' and bom_detail_no = '%s' and parent = '%s' " %(d.name, i[6], self.doc.name)): - rm_child = addchild(self.doc, 'pr_raw_material_details', 'Purchase Receipt Item Supplied', 1, self.doclist) + rm_child = addchild(self.doc, 'pr_raw_material_details', 'Purchase Receipt Item Supplied', self.doclist) rm_child.reference_name = d.name rm_child.bom_detail_no = i and i[6] or '' diff --git a/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.py b/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.py index 92fa63e1247..92b0cb1d097 100644 --- a/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.py +++ b/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.py @@ -8,11 +8,11 @@ # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . from __future__ import unicode_literals import webnotes @@ -26,45 +26,46 @@ sql = webnotes.conn.sql class DocType : - def __init__(self, doc, doclist=[]): - self.doc = doc - self.doclist = doclist + def __init__(self, doc, doclist=[]): + self.doc = doc + self.doclist = doclist - # Pull Item Details - # --------------------------- - def pull_item_details(self): - if self.doc.return_type == 'Sales Return': - if self.doc.delivery_note_no: - det = sql("select t1.name, t1.item_code, t1.description, t1.qty, t1.uom, t2.export_rate * t3.conversion_rate, t3.customer, t3.customer_name, t3.customer_address, t2.serial_no, t2.batch_no from `tabDelivery Note Packing Item` t1, `tabDelivery Note Item` t2, `tabDelivery Note` t3 where t1.parent = t3.name and t2.parent = t3.name and t1.parent_detail_docname = t2.name and t3.name = '%s' and t3.docstatus = 1" % self.doc.delivery_note_no) - elif self.doc.sales_invoice_no: - det = sql("select t1.name, t1.item_code, t1.description, t1.qty, t1.stock_uom, t1.export_rate * t2.conversion_rate, t2.customer, t2.customer_name, t2.customer_address, t1.serial_no from `tabSales Invoice Item` t1, `tabSales Invoice` t2 where t1.parent = t2.name and t2.name = '%s' and t2.docstatus = 1" % self.doc.sales_invoice_no) - elif self.doc.return_type == 'Purchase Return' and self.doc.purchase_receipt_no: - det = sql("select t1.name, t1.item_code, t1.description, t1.received_qty, t1.uom, t1.purchase_rate, t2.supplier, t2.supplier_name, t2.supplier_address, t1.serial_no, t1.batch_no from `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 where t1.parent = t2.name and t2.name = '%s' and t2.docstatus = 1" % self.doc.purchase_receipt_no) + # Pull Item Details + # --------------------------- + def pull_item_details(self): + if self.doc.return_type == 'Sales Return': + if self.doc.delivery_note_no: + det = sql("select t1.name, t1.item_code, t1.description, t1.qty, t1.uom, t2.export_rate * t3.conversion_rate, t3.customer, t3.customer_name, t3.customer_address, t2.serial_no, t2.batch_no from `tabDelivery Note Packing Item` t1, `tabDelivery Note Item` t2, `tabDelivery Note` t3 where t1.parent = t3.name and t2.parent = t3.name and t1.parent_detail_docname = t2.name and t3.name = '%s' and t3.docstatus = 1" % self.doc.delivery_note_no) + elif self.doc.sales_invoice_no: + det = sql("select t1.name, t1.item_code, t1.description, t1.qty, t1.stock_uom, t1.export_rate * t2.conversion_rate, t2.customer, t2.customer_name, t2.customer_address, t1.serial_no from `tabSales Invoice Item` t1, `tabSales Invoice` t2 where t1.parent = t2.name and t2.name = '%s' and t2.docstatus = 1" % self.doc.sales_invoice_no) + elif self.doc.return_type == 'Purchase Return' and self.doc.purchase_receipt_no: + det = sql("select t1.name, t1.item_code, t1.description, t1.received_qty, t1.uom, t1.purchase_rate, t2.supplier, t2.supplier_name, t2.supplier_address, t1.serial_no, t1.batch_no from `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 where t1.parent = t2.name and t2.name = '%s' and t2.docstatus = 1" % self.doc.purchase_receipt_no) - self.doc.cust_supp = det and det[0][6] or '' - self.doc.cust_supp_name = det and det[0][7] or '' - self.doc.cust_supp_address = det and det[0][8] or '' - self.create_item_table(det) - self.doc.save() - - # Create Item Table - # ----------------------------- - def create_item_table(self, det): - self.doclist = self.doc.clear_table(self.doclist, 'return_details', 1) - for i in det: - ch = addchild(self.doc, 'return_details', 'Sales and Purchase Return Item', 1, self.doclist) - ch.detail_name = i and i[0] or '' - ch.item_code = i and i[1] or '' - ch.description = i and i[2] or '' - ch.qty = i and flt(i[3]) or 0 - ch.uom = i and i[4] or '' - ch.rate = i and flt(i[5]) or 0 - ch.serial_no = i and i[9] or '' - ch.batch_no = (len(i) == 11) and i[10] or '' - ch.save() + self.doc.cust_supp = det and det[0][6] or '' + self.doc.cust_supp_name = det and det[0][7] or '' + self.doc.cust_supp_address = det and det[0][8] or '' + self.create_item_table(det) + self.doc.save() + + # Create Item Table + # ----------------------------- + def create_item_table(self, det): + self.doclist = self.doc.clear_table(self.doclist, 'return_details', 1) + for i in det: + ch = addchild(self.doc, 'return_details', 'Sales and Purchase Return Item', + self.doclist) + ch.detail_name = i and i[0] or '' + ch.item_code = i and i[1] or '' + ch.description = i and i[2] or '' + ch.qty = i and flt(i[3]) or 0 + ch.uom = i and i[4] or '' + ch.rate = i and flt(i[5]) or 0 + ch.serial_no = i and i[9] or '' + ch.batch_no = (len(i) == 11) and i[10] or '' + ch.save() - # Clear return table - # -------------------------------- - def clear_return_table(self): - self.doclist = self.doc.clear_table(self.doclist, 'return_details', 1) - self.doc.save() + # Clear return table + # -------------------------------- + def clear_return_table(self): + self.doclist = self.doc.clear_table(self.doclist, 'return_details', 1) + self.doc.save() \ No newline at end of file diff --git a/stock/doctype/stock_entry/stock_entry.js b/stock/doctype/stock_entry/stock_entry.js index 724b215d3fe..a6d233e258b 100644 --- a/stock/doctype/stock_entry/stock_entry.js +++ b/stock/doctype/stock_entry/stock_entry.js @@ -160,6 +160,7 @@ fld.get_query = function(doc, cdt, cdn) { return 'SELECT tabItem.name, tabItem.description, tabBin.actual_qty ' + 'FROM tabItem, tabBin ' + 'WHERE tabItem.name = tabBin.item_code ' + + 'AND tabItem.is_stock_item = "Yes"' + 'AND ifnull(`tabBin`.`actual_qty`,0) > 0 ' + 'AND tabBin.warehouse="'+ d.s_warehouse +'" ' + 'AND tabItem.docstatus < 2 ' @@ -171,6 +172,7 @@ fld.get_query = function(doc, cdt, cdn) { return 'SELECT tabItem.name, tabItem.description ' + 'FROM tabItem ' + 'WHERE tabItem.docstatus < 2 ' + + 'AND tabItem.is_stock_item = "Yes"' + 'AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") ' + 'AND tabItem.%(key)s LIKE "%s" ' + 'ORDER BY tabItem.name ASC ' diff --git a/stock/doctype/stock_entry/stock_entry.py b/stock/doctype/stock_entry/stock_entry.py index cddaa497e1d..2e26a1a86a6 100644 --- a/stock/doctype/stock_entry/stock_entry.py +++ b/stock/doctype/stock_entry/stock_entry.py @@ -36,7 +36,6 @@ class DocType(TransactionBase): def validate(self): self.validate_serial_nos() - pro_obj = self.doc.production_order and \ get_obj('Production Order', self.doc.production_order) or None @@ -467,7 +466,8 @@ class DocType(TransactionBase): def add_to_stock_entry_detail(self, source_wh, target_wh, item_dict, bom_no=None): for d in item_dict: - se_child = addchild(self.doc, 'mtn_details', 'Stock Entry Detail', 0, self.doclist) + se_child = addchild(self.doc, 'mtn_details', 'Stock Entry Detail', + self.doclist) se_child.s_warehouse = source_wh se_child.t_warehouse = target_wh se_child.item_code = cstr(d) diff --git a/stock/doctype/stock_ledger_entry/stock_ledger_entry.py b/stock/doctype/stock_ledger_entry/stock_ledger_entry.py index 0994e505c07..fae2fcb9f6f 100644 --- a/stock/doctype/stock_ledger_entry/stock_ledger_entry.py +++ b/stock/doctype/stock_ledger_entry/stock_ledger_entry.py @@ -28,6 +28,14 @@ class DocType: def __init__(self, doc, doclist=[]): self.doc = doc self.doclist = doclist + + def validate(self): + self.validate_mandatory() + self.validate_posting_time() + self.validate_item() + self.actual_amt_check() + self.check_stock_frozen_date() + self.scrub_posting_time() #check for item quantity available in stock def actual_amt_check(self): @@ -53,13 +61,19 @@ class DocType: msgprint("Warehouse: '%s' does not exist in the system. Please check." % self.doc.fields.get(k), raise_exception = 1) def validate_item(self): - item_det = sql("select name, has_batch_no, docstatus from tabItem where name = '%s'" % self.doc.item_code) + item_det = sql("""select name, has_batch_no, docstatus, + ifnull(is_stock_item, 'No') from tabItem where name=%s""", + self.doc.item_code) # check item exists if item_det: item_det = item_det and item_det[0] else: msgprint("Item: '%s' does not exist in the system. Please check." % self.doc.item_code, raise_exception = 1) + + if item_det[3]!='Yes': + webnotes.msgprint("""Item: "%s" is not a Stock Item.""" % self.doc.item_code, + raise_exception=1) # check if item is trashed if cint(item_det[2])==2: @@ -96,12 +110,4 @@ class DocType: self.doc.posting_time = '00:00' if len(self.doc.posting_time.split(':')) > 2: self.doc.posting_time = '00:00' - - - def validate(self): - self.validate_mandatory() - self.validate_posting_time() - self.validate_item() - self.actual_amt_check() - self.check_stock_frozen_date() - self.scrub_posting_time() + \ No newline at end of file diff --git a/support/doctype/maintenance_schedule/maintenance_schedule.py b/support/doctype/maintenance_schedule/maintenance_schedule.py index b703e56ac82..6560c83598f 100644 --- a/support/doctype/maintenance_schedule/maintenance_schedule.py +++ b/support/doctype/maintenance_schedule/maintenance_schedule.py @@ -8,11 +8,11 @@ # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . from __future__ import unicode_literals import webnotes @@ -30,313 +30,314 @@ sql = webnotes.conn.sql from utilities.transaction_base import TransactionBase class DocType(TransactionBase): - def __init__(self, doc, doclist=[]): - self.doc = doc - self.doclist = doclist - - # pull sales order details - #-------------------------- - def pull_sales_order_detail(self): - self.doclist = self.doc.clear_table(self.doclist, 'item_maintenance_detail') - self.doclist = self.doc.clear_table(self.doclist, 'maintenance_schedule_detail') - self.doclist = get_obj('DocType Mapper', 'Sales Order-Maintenance Schedule').dt_map('Sales Order', 'Maintenance Schedule', self.doc.sales_order_no, self.doc, self.doclist, "[['Sales Order', 'Maintenance Schedule'],['Sales Order Item', 'Maintenance Schedule Item']]") - - #pull item details - #------------------- - def get_item_details(self, item_code): - item = sql("select item_name, description from `tabItem` where name = '%s'" %(item_code), as_dict=1) - ret = { - 'item_name': item and item[0]['item_name'] or '', - 'description' : item and item[0]['description'] or '' - } - return ret - - # generate maintenance schedule - #------------------------------------- - def generate_schedule(self): - import datetime - self.doclist = self.doc.clear_table(self.doclist, 'maintenance_schedule_detail') - count = 0 - sql("delete from `tabMaintenance Schedule Detail` where parent='%s'" %(self.doc.name)) - for d in getlist(self.doclist, 'item_maintenance_detail'): - self.validate_maintenance_detail() - s_list =[] - s_list = self.create_schedule_list(d.start_date, d.end_date, d.no_of_visits) - for i in range(d.no_of_visits): - child = addchild(self.doc,'maintenance_schedule_detail','Maintenance Schedule Detail',1,self.doclist) - child.item_code = d.item_code - child.item_name = d.item_name - child.scheduled_date = s_list[i].strftime('%Y-%m-%d') - if d.serial_no: - child.serial_no = d.serial_no - child.idx = count - count = count+1 - child.incharge_name = d.incharge_name - child.save(1) - - self.on_update() + def __init__(self, doc, doclist=[]): + self.doc = doc + self.doclist = doclist + + # pull sales order details + #-------------------------- + def pull_sales_order_detail(self): + self.doclist = self.doc.clear_table(self.doclist, 'item_maintenance_detail') + self.doclist = self.doc.clear_table(self.doclist, 'maintenance_schedule_detail') + self.doclist = get_obj('DocType Mapper', 'Sales Order-Maintenance Schedule').dt_map('Sales Order', 'Maintenance Schedule', self.doc.sales_order_no, self.doc, self.doclist, "[['Sales Order', 'Maintenance Schedule'],['Sales Order Item', 'Maintenance Schedule Item']]") + + #pull item details + #------------------- + def get_item_details(self, item_code): + item = sql("select item_name, description from `tabItem` where name = '%s'" %(item_code), as_dict=1) + ret = { + 'item_name': item and item[0]['item_name'] or '', + 'description' : item and item[0]['description'] or '' + } + return ret + + # generate maintenance schedule + #------------------------------------- + def generate_schedule(self): + import datetime + self.doclist = self.doc.clear_table(self.doclist, 'maintenance_schedule_detail') + count = 0 + sql("delete from `tabMaintenance Schedule Detail` where parent='%s'" %(self.doc.name)) + for d in getlist(self.doclist, 'item_maintenance_detail'): + self.validate_maintenance_detail() + s_list =[] + s_list = self.create_schedule_list(d.start_date, d.end_date, d.no_of_visits) + for i in range(d.no_of_visits): + child = addchild(self.doc, 'maintenance_schedule_detail', + 'Maintenance Schedule Detail', self.doclist) + child.item_code = d.item_code + child.item_name = d.item_name + child.scheduled_date = s_list[i].strftime('%Y-%m-%d') + if d.serial_no: + child.serial_no = d.serial_no + child.idx = count + count = count+1 + child.incharge_name = d.incharge_name + child.save(1) + + self.on_update() - def on_submit(self): - if not getlist(self.doclist, 'maintenance_schedule_detail'): - msgprint("Please click on 'Generate Schedule' to get schedule") - raise Exception - self.check_serial_no_added() - self.validate_serial_no_warranty() - self.validate_schedule() + def on_submit(self): + if not getlist(self.doclist, 'maintenance_schedule_detail'): + msgprint("Please click on 'Generate Schedule' to get schedule") + raise Exception + self.check_serial_no_added() + self.validate_serial_no_warranty() + self.validate_schedule() - email_map ={} - for d in getlist(self.doclist, 'item_maintenance_detail'): - if d.serial_no: - self.update_amc_date(d.serial_no, d.end_date) + email_map ={} + for d in getlist(self.doclist, 'item_maintenance_detail'): + if d.serial_no: + self.update_amc_date(d.serial_no, d.end_date) - if d.incharge_name not in email_map: - e = sql("select email_id, name from `tabSales Person` where name='%s' " %(d.incharge_name),as_dict=1)[0] - email_map[d.incharge_name] = (e['email_id']) + if d.incharge_name not in email_map: + e = sql("select email_id, name from `tabSales Person` where name='%s' " %(d.incharge_name),as_dict=1)[0] + email_map[d.incharge_name] = (e['email_id']) - scheduled_date =sql("select scheduled_date from `tabMaintenance Schedule Detail` \ - where incharge_name='%s' and item_code='%s' and parent='%s' " %(d.incharge_name, \ - d.item_code, self.doc.name), as_dict=1) + scheduled_date =sql("select scheduled_date from `tabMaintenance Schedule Detail` \ + where incharge_name='%s' and item_code='%s' and parent='%s' " %(d.incharge_name, \ + d.item_code, self.doc.name), as_dict=1) - for key in scheduled_date: - if email_map[d.incharge_name]: - self.add_calender_event(key["scheduled_date"],email_map[d.incharge_name],d.item_code) - webnotes.conn.set(self.doc, 'status', 'Submitted') - + for key in scheduled_date: + if email_map[d.incharge_name]: + self.add_calender_event(key["scheduled_date"],email_map[d.incharge_name],d.item_code) + webnotes.conn.set(self.doc, 'status', 'Submitted') + - def add_calender_event(self,scheduled_date,incharge_email,item_code): - """ Add calendar event for Maintenece Schedule in calendar of Allocated person""" - event = Document('Event') - event.owner = incharge_email - event.description = "Reference:%s, Item Code:%s and Customer: %s" %(self.doc.name, item_code, self.doc.customer) - event.event_date = scheduled_date - event.event_hour = '10:00' - event.event_type = 'Private' - event.ref_type = 'Maintenance Schedule' - event.ref_name = self.doc.name - event.save(1) + def add_calender_event(self,scheduled_date,incharge_email,item_code): + """ Add calendar event for Maintenece Schedule in calendar of Allocated person""" + event = Document('Event') + event.owner = incharge_email + event.description = "Reference:%s, Item Code:%s and Customer: %s" %(self.doc.name, item_code, self.doc.customer) + event.event_date = scheduled_date + event.event_hour = '10:00' + event.event_type = 'Private' + event.ref_type = 'Maintenance Schedule' + event.ref_name = self.doc.name + event.save(1) - #get schedule dates - #---------------------- - def create_schedule_list(self, start_date, end_date, no_of_visit): - schedule_list = [] - start_date1 = start_date - date_diff = (getdate(end_date) - getdate(start_date)).days - add_by = date_diff/no_of_visit - #schedule_list.append(start_date1) - while(getdate(start_date1) < getdate(end_date)): - start_date1 = add_days(start_date1, add_by) - if len(schedule_list) < no_of_visit: - schedule_list.append(getdate(start_date1)) - return schedule_list - - #validate date range and periodicity selected - #------------------------------------------------- - def validate_period(self, arg): - arg1 = eval(arg) - if getdate(arg1['start_date']) >= getdate(arg1['end_date']): - msgprint("Start date should be less than end date ") - raise Exception - - period = (getdate(arg1['end_date'])-getdate(arg1['start_date'])).days+1 - - if (arg1['periodicity']=='Yearly' or arg1['periodicity']=='Half Yearly' or arg1['periodicity']=='Quarterly') and period<365: - msgprint(cstr(arg1['periodicity'])+ " periodicity can be set for period of atleast 1 year or more only") - raise Exception - elif arg1['periodicity']=='Monthly' and period<30: - msgprint("Monthly periodicity can be set for period of atleast 1 month or more") - raise Exception - elif arg1['periodicity']=='Weekly' and period<7: - msgprint("Weekly periodicity can be set for period of atleast 1 week or more") - raise Exception - + #get schedule dates + #---------------------- + def create_schedule_list(self, start_date, end_date, no_of_visit): + schedule_list = [] + start_date1 = start_date + date_diff = (getdate(end_date) - getdate(start_date)).days + add_by = date_diff/no_of_visit + #schedule_list.append(start_date1) + while(getdate(start_date1) < getdate(end_date)): + start_date1 = add_days(start_date1, add_by) + if len(schedule_list) < no_of_visit: + schedule_list.append(getdate(start_date1)) + return schedule_list + + #validate date range and periodicity selected + #------------------------------------------------- + def validate_period(self, arg): + arg1 = eval(arg) + if getdate(arg1['start_date']) >= getdate(arg1['end_date']): + msgprint("Start date should be less than end date ") + raise Exception + + period = (getdate(arg1['end_date'])-getdate(arg1['start_date'])).days+1 + + if (arg1['periodicity']=='Yearly' or arg1['periodicity']=='Half Yearly' or arg1['periodicity']=='Quarterly') and period<365: + msgprint(cstr(arg1['periodicity'])+ " periodicity can be set for period of atleast 1 year or more only") + raise Exception + elif arg1['periodicity']=='Monthly' and period<30: + msgprint("Monthly periodicity can be set for period of atleast 1 month or more") + raise Exception + elif arg1['periodicity']=='Weekly' and period<7: + msgprint("Weekly periodicity can be set for period of atleast 1 week or more") + raise Exception + - #get count on the basis of periodicity selected - #---------------------------------------------------- - def get_no_of_visits(self, arg): - arg1 = eval(arg) - start_date = arg1['start_date'] - - self.validate_period(arg) - period = (getdate(arg1['end_date'])-getdate(arg1['start_date'])).days+1 - - count =0 - if arg1['periodicity'] == 'Weekly': - count = period/7 - elif arg1['periodicity'] == 'Monthly': - count = period/30 - elif arg1['periodicity'] == 'Quarterly': - count = period/91 - elif arg1['periodicity'] == 'Half Yearly': - count = period/182 - elif arg1['periodicity'] == 'Yearly': - count = period/365 - - ret = {'no_of_visits':count} - return ret - + #get count on the basis of periodicity selected + #---------------------------------------------------- + def get_no_of_visits(self, arg): + arg1 = eval(arg) + start_date = arg1['start_date'] + + self.validate_period(arg) + period = (getdate(arg1['end_date'])-getdate(arg1['start_date'])).days+1 + + count =0 + if arg1['periodicity'] == 'Weekly': + count = period/7 + elif arg1['periodicity'] == 'Monthly': + count = period/30 + elif arg1['periodicity'] == 'Quarterly': + count = period/91 + elif arg1['periodicity'] == 'Half Yearly': + count = period/182 + elif arg1['periodicity'] == 'Yearly': + count = period/365 + + ret = {'no_of_visits':count} + return ret + - def validate_maintenance_detail(self): - if not getlist(self.doclist, 'item_maintenance_detail'): - msgprint("Please enter Maintaince Details first") - raise Exception - - for d in getlist(self.doclist, 'item_maintenance_detail'): - if not d.item_code: - msgprint("Please select item code") - raise Exception - elif not d.start_date or not d.end_date: - msgprint("Please select Start Date and End Date for item "+d.item_code) - raise Exception - elif not d.no_of_visits: - msgprint("Please mention no of visits required") - raise Exception - elif not d.incharge_name: - msgprint("Please select Incharge Person's name") - raise Exception - - if getdate(d.start_date) >= getdate(d.end_date): - msgprint("Start date should be less than end date for item "+d.item_code) - raise Exception - - #check if maintenance schedule already created against same sales order - #----------------------------------------------------------------------------------- - def validate_sales_order(self): - for d in getlist(self.doclist, 'item_maintenance_detail'): - if d.prevdoc_docname: - chk = sql("select t1.name from `tabMaintenance Schedule` t1, `tabMaintenance Schedule Item` t2 where t2.parent=t1.name and t2.prevdoc_docname=%s and t1.docstatus=1", d.prevdoc_docname) - if chk: - msgprint("Maintenance Schedule against "+d.prevdoc_docname+" already exist") - raise Exception - - # Validate values with reference document - #---------------------------------------- - def validate_reference_value(self): - get_obj('DocType Mapper', 'Sales Order-Maintenance Schedule', with_children = 1).validate_reference_value(self, self.doc.name) - - def validate_serial_no(self): - for d in getlist(self.doclist, 'item_maintenance_detail'): - cur_s_no=[] - if d.serial_no: - cur_serial_no = d.serial_no.replace(' ', '') - cur_s_no = cur_serial_no.split(',') - - for x in cur_s_no: - chk = sql("select name, status from `tabSerial No` where docstatus!=2 and name=%s", (x)) - chk1 = chk and chk[0][0] or '' - status = chk and chk[0][1] or '' - - if not chk1: - msgprint("Serial no "+x+" does not exist in system.") - raise Exception - else: - if status=='In Store' or status=='Note in Use' or status=='Scrapped': - msgprint("Serial no "+x+" is '"+status+"'") - raise Exception - - def validate(self): - self.validate_maintenance_detail() - self.validate_sales_order() - if self.doc.sales_order_no: - self.validate_reference_value() - self.validate_serial_no() - self.validate_start_date() - - # validate that maintenance start date can not be before serial no delivery date - #------------------------------------------------------------------------------------------- - def validate_start_date(self): - for d in getlist(self.doclist, 'item_maintenance_detail'): - if d.serial_no: - cur_serial_no = d.serial_no.replace(' ', '') - cur_s_no = cur_serial_no.split(',') - - for x in cur_s_no: - dt = sql("select delivery_date from `tabSerial No` where name = %s", x) - dt = dt and dt[0][0] or '' - - if dt: - if dt > getdate(d.start_date): - msgprint("Maintenance start date can not be before delivery date "+dt.strftime('%Y-%m-%d')+" for serial no "+x) - raise Exception - - #update amc expiry date in serial no - #------------------------------------------ - def update_amc_date(self,serial_no,amc_end_date): - #get current list of serial no - cur_serial_no = serial_no.replace(' ', '') - cur_s_no = cur_serial_no.split(',') - - for x in cur_s_no: - sql("update `tabSerial No` set amc_expiry_date = '%s', maintenance_status = 'Under AMC' where name = '%s'"% (amc_end_date,x)) - - def on_update(self): - webnotes.conn.set(self.doc, 'status', 'Draft') - - #validate that new maintenance start date does not clash with existing mntc end date - #------------------------------------------------------------------------------------------------- - def validate_serial_no_warranty(self): - for d in getlist(self.doclist, 'item_maintenance_detail'): - if d.serial_no: - dt = sql("select warranty_expiry_date, amc_expiry_date from `tabSerial No` where name = %s", d.serial_no, as_dict=1) - - if dt[0]['warranty_expiry_date']: - if dt[0]['warranty_expiry_date'] >= getdate(d.start_date): - msgprint("Serial no "+d.serial_no+" for item "+d.item_code+" is already under warranty till "+(dt[0]['warranty_expiry_date']).strftime('%Y-%m-%d')+". You can schedule AMC start date after "+(dt[0]['warranty_expiry_date']).strftime('%Y-%m-%d')) - raise Exception - if dt[0]['amc_expiry_date']: - if dt[0]['amc_expiry_date'] >= getdate(d.start_date): - msgprint("Serial no "+d.serial_no+" for item "+d.item_code+" is already under AMC till "+(dt[0]['amc_expiry_date']).strftime('%Y-%m-%d')+". You can schedule new AMC start date after "+(dt[0]['amc_expiry_date']).strftime('%Y-%m-%d')) - raise Exception - - #validate if schedule generated for all items - #------------------------------------------------- - def validate_schedule(self): - item_lst1 =[] - item_lst2 =[] - for d in getlist(self.doclist, 'item_maintenance_detail'): - if d.item_code not in item_lst1: - item_lst1.append(d.item_code) - - for m in getlist(self.doclist, 'maintenance_schedule_detail'): - if m.item_code not in item_lst2: - item_lst2.append(m.item_code) - - if len(item_lst1) != len(item_lst2): - msgprint("Maintenance Schedule is not generated for all the items. Please click on 'Generate Schedule'") - raise Exception - else: - for x in item_lst1: - if x not in item_lst2: - msgprint("Maintenance Schedule is not generated for item "+x+". Please click on 'Generate Schedule'") - raise Exception - - #check if serial no present in item maintenance table - #----------------------------------------------------------- - def check_serial_no_added(self): - serial_present =[] - for d in getlist(self.doclist, 'item_maintenance_detail'): - if d.serial_no: - serial_present.append(d.item_code) - - for m in getlist(self.doclist, 'maintenance_schedule_detail'): - if serial_present: - if m.item_code in serial_present and not m.serial_no: - msgprint("Please click on 'Generate Schedule' to fetch serial no added for item "+m.item_code) - raise Exception - - - - def on_cancel(self): - for d in getlist(self.doclist, 'item_maintenance_detail'): - if d.serial_no: - self.update_amc_date(d.serial_no, '') - webnotes.conn.set(self.doc, 'status', 'Cancelled') - sql("delete from `tabEvent` where ref_type='Maintenance Schedule' and ref_name='%s' " %(self.doc.name)) - def on_trash(self): - sql("delete from `tabEvent` where ref_type='Maintenance Schedule' and ref_name='%s' " %(self.doc.name)) - + def validate_maintenance_detail(self): + if not getlist(self.doclist, 'item_maintenance_detail'): + msgprint("Please enter Maintaince Details first") + raise Exception + + for d in getlist(self.doclist, 'item_maintenance_detail'): + if not d.item_code: + msgprint("Please select item code") + raise Exception + elif not d.start_date or not d.end_date: + msgprint("Please select Start Date and End Date for item "+d.item_code) + raise Exception + elif not d.no_of_visits: + msgprint("Please mention no of visits required") + raise Exception + elif not d.incharge_name: + msgprint("Please select Incharge Person's name") + raise Exception + + if getdate(d.start_date) >= getdate(d.end_date): + msgprint("Start date should be less than end date for item "+d.item_code) + raise Exception + + #check if maintenance schedule already created against same sales order + #----------------------------------------------------------------------------------- + def validate_sales_order(self): + for d in getlist(self.doclist, 'item_maintenance_detail'): + if d.prevdoc_docname: + chk = sql("select t1.name from `tabMaintenance Schedule` t1, `tabMaintenance Schedule Item` t2 where t2.parent=t1.name and t2.prevdoc_docname=%s and t1.docstatus=1", d.prevdoc_docname) + if chk: + msgprint("Maintenance Schedule against "+d.prevdoc_docname+" already exist") + raise Exception + + # Validate values with reference document + #---------------------------------------- + def validate_reference_value(self): + get_obj('DocType Mapper', 'Sales Order-Maintenance Schedule', with_children = 1).validate_reference_value(self, self.doc.name) + + def validate_serial_no(self): + for d in getlist(self.doclist, 'item_maintenance_detail'): + cur_s_no=[] + if d.serial_no: + cur_serial_no = d.serial_no.replace(' ', '') + cur_s_no = cur_serial_no.split(',') + + for x in cur_s_no: + chk = sql("select name, status from `tabSerial No` where docstatus!=2 and name=%s", (x)) + chk1 = chk and chk[0][0] or '' + status = chk and chk[0][1] or '' + + if not chk1: + msgprint("Serial no "+x+" does not exist in system.") + raise Exception + else: + if status=='In Store' or status=='Note in Use' or status=='Scrapped': + msgprint("Serial no "+x+" is '"+status+"'") + raise Exception + + def validate(self): + self.validate_maintenance_detail() + self.validate_sales_order() + if self.doc.sales_order_no: + self.validate_reference_value() + self.validate_serial_no() + self.validate_start_date() + + # validate that maintenance start date can not be before serial no delivery date + #------------------------------------------------------------------------------------------- + def validate_start_date(self): + for d in getlist(self.doclist, 'item_maintenance_detail'): + if d.serial_no: + cur_serial_no = d.serial_no.replace(' ', '') + cur_s_no = cur_serial_no.split(',') + + for x in cur_s_no: + dt = sql("select delivery_date from `tabSerial No` where name = %s", x) + dt = dt and dt[0][0] or '' + + if dt: + if dt > getdate(d.start_date): + msgprint("Maintenance start date can not be before delivery date "+dt.strftime('%Y-%m-%d')+" for serial no "+x) + raise Exception + + #update amc expiry date in serial no + #------------------------------------------ + def update_amc_date(self,serial_no,amc_end_date): + #get current list of serial no + cur_serial_no = serial_no.replace(' ', '') + cur_s_no = cur_serial_no.split(',') + + for x in cur_s_no: + sql("update `tabSerial No` set amc_expiry_date = '%s', maintenance_status = 'Under AMC' where name = '%s'"% (amc_end_date,x)) + + def on_update(self): + webnotes.conn.set(self.doc, 'status', 'Draft') + + #validate that new maintenance start date does not clash with existing mntc end date + #------------------------------------------------------------------------------------------------- + def validate_serial_no_warranty(self): + for d in getlist(self.doclist, 'item_maintenance_detail'): + if d.serial_no: + dt = sql("select warranty_expiry_date, amc_expiry_date from `tabSerial No` where name = %s", d.serial_no, as_dict=1) + + if dt[0]['warranty_expiry_date']: + if dt[0]['warranty_expiry_date'] >= getdate(d.start_date): + msgprint("Serial no "+d.serial_no+" for item "+d.item_code+" is already under warranty till "+(dt[0]['warranty_expiry_date']).strftime('%Y-%m-%d')+". You can schedule AMC start date after "+(dt[0]['warranty_expiry_date']).strftime('%Y-%m-%d')) + raise Exception + if dt[0]['amc_expiry_date']: + if dt[0]['amc_expiry_date'] >= getdate(d.start_date): + msgprint("Serial no "+d.serial_no+" for item "+d.item_code+" is already under AMC till "+(dt[0]['amc_expiry_date']).strftime('%Y-%m-%d')+". You can schedule new AMC start date after "+(dt[0]['amc_expiry_date']).strftime('%Y-%m-%d')) + raise Exception + + #validate if schedule generated for all items + #------------------------------------------------- + def validate_schedule(self): + item_lst1 =[] + item_lst2 =[] + for d in getlist(self.doclist, 'item_maintenance_detail'): + if d.item_code not in item_lst1: + item_lst1.append(d.item_code) + + for m in getlist(self.doclist, 'maintenance_schedule_detail'): + if m.item_code not in item_lst2: + item_lst2.append(m.item_code) + + if len(item_lst1) != len(item_lst2): + msgprint("Maintenance Schedule is not generated for all the items. Please click on 'Generate Schedule'") + raise Exception + else: + for x in item_lst1: + if x not in item_lst2: + msgprint("Maintenance Schedule is not generated for item "+x+". Please click on 'Generate Schedule'") + raise Exception + + #check if serial no present in item maintenance table + #----------------------------------------------------------- + def check_serial_no_added(self): + serial_present =[] + for d in getlist(self.doclist, 'item_maintenance_detail'): + if d.serial_no: + serial_present.append(d.item_code) + + for m in getlist(self.doclist, 'maintenance_schedule_detail'): + if serial_present: + if m.item_code in serial_present and not m.serial_no: + msgprint("Please click on 'Generate Schedule' to fetch serial no added for item "+m.item_code) + raise Exception + + + + def on_cancel(self): + for d in getlist(self.doclist, 'item_maintenance_detail'): + if d.serial_no: + self.update_amc_date(d.serial_no, '') + webnotes.conn.set(self.doc, 'status', 'Cancelled') + sql("delete from `tabEvent` where ref_type='Maintenance Schedule' and ref_name='%s' " %(self.doc.name)) + def on_trash(self): + sql("delete from `tabEvent` where ref_type='Maintenance Schedule' and ref_name='%s' " %(self.doc.name)) + diff --git a/utilities/transaction_base.py b/utilities/transaction_base.py index 3f47237501a..423459739e3 100644 --- a/utilities/transaction_base.py +++ b/utilities/transaction_base.py @@ -220,7 +220,7 @@ class TransactionBase: self.doclist = self.doc.clear_table(self.doclist,'sales_team') idx = 0 for d in webnotes.conn.sql("select sales_person, allocated_percentage, allocated_amount, incentives from `tabSales Team` where parent = '%s'" % name): - ch = addchild(self.doc, 'sales_team', 'Sales Team', 1, self.doclist) + ch = addchild(self.doc, 'sales_team', 'Sales Team', self.doclist) ch.sales_person = d and cstr(d[0]) or '' ch.allocated_percentage = d and flt(d[1]) or 0 ch.allocated_amount = d and flt(d[2]) or 0 diff --git a/website/css/website.css b/website/css/website.css index 86f0414bbf1..112d29c4567 100644 --- a/website/css/website.css +++ b/website/css/website.css @@ -6,7 +6,9 @@ div#body_div { padding: 0px; min-height: 400px; margin: 40px auto; - box-shadow: 1px 1px 3px 3px #ccc; + box-shadow: 1px 1px 3px 3px #bbb; + border-radius: 5px; + overflow: hidden; } .navbar-inner { @@ -23,6 +25,7 @@ p, li { box-shadow: none; -webkit-box-shadow: none; -moz-box-shadow: none; + border-radius: 0px 0px 5px 5px; } .layout-main { diff --git a/website/templates/css/login.css b/website/templates/css/login.css index 3d6400954d9..710f88944b1 100644 --- a/website/templates/css/login.css +++ b/website/templates/css/login.css @@ -10,6 +10,7 @@ box-shadow: 1px 1px 3px 3px #ccc; font-size: 12px; min-height: 100px; + border-radius: 5px; } #login_wrapper h3 { diff --git a/website/utils.py b/website/utils.py index 079ad21e028..bac87ffb9d6 100644 --- a/website/utils.py +++ b/website/utils.py @@ -210,7 +210,7 @@ def get_outer_env(): from `tabWebsite Product Category` t1, `tabItem Group` t2 where t1.item_group = t2.name and ifnull(t2.show_in_website,0)=1 order by t1.idx""", as_dict=1) - products_item = filter(lambda d: d.url.split(".")[0]=="products", top_items)[0] + products_item = filter(lambda d: d.url and d.url.split(".")[0]=="products", top_items)[0] products_item.child_items = products return {