diff --git a/manufacturing/doctype/bom/bom.js b/manufacturing/doctype/bom/bom.js index b1f43f7620..d14590cb08 100644 --- a/manufacturing/doctype/bom/bom.js +++ b/manufacturing/doctype/bom/bom.js @@ -44,9 +44,9 @@ var set_operation_no = function(doc) { var op = op_table[i].operation_no; if (op && !inList(operations, op)) operations.push(op); } - - cur_frm.fields_dict["bom_materials"].grid.get_field("operation_no") - .df.options = operations.join("\n"); + + wn.meta.get_docfield("BOM Item", "operation_no", + cur_frm.docname).options = operations.join("\n"); $.each(getchildren("BOM Item", doc.name, "bom_materials"), function(i, v) { if(!inList(operations, cstr(v.operation_no))) v.operation_no = null; diff --git a/manufacturing/doctype/bom/bom.txt b/manufacturing/doctype/bom/bom.txt index 922fd80363..d539ad0338 100644 --- a/manufacturing/doctype/bom/bom.txt +++ b/manufacturing/doctype/bom/bom.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-22 15:11:38", "docstatus": 0, - "modified": "2013-01-29 17:32:53", + "modified": "2013-06-27 11:08:28", "modified_by": "Administrator", "owner": "Administrator" }, @@ -112,6 +112,7 @@ "options": "Specify the operations, operating cost and give a unique Operation no to your operations." }, { + "depends_on": "with_operations", "doctype": "DocField", "fieldname": "bom_operations", "fieldtype": "Table", diff --git a/manufacturing/doctype/bom_item/bom_item.txt b/manufacturing/doctype/bom_item/bom_item.txt index 14be95a336..2554adf21f 100644 --- a/manufacturing/doctype/bom_item/bom_item.txt +++ b/manufacturing/doctype/bom_item/bom_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:49", "docstatus": 0, - "modified": "2013-03-07 07:03:18", + "modified": "2013-06-27 11:30:07", "modified_by": "Administrator", "owner": "Administrator" }, @@ -92,6 +92,7 @@ "reqd": 1 }, { + "description": "See \"Rate Of Materials Based On\" in Costing Section", "doctype": "DocField", "fieldname": "rate", "fieldtype": "Float", diff --git a/patches/february_2013/p09_timesheets.py b/patches/february_2013/p09_timesheets.py index 2242d6b629..609dba33bc 100644 --- a/patches/february_2013/p09_timesheets.py +++ b/patches/february_2013/p09_timesheets.py @@ -49,7 +49,7 @@ def execute(): for key in custom_map["Timesheet Detail"]: tl.doc.fields[key] = tsd.fields.get(key) - tl.make_obj() + tl.make_controller() tl.controller.set_status() tl.controller.calculate_total_hours() tl.doc.insert() diff --git a/setup/doctype/company/company.py b/setup/doctype/company/company.py index 64783a0c60..54a293f6ea 100644 --- a/setup/doctype/company/company.py +++ b/setup/doctype/company/company.py @@ -190,33 +190,23 @@ class DocType: self.doc.letter_head = header def set_default_accounts(self): - if not self.doc.receivables_group and webnotes.conn.exists('Account', - 'Accounts Receivable - ' + self.doc.abbr): - webnotes.conn.set(self.doc, 'receivables_group', 'Accounts Receivable - ' + - self.doc.abbr) - - if not self.doc.payables_group and webnotes.conn.exists('Account', - 'Accounts Payable - ' + self.doc.abbr): - webnotes.conn.set(self.doc, 'payables_group', 'Accounts Payable - ' + self.doc.abbr) - - if not self.doc.stock_received_but_not_billed and webnotes.conn.exists("Account", - "Stock Received But Not Billed - " + self.doc.abbr): - webnotes.conn.set(self.doc, "stock_received_but_not_billed", - "Stock Received But Not Billed - " + self.doc.abbr) - - if not self.doc.stock_adjustment_account and webnotes.conn.exists("Account", - "Stock Adjustment - " + self.doc.abbr): - webnotes.conn.set(self.doc, "stock_adjustment_account", "Stock Adjustment - " + - self.doc.abbr) - - if not self.doc.expenses_included_in_valuation and webnotes.conn.exists("Account", - "Expenses Included In Valuation - " + self.doc.abbr): - webnotes.conn.set(self.doc, "expenses_included_in_valuation", - "Expenses Included In Valuation - " + self.doc.abbr) + accounts = { + "receivables_group": "Accounts Receivable", + "payables_group": "Accounts Payable", + "stock_received_but_not_billed": "Stock Received But Not Billed", + "stock_in_hand_account": "Stock In Hand", + "stock_adjustment_account": "Stock Adjustment", + "expenses_included_in_valuation": "Expenses Included In Valuation" + } + for a in accounts: + account_name = accounts[a] + " - " + self.doc.abbr + if not self.doc.fields[a] and webnotes.conn.exists("Account", account_name): + webnotes.conn.set(self.doc, account_name) + if not self.doc.stock_adjustment_cost_center: webnotes.conn.set(self.doc, "stock_adjustment_cost_center", self.doc.cost_center) - + # Create default cost center # --------------------------------------------------- def create_default_cost_center(self): @@ -249,8 +239,7 @@ class DocType: where company=%s and docstatus<2 limit 1""", self.doc.name): self.create_default_accounts() - if not webnotes.conn.sql("""select name from `tabCost Center` - where cost_center_name = 'All Units' and company_name = %s""", self.doc.name): + if not self.doc.cost_center: self.create_default_cost_center() self.set_default_accounts() diff --git a/stock/doctype/stock_ledger_entry/stock_ledger_entry.py b/stock/doctype/stock_ledger_entry/stock_ledger_entry.py index 3cde2e20c9..3492931451 100644 --- a/stock/doctype/stock_ledger_entry/stock_ledger_entry.py +++ b/stock/doctype/stock_ledger_entry/stock_ledger_entry.py @@ -119,4 +119,13 @@ class DocType(DocListController): def scrub_posting_time(self): if not self.doc.posting_time or self.doc.posting_time == '00:0': self.doc.posting_time = '00:00' - \ No newline at end of file + + def on_doctype_update(self): + webnotes.msgprint(webnotes.conn.sql("""show index from `tabStock Ledger Entry` + where Key_name="posting_sort_index" """)) + if not webnotes.conn.sql("""show index from `tabStock Ledger Entry` + where Key_name="posting_sort_index" """): + webnotes.conn.commit() + webnotes.conn.sql("""alter table `tabStock Ledger Entry` + add index posting_sort_index(posting_date, posting_time, name)""") + webnotes.conn.begin() \ No newline at end of file diff --git a/stock/doctype/stock_ledger_entry/stock_ledger_entry.txt b/stock/doctype/stock_ledger_entry/stock_ledger_entry.txt index 6bcd758733..674104dfeb 100644 --- a/stock/doctype/stock_ledger_entry/stock_ledger_entry.txt +++ b/stock/doctype/stock_ledger_entry/stock_ledger_entry.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-29 19:25:42", "docstatus": 0, - "modified": "2013-03-25 16:04:59", + "modified": "2013-06-28 12:39:07", "modified_by": "Administrator", "owner": "Administrator" }, diff --git a/stock/doctype/stock_reconciliation/stock_reconciliation.py b/stock/doctype/stock_reconciliation/stock_reconciliation.py index 49e8b15547..8e5698c4e2 100644 --- a/stock/doctype/stock_reconciliation/stock_reconciliation.py +++ b/stock/doctype/stock_reconciliation/stock_reconciliation.py @@ -45,9 +45,12 @@ class DocType(StockController): return data = json.loads(self.doc.reconciliation_json) + + # strip out extra columns (if any) + data = [row[:4] for row in data] + if self.head_row not in data: - msgprint(_("""Hey! You seem to be using the wrong template. \ - Click on 'Download Template' button to get the correct template."""), + msgprint(_("""Wrong Template: Unable to find head row."""), raise_exception=1) # remove the help part and save the json diff --git a/stock/doctype/warehouse/warehouse.py b/stock/doctype/warehouse/warehouse.py index 264e459e56..758bd31eb0 100644 --- a/stock/doctype/warehouse/warehouse.py +++ b/stock/doctype/warehouse/warehouse.py @@ -42,7 +42,7 @@ class DocType: bin_wrapper.ignore_permissions = 1 bin_wrapper.insert() - bin_obj = bin_wrapper.make_obj() + bin_obj = bin_wrapper.make_controller() else: bin_obj = get_obj('Bin', bin) return bin_obj