From 6e9756b8bbad5825133252343cf54567fee44b0f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 22 Jan 2013 16:49:55 +0530 Subject: [PATCH 1/7] valuation rate mandatory for opening stock reco --- .../stock_reconciliation/stock_reconciliation.py | 15 ++++++++++----- .../test_stock_reconciliation.py | 1 - 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/stock/doctype/stock_reconciliation/stock_reconciliation.py b/stock/doctype/stock_reconciliation/stock_reconciliation.py index 9017843c662..32fcf891513 100644 --- a/stock/doctype/stock_reconciliation/stock_reconciliation.py +++ b/stock/doctype/stock_reconciliation/stock_reconciliation.py @@ -141,11 +141,18 @@ class DocType(DocListController): "posting_time": self.doc.posting_time }) + # check valuation rate mandatory + if row.qty != "" and not row.valuation_rate and \ + flt(previous_sle.get("qty_after_transaction")) <= 0: + webnotes.msgprint(_("As existing qty for item: ") + row.item_code + + _(" is less than equals to zero in the system, \ + valuation rate is mandatory for this item"), raise_exception=1) + change_in_qty = row.qty != "" and \ (flt(row.qty) - flt(previous_sle.get("qty_after_transaction"))) - + change_in_rate = row.valuation_rate != "" and \ - (flt(row.valuation_rate) != flt(previous_sle.get("valuation_rate"))) + (flt(row.valuation_rate) - flt(previous_sle.get("valuation_rate"))) if get_valuation_method(row.item_code) == "Moving Average": self.sle_for_moving_avg(row, previous_sle, change_in_qty, change_in_rate) @@ -162,7 +169,6 @@ class DocType(DocListController): else: if valuation_rate == "": valuation_rate = previous_valuation_rate - return (qty * valuation_rate - previous_qty * previous_valuation_rate) \ / flt(qty - previous_qty) @@ -175,7 +181,7 @@ class DocType(DocListController): self.insert_entries({"actual_qty": change_in_qty, "incoming_rate": incoming_rate}, row) - elif change_in_rate and flt(previous_sle.get("qty_after_transaction")) >= 0: + elif change_in_rate and flt(previous_sle.get("qty_after_transaction")) > 0: # if no change in qty, but change in rate # and positive actual stock before this reconciliation incoming_rate = _get_incoming_rate( @@ -241,7 +247,6 @@ class DocType(DocListController): "is_cancelled": "No", } args.update(opts) - # create stock ledger entry sle_wrapper = webnotes.model_wrapper([args]) sle_wrapper.ignore_permissions = 1 diff --git a/stock/doctype/stock_reconciliation/test_stock_reconciliation.py b/stock/doctype/stock_reconciliation/test_stock_reconciliation.py index b3501cef56d..7030c1b4920 100644 --- a/stock/doctype/stock_reconciliation/test_stock_reconciliation.py +++ b/stock/doctype/stock_reconciliation/test_stock_reconciliation.py @@ -21,7 +21,6 @@ import webnotes from webnotes.tests import insert_test_data from webnotes.utils import flt import json -from pprint import pprint company = webnotes.conn.get_default("company") From 92a0218091819918bc94900afea697c200279160 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 22 Jan 2013 17:52:43 +0530 Subject: [PATCH 2/7] added uom column in stock reports --- public/js/stock_analytics.js | 1 + stock/page/stock_ageing/stock_ageing.js | 3 ++- stock/page/stock_balance/stock_balance.js | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/public/js/stock_analytics.js b/public/js/stock_analytics.js index 124b02afa5b..5ebe65f8039 100644 --- a/public/js/stock_analytics.js +++ b/public/js/stock_analytics.js @@ -53,6 +53,7 @@ erpnext.StockAnalytics = erpnext.StockGridReport.extend({ formatter: this.check_formatter}, {id: "name", name: "Item", field: "name", width: 300, formatter: this.tree_formatter}, + {id: "stock_uom", name: "UOM", field: "stock_uom", width: 100}, {id: "brand", name: "Brand", field: "brand", width: 100}, {id: "opening", name: "Opening", field: "opening", hidden: true, formatter: this.currency_formatter} diff --git a/stock/page/stock_ageing/stock_ageing.js b/stock/page/stock_ageing/stock_ageing.js index 780fb86f3ed..16847266ece 100644 --- a/stock/page/stock_ageing/stock_ageing.js +++ b/stock/page/stock_ageing/stock_ageing.js @@ -48,13 +48,14 @@ erpnext.StockAgeing = erpnext.StockGridReport.extend({ open_btn: true, doctype: '"Item"' }}, - {id: "brand", name: "Brand", field: "brand", width: 100}, {id: "average_age", name: "Average Age", field: "average_age", formatter: this.currency_formatter}, {id: "earliest", name: "Earliest", field: "earliest", formatter: this.currency_formatter}, {id: "latest", name: "Latest", field: "latest", formatter: this.currency_formatter}, + {id: "stock_uom", name: "UOM", field: "stock_uom", width: 100}, + {id: "brand", name: "Brand", field: "brand", width: 100}, {id: "item_name", name: "Item Name", field: "item_name", width: 100, formatter: this.text_formatter}, {id: "description", name: "Description", field: "description", diff --git a/stock/page/stock_balance/stock_balance.js b/stock/page/stock_balance/stock_balance.js index 536d4357328..bec13372b31 100644 --- a/stock/page/stock_balance/stock_balance.js +++ b/stock/page/stock_balance/stock_balance.js @@ -60,7 +60,7 @@ erpnext.StockBalance = erpnext.StockAnalytics.extend({ formatter: this.currency_formatter}, {id: "closing_value", name: "Closing Value", field: "closing_value", width: 100, formatter: this.currency_formatter}, - + {id: "stock_uom", name: "UOM", field: "stock_uom", width: 100}, {id: "brand", name: "Brand", field: "brand", width: 100}, {id: "item_name", name: "Item Name", field: "item_name", width: 100}, {id: "description", name: "Description", field: "description", width: 200, From 8e4a772a350b2564cfcde3923e3e8f29e21cfbe6 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 23 Jan 2013 13:59:00 +0530 Subject: [PATCH 3/7] fixes in payment reconciliation --- .../payment_to_invoice_matching_tool.js | 53 +++++++++++++++---- .../payment_to_invoice_matching_tool.py | 44 +++++++-------- .../payment_to_invoice_matching_tool.txt | 14 +++-- 3 files changed, 76 insertions(+), 35 deletions(-) diff --git a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js index f719db97aae..17b42bec87d 100644 --- a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js +++ b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js @@ -30,19 +30,43 @@ cur_frm.cscript.refresh = function(doc) { } } +// cur_frm.fields_dict.voucher_no.get_query = function(doc) { +// if (!doc.account) msgprint("Please select Account first"); +// else { +// return repl("select gle.voucher_no, gle.posting_date \ +// from `tabGL Entry` gle where gle.account = '%(acc)s' \ +// and gle.voucher_type = '%(dt)s' \ +// and gle.voucher_no LIKE '%s' \ +// and ifnull(gle.is_cancelled, 'No') = 'No'\ +// and (ifnull(against_voucher_type, '') = '' or \ +// (select sum(debit) - sum(credit) from `tabGL Entry` \ +// where against_voucher_type = '%(dt)s' and against_voucher = gle.voucher_no \ +// and ifnull(is_cancelled, 'No') = 'No') != 0 )\ +// ORDER BY gle.posting_date DESC, gle.voucher_no DESC LIMIT 50 \ +// ", {dt:doc.voucher_type, acc:doc.account}); +// } +// } + cur_frm.fields_dict.voucher_no.get_query = function(doc) { if (!doc.account) msgprint("Please select Account first"); else { - return repl("select gle.voucher_no, gle.posting_date \ - from `tabGL Entry` gle where gle.account = '%(acc)s' \ - and gle.voucher_type = '%(dt)s' \ - and gle.voucher_no LIKE '%s' \ - and ifnull(gle.is_cancelled, 'No') = 'No'\ - and (select sum(debit) - sum(credit) from `tabGL Entry` \ - where against_voucher_type = '%(dt)s' and against_voucher = gle.voucher_no \ - and ifnull(is_cancelled, 'No') = 'No') != 0 \ - ORDER BY gle.posting_date DESC, gle.voucher_no DESC LIMIT 50 \ - ", {dt:doc.voucher_type, acc:doc.account}); + return repl("select gle.voucher_no, gle.posting_date, gle.%(account_type)s \ + from `tabGL Entry` gle \ + where gle.account = '%(acc)s' \ + and gle.voucher_type = '%(dt)s' \ + and gle.voucher_no like '%s' \ + and ifnull(gle.is_cancelled, 'No') = 'No' \ + and (ifnull(gle.against_voucher, '') = '' \ + or ifnull(gle.against_voucher, '') = gle.voucher_no ) \ + and ifnull(gle.%(account_type)s, 0) > 0 \ + and (select ifnull(abs(sum(debit) - sum(credit)), 0) from `tabGL Entry` \ + where against_voucher_type = '%(dt)s' \ + and against_voucher = gle.voucher_no \ + and voucher_no != gle.voucher_no \ + and ifnull(is_cancelled, 'No') = 'No') != \ + abs(ifnull(gle.debit, 0) - ifnull(gle.credit, 0)) \ + ORDER BY gle.posting_date DESC, gle.voucher_no DESC LIMIT 50", + {dt:doc.voucher_type, acc:doc.account, account_type: doc.account_type}); } } @@ -50,3 +74,12 @@ cur_frm.cscript.voucher_no =function(doc, cdt, cdn) { get_server_fields('get_voucher_details', '', '', doc, cdt, cdn, 1) } +cur_frm.cscript.account = function(doc, cdt, cdn) { + wn.call({ + doc: this.frm.doc, + method: "set_account_type", + callback: function(r) { + if(!r.exc) refresh_field("account_type"); + } + }); +} 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 ee33c3a1889..3978688f17e 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 @@ -27,32 +27,32 @@ class DocType: def __init__(self, doc, doclist): self.doc = doc self.doclist = doclist - self.acc_type = self.doc.account and webnotes.conn.sql("""select debit_or_credit - from `tabAccount` where name = %s""", self.doc.account)[0][0].lower() or '' - self.dt = { - 'Sales Invoice': 'Sales Invoice', - 'Purchase Invoice': 'Purchase Invoice', - 'Journal Voucher': 'Journal Voucher' - } + + def set_account_type(self): + self.doc.account_type = self.doc.account and \ + webnotes.conn.get_value("Account", self.doc.account, "debit_or_credit").lower() or "" def get_voucher_details(self): - tot_amt = webnotes.conn.sql(""" - select sum(%s) from `tabGL Entry` where - voucher_type = %s and voucher_no = %s + total_amount = webnotes.conn.sql("""select %s from `tabGL Entry` + where voucher_type = %s and voucher_no = %s and account = %s and ifnull(is_cancelled, 'No') = 'No'""" % - (self.acc_type, '%s', '%s', '%s'), - (self.dt[self.doc.voucher_type], self.doc.voucher_no, self.doc.account)) + (self.doc.account_type, '%s', '%s', '%s'), + (self.doc.voucher_type, self.doc.voucher_no, self.doc.account)) + + total_amount = total_amount and flt(total_amount[0][0]) or 0 - outstanding = webnotes.conn.sql(""" + reconciled_payment = webnotes.conn.sql(""" select sum(%s) - sum(%s) from `tabGL Entry` where against_voucher = %s and voucher_no != %s and account = %s and ifnull(is_cancelled, 'No') = 'No'""" % - ((self.acc_type == 'debit' and 'credit' or 'debit'), self.acc_type, '%s', '%s', '%s'), - (self.doc.voucher_no, self.doc.voucher_no, self.doc.account)) + ((self.doc.account_type == 'debit' and 'credit' or 'debit'), self.doc.account_type, + '%s', '%s', '%s'), (self.doc.voucher_no, self.doc.voucher_no, self.doc.account)) + + reconciled_payment = reconciled_payment and flt(reconciled_payment[0][0]) or 0 ret = { - 'total_amount': flt(tot_amt[0][0]) or 0, - 'pending_amt_to_reconcile': flt(tot_amt[0][0]) - flt(outstanding[0][0]) or 0 + 'total_amount': total_amount, + 'pending_amt_to_reconcile': total_amount - reconciled_payment } return ret @@ -69,7 +69,7 @@ class DocType: def get_gl_entries(self): self.validate_mandatory() - dc = self.acc_type == 'debit' and 'credit' or 'debit' + dc = self.doc.account_type == 'debit' and 'credit' or 'debit' cond = self.doc.from_date and " and t1.posting_date >= '" + self.doc.from_date + "'" or "" cond += self.doc.to_date and " and t1.posting_date <= '" + self.doc.to_date + "'"or "" @@ -97,7 +97,7 @@ class DocType: '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')) \ + ch.amt_due = self.doc.account_type == 'debit' and flt(d.get('amt_due')) \ or -1*flt(d.get('amt_due')) ch.total_amt = flt(d.get('total_amt')) ch.against_account = d.get('against_account') @@ -116,7 +116,7 @@ class DocType: 3. submit payment voucher """ if not self.doc.voucher_no or not webnotes.conn.sql("""select name from `tab%s` - where name = %s""" % (self.dt[self.doc.voucher_type], '%s'), self.doc.voucher_no): + where name = %s""" % (self.doc.voucher_type, '%s'), self.doc.voucher_no): msgprint("Please select valid Voucher No to proceed", raise_exception=1) lst = [] @@ -125,11 +125,11 @@ class DocType: args = { 'voucher_no' : d.voucher_no, 'voucher_detail_no' : d.voucher_detail_no, - 'against_voucher_type' : self.dt[self.doc.voucher_type], + 'against_voucher_type' : self.doc.voucher_type, 'against_voucher' : self.doc.voucher_no, 'account' : self.doc.account, 'is_advance' : 'No', - 'dr_or_cr' : self.acc_type=='debit' and 'credit' or 'debit', + 'dr_or_cr' : self.doc.account_type=='debit' and 'credit' or 'debit', 'unadjusted_amt' : flt(d.amt_due), 'allocated_amt' : flt(d.amt_to_be_reconciled) } diff --git a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.txt b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.txt index 5a8331405e9..6f5bdb497ae 100644 --- a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.txt +++ b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-01-21 18:19:17", + "creation": "2013-01-23 12:23:46", "docstatus": 0, - "modified": "2013-01-22 14:56:41", + "modified": "2013-01-23 12:26:49", "modified_by": "Administrator", "owner": "Administrator" }, @@ -31,7 +31,7 @@ "parenttype": "DocType", "permlevel": 0, "read": 1, - "report": 1, + "report": 0, "submit": 0, "write": 1 }, @@ -47,6 +47,14 @@ "options": "Account", "reqd": 1 }, + { + "doctype": "DocField", + "fieldname": "account_type", + "fieldtype": "Data", + "hidden": 1, + "label": "Account Type", + "read_only": 1 + }, { "doctype": "DocField", "fieldname": "voucher_type", From 3ac8e59cb8ccec2352985082b2191882a583157c Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 23 Jan 2013 13:59:29 +0530 Subject: [PATCH 4/7] fixes in payment reconciliation --- .../payment_to_invoice_matching_tool.js | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js index 17b42bec87d..a12fe27b9c3 100644 --- a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js +++ b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js @@ -30,23 +30,6 @@ cur_frm.cscript.refresh = function(doc) { } } -// cur_frm.fields_dict.voucher_no.get_query = function(doc) { -// if (!doc.account) msgprint("Please select Account first"); -// else { -// return repl("select gle.voucher_no, gle.posting_date \ -// from `tabGL Entry` gle where gle.account = '%(acc)s' \ -// and gle.voucher_type = '%(dt)s' \ -// and gle.voucher_no LIKE '%s' \ -// and ifnull(gle.is_cancelled, 'No') = 'No'\ -// and (ifnull(against_voucher_type, '') = '' or \ -// (select sum(debit) - sum(credit) from `tabGL Entry` \ -// where against_voucher_type = '%(dt)s' and against_voucher = gle.voucher_no \ -// and ifnull(is_cancelled, 'No') = 'No') != 0 )\ -// ORDER BY gle.posting_date DESC, gle.voucher_no DESC LIMIT 50 \ -// ", {dt:doc.voucher_type, acc:doc.account}); -// } -// } - cur_frm.fields_dict.voucher_no.get_query = function(doc) { if (!doc.account) msgprint("Please select Account first"); else { From a8454e27645cfe216ab73ea1446e335cf7f38e93 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 23 Jan 2013 16:01:35 +0530 Subject: [PATCH 5/7] removed unwanted permission --- patches/january_2013/remove_unwanted_permission.py | 14 ++++++++++++++ patches/patch_list.py | 1 + 2 files changed, 15 insertions(+) create mode 100644 patches/january_2013/remove_unwanted_permission.py diff --git a/patches/january_2013/remove_unwanted_permission.py b/patches/january_2013/remove_unwanted_permission.py new file mode 100644 index 00000000000..2c014ec57f7 --- /dev/null +++ b/patches/january_2013/remove_unwanted_permission.py @@ -0,0 +1,14 @@ +def execute(): + import webnotes + for dt in webnotes.conn.sql("""select name, issingle from tabDocType"""): + if dt[1]: + webnotes.conn.sql("""update tabDocPerm set report = 0 where parent = %s""", dt[0]) + + + doctype = webnotes.model_wrapper("DocType", dt[0]) + for pl in [1, 2, 3]: + if not doctype.doclist.get({"doctype": "DocField", "permlevel": pl}): + if doctype.doclist.get({"doctype":"DocPerm", "permlevel":pl}): + webnotes.conn.sql("""delete from `tabDocPerm` + where parent = %s and permlevel = %s""", (dt[0], pl)) + print doctype.doc.name \ No newline at end of file diff --git a/patches/patch_list.py b/patches/patch_list.py index cdaa2ad9a19..7e87fe41e0b 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -155,4 +155,5 @@ patch_list = [ "patches.january_2013.purchase_price_list", "execute:webnotes.reload_doc('accounts','Print Format','Payment Receipt Voucher')", "patches.january_2013.update_fraction_for_usd", + "patches.january_2013.remove_unwanted_permission", ] \ No newline at end of file From 291e8c254510df52457548ba39d455b443d46e9b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 23 Jan 2013 16:06:44 +0530 Subject: [PATCH 6/7] removed landed cost master --- .../payment_to_invoice_matching_tool.txt | 4 +- .../january_2013/remove_landed_cost_master.py | 4 + patches/patch_list.py | 1 + .../september_2012/all_permissions_patch.py | 2 +- setup/doctype/company/company.txt | 4 +- stock/doctype/landed_cost_master/__init__.py | 1 - .../landed_cost_master/landed_cost_master.js | 30 ------- .../landed_cost_master/landed_cost_master.py | 22 ----- .../landed_cost_master/landed_cost_master.txt | 86 ------------------- .../locale/_messages_doc.json | 8 -- .../landed_cost_master/locale/hi-doc.json | 8 -- .../landed_cost_master_detail/__init__.py | 1 - .../landed_cost_master_detail.py | 22 ----- .../landed_cost_master_detail.txt | 48 ----------- .../locale/_messages_doc.json | 6 -- .../locale/hi-doc.json | 6 -- .../landed_cost_wizard/landed_cost_wizard.py | 16 ---- .../landed_cost_wizard/landed_cost_wizard.txt | 20 +---- stock/page/stock_home/stock_home.js | 5 -- utilities/cleanup_data.py | 1 - 20 files changed, 13 insertions(+), 282 deletions(-) create mode 100644 patches/january_2013/remove_landed_cost_master.py delete mode 100644 stock/doctype/landed_cost_master/__init__.py delete mode 100644 stock/doctype/landed_cost_master/landed_cost_master.js delete mode 100644 stock/doctype/landed_cost_master/landed_cost_master.py delete mode 100644 stock/doctype/landed_cost_master/landed_cost_master.txt delete mode 100644 stock/doctype/landed_cost_master/locale/_messages_doc.json delete mode 100644 stock/doctype/landed_cost_master/locale/hi-doc.json delete mode 100644 stock/doctype/landed_cost_master_detail/__init__.py delete mode 100644 stock/doctype/landed_cost_master_detail/landed_cost_master_detail.py delete mode 100644 stock/doctype/landed_cost_master_detail/landed_cost_master_detail.txt delete mode 100644 stock/doctype/landed_cost_master_detail/locale/_messages_doc.json delete mode 100644 stock/doctype/landed_cost_master_detail/locale/hi-doc.json diff --git a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.txt b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.txt index 6f5bdb497ae..58bee4cbfac 100644 --- a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.txt +++ b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-01-23 12:23:46", + "creation": "2013-01-23 15:27:14", "docstatus": 0, - "modified": "2013-01-23 12:26:49", + "modified": "2013-01-23 15:56:55", "modified_by": "Administrator", "owner": "Administrator" }, diff --git a/patches/january_2013/remove_landed_cost_master.py b/patches/january_2013/remove_landed_cost_master.py new file mode 100644 index 00000000000..01eefb46c7a --- /dev/null +++ b/patches/january_2013/remove_landed_cost_master.py @@ -0,0 +1,4 @@ +def execute(): + import webnotes + webnotes.delete_doc("DocType", "Landed Cost Master") + webnotes.delete_doc("DocType", "Landed Cost Master Detail") \ No newline at end of file diff --git a/patches/patch_list.py b/patches/patch_list.py index 7e87fe41e0b..f35cb62ecb3 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -156,4 +156,5 @@ patch_list = [ "execute:webnotes.reload_doc('accounts','Print Format','Payment Receipt Voucher')", "patches.january_2013.update_fraction_for_usd", "patches.january_2013.remove_unwanted_permission", + "patches.january_2013.remove_landed_cost_master", ] \ No newline at end of file diff --git a/patches/september_2012/all_permissions_patch.py b/patches/september_2012/all_permissions_patch.py index ab06b71d9ff..8373d8aadfa 100644 --- a/patches/september_2012/all_permissions_patch.py +++ b/patches/september_2012/all_permissions_patch.py @@ -16,7 +16,7 @@ def project_perms(): def stock_perms(): webnotes.conn.sql("""delete from `tabDocPerm` - where parent in ('Landed Cost Master', 'Landed Cost Wizard', + where parent in ('Landed Cost Wizard', 'Sales and Purchase Return Tool') and role='All' and permlevel=0""") def account_perms(): diff --git a/setup/doctype/company/company.txt b/setup/doctype/company/company.txt index fc778ceb356..b81e1f1b308 100644 --- a/setup/doctype/company/company.txt +++ b/setup/doctype/company/company.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-01-10 16:34:22", + "creation": "2013-01-22 16:50:36", "docstatus": 0, - "modified": "2013-01-22 14:55:58", + "modified": "2013-01-23 15:56:48", "modified_by": "Administrator", "owner": "Administrator" }, diff --git a/stock/doctype/landed_cost_master/__init__.py b/stock/doctype/landed_cost_master/__init__.py deleted file mode 100644 index baffc488252..00000000000 --- a/stock/doctype/landed_cost_master/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/stock/doctype/landed_cost_master/landed_cost_master.js b/stock/doctype/landed_cost_master/landed_cost_master.js deleted file mode 100644 index 03e8a39fd0b..00000000000 --- a/stock/doctype/landed_cost_master/landed_cost_master.js +++ /dev/null @@ -1,30 +0,0 @@ -// ERPNext - web based ERP (http://erpnext.com) -// Copyright (C) 2012 Web Notes Technologies Pvt Ltd -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// 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 -// 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 . - - - -//--------- ONLOAD ------------- -cur_frm.cscript.onload = function(doc, cdt, cdn) { - -} - -cur_frm.cscript.refresh = function(doc, cdt, cdn) { - -} - -cur_frm.fields_dict.landed_cost.grid.get_field('account_head').get_query = function(doc, cdt, cdn) { - return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND (tabAccount.account_type = "Tax" OR tabAccount.account_type = "Chargeable" or (tabAccount.is_pl_account = "Yes" and tabAccount.debit_or_credit = "Debit")) AND tabAccount.name LIKE "%s"'; -} \ No newline at end of file diff --git a/stock/doctype/landed_cost_master/landed_cost_master.py b/stock/doctype/landed_cost_master/landed_cost_master.py deleted file mode 100644 index 7f48feb2ebf..00000000000 --- a/stock/doctype/landed_cost_master/landed_cost_master.py +++ /dev/null @@ -1,22 +0,0 @@ -# ERPNext - web based ERP (http://erpnext.com) -# Copyright (C) 2012 Web Notes Technologies Pvt Ltd -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# 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 -# 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 . - -from __future__ import unicode_literals -import webnotes - -class DocType: - def __init__(self, d, dl): - self.doc, self.doclist = d, dl \ No newline at end of file diff --git a/stock/doctype/landed_cost_master/landed_cost_master.txt b/stock/doctype/landed_cost_master/landed_cost_master.txt deleted file mode 100644 index 63b102c595f..00000000000 --- a/stock/doctype/landed_cost_master/landed_cost_master.txt +++ /dev/null @@ -1,86 +0,0 @@ -[ - { - "creation": "2013-01-10 16:34:27", - "docstatus": 0, - "modified": "2013-01-22 14:56:03", - "modified_by": "Administrator", - "owner": "Administrator" - }, - { - "autoname": "field:title", - "doctype": "DocType", - "document_type": "Master", - "module": "Stock", - "name": "__common__" - }, - { - "doctype": "DocField", - "name": "__common__", - "parent": "Landed Cost Master", - "parentfield": "fields", - "parenttype": "DocType", - "permlevel": 0 - }, - { - "create": 1, - "doctype": "DocPerm", - "name": "__common__", - "parent": "Landed Cost Master", - "parentfield": "permissions", - "parenttype": "DocType", - "permlevel": 0, - "read": 1, - "report": 1, - "submit": 0, - "write": 1 - }, - { - "doctype": "DocType", - "name": "Landed Cost Master" - }, - { - "doctype": "DocField", - "fieldname": "trash_reason", - "fieldtype": "Small Text", - "label": "Trash Reason", - "oldfieldname": "trash_reason", - "oldfieldtype": "Small Text", - "read_only": 1 - }, - { - "doctype": "DocField", - "fieldname": "title", - "fieldtype": "Data", - "label": "Title", - "oldfieldname": "title", - "oldfieldtype": "Data" - }, - { - "doctype": "DocField", - "fieldname": "landed_cost_details", - "fieldtype": "Section Break", - "label": "Landed Cost Items", - "oldfieldtype": "Section Break" - }, - { - "doctype": "DocField", - "fieldname": "landed_cost", - "fieldtype": "Table", - "label": "Landed Cost", - "oldfieldname": "landed_cost", - "oldfieldtype": "Table", - "options": "Landed Cost Master Detail" - }, - { - "doctype": "DocPerm", - "role": "Purchase Manager" - }, - { - "doctype": "DocPerm", - "role": "System Manager" - }, - { - "doctype": "DocPerm", - "role": "Purchase User" - } -] \ No newline at end of file diff --git a/stock/doctype/landed_cost_master/locale/_messages_doc.json b/stock/doctype/landed_cost_master/locale/_messages_doc.json deleted file mode 100644 index 4f1ad6344dc..00000000000 --- a/stock/doctype/landed_cost_master/locale/_messages_doc.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "Trash Reason", - "Title", - "Landed Cost Master", - "Landed Cost", - "Landed Cost Items", - "Stock" -] \ No newline at end of file diff --git a/stock/doctype/landed_cost_master/locale/hi-doc.json b/stock/doctype/landed_cost_master/locale/hi-doc.json deleted file mode 100644 index 41f33444356..00000000000 --- a/stock/doctype/landed_cost_master/locale/hi-doc.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "Landed Cost": "\u0906\u092f\u093e\u0924\u093f\u0924 \u092e\u093e\u0932 \u0915\u0940 \u0932\u093e\u0917\u0924", - "Landed Cost Items": "\u0906\u092f\u093e\u0924\u093f\u0924 \u092e\u093e\u0932 \u0915\u0940 \u0932\u093e\u0917\u0924 \u0906\u0907\u091f\u092e", - "Landed Cost Master": "\u0906\u092f\u093e\u0924\u093f\u0924 \u092e\u093e\u0932 \u0915\u0940 \u0932\u093e\u0917\u0924 \u092e\u093e\u0938\u094d\u091f\u0930", - "Stock": "\u0938\u094d\u091f\u0949\u0915", - "Title": "\u0936\u0940\u0930\u094d\u0937\u0915", - "Trash Reason": "\u091f\u094d\u0930\u0948\u0936 \u0915\u093e\u0930\u0923" -} \ No newline at end of file diff --git a/stock/doctype/landed_cost_master_detail/__init__.py b/stock/doctype/landed_cost_master_detail/__init__.py deleted file mode 100644 index baffc488252..00000000000 --- a/stock/doctype/landed_cost_master_detail/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/stock/doctype/landed_cost_master_detail/landed_cost_master_detail.py b/stock/doctype/landed_cost_master_detail/landed_cost_master_detail.py deleted file mode 100644 index 7f48feb2ebf..00000000000 --- a/stock/doctype/landed_cost_master_detail/landed_cost_master_detail.py +++ /dev/null @@ -1,22 +0,0 @@ -# ERPNext - web based ERP (http://erpnext.com) -# Copyright (C) 2012 Web Notes Technologies Pvt Ltd -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# 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 -# 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 . - -from __future__ import unicode_literals -import webnotes - -class DocType: - def __init__(self, d, dl): - self.doc, self.doclist = d, dl \ No newline at end of file diff --git a/stock/doctype/landed_cost_master_detail/landed_cost_master_detail.txt b/stock/doctype/landed_cost_master_detail/landed_cost_master_detail.txt deleted file mode 100644 index b1db6a3b967..00000000000 --- a/stock/doctype/landed_cost_master_detail/landed_cost_master_detail.txt +++ /dev/null @@ -1,48 +0,0 @@ -[ - { - "owner": "Administrator", - "docstatus": 0, - "creation": "2012-05-03 11:00:55", - "modified_by": "Administrator", - "modified": "2012-05-04 13:02:35" - }, - { - "section_style": "Simple", - "istable": 1, - "name": "__common__", - "colour": "White:FFF", - "module": "Stock", - "doctype": "DocType", - "version": 1, - "server_code_error": " " - }, - { - "name": "__common__", - "parent": "Landed Cost Master Detail", - "oldfieldtype": "Data", - "doctype": "DocField", - "parenttype": "DocType", - "permlevel": 0, - "parentfield": "fields" - }, - { - "name": "Landed Cost Master Detail", - "doctype": "DocType" - }, - { - "doctype": "DocField", - "label": "Account Head", - "oldfieldname": "account_head", - "fieldname": "account_head", - "fieldtype": "Link", - "options": "Account" - }, - { - "doctype": "DocField", - "label": "Description", - "oldfieldname": "description", - "width": "300px", - "fieldname": "description", - "fieldtype": "Data" - } -] \ No newline at end of file diff --git a/stock/doctype/landed_cost_master_detail/locale/_messages_doc.json b/stock/doctype/landed_cost_master_detail/locale/_messages_doc.json deleted file mode 100644 index a8a7ba160e5..00000000000 --- a/stock/doctype/landed_cost_master_detail/locale/_messages_doc.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - "Description", - "Landed Cost Master Detail", - "Account Head", - "Stock" -] \ No newline at end of file diff --git a/stock/doctype/landed_cost_master_detail/locale/hi-doc.json b/stock/doctype/landed_cost_master_detail/locale/hi-doc.json deleted file mode 100644 index ee50455c37b..00000000000 --- a/stock/doctype/landed_cost_master_detail/locale/hi-doc.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "Account Head": "\u0932\u0947\u0916\u093e\u0936\u0940\u0930\u094d\u0937", - "Description": "\u0935\u093f\u0935\u0930\u0923", - "Landed Cost Master Detail": "\u0909\u0924\u0930\u093e \u0932\u093e\u0917\u0924 \u092e\u093e\u0938\u094d\u091f\u0930 \u0935\u093f\u0938\u094d\u0924\u093e\u0930", - "Stock": "\u0938\u094d\u091f\u0949\u0915" -} \ No newline at end of file diff --git a/stock/doctype/landed_cost_wizard/landed_cost_wizard.py b/stock/doctype/landed_cost_wizard/landed_cost_wizard.py index 7067e52d0bf..f2bc7992d0e 100644 --- a/stock/doctype/landed_cost_wizard/landed_cost_wizard.py +++ b/stock/doctype/landed_cost_wizard/landed_cost_wizard.py @@ -56,19 +56,6 @@ class DocType: ch.purchase_receipt = i and i['name'] or '' ch.save() - - def get_landed_cost_master_details(self): - """ pull details from landed cost master""" - self.doclist = self.doc.clear_table(self.doclist, 'landed_cost_details') - 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', - self.doclist) - lct.account_head = cost['account_head'] - lct.description = cost['description'] - - def get_selected_pr(self): """ Get selected purchase receipt no """ self.selected_pr = [d.purchase_receipt for d in getlist(self.doclist, 'lc_pr_details') if d.select_pr] @@ -199,9 +186,6 @@ class DocType: ocd[oc].total_tax_amount = flt(prev_total) ocd[oc].tax_amount += flt(tax_amount) - total_amount = flt(ocd[oc].tax_amount) - total_tax_amount = flt(ocd[oc].total_tax_amount) + (add_ded * flt(total_amount)) - if ocd[oc].category != "Valuation": prev_total += add_ded * flt(ocd[oc].total_amount) total += add_ded * flt(ocd[oc].tax_amount) diff --git a/stock/doctype/landed_cost_wizard/landed_cost_wizard.txt b/stock/doctype/landed_cost_wizard/landed_cost_wizard.txt index fb4483f3e17..15b370ae2d5 100644 --- a/stock/doctype/landed_cost_wizard/landed_cost_wizard.txt +++ b/stock/doctype/landed_cost_wizard/landed_cost_wizard.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-01-10 16:34:28", + "creation": "2013-01-22 16:50:39", "docstatus": 0, - "modified": "2013-01-22 14:56:03", + "modified": "2013-01-23 15:25:00", "modified_by": "Administrator", "owner": "wasim@webnotestech.com" }, @@ -29,7 +29,7 @@ "parenttype": "DocType", "permlevel": 0, "read": 1, - "report": 1, + "report": 0, "submit": 0, "write": 1 }, @@ -92,20 +92,6 @@ "fieldtype": "Section Break", "options": "Simple" }, - { - "doctype": "DocField", - "fieldname": "landed_cost", - "fieldtype": "Link", - "label": "Select Landed Cost Items Master", - "options": "Landed Cost Master" - }, - { - "doctype": "DocField", - "fieldname": "get_details", - "fieldtype": "Button", - "label": "Get Details", - "options": "get_landed_cost_master_details" - }, { "doctype": "DocField", "fieldname": "landed_cost_details", diff --git a/stock/page/stock_home/stock_home.js b/stock/page/stock_home/stock_home.js index 7ea62de2546..ec039993e13 100644 --- a/stock/page/stock_home/stock_home.js +++ b/stock/page/stock_home/stock_home.js @@ -78,11 +78,6 @@ wn.module_page["Stock"] = [ "label": wn._("Quality Inspection"), description: wn._("Incoming quality inspection.") }, - { - "doctype":"Landed Cost Master", - "label":"Landed Cost Master", - description: wn._("Transportatoin cost distribution template.") - }, { "route":"Form/Landed Cost Wizard/Landed Cost Wizard", "label": wn._("Landed Cost Wizard"), diff --git a/utilities/cleanup_data.py b/utilities/cleanup_data.py index 6f790da309f..92c41a340ea 100644 --- a/utilities/cleanup_data.py +++ b/utilities/cleanup_data.py @@ -64,7 +64,6 @@ def delete_masters(): 'Letter Head':'', 'Leave Type':['Leave Without Pay', 'Privilege Leave', 'Casual Leave', 'PL', 'CL', 'LWP', 'Compensatory Off', 'Sick Leave'], - 'Landed Cost Master':'', 'Appraisal Template':'', 'Item Group':['All Item Groups', 'Default'], 'Item':'', From 7c833af873a0d20cf2df342f92fb53abbc2a052c Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 23 Jan 2013 16:10:15 +0530 Subject: [PATCH 7/7] removed unwanted permission --- patches/january_2013/remove_unwanted_permission.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/patches/january_2013/remove_unwanted_permission.py b/patches/january_2013/remove_unwanted_permission.py index 2c014ec57f7..deeb1b3b1e3 100644 --- a/patches/january_2013/remove_unwanted_permission.py +++ b/patches/january_2013/remove_unwanted_permission.py @@ -10,5 +10,4 @@ def execute(): if not doctype.doclist.get({"doctype": "DocField", "permlevel": pl}): if doctype.doclist.get({"doctype":"DocPerm", "permlevel":pl}): webnotes.conn.sql("""delete from `tabDocPerm` - where parent = %s and permlevel = %s""", (dt[0], pl)) - print doctype.doc.name \ No newline at end of file + where parent = %s and permlevel = %s""", (dt[0], pl)) \ No newline at end of file