From b09dc46e68356c1c06c63dca9d2e5cc4aa2a10e0 Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Mon, 23 Dec 2013 15:49:08 +0530 Subject: [PATCH 001/107] [flat discount] first commit --- .../doctype/sales_invoice/sales_invoice.py | 4 +- .../doctype/sales_invoice/sales_invoice.txt | 9 +- .../sales_invoice/test_sales_invoice.py | 94 +++++++++++++------ .../sales_taxes_and_charges.txt | 13 ++- controllers/accounts_controller.py | 27 ++++-- controllers/buying_controller.py | 5 +- controllers/selling_controller.py | 61 ++++++++---- public/js/transaction.js | 24 +++-- selling/sales_common.js | 58 ++++++++++-- 9 files changed, 218 insertions(+), 77 deletions(-) diff --git a/accounts/doctype/sales_invoice/sales_invoice.py b/accounts/doctype/sales_invoice/sales_invoice.py index bfba30fa1b..d065dedd70 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.py +++ b/accounts/doctype/sales_invoice/sales_invoice.py @@ -556,12 +556,12 @@ class DocType(SellingController): def make_tax_gl_entries(self, gl_entries): for tax in self.doclist.get({"parentfield": "other_charges"}): - if flt(tax.tax_amount): + if flt(tax.tax_amount_after_flat_discount): gl_entries.append( self.get_gl_dict({ "account": tax.account_head, "against": self.doc.debit_to, - "credit": flt(tax.tax_amount), + "credit": flt(tax.tax_amount_after_flat_discount), "remarks": self.doc.remarks, "cost_center": tax.cost_center }) diff --git a/accounts/doctype/sales_invoice/sales_invoice.txt b/accounts/doctype/sales_invoice/sales_invoice.txt index 99bfe5cdf0..66cc0d930a 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.txt +++ b/accounts/doctype/sales_invoice/sales_invoice.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 19:29:05", "docstatus": 0, - "modified": "2013-11-18 15:16:50", + "modified": "2013-12-19 11:10:11", "modified_by": "Administrator", "owner": "Administrator" }, @@ -362,6 +362,13 @@ "read_only": 1, "reqd": 1 }, + { + "doctype": "DocField", + "fieldname": "flat_discount", + "fieldtype": "Currency", + "label": "Flat Discount", + "options": "Company:company:default_currency" + }, { "doctype": "DocField", "fieldname": "taxes", diff --git a/accounts/doctype/sales_invoice/test_sales_invoice.py b/accounts/doctype/sales_invoice/test_sales_invoice.py index 9b740d1061..bc6d01ce60 100644 --- a/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -16,7 +16,7 @@ class TestSalesInvoice(unittest.TestCase): w.submit() return w - def test_double_submission(self): + def atest_double_submission(self): w = webnotes.bean(copy=test_records[0]) w.doc.docstatus = '0' w.insert() @@ -27,7 +27,7 @@ class TestSalesInvoice(unittest.TestCase): w = webnotes.bean(w2) self.assertRaises(DocstatusTransitionError, w.submit) - def test_timestamp_change(self): + def atest_timestamp_change(self): w = webnotes.bean(copy=test_records[0]) w.doc.docstatus = '0' w.insert() @@ -42,9 +42,8 @@ class TestSalesInvoice(unittest.TestCase): time.sleep(1) self.assertRaises(TimestampMismatchError, w2.save) - def test_sales_invoice_calculation_base_currency(self): + def atest_sales_invoice_calculation_base_currency(self): si = webnotes.bean(copy=test_records[2]) - si.run_method("calculate_taxes_and_totals") si.insert() expected_values = { @@ -87,7 +86,7 @@ class TestSalesInvoice(unittest.TestCase): self.assertEquals(si.doc.grand_total, 1627.05) self.assertEquals(si.doc.grand_total_export, 1627.05) - def test_sales_invoice_calculation_export_currency(self): + def atest_sales_invoice_calculation_export_currency(self): si = webnotes.bean(copy=test_records[2]) si.doc.currency = "USD" si.doc.conversion_rate = 50 @@ -136,8 +135,53 @@ class TestSalesInvoice(unittest.TestCase): self.assertEquals(si.doc.grand_total, 1627.05) self.assertEquals(si.doc.grand_total_export, 32.54) + + def test_sales_invoice_flat_discount(self): + si = webnotes.bean(copy=test_records[3]) + si.doc.flat_discount = 22.98 + si.insert() + + expected_values = { + "keys": ["ref_rate", "adj_rate", "export_rate", "export_amount", + "base_ref_rate", "basic_rate", "amount"], + "_Test Item Home Desktop 100": [62.5, 0, 62.5, 625.0, 50, 50, 492.44], + "_Test Item Home Desktop 200": [190.66, 0, 190.66, 953.3, 150, 150, 738.68], + } + + # check if children are saved + self.assertEquals(len(si.doclist.get({"parentfield": "entries"})), + len(expected_values)-1) + + # check if item values are calculated + for d in si.doclist.get({"parentfield": "entries"}): + for i, k in enumerate(expected_values["keys"]): + self.assertEquals(d.fields.get(k), expected_values[d.item_code][i]) + + # check net total + self.assertEquals(si.doc.net_total, 1231.12) + self.assertEquals(si.doc.net_total_export, 1578.3) + + # check tax calculation + expected_values = { + "keys": ["tax_amount", "tax_amount_after_flat_discount", "total"], + "_Test Account Excise Duty - _TC": [140, 137.89, 1369.01], + "_Test Account Education Cess - _TC": [2.8, 2.76, 1371.77], + "_Test Account S&H Education Cess - _TC": [1.4, 1.38, 1373.15], + "_Test Account CST - _TC": [27.88, 27.46, 1400.61], + "_Test Account VAT - _TC": [156.25, 153.89, 1554.5], + "_Test Account Customs Duty - _TC": [125, 123.11, 1677.61], + "_Test Account Shipping Charges - _TC": [100, 100, 1777.61], + "_Test Account Discount - _TC": [-180.33, -177.61, 1600] + } + + for d in si.doclist.get({"parentfield": "other_charges"}): + for i, k in enumerate(expected_values["keys"]): + self.assertEquals(flt(d.fields.get(k), 6), expected_values[d.account_head][i]) - def test_inclusive_rate_validations(self): + self.assertEquals(si.doc.grand_total, 1600) + self.assertEquals(si.doc.grand_total_export, 1600) + + def atest_inclusive_rate_validations(self): si = webnotes.bean(copy=test_records[2]) for i, tax in enumerate(si.doclist.get({"parentfield": "other_charges"})): tax.idx = i+1 @@ -148,16 +192,15 @@ class TestSalesInvoice(unittest.TestCase): si.doclist[i].included_in_print_rate = 1 # tax type "Actual" cannot be inclusive - self.assertRaises(webnotes.ValidationError, si.run_method, "calculate_taxes_and_totals") + self.assertRaises(webnotes.ValidationError, si.insert) # taxes above included type 'On Previous Row Total' should also be included si.doclist[3].included_in_print_rate = 0 - self.assertRaises(webnotes.ValidationError, si.run_method, "calculate_taxes_and_totals") + self.assertRaises(webnotes.ValidationError, si.insert) - def test_sales_invoice_calculation_base_currency_with_tax_inclusive_price(self): + def atest_sales_invoice_calculation_base_currency_with_tax_inclusive_price(self): # prepare si = webnotes.bean(copy=test_records[3]) - si.run_method("calculate_taxes_and_totals") si.insert() expected_values = { @@ -200,7 +243,7 @@ class TestSalesInvoice(unittest.TestCase): self.assertEquals(si.doc.grand_total, 1622.98) self.assertEquals(si.doc.grand_total_export, 1622.98) - def test_sales_invoice_calculation_export_currency_with_tax_inclusive_price(self): + def atest_sales_invoice_calculation_export_currency_with_tax_inclusive_price(self): # prepare si = webnotes.bean(copy=test_records[3]) si.doc.currency = "USD" @@ -211,7 +254,6 @@ class TestSalesInvoice(unittest.TestCase): si.doclist[2].adj_rate = 20 si.doclist[9].rate = 5000 - si.run_method("calculate_taxes_and_totals") si.insert() expected_values = { @@ -254,11 +296,11 @@ class TestSalesInvoice(unittest.TestCase): self.assertEquals(si.doc.grand_total, 65205.16) self.assertEquals(si.doc.grand_total_export, 1304.1) - def test_outstanding(self): + def atest_outstanding(self): w = self.make() self.assertEquals(w.doc.outstanding_amount, w.doc.grand_total) - def test_payment(self): + def atest_payment(self): webnotes.conn.sql("""delete from `tabGL Entry`""") w = self.make() @@ -277,7 +319,7 @@ class TestSalesInvoice(unittest.TestCase): self.assertEquals(webnotes.conn.get_value("Sales Invoice", w.doc.name, "outstanding_amount"), 561.8) - def test_time_log_batch(self): + def atest_time_log_batch(self): tlb = webnotes.bean("Time Log Batch", "_T-Time Log Batch-00001") tlb.submit() @@ -300,7 +342,7 @@ class TestSalesInvoice(unittest.TestCase): self.assertEquals(webnotes.conn.get_value("Time Log", "_T-Time Log-00001", "status"), "Batched for Billing") - def test_sales_invoice_gl_entry_without_aii(self): + def atest_sales_invoice_gl_entry_without_aii(self): self.clear_stock_account_balance() set_perpetual_inventory(0) si = webnotes.bean(copy=test_records[1]) @@ -333,7 +375,7 @@ class TestSalesInvoice(unittest.TestCase): self.assertFalse(gle) - def test_pos_gl_entry_with_aii(self): + def atest_pos_gl_entry_with_aii(self): self.clear_stock_account_balance() set_perpetual_inventory() @@ -393,7 +435,7 @@ class TestSalesInvoice(unittest.TestCase): set_perpetual_inventory(0) - def test_si_gl_entry_with_aii_and_update_stock_with_warehouse_but_no_account(self): + def atest_si_gl_entry_with_aii_and_update_stock_with_warehouse_but_no_account(self): self.clear_stock_account_balance() set_perpetual_inventory() webnotes.delete_doc("Account", "_Test Warehouse No Account - _TC") @@ -404,7 +446,6 @@ class TestSalesInvoice(unittest.TestCase): pr = webnotes.bean(copy=pr_test_records[0]) pr.doc.naming_series = "_T-Purchase Receipt-" pr.doclist[1].warehouse = "_Test Warehouse No Account - _TC" - pr.run_method("calculate_taxes_and_totals") pr.insert() pr.submit() @@ -449,7 +490,7 @@ class TestSalesInvoice(unittest.TestCase): self.assertFalse(gle) set_perpetual_inventory(0) - def test_sales_invoice_gl_entry_with_aii_no_item_code(self): + def atest_sales_invoice_gl_entry_with_aii_no_item_code(self): self.clear_stock_account_balance() set_perpetual_inventory() @@ -477,7 +518,7 @@ class TestSalesInvoice(unittest.TestCase): set_perpetual_inventory(0) - def test_sales_invoice_gl_entry_with_aii_non_stock_item(self): + def atest_sales_invoice_gl_entry_with_aii_non_stock_item(self): self.clear_stock_account_balance() set_perpetual_inventory() si_copy = webnotes.copy_doclist(test_records[1]) @@ -509,7 +550,6 @@ class TestSalesInvoice(unittest.TestCase): as pr_test_records pr = webnotes.bean(copy=pr_test_records[0]) pr.doc.naming_series = "_T-Purchase Receipt-" - pr.run_method("calculate_taxes_and_totals") pr.insert() pr.submit() @@ -530,7 +570,7 @@ class TestSalesInvoice(unittest.TestCase): ps = webnotes.bean(copy=pos_setting_test_records[0]) ps.insert() - def test_sales_invoice_with_advance(self): + def atest_sales_invoice_with_advance(self): from accounts.doctype.journal_voucher.test_journal_voucher \ import test_records as jv_test_records @@ -565,7 +605,7 @@ class TestSalesInvoice(unittest.TestCase): self.assertTrue(not webnotes.conn.sql("""select name from `tabJournal Voucher Detail` where against_invoice=%s""", si.doc.name)) - def test_recurring_invoice(self): + def atest_recurring_invoice(self): from webnotes.utils import now_datetime, get_first_day, get_last_day, add_to_date today = now_datetime().date() @@ -705,7 +745,7 @@ class TestSalesInvoice(unittest.TestCase): webnotes.conn.sql("delete from tabBin") webnotes.conn.sql("delete from `tabGL Entry`") - def test_serialized(self): + def atest_serialized(self): from stock.doctype.stock_entry.test_stock_entry import make_serialized_item from stock.doctype.serial_no.serial_no import get_serial_nos @@ -727,7 +767,7 @@ class TestSalesInvoice(unittest.TestCase): return si - def test_serialized_cancel(self): + def atest_serialized_cancel(self): from stock.doctype.serial_no.serial_no import get_serial_nos si = self.test_serialized() si.cancel() @@ -739,7 +779,7 @@ class TestSalesInvoice(unittest.TestCase): self.assertFalse(webnotes.conn.get_value("Serial No", serial_nos[0], "delivery_document_no")) - def test_serialize_status(self): + def atest_serialize_status(self): from stock.doctype.serial_no.serial_no import SerialNoStatusError, get_serial_nos from stock.doctype.stock_entry.test_stock_entry import make_serialized_item diff --git a/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt b/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt index b006c1d85c..3b31623e41 100644 --- a/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt +++ b/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt @@ -2,7 +2,7 @@ { "creation": "2013-04-24 11:39:32", "docstatus": 0, - "modified": "2013-12-17 12:38:08", + "modified": "2013-12-20 12:31:08", "modified_by": "Administrator", "owner": "Administrator" }, @@ -131,12 +131,21 @@ "options": "Company:company:default_currency", "read_only": 1 }, + { + "doctype": "DocField", + "fieldname": "tax_amount_after_flat_discount", + "fieldtype": "Currency", + "hidden": 1, + "label": "Tax Amount After Flat Discount", + "options": "Company:company:default_currency", + "read_only": 1 + }, { "doctype": "DocField", "fieldname": "item_wise_tax_detail", "fieldtype": "Small Text", "hidden": 1, - "label": "Item Wise Tax Detail ", + "label": "Item Wise Tax Detail", "oldfieldname": "item_wise_tax_detail", "oldfieldtype": "Small Text", "read_only": 1 diff --git a/controllers/accounts_controller.py b/controllers/accounts_controller.py index 5388ee120a..c76258ac27 100644 --- a/controllers/accounts_controller.py +++ b/controllers/accounts_controller.py @@ -16,7 +16,10 @@ class AccountsController(TransactionBase): self.set_missing_values(for_validate=True) self.validate_date_with_fiscal_year() if self.meta.get_field("currency"): + self.flat_discount_applied = False self.calculate_taxes_and_totals() + if hasattr(self, "apply_flat_discount"): + self.apply_flat_discount() self.validate_value("grand_total", ">=", 0) self.set_total_in_words() @@ -141,7 +144,7 @@ class AccountsController(TransactionBase): else: validate_conversion_rate(self.doc.currency, self.doc.conversion_rate, self.meta.get_label("conversion_rate"), self.doc.company) - + self.doc.conversion_rate = flt(self.doc.conversion_rate) self.item_doclist = self.doclist.get({"parentfield": self.fname}) self.tax_doclist = self.doclist.get({"parentfield": self.other_fname}) @@ -163,11 +166,16 @@ class AccountsController(TransactionBase): def initialize_taxes(self): for tax in self.tax_doclist: tax.item_wise_tax_detail = {} - for fieldname in ["tax_amount", "total", - "tax_amount_for_current_item", "grand_total_for_current_item", - "tax_fraction_for_current_item", "grand_total_fraction_for_current_item"]: - tax.fields[fieldname] = 0.0 - + tax_fields = ["total", "tax_amount_after_flat_discount", + "tax_amount_for_current_item", "grand_total_for_current_item", + "tax_fraction_for_current_item", "grand_total_fraction_for_current_item"] + + if not self.flat_discount_applied: + tax_fields.append("tax_amount") + + for fieldname in tax_fields: + tax.fields[fieldname] = 0.0 + self.validate_on_previous_row(tax) self.validate_inclusive_tax(tax) self.round_floats_in(tax) @@ -247,7 +255,10 @@ class AccountsController(TransactionBase): tax.tax_amount_for_current_item = current_tax_amount # accumulate tax amount into tax.tax_amount - tax.tax_amount += current_tax_amount + if not self.flat_discount_applied: + tax.tax_amount += current_tax_amount + + tax.tax_amount_after_flat_discount += current_tax_amount if tax.category: # if just for valuation, do not add the tax amount in total @@ -270,7 +281,7 @@ class AccountsController(TransactionBase): # in tax.total, accumulate grand total of each item tax.total += tax.grand_total_for_current_item - + def get_current_tax_amount(self, item, tax, item_tax_map): tax_rate = self._get_tax_rate(tax, item_tax_map) current_tax_amount = 0.0 diff --git a/controllers/buying_controller.py b/controllers/buying_controller.py index b52d51cf31..5e265e720f 100644 --- a/controllers/buying_controller.py +++ b/controllers/buying_controller.py @@ -5,7 +5,6 @@ from __future__ import unicode_literals import webnotes from webnotes import _, msgprint from webnotes.utils import flt, _round - from buying.utils import get_item_details from setup.utils import get_company_currency @@ -162,6 +161,10 @@ class BuyingController(StockController): if not self.meta.get_field("item_tax_amount", parentfield=self.fname): for item in self.item_doclist: del item.fields["item_tax_amount"] + + if not self.meta.get_field("tax_amount_after_flat_discount", parentfield=self.other_fname): + for tax in self.tax_doclist: + del tax.fields["tax_amount_after_flat_discount"] def set_item_tax_amount(self, item, tax, current_tax_amount): """ diff --git a/controllers/selling_controller.py b/controllers/selling_controller.py index 67c1462662..ede6ca9242 100644 --- a/controllers/selling_controller.py +++ b/controllers/selling_controller.py @@ -121,7 +121,7 @@ class SellingController(StockController): cumulated_tax_fraction += tax.tax_fraction_for_current_item - if cumulated_tax_fraction: + if cumulated_tax_fraction and not self.flat_discount_applied: item.amount = flt((item.export_amount * self.doc.conversion_rate) / (1 + cumulated_tax_fraction), self.precision("amount", item)) @@ -158,22 +158,23 @@ class SellingController(StockController): return current_tax_fraction def calculate_item_values(self): - for item in self.item_doclist: - self.round_floats_in(item) - - if item.adj_rate == 100: - item.export_rate = 0 - elif not item.export_rate: - item.export_rate = flt(item.ref_rate * (1.0 - (item.adj_rate / 100.0)), - self.precision("export_rate", item)) - - item.export_amount = flt(item.export_rate * item.qty, - self.precision("export_amount", item)) + if not self.flat_discount_applied: + for item in self.item_doclist: + self.round_floats_in(item) + + if item.adj_rate == 100: + item.export_rate = 0 + elif not item.export_rate: + item.export_rate = flt(item.ref_rate * (1.0 - (item.adj_rate / 100.0)), + self.precision("export_rate", item)) + + item.export_amount = flt(item.export_rate * item.qty, + self.precision("export_amount", item)) + + self._set_in_company_currency(item, "ref_rate", "base_ref_rate") + self._set_in_company_currency(item, "export_rate", "basic_rate") + self._set_in_company_currency(item, "export_amount", "amount") - self._set_in_company_currency(item, "ref_rate", "base_ref_rate") - self._set_in_company_currency(item, "export_rate", "basic_rate") - self._set_in_company_currency(item, "export_amount", "amount") - def calculate_net_total(self): self.doc.net_total = self.doc.net_total_export = 0.0 @@ -184,6 +185,7 @@ class SellingController(StockController): self.round_floats_in(self.doc, ["net_total", "net_total_export"]) def calculate_totals(self): + self.total_tax_excluding_actual = 0.0 self.doc.grand_total = flt(self.tax_doclist and \ self.tax_doclist[-1].total or self.doc.net_total, self.precision("grand_total")) self.doc.grand_total_export = flt(self.doc.grand_total / self.doc.conversion_rate, @@ -191,12 +193,33 @@ class SellingController(StockController): self.doc.other_charges_total = flt(self.doc.grand_total - self.doc.net_total, self.precision("other_charges_total")) - self.doc.other_charges_total_export = flt(self.doc.grand_total_export - self.doc.net_total_export, - self.precision("other_charges_total_export")) + self.doc.other_charges_total_export = flt(self.doc.grand_total_export - + self.doc.net_total_export + flt(self.doc.flat_discount), self.precision("other_charges_total_export")) self.doc.rounded_total = _round(self.doc.grand_total) self.doc.rounded_total_export = _round(self.doc.grand_total_export) - + + if self.doc.flat_discount: + # calculate total tax for flat discount excluding actual + for tax in self.tax_doclist: + if tax.charge_type != "Actual": + self.total_tax_excluding_actual += tax.tax_amount + + self.total_amount_for_flat_discount = flt(self.doc.net_total + + self.total_tax_excluding_actual, self.precision("grand_total")) + + def apply_flat_discount(self): + distributed_amount = 0.0 + + if self.doc.flat_discount and self.total_amount_for_flat_discount: + # calculate item amount after flat discount + for item in self.item_doclist: + distributed_amount = self.doc.flat_discount * item.amount / self.total_amount_for_flat_discount + item.amount = flt(item.amount - distributed_amount, self.precision("amount", item)) + + self.flat_discount_applied = True + self.calculate_taxes_and_totals() + def calculate_outstanding_amount(self): # NOTE: # write_off_amount is only for POS Invoice diff --git a/public/js/transaction.js b/public/js/transaction.js index 4c4a810ed2..f06fc6b735 100644 --- a/public/js/transaction.js +++ b/public/js/transaction.js @@ -146,7 +146,9 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ }, validate: function() { + this.flat_discount_applied = false; this.calculate_taxes_and_totals(); + this.apply_flat_discount && this.apply_flat_discount(); }, set_default_values: function() { @@ -528,12 +530,18 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ initialize_taxes: function() { var me = this; + $.each(this.frm.tax_doclist, function(i, tax) { tax.item_wise_tax_detail = {}; - $.each(["tax_amount", "total", - "tax_amount_for_current_item", "grand_total_for_current_item", - "tax_fraction_for_current_item", "grand_total_fraction_for_current_item"], - function(i, fieldname) { tax[fieldname] = 0.0 }); + tax_fields = ["total", "tax_amount_for_current_item", "grand_total_for_current_item", + "tax_fraction_for_current_item", "grand_total_fraction_for_current_item"] + + if (me.flat_discount_applied) + tax_fields.push("tax_amount_after_flat_discount"); + else + tax_fields.push("tax_amount"); + + $.each(tax_fields, function(i, fieldname) { tax[fieldname] = 0.0 }); me.validate_on_previous_row(tax); me.validate_inclusive_tax(tax); @@ -567,7 +575,10 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ tax.tax_amount_for_current_item = current_tax_amount; // accumulate tax amount into tax.tax_amount - tax.tax_amount += current_tax_amount; + if (me.flat_discount_applied) + tax.tax_amount_after_flat_discount += current_tax_amount; + else + tax.tax_amount += current_tax_amount; // for buying if(tax.category) { @@ -617,9 +628,8 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ } else if(tax.charge_type == "On Previous Row Total") { current_tax_amount = (tax_rate / 100.0) * this.frm.tax_doclist[cint(tax.row_id) - 1].grand_total_for_current_item; - } - + current_tax_amount = flt(current_tax_amount, precision("tax_amount", tax)); // store tax breakup for each item diff --git a/selling/sales_common.js b/selling/sales_common.js index dddc2b568d..d8fdb706b0 100644 --- a/selling/sales_common.js +++ b/selling/sales_common.js @@ -225,6 +225,12 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ this.calculate_taxes_and_totals(); }, + + flat_discount: function() { + this.flat_discount_applied = false; + this.calculate_taxes_and_totals(); + this.apply_flat_discount(); + }, commission_rate: function() { this.calculate_commission(); @@ -310,15 +316,17 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ calculate_item_values: function() { var me = this; - $.each(this.frm.item_doclist, function(i, item) { - wn.model.round_floats_in(item); - item.export_amount = flt(item.export_rate * item.qty, precision("export_amount", item)); - - me._set_in_company_currency(item, "ref_rate", "base_ref_rate"); - me._set_in_company_currency(item, "export_rate", "basic_rate"); - me._set_in_company_currency(item, "export_amount", "amount"); - }); + if (!this.flat_discount_applied) { + $.each(this.frm.item_doclist, function(i, item) { + wn.model.round_floats_in(item); + item.export_amount = flt(item.export_rate * item.qty, precision("export_amount", item)); + + me._set_in_company_currency(item, "ref_rate", "base_ref_rate"); + me._set_in_company_currency(item, "export_rate", "basic_rate"); + me._set_in_company_currency(item, "export_amount", "amount"); + }); + } }, determine_exclusive_rate: function() { @@ -341,7 +349,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ cumulated_tax_fraction += tax.tax_fraction_for_current_item; }); - if(cumulated_tax_fraction) { + if(cumulated_tax_fraction && !me.flat_discount_applied) { item.amount = flt( (item.export_amount * me.frm.doc.conversion_rate) / (1 + cumulated_tax_fraction), precision("amount", item)); @@ -396,7 +404,10 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ }, calculate_totals: function() { + var me = this; var tax_count = this.frm.tax_doclist.length; + this.total_tax_excluding_actual = 0.0; + this.frm.doc.grand_total = flt( tax_count ? this.frm.tax_doclist[tax_count - 1].total : this.frm.doc.net_total, precision("grand_total")); @@ -406,11 +417,38 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ this.frm.doc.other_charges_total = flt(this.frm.doc.grand_total - this.frm.doc.net_total, precision("other_charges_total")); this.frm.doc.other_charges_total_export = flt( - this.frm.doc.grand_total_export - this.frm.doc.net_total_export, + this.frm.doc.grand_total_export - this.frm.doc.net_total_export + this.frm.doc.flat_discount, precision("other_charges_total_export")); this.frm.doc.rounded_total = Math.round(this.frm.doc.grand_total); this.frm.doc.rounded_total_export = Math.round(this.frm.doc.grand_total_export); + + // calculate total amount for flat discount + $.each(this.frm.tax_doclist, function(i, tax) { + if (tax.charge_type != "Actual") { + me.total_tax_excluding_actual += flt(tax.tax_amount, precision("tax_amount", tax)); + } + }); + + this.total_amount_for_flat_discount = flt(this.frm.doc.net_total + + this.total_tax_excluding_actual, precision("grand_total")); + }, + + apply_flat_discount: function() { + var me = this; + var distributed_amount = 0.0; + + if (this.frm.doc.flat_discount && this.total_amount_for_flat_discount) { + // calculate item amount after flat discount + $.each(this.frm.item_doclist, function(i, item) { + distributed_amount = flt(me.frm.doc.flat_discount * item.amount / me.total_amount_for_flat_discount, + precision("amount", item)); + item.amount -= distributed_amount; + }); + + this.flat_discount_applied = true; + this.calculate_taxes_and_totals(); + } }, calculate_outstanding_amount: function() { From 63aa5fd67351e3478819d316f89f44aa0a4e73f4 Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Tue, 24 Dec 2013 20:30:03 +0530 Subject: [PATCH 002/107] [flat discount] implemented flat discount on server side --- .../sales_invoice/test_sales_invoice.py | 86 +++++++++++-------- controllers/accounts_controller.py | 50 +++++++---- controllers/selling_controller.py | 42 +++++---- 3 files changed, 108 insertions(+), 70 deletions(-) diff --git a/accounts/doctype/sales_invoice/test_sales_invoice.py b/accounts/doctype/sales_invoice/test_sales_invoice.py index bc6d01ce60..46a3f26d48 100644 --- a/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -16,7 +16,7 @@ class TestSalesInvoice(unittest.TestCase): w.submit() return w - def atest_double_submission(self): + def test_double_submission(self): w = webnotes.bean(copy=test_records[0]) w.doc.docstatus = '0' w.insert() @@ -27,7 +27,7 @@ class TestSalesInvoice(unittest.TestCase): w = webnotes.bean(w2) self.assertRaises(DocstatusTransitionError, w.submit) - def atest_timestamp_change(self): + def test_timestamp_change(self): w = webnotes.bean(copy=test_records[0]) w.doc.docstatus = '0' w.insert() @@ -42,7 +42,7 @@ class TestSalesInvoice(unittest.TestCase): time.sleep(1) self.assertRaises(TimestampMismatchError, w2.save) - def atest_sales_invoice_calculation_base_currency(self): + def test_sales_invoice_calculation_base_currency(self): si = webnotes.bean(copy=test_records[2]) si.insert() @@ -86,7 +86,7 @@ class TestSalesInvoice(unittest.TestCase): self.assertEquals(si.doc.grand_total, 1627.05) self.assertEquals(si.doc.grand_total_export, 1627.05) - def atest_sales_invoice_calculation_export_currency(self): + def test_sales_invoice_calculation_export_currency(self): si = webnotes.bean(copy=test_records[2]) si.doc.currency = "USD" si.doc.conversion_rate = 50 @@ -138,14 +138,25 @@ class TestSalesInvoice(unittest.TestCase): def test_sales_invoice_flat_discount(self): si = webnotes.bean(copy=test_records[3]) - si.doc.flat_discount = 22.98 + si.doc.flat_discount = 104.95 + si.doclist.append({ + "doctype": "Sales Taxes and Charges", + "parentfield": "other_charges", + "charge_type": "On Previous Row Amount", + "account_head": "_Test Account Service Tax - _TC", + "cost_center": "_Test Cost Center - _TC", + "description": "Service Tax", + "rate": 10, + "row_id": 8, + "idx": 9 + }) si.insert() expected_values = { "keys": ["ref_rate", "adj_rate", "export_rate", "export_amount", "base_ref_rate", "basic_rate", "amount"], - "_Test Item Home Desktop 100": [62.5, 0, 62.5, 625.0, 50, 50, 492.44], - "_Test Item Home Desktop 200": [190.66, 0, 190.66, 953.3, 150, 150, 738.68], + "_Test Item Home Desktop 100": [62.5, 0, 62.5, 625.0, 50, 50, 465.37], + "_Test Item Home Desktop 200": [190.66, 0, 190.66, 953.3, 150, 150, 698.08], } # check if children are saved @@ -158,30 +169,31 @@ class TestSalesInvoice(unittest.TestCase): self.assertEquals(d.fields.get(k), expected_values[d.item_code][i]) # check net total - self.assertEquals(si.doc.net_total, 1231.12) + self.assertEquals(si.doc.net_total, 1163.45) self.assertEquals(si.doc.net_total_export, 1578.3) # check tax calculation expected_values = { "keys": ["tax_amount", "tax_amount_after_flat_discount", "total"], - "_Test Account Excise Duty - _TC": [140, 137.89, 1369.01], - "_Test Account Education Cess - _TC": [2.8, 2.76, 1371.77], - "_Test Account S&H Education Cess - _TC": [1.4, 1.38, 1373.15], - "_Test Account CST - _TC": [27.88, 27.46, 1400.61], - "_Test Account VAT - _TC": [156.25, 153.89, 1554.5], - "_Test Account Customs Duty - _TC": [125, 123.11, 1677.61], - "_Test Account Shipping Charges - _TC": [100, 100, 1777.61], - "_Test Account Discount - _TC": [-180.33, -177.61, 1600] + "_Test Account Excise Duty - _TC": [140, 130.31, 1293.76], + "_Test Account Education Cess - _TC": [2.8, 2.61, 1296.37], + "_Test Account S&H Education Cess - _TC": [1.4, 1.31, 1297.68], + "_Test Account CST - _TC": [27.88, 25.96, 1323.64], + "_Test Account VAT - _TC": [156.25, 145.43, 1469.07], + "_Test Account Customs Duty - _TC": [125, 116.35, 1585.42], + "_Test Account Shipping Charges - _TC": [100, 100, 1685.42], + "_Test Account Discount - _TC": [-180.33, -168.54, 1516.88], + "_Test Account Service Tax - _TC": [-18.03, -16.88, 1500] } for d in si.doclist.get({"parentfield": "other_charges"}): for i, k in enumerate(expected_values["keys"]): - self.assertEquals(flt(d.fields.get(k), 6), expected_values[d.account_head][i]) + self.assertEquals(d.fields.get(k), expected_values[d.account_head][i]) - self.assertEquals(si.doc.grand_total, 1600) - self.assertEquals(si.doc.grand_total_export, 1600) + self.assertEquals(si.doc.grand_total, 1500) + self.assertEquals(si.doc.grand_total_export, 1500) - def atest_inclusive_rate_validations(self): + def test_inclusive_rate_validations(self): si = webnotes.bean(copy=test_records[2]) for i, tax in enumerate(si.doclist.get({"parentfield": "other_charges"})): tax.idx = i+1 @@ -198,7 +210,7 @@ class TestSalesInvoice(unittest.TestCase): si.doclist[3].included_in_print_rate = 0 self.assertRaises(webnotes.ValidationError, si.insert) - def atest_sales_invoice_calculation_base_currency_with_tax_inclusive_price(self): + def test_sales_invoice_calculation_base_currency_with_tax_inclusive_price(self): # prepare si = webnotes.bean(copy=test_records[3]) si.insert() @@ -238,12 +250,12 @@ class TestSalesInvoice(unittest.TestCase): for d in si.doclist.get({"parentfield": "other_charges"}): for i, k in enumerate(expected_values["keys"]): - self.assertEquals(flt(d.fields.get(k), 6), expected_values[d.account_head][i]) + self.assertEquals(d.fields.get(k), expected_values[d.account_head][i]) self.assertEquals(si.doc.grand_total, 1622.98) self.assertEquals(si.doc.grand_total_export, 1622.98) - def atest_sales_invoice_calculation_export_currency_with_tax_inclusive_price(self): + def test_sales_invoice_calculation_export_currency_with_tax_inclusive_price(self): # prepare si = webnotes.bean(copy=test_records[3]) si.doc.currency = "USD" @@ -291,16 +303,16 @@ class TestSalesInvoice(unittest.TestCase): for d in si.doclist.get({"parentfield": "other_charges"}): for i, k in enumerate(expected_values["keys"]): - self.assertEquals(flt(d.fields.get(k), 6), expected_values[d.account_head][i]) + self.assertEquals(d.fields.get(k), expected_values[d.account_head][i]) self.assertEquals(si.doc.grand_total, 65205.16) self.assertEquals(si.doc.grand_total_export, 1304.1) - def atest_outstanding(self): + def test_outstanding(self): w = self.make() self.assertEquals(w.doc.outstanding_amount, w.doc.grand_total) - def atest_payment(self): + def test_payment(self): webnotes.conn.sql("""delete from `tabGL Entry`""") w = self.make() @@ -319,7 +331,7 @@ class TestSalesInvoice(unittest.TestCase): self.assertEquals(webnotes.conn.get_value("Sales Invoice", w.doc.name, "outstanding_amount"), 561.8) - def atest_time_log_batch(self): + def test_time_log_batch(self): tlb = webnotes.bean("Time Log Batch", "_T-Time Log Batch-00001") tlb.submit() @@ -342,7 +354,7 @@ class TestSalesInvoice(unittest.TestCase): self.assertEquals(webnotes.conn.get_value("Time Log", "_T-Time Log-00001", "status"), "Batched for Billing") - def atest_sales_invoice_gl_entry_without_aii(self): + def test_sales_invoice_gl_entry_without_aii(self): self.clear_stock_account_balance() set_perpetual_inventory(0) si = webnotes.bean(copy=test_records[1]) @@ -375,7 +387,7 @@ class TestSalesInvoice(unittest.TestCase): self.assertFalse(gle) - def atest_pos_gl_entry_with_aii(self): + def test_pos_gl_entry_with_aii(self): self.clear_stock_account_balance() set_perpetual_inventory() @@ -435,7 +447,7 @@ class TestSalesInvoice(unittest.TestCase): set_perpetual_inventory(0) - def atest_si_gl_entry_with_aii_and_update_stock_with_warehouse_but_no_account(self): + def test_si_gl_entry_with_aii_and_update_stock_with_warehouse_but_no_account(self): self.clear_stock_account_balance() set_perpetual_inventory() webnotes.delete_doc("Account", "_Test Warehouse No Account - _TC") @@ -490,7 +502,7 @@ class TestSalesInvoice(unittest.TestCase): self.assertFalse(gle) set_perpetual_inventory(0) - def atest_sales_invoice_gl_entry_with_aii_no_item_code(self): + def test_sales_invoice_gl_entry_with_aii_no_item_code(self): self.clear_stock_account_balance() set_perpetual_inventory() @@ -518,7 +530,7 @@ class TestSalesInvoice(unittest.TestCase): set_perpetual_inventory(0) - def atest_sales_invoice_gl_entry_with_aii_non_stock_item(self): + def test_sales_invoice_gl_entry_with_aii_non_stock_item(self): self.clear_stock_account_balance() set_perpetual_inventory() si_copy = webnotes.copy_doclist(test_records[1]) @@ -570,7 +582,7 @@ class TestSalesInvoice(unittest.TestCase): ps = webnotes.bean(copy=pos_setting_test_records[0]) ps.insert() - def atest_sales_invoice_with_advance(self): + def test_sales_invoice_with_advance(self): from accounts.doctype.journal_voucher.test_journal_voucher \ import test_records as jv_test_records @@ -605,7 +617,7 @@ class TestSalesInvoice(unittest.TestCase): self.assertTrue(not webnotes.conn.sql("""select name from `tabJournal Voucher Detail` where against_invoice=%s""", si.doc.name)) - def atest_recurring_invoice(self): + def test_recurring_invoice(self): from webnotes.utils import now_datetime, get_first_day, get_last_day, add_to_date today = now_datetime().date() @@ -745,7 +757,7 @@ class TestSalesInvoice(unittest.TestCase): webnotes.conn.sql("delete from tabBin") webnotes.conn.sql("delete from `tabGL Entry`") - def atest_serialized(self): + def test_serialized(self): from stock.doctype.stock_entry.test_stock_entry import make_serialized_item from stock.doctype.serial_no.serial_no import get_serial_nos @@ -767,7 +779,7 @@ class TestSalesInvoice(unittest.TestCase): return si - def atest_serialized_cancel(self): + def test_serialized_cancel(self): from stock.doctype.serial_no.serial_no import get_serial_nos si = self.test_serialized() si.cancel() @@ -779,7 +791,7 @@ class TestSalesInvoice(unittest.TestCase): self.assertFalse(webnotes.conn.get_value("Serial No", serial_nos[0], "delivery_document_no")) - def atest_serialize_status(self): + def test_serialize_status(self): from stock.doctype.serial_no.serial_no import SerialNoStatusError, get_serial_nos from stock.doctype.stock_entry.test_stock_entry import make_serialized_item diff --git a/controllers/accounts_controller.py b/controllers/accounts_controller.py index c76258ac27..41d4859357 100644 --- a/controllers/accounts_controller.py +++ b/controllers/accounts_controller.py @@ -148,6 +148,10 @@ class AccountsController(TransactionBase): self.doc.conversion_rate = flt(self.doc.conversion_rate) self.item_doclist = self.doclist.get({"parentfield": self.fname}) self.tax_doclist = self.doclist.get({"parentfield": self.other_fname}) + + # for buying + if not hasattr(self, "flat_discount_applied"): + self.flat_discount_applied = False self.calculate_item_values() self.initialize_taxes() @@ -232,24 +236,26 @@ class AccountsController(TransactionBase): _on_previous_row_error("1 - %d" % (tax.row_id,)) def calculate_taxes(self): - for item in self.item_doclist: + # maintain actual tax rate based on idx + actual_tax_dict = dict([[tax.idx, tax.rate] for tax in self.tax_doclist + if tax.charge_type == "Actual"]) + + for n, item in enumerate(self.item_doclist): item_tax_map = self._load_item_tax_rate(item.item_tax_rate) for i, tax in enumerate(self.tax_doclist): # tax_amount represents the amount of tax for the current step current_tax_amount = self.get_current_tax_amount(item, tax, item_tax_map) + + # Adjust divisional loss to the last item + if tax.charge_type == "Actual": + actual_tax_dict[tax.idx] -= current_tax_amount; + if n == len(self.item_doclist) - 1: + current_tax_amount += actual_tax_dict[tax.idx] if hasattr(self, "set_item_tax_amount"): self.set_item_tax_amount(item, tax, current_tax_amount) - # case when net total is 0 but there is an actual type charge - # in this case add the actual amount to tax.tax_amount - # and tax.grand_total_for_current_item for the first such iteration - if tax.charge_type=="Actual" and \ - not (current_tax_amount or self.doc.net_total or tax.tax_amount): - zero_net_total_adjustment = flt(tax.rate, self.precision("tax_amount", tax)) - current_tax_amount += zero_net_total_adjustment - # store tax_amount for current item as it will be used for # charge type = 'On Previous Row Amount' tax.tax_amount_for_current_item = current_tax_amount @@ -271,17 +277,31 @@ class AccountsController(TransactionBase): # note: grand_total_for_current_item contains the contribution of # item's amount, previously applied tax and the current tax on that item if i==0: - tax.grand_total_for_current_item = flt(item.amount + - current_tax_amount, self.precision("total", tax)) - + tax.grand_total_for_current_item = flt(item.amount + current_tax_amount, + self.precision("total", tax)) else: tax.grand_total_for_current_item = \ - flt(self.tax_doclist[i-1].grand_total_for_current_item + + flt(self.tax_doclist[i-1].grand_total_for_current_item + current_tax_amount, self.precision("total", tax)) + # in tax.total, accumulate grand total of each item tax.total += tax.grand_total_for_current_item + # set precision in the last item iteration + if n == len(self.item_doclist) - 1: + tax.total = flt(tax.total, self.precision("total", tax)) + tax.tax_amount = flt(tax.tax_amount, self.precision("tax_amount", tax)) + tax.tax_amount_after_flat_discount = flt(tax.tax_amount_after_flat_discount, + self.precision("tax_amount", tax)) + + # adjust discount loss in last tax iteration + if i == (len(self.tax_doclist) - 1) and self.flat_discount_applied: + flat_discount_loss = self.doc.grand_total - self.doc.flat_discount - tax.total + tax.tax_amount_after_flat_discount = flt(tax.tax_amount_after_flat_discount + + flat_discount_loss, self.precision("tax_amount", tax)) + tax.total = flt(tax.total + flat_discount_loss, self.precision("total", tax)) + def get_current_tax_amount(self, item, tax, item_tax_map): tax_rate = self._get_tax_rate(tax, item_tax_map) current_tax_amount = 0.0 @@ -300,9 +320,9 @@ class AccountsController(TransactionBase): elif tax.charge_type == "On Previous Row Total": current_tax_amount = (tax_rate / 100.0) * \ self.tax_doclist[cint(tax.row_id) - 1].grand_total_for_current_item - + current_tax_amount = flt(current_tax_amount, self.precision("tax_amount", tax)) - + # store tax breakup for each item key = item.item_code or item.item_name if tax.item_wise_tax_detail.get(key): diff --git a/controllers/selling_controller.py b/controllers/selling_controller.py index ede6ca9242..2571c3c83e 100644 --- a/controllers/selling_controller.py +++ b/controllers/selling_controller.py @@ -185,7 +185,6 @@ class SellingController(StockController): self.round_floats_in(self.doc, ["net_total", "net_total_export"]) def calculate_totals(self): - self.total_tax_excluding_actual = 0.0 self.doc.grand_total = flt(self.tax_doclist and \ self.tax_doclist[-1].total or self.doc.net_total, self.precision("grand_total")) self.doc.grand_total_export = flt(self.doc.grand_total / self.doc.conversion_rate, @@ -199,26 +198,33 @@ class SellingController(StockController): self.doc.rounded_total = _round(self.doc.grand_total) self.doc.rounded_total_export = _round(self.doc.grand_total_export) - if self.doc.flat_discount: - # calculate total tax for flat discount excluding actual - for tax in self.tax_doclist: - if tax.charge_type != "Actual": - self.total_tax_excluding_actual += tax.tax_amount - - self.total_amount_for_flat_discount = flt(self.doc.net_total + - self.total_tax_excluding_actual, self.precision("grand_total")) - def apply_flat_discount(self): - distributed_amount = 0.0 + if self.doc.flat_discount: + total_amount_for_flat_discount = self.get_flat_discountable_amount() - if self.doc.flat_discount and self.total_amount_for_flat_discount: - # calculate item amount after flat discount - for item in self.item_doclist: - distributed_amount = self.doc.flat_discount * item.amount / self.total_amount_for_flat_discount - item.amount = flt(item.amount - distributed_amount, self.precision("amount", item)) + if total_amount_for_flat_discount: + # calculate item amount after flat discount + for item in self.item_doclist: + distributed_amount = self.doc.flat_discount * item.amount / total_amount_for_flat_discount + item.amount = flt(item.amount - distributed_amount, self.precision("amount", item)) - self.flat_discount_applied = True - self.calculate_taxes_and_totals() + self.flat_discount_applied = True + self.calculate_taxes_and_totals() + + def get_flat_discountable_amount(self): + actual_taxes_dict = {} + + for tax in self.tax_doclist: + if tax.charge_type == "Actual": + actual_taxes_dict.setdefault(tax.idx, tax.tax_amount) + elif tax.row_id in actual_taxes_dict: + actual_tax_amount = flt(actual_taxes_dict.get(tax.row_id, 0)) * \ + flt(tax.rate) / 100 + actual_taxes_dict.setdefault(tax.idx, actual_tax_amount) + + total_amount_for_flat_discount = flt(self.doc.grand_total - sum(actual_taxes_dict.values()), + self.precision("grand_total")) + return total_amount_for_flat_discount def calculate_outstanding_amount(self): # NOTE: From c53dbc7cdfec972872abd7febe60220acf75f0c3 Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Wed, 25 Dec 2013 19:46:20 +0530 Subject: [PATCH 003/107] [flat discount] implemented flat discount on client side --- .../sales_invoice/test_sales_invoice.py | 53 ++++++++++++++- .../purchase_common/purchase_common.js | 8 +++ controllers/accounts_controller.py | 31 +++++---- public/js/transaction.js | 67 +++++++++++++------ selling/sales_common.js | 53 +++++++++------ stock/doctype/item/item.js | 3 +- stock/doctype/item/item.py | 4 +- 7 files changed, 162 insertions(+), 57 deletions(-) diff --git a/accounts/doctype/sales_invoice/test_sales_invoice.py b/accounts/doctype/sales_invoice/test_sales_invoice.py index 46a3f26d48..86308905b5 100644 --- a/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -192,7 +192,57 @@ class TestSalesInvoice(unittest.TestCase): self.assertEquals(si.doc.grand_total, 1500) self.assertEquals(si.doc.grand_total_export, 1500) - + + def test_flat_discount_gl_entry(self): + si = webnotes.bean(copy=test_records[3]) + si.doc.flat_discount = 104.95 + si.doclist.append({ + "doctype": "Sales Taxes and Charges", + "parentfield": "other_charges", + "charge_type": "On Previous Row Amount", + "account_head": "_Test Account Service Tax - _TC", + "cost_center": "_Test Cost Center - _TC", + "description": "Service Tax", + "rate": 10, + "row_id": 8, + "idx": 9 + }) + si.insert() + si.submit() + + gl_entries = webnotes.conn.sql("""select account, debit, credit + from `tabGL Entry` where voucher_type='Sales Invoice' and voucher_no=%s + order by account asc""", si.doc.name, as_dict=1) + + self.assertTrue(gl_entries) + + expected_values = sorted([ + [si.doc.debit_to, 1500, 0.0], + [test_records[3][1]["income_account"], 0.0, 1163.45], + [test_records[3][3]["account_head"], 0.0, 130.31], + [test_records[3][4]["account_head"], 0.0, 2.61], + [test_records[3][5]["account_head"], 0.0, 1.31], + [test_records[3][6]["account_head"], 0.0, 25.96], + [test_records[3][7]["account_head"], 0.0, 145.43], + [test_records[3][8]["account_head"], 0.0, 116.35], + [test_records[3][9]["account_head"], 0.0, 100], + [test_records[3][10]["account_head"], 168.54, 0.0], + ["_Test Account Service Tax - _TC", 16.88, 0.0], + ]) + + for i, gle in enumerate(gl_entries): + self.assertEquals(expected_values[i][0], gle.account) + self.assertEquals(expected_values[i][1], gle.debit) + self.assertEquals(expected_values[i][2], gle.credit) + + # cancel + si.cancel() + + gle = webnotes.conn.sql("""select * from `tabGL Entry` + where voucher_type='Sales Invoice' and voucher_no=%s""", si.doc.name) + + self.assertFalse(gle) + def test_inclusive_rate_validations(self): si = webnotes.bean(copy=test_records[2]) for i, tax in enumerate(si.doclist.get({"parentfield": "other_charges"})): @@ -418,7 +468,6 @@ class TestSalesInvoice(unittest.TestCase): from `tabGL Entry` where voucher_type='Sales Invoice' and voucher_no=%s order by account asc, debit asc""", si.doc.name, as_dict=1) self.assertTrue(gl_entries) - # print gl_entries stock_in_hand = webnotes.conn.get_value("Account", {"master_name": "_Test Warehouse - _TC"}) diff --git a/buying/doctype/purchase_common/purchase_common.js b/buying/doctype/purchase_common/purchase_common.js index 9661f6edaf..92d127b267 100644 --- a/buying/doctype/purchase_common/purchase_common.js +++ b/buying/doctype/purchase_common/purchase_common.js @@ -360,6 +360,14 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ }); } } + + if(this.frm.tax_doclist.length) { + if(!wn.meta.get_docfield(this.frm.tax_doclist[0].doctype, "tax_amount_after_flat_discount", this.frm.doctype)) { + $.each(this.frm.tax_doclist, function(i, tax) { + delete tax["tax_amount_after_flat_discount"]; + }); + } + } }, calculate_outstanding_amount: function() { diff --git a/controllers/accounts_controller.py b/controllers/accounts_controller.py index 41d4859357..bcb50da44c 100644 --- a/controllers/accounts_controller.py +++ b/controllers/accounts_controller.py @@ -227,11 +227,11 @@ class AccountsController(TransactionBase): "charge_type": tax.charge_type, }, raise_exception=True) elif tax.charge_type == "On Previous Row Amount" and \ - not cint(self.tax_doclist[tax.row_id - 1].included_in_print_rate): + not cint(self.tax_doclist[cint(tax.row_id) - 1].included_in_print_rate): # referred row should also be inclusive _on_previous_row_error(tax.row_id) elif tax.charge_type == "On Previous Row Total" and \ - not all([cint(t.included_in_print_rate) for t in self.tax_doclist[:tax.row_id - 1]]): + not all([cint(t.included_in_print_rate) for t in self.tax_doclist[:cint(tax.row_id) - 1]]): # all rows about the reffered tax should be inclusive _on_previous_row_error("1 - %d" % (tax.row_id,)) @@ -249,7 +249,7 @@ class AccountsController(TransactionBase): # Adjust divisional loss to the last item if tax.charge_type == "Actual": - actual_tax_dict[tax.idx] -= current_tax_amount; + actual_tax_dict[tax.idx] -= current_tax_amount if n == len(self.item_doclist) - 1: current_tax_amount += actual_tax_dict[tax.idx] @@ -283,24 +283,29 @@ class AccountsController(TransactionBase): tax.grand_total_for_current_item = \ flt(self.tax_doclist[i-1].grand_total_for_current_item + current_tax_amount, self.precision("total", tax)) - # in tax.total, accumulate grand total of each item tax.total += tax.grand_total_for_current_item # set precision in the last item iteration if n == len(self.item_doclist) - 1: - tax.total = flt(tax.total, self.precision("total", tax)) - tax.tax_amount = flt(tax.tax_amount, self.precision("tax_amount", tax)) - tax.tax_amount_after_flat_discount = flt(tax.tax_amount_after_flat_discount, - self.precision("tax_amount", tax)) + self.round_off_totals(tax) - # adjust discount loss in last tax iteration + # adjust flat discount loss in last tax iteration if i == (len(self.tax_doclist) - 1) and self.flat_discount_applied: - flat_discount_loss = self.doc.grand_total - self.doc.flat_discount - tax.total - tax.tax_amount_after_flat_discount = flt(tax.tax_amount_after_flat_discount + - flat_discount_loss, self.precision("tax_amount", tax)) - tax.total = flt(tax.total + flat_discount_loss, self.precision("total", tax)) + self.adjust_flat_discount_loss(tax) + + def round_off_totals(self, tax): + tax.total = flt(tax.total, self.precision("total", tax)) + tax.tax_amount = flt(tax.tax_amount, self.precision("tax_amount", tax)) + tax.tax_amount_after_flat_discount = flt(tax.tax_amount_after_flat_discount, + self.precision("tax_amount", tax)) + + def adjust_flat_discount_loss(self, tax): + flat_discount_loss = self.doc.grand_total - self.doc.flat_discount - tax.total + tax.tax_amount_after_flat_discount = flt(tax.tax_amount_after_flat_discount + + flat_discount_loss, self.precision("tax_amount", tax)) + tax.total = flt(tax.total + flat_discount_loss, self.precision("total", tax)) def get_current_tax_amount(self, item, tax, item_tax_map): tax_rate = self._get_tax_rate(tax, item_tax_map) diff --git a/public/js/transaction.js b/public/js/transaction.js index f06fc6b735..542a1c1411 100644 --- a/public/js/transaction.js +++ b/public/js/transaction.js @@ -516,7 +516,7 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ this.validate_conversion_rate(); this.frm.item_doclist = this.get_item_doclist(); this.frm.tax_doclist = this.get_tax_doclist(); - + this.calculate_item_values(); this.initialize_taxes(); this.determine_exclusive_rate && this.determine_exclusive_rate(); @@ -533,12 +533,11 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ $.each(this.frm.tax_doclist, function(i, tax) { tax.item_wise_tax_detail = {}; - tax_fields = ["total", "tax_amount_for_current_item", "grand_total_for_current_item", + tax_fields = ["total", "tax_amount_after_flat_discount", + "tax_amount_for_current_item", "grand_total_for_current_item", "tax_fraction_for_current_item", "grand_total_fraction_for_current_item"] - if (me.flat_discount_applied) - tax_fields.push("tax_amount_after_flat_discount"); - else + if (!me.flat_discount_applied) tax_fields.push("tax_amount"); $.each(tax_fields, function(i, fieldname) { tax[fieldname] = 0.0 }); @@ -551,34 +550,41 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ calculate_taxes: function() { var me = this; + var actual_tax_dict = {}; + // maintain actual tax rate based on idx + $.each(this.frm.tax_doclist, function(i, tax) { + if (tax.charge_type == "Actual") { + actual_tax_dict[tax.idx] = flt(tax.rate); + } + }); + $.each(this.frm.item_doclist, function(n, item) { var item_tax_map = me._load_item_tax_rate(item.item_tax_rate); - + $.each(me.frm.tax_doclist, function(i, tax) { // tax_amount represents the amount of tax for the current step var current_tax_amount = me.get_current_tax_amount(item, tax, item_tax_map); - me.set_item_tax_amount && me.set_item_tax_amount(item, tax, current_tax_amount); - - // case when net total is 0 but there is an actual type charge - // in this case add the actual amount to tax.tax_amount - // and tax.grand_total_for_current_item for the first such iteration - if(tax.charge_type == "Actual" && - !(current_tax_amount || me.frm.doc.net_total || tax.tax_amount)) { - var zero_net_total_adjustment = flt(tax.rate, precision("tax_amount", tax)); - current_tax_amount += zero_net_total_adjustment; + // Adjust divisional loss to the last item + if (tax.charge_type == "Actual") { + actual_tax_dict[tax.idx] -= current_tax_amount; + if (n == me.frm.item_doclist.length - 1) { + current_tax_amount += actual_tax_dict[tax.idx] } - + } + + me.set_item_tax_amount && me.set_item_tax_amount(item, tax, current_tax_amount); + // store tax_amount for current item as it will be used for // charge type = 'On Previous Row Amount' tax.tax_amount_for_current_item = current_tax_amount; // accumulate tax amount into tax.tax_amount - if (me.flat_discount_applied) - tax.tax_amount_after_flat_discount += current_tax_amount; - else + if (!me.flat_discount_applied) tax.tax_amount += current_tax_amount; + + tax.tax_amount_after_flat_discount += current_tax_amount; // for buying if(tax.category) { @@ -603,9 +609,32 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ // in tax.total, accumulate grand total for each item tax.total += tax.grand_total_for_current_item; + + // set precision in the last item iteration + if (n == me.frm.item_doclist.length - 1) { + me.round_off_totals(tax); + + // adjust flat discount loss in last tax iteration + if ((i == me.frm.tax_doclist.length - 1) && me.flat_discount_applied) + me.adjust_flat_discount_loss(tax); + } }); }); }, + + round_off_totals: function(tax) { + tax.total = flt(tax.total, precision("total", tax)); + tax.tax_amount = flt(tax.tax_amount, precision("tax_amount", tax)); + tax.tax_amount_after_flat_discount = flt(tax.tax_amount_after_flat_discount, + precision("tax_amount", tax)); + }, + + adjust_flat_discount_loss: function(tax) { + var flat_discount_loss = this.frm.doc.grand_total - this.frm.doc.flat_discount - tax.total; + tax.tax_amount_after_flat_discount = flt(tax.tax_amount_after_flat_discount + + flat_discount_loss, precision("tax_amount", tax)); + tax.total = flt(tax.total + flat_discount_loss, precision("total", tax)); + }, get_current_tax_amount: function(item, tax, item_tax_map) { var tax_rate = this._get_tax_rate(tax, item_tax_map); diff --git a/selling/sales_common.js b/selling/sales_common.js index d8fdb706b0..91ec01dfcf 100644 --- a/selling/sales_common.js +++ b/selling/sales_common.js @@ -353,7 +353,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ item.amount = flt( (item.export_amount * me.frm.doc.conversion_rate) / (1 + cumulated_tax_fraction), precision("amount", item)); - + item.basic_rate = flt(item.amount / item.qty, precision("basic_rate", item)); if(item.adj_rate == 100) { @@ -393,20 +393,19 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ calculate_net_total: function() { var me = this; - this.frm.doc.net_total = this.frm.doc.net_total_export = 0.0; + $.each(this.frm.item_doclist, function(i, item) { me.frm.doc.net_total += item.amount; me.frm.doc.net_total_export += item.export_amount; }); - + wn.model.round_floats_in(this.frm.doc, ["net_total", "net_total_export"]); }, calculate_totals: function() { var me = this; var tax_count = this.frm.tax_doclist.length; - this.total_tax_excluding_actual = 0.0; this.frm.doc.grand_total = flt( tax_count ? this.frm.tax_doclist[tax_count - 1].total : this.frm.doc.net_total, @@ -416,40 +415,54 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ this.frm.doc.other_charges_total = flt(this.frm.doc.grand_total - this.frm.doc.net_total, precision("other_charges_total")); - this.frm.doc.other_charges_total_export = flt( - this.frm.doc.grand_total_export - this.frm.doc.net_total_export + this.frm.doc.flat_discount, + this.frm.doc.other_charges_total_export = flt(this.frm.doc.grand_total_export - + this.frm.doc.net_total_export + this.frm.doc.flat_discount, precision("other_charges_total_export")); this.frm.doc.rounded_total = Math.round(this.frm.doc.grand_total); this.frm.doc.rounded_total_export = Math.round(this.frm.doc.grand_total_export); - - // calculate total amount for flat discount - $.each(this.frm.tax_doclist, function(i, tax) { - if (tax.charge_type != "Actual") { - me.total_tax_excluding_actual += flt(tax.tax_amount, precision("tax_amount", tax)); - } - }); - - this.total_amount_for_flat_discount = flt(this.frm.doc.net_total + - this.total_tax_excluding_actual, precision("grand_total")); }, apply_flat_discount: function() { var me = this; var distributed_amount = 0.0; - if (this.frm.doc.flat_discount && this.total_amount_for_flat_discount) { + if (this.frm.doc.flat_discount) { + var total_amount_for_flat_discount = this.get_flat_discountable_amount(); // calculate item amount after flat discount $.each(this.frm.item_doclist, function(i, item) { - distributed_amount = flt(me.frm.doc.flat_discount * item.amount / me.total_amount_for_flat_discount, - precision("amount", item)); - item.amount -= distributed_amount; + distributed_amount = me.frm.doc.flat_discount * item.amount / total_amount_for_flat_discount; + item.amount = flt(item.amount - distributed_amount, precision("amount", item)); }); this.flat_discount_applied = true; this.calculate_taxes_and_totals(); } }, + + get_flat_discountable_amount: function() { + var me = this; + var total_actual_tax = 0.0; + var actual_taxes_dict = {}; + + $.each(this.frm.tax_doclist, function(i, tax) { + if (tax.charge_type == "Actual") + actual_taxes_dict[tax.idx] = tax.tax_amount; + else if (actual_taxes_dict[tax.row_id] !== null) { + actual_tax_amount = flt(actual_taxes_dict[tax.row_id]) * flt(tax.rate) / 100; + actual_taxes_dict[tax.idx] = actual_tax_amount; + } + }); + + $.each(actual_taxes_dict, function(key, value) { + if (value) + total_actual_tax += value; + }); + + total_amount_for_flat_discount = flt(this.frm.doc.grand_total - total_actual_tax, + precision("grand_total")); + return total_amount_for_flat_discount; + }, calculate_outstanding_amount: function() { // NOTE: diff --git a/stock/doctype/item/item.js b/stock/doctype/item/item.js index c9aa75e7b7..6a1a7ef1c2 100644 --- a/stock/doctype/item/item.js +++ b/stock/doctype/item/item.js @@ -97,7 +97,8 @@ cur_frm.fields_dict['default_sales_cost_center'].get_query = function(doc) { cur_frm.fields_dict['item_tax'].grid.get_field("tax_type").get_query = function(doc, cdt, cdn) { return{ filters:[ - ['Account', 'account_type', 'in', 'Tax, Chargeable'], + ['Account', 'account_type', 'in', + 'Tax, Chargeable, Income Account, Expense Account'], ['Account', 'docstatus', '!=', 2] ] } diff --git a/stock/doctype/item/item.py b/stock/doctype/item/item.py index b5884b4111..0c4d5dd596 100644 --- a/stock/doctype/item/item.py +++ b/stock/doctype/item/item.py @@ -154,8 +154,8 @@ class DocType(DocListController, WebsiteGenerator): if d.tax_type: account_type = webnotes.conn.get_value("Account", d.tax_type, "account_type") - if account_type not in ['Tax', 'Chargeable']: - msgprint("'%s' is not Tax / Chargeable Account" % d.tax_type, raise_exception=1) + if account_type not in ['Tax', 'Chargeable', 'Income Account', 'Expense Account']: + msgprint("'%s' is not Tax / Chargeable / Income / Expense Account" % d.tax_type, raise_exception=1) else: if d.tax_type in check_list: msgprint("Rate is entered twice for: '%s'" % d.tax_type, raise_exception=1) From aebb844da974fac347bb1b76f8bf393fe7d70910 Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Thu, 26 Dec 2013 18:05:41 +0530 Subject: [PATCH 004/107] [flat discount] added flat discount in print format and all selling doctypes --- .../Print Format/POS Invoice/POS Invoice.txt | 4 +-- .../Sales Invoice Classic.txt | 4 +-- .../Sales Invoice Modern.txt | 4 +-- .../Sales Invoice Spartan.txt | 4 +-- .../doctype/sales_invoice/sales_invoice.js | 6 ++-- .../doctype/sales_invoice/sales_invoice.txt | 17 ++++----- .../sales_taxes_and_charges_master.js | 36 ++++++++++++------- .../report/sales_register/sales_register.py | 5 +-- .../Quotation Classic/Quotation Classic.txt | 4 +-- .../Quotation Modern/Quotation Modern.txt | 4 +-- .../Quotation Spartan/Quotation Spartan.txt | 4 +-- .../Sales Order Classic.txt | 4 +-- .../Sales Order Modern/Sales Order Modern.txt | 4 +-- .../Sales Order Spartan.txt | 4 +-- selling/doctype/quotation/quotation.txt | 10 ++++-- selling/doctype/sales_order/sales_order.txt | 9 ++++- .../Delivery Note Classic.txt | 4 +-- .../Delivery Note Modern.txt | 4 +-- .../Delivery Note Spartan.txt | 4 +-- stock/doctype/delivery_note/delivery_note.txt | 13 +++++-- 20 files changed, 90 insertions(+), 58 deletions(-) diff --git a/accounts/Print Format/POS Invoice/POS Invoice.txt b/accounts/Print Format/POS Invoice/POS Invoice.txt index aab8e18491..d2cfa6d18a 100644 --- a/accounts/Print Format/POS Invoice/POS Invoice.txt +++ b/accounts/Print Format/POS Invoice/POS Invoice.txt @@ -2,14 +2,14 @@ { "creation": "2011-12-21 11:08:55", "docstatus": 0, - "modified": "2013-09-13 17:17:47", + "modified": "2013-12-26 14:19:13", "modified_by": "Administrator", "owner": "Administrator" }, { "doc_type": "Sales Invoice", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n \n \n \n \n \n \n \n
RECEIPT NO: DATE:
M/s
\n\n
\n\n\n", + "html": "\n\n\n\n\n\n\n\n\n \n \n \n \n \n \n \n
RECEIPT NO: DATE:
M/s
\n\n
\n\n\n", "module": "Accounts", "name": "__common__", "print_format_type": "Client", diff --git a/accounts/Print Format/Sales Invoice Classic/Sales Invoice Classic.txt b/accounts/Print Format/Sales Invoice Classic/Sales Invoice Classic.txt index fc99597766..4e8b12b943 100644 --- a/accounts/Print Format/Sales Invoice Classic/Sales Invoice Classic.txt +++ b/accounts/Print Format/Sales Invoice Classic/Sales Invoice Classic.txt @@ -2,14 +2,14 @@ { "creation": "2013-04-19 13:30:27", "docstatus": 0, - "modified": "2013-08-07 20:14:53", + "modified": "2013-12-26 17:33:08", "modified_by": "Administrator", "owner": "Administrator" }, { "doc_type": "Sales Invoice", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n\n", + "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", "module": "Accounts", "name": "__common__", "print_format_type": "Client", diff --git a/accounts/Print Format/Sales Invoice Modern/Sales Invoice Modern.txt b/accounts/Print Format/Sales Invoice Modern/Sales Invoice Modern.txt index 07946f7fcc..6808c009e6 100644 --- a/accounts/Print Format/Sales Invoice Modern/Sales Invoice Modern.txt +++ b/accounts/Print Format/Sales Invoice Modern/Sales Invoice Modern.txt @@ -2,14 +2,14 @@ { "creation": "2013-04-19 13:30:27", "docstatus": 0, - "modified": "2013-08-07 20:12:16", + "modified": "2013-12-26 17:33:05", "modified_by": "Administrator", "owner": "Administrator" }, { "doc_type": "Sales Invoice", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n\n", + "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", "module": "Accounts", "name": "__common__", "print_format_type": "Client", diff --git a/accounts/Print Format/Sales Invoice Spartan/Sales Invoice Spartan.txt b/accounts/Print Format/Sales Invoice Spartan/Sales Invoice Spartan.txt index 57c02fe2ec..45905fc2e1 100644 --- a/accounts/Print Format/Sales Invoice Spartan/Sales Invoice Spartan.txt +++ b/accounts/Print Format/Sales Invoice Spartan/Sales Invoice Spartan.txt @@ -2,14 +2,14 @@ { "creation": "2013-04-19 13:30:27", "docstatus": 0, - "modified": "2013-08-07 19:50:51", + "modified": "2013-12-26 17:34:00", "modified_by": "Administrator", "owner": "Administrator" }, { "doc_type": "Sales Invoice", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n\n", + "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", "module": "Accounts", "name": "__common__", "print_format_type": "Client", diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js index 7784005578..b3d784b383 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.js +++ b/accounts/doctype/sales_invoice/sales_invoice.js @@ -25,7 +25,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte } // toggle to pos view if is_pos is 1 in user_defaults - if ((cint(wn.defaults.get_user_defaults("is_pos"))===1 || cur_frm.doc.is_pos)) { + if ((cint(wn.defaults.get_user_defaults("is_pos"))===1 || this.frm.doc.is_pos)) { if(this.frm.doc.__islocal && !this.frm.doc.amended_from && !this.frm.doc.customer) { this.frm.set_value("is_pos", 1); this.is_pos(function() { @@ -144,8 +144,8 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte me.set_default_values(); me.set_dynamic_labels(); me.calculate_taxes_and_totals(); - - if(callback_fn) callback_fn() + + if(callback_fn) callback_fn(); } } }); diff --git a/accounts/doctype/sales_invoice/sales_invoice.txt b/accounts/doctype/sales_invoice/sales_invoice.txt index 66cc0d930a..82a1eb5172 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.txt +++ b/accounts/doctype/sales_invoice/sales_invoice.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 19:29:05", "docstatus": 0, - "modified": "2013-12-19 11:10:11", + "modified": "2013-12-26 17:50:21", "modified_by": "Administrator", "owner": "Administrator" }, @@ -362,13 +362,6 @@ "read_only": 1, "reqd": 1 }, - { - "doctype": "DocField", - "fieldname": "flat_discount", - "fieldtype": "Currency", - "label": "Flat Discount", - "options": "Company:company:default_currency" - }, { "doctype": "DocField", "fieldname": "taxes", @@ -459,6 +452,14 @@ "print_hide": 1, "read_only": 1 }, + { + "doctype": "DocField", + "fieldname": "flat_discount", + "fieldtype": "Currency", + "label": "Flat Discount", + "options": "Company:company:default_currency", + "print_hide": 0 + }, { "doctype": "DocField", "fieldname": "totals", diff --git a/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js b/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js index e2e5047028..0c5daf3667 100644 --- a/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js +++ b/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js @@ -19,6 +19,10 @@ cur_frm.pformat.net_total_export = function(doc) { return ''; } +cur_frm.pformat.flat_discount = function(doc) { + return ''; +} + cur_frm.pformat.grand_total_export = function(doc) { return ''; } @@ -33,10 +37,10 @@ cur_frm.pformat.in_words_export = function(doc) { cur_frm.pformat.other_charges= function(doc){ //function to make row of table - var make_row = function(title,val,bold){ + var make_row = function(title, val, bold){ var bstart = ''; var bend = ''; - return ''+(bold?bstart:'')+title+(bold?bend:'')+'' - +''+format_currency(val, doc.currency)+'' + return '' + (bold?bstart:'') + title + (bold?bend:'') + '' + +'' + format_currency(val, doc.currency) + '' +'' } @@ -52,7 +56,7 @@ cur_frm.pformat.other_charges= function(doc){ out =''; if (!doc.print_without_amount) { - var cl = getchildren('Sales Taxes and Charges',doc.name,'other_charges'); + var cl = getchildren('Sales Taxes and Charges', doc.name, 'other_charges'); // outer table var out='
'; @@ -60,6 +64,7 @@ cur_frm.pformat.other_charges= function(doc){ // main table out +=''; + if(!print_hide('net_total_export')) { out += make_row('Net Total', doc.net_total_export, 1); } @@ -68,26 +73,31 @@ cur_frm.pformat.other_charges= function(doc){ if(cl.length){ for(var i=0;i' + out += '' } - out +='
' + doc.in_words_export + '
'; + out += ''; } return out; } @@ -99,7 +109,7 @@ cur_frm.cscript.charge_type = function(doc, cdt, cdn) { d.charge_type = ''; } validated = false; - refresh_field('charge_type',d.name,'other_charges'); + refresh_field('charge_type', d.name, 'other_charges'); cur_frm.cscript.row_id(doc, cdt, cdn); cur_frm.cscript.rate(doc, cdt, cdn); cur_frm.cscript.tax_amount(doc, cdt, cdn); @@ -122,7 +132,7 @@ cur_frm.cscript.row_id = function(doc, cdt, cdn) { } } validated = false; - refresh_field('row_id',d.name,'other_charges'); + refresh_field('row_id', d.name, 'other_charges'); } /*---------------------- Get rate if account_head has account_type as TAX or CHARGEABLE-------------------------------------*/ @@ -152,7 +162,7 @@ cur_frm.cscript.rate = function(doc, cdt, cdn) { d.rate = ''; } validated = false; - refresh_field('rate',d.name,'other_charges'); + refresh_field('rate', d.name, 'other_charges'); } cur_frm.cscript.tax_amount = function(doc, cdt, cdn) { @@ -166,5 +176,5 @@ cur_frm.cscript.tax_amount = function(doc, cdt, cdn) { d.tax_amount = ''; } validated = false; - refresh_field('tax_amount',d.name,'other_charges'); + refresh_field('tax_amount', d.name, 'other_charges'); }; \ No newline at end of file diff --git a/accounts/report/sales_register/sales_register.py b/accounts/report/sales_register/sales_register.py index 49b914e4a3..98ef93662d 100644 --- a/accounts/report/sales_register/sales_register.py +++ b/accounts/report/sales_register/sales_register.py @@ -79,7 +79,7 @@ def get_columns(invoice_list): tax_accounts = webnotes.conn.sql_list("""select distinct account_head from `tabSales Taxes and Charges` where parenttype = 'Sales Invoice' - and docstatus = 1 and ifnull(tax_amount, 0) != 0 + and docstatus = 1 and ifnull(tax_amount_after_flat_discount, 0) != 0 and parent in (%s) order by account_head""" % ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list])) @@ -126,7 +126,8 @@ def get_invoice_income_map(invoice_list): return invoice_income_map def get_invoice_tax_map(invoice_list, invoice_income_map, income_accounts): - tax_details = webnotes.conn.sql("""select parent, account_head, sum(tax_amount) as tax_amount + tax_details = webnotes.conn.sql("""select parent, account_head, + sum(tax_amount_after_flat_discount) as tax_amount from `tabSales Taxes and Charges` where parent in (%s) group by parent, account_head""" % ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1) diff --git a/selling/Print Format/Quotation Classic/Quotation Classic.txt b/selling/Print Format/Quotation Classic/Quotation Classic.txt index e7588c4522..dc845290fe 100644 --- a/selling/Print Format/Quotation Classic/Quotation Classic.txt +++ b/selling/Print Format/Quotation Classic/Quotation Classic.txt @@ -2,14 +2,14 @@ { "creation": "2013-04-19 13:30:51", "docstatus": 0, - "modified": "2013-08-07 19:55:11", + "modified": "2013-12-26 17:45:37", "modified_by": "Administrator", "owner": "Administrator" }, { "doc_type": "Quotation", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n\n", + "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", "module": "Selling", "name": "__common__", "print_format_type": "Client", diff --git a/selling/Print Format/Quotation Modern/Quotation Modern.txt b/selling/Print Format/Quotation Modern/Quotation Modern.txt index 20d380dcbf..8b4b0d8f65 100644 --- a/selling/Print Format/Quotation Modern/Quotation Modern.txt +++ b/selling/Print Format/Quotation Modern/Quotation Modern.txt @@ -2,14 +2,14 @@ { "creation": "2013-04-19 13:30:51", "docstatus": 0, - "modified": "2013-08-07 20:12:11", + "modified": "2013-12-26 17:45:15", "modified_by": "Administrator", "owner": "Administrator" }, { "doc_type": "Quotation", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n\n", + "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", "module": "Selling", "name": "__common__", "print_format_type": "Client", diff --git a/selling/Print Format/Quotation Spartan/Quotation Spartan.txt b/selling/Print Format/Quotation Spartan/Quotation Spartan.txt index c5b4cb92b3..c4a1362ad3 100644 --- a/selling/Print Format/Quotation Spartan/Quotation Spartan.txt +++ b/selling/Print Format/Quotation Spartan/Quotation Spartan.txt @@ -2,14 +2,14 @@ { "creation": "2013-04-19 13:30:51", "docstatus": 0, - "modified": "2013-08-07 19:53:01", + "modified": "2013-12-26 17:45:50", "modified_by": "Administrator", "owner": "Administrator" }, { "doc_type": "Quotation", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n\n", + "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", "module": "Selling", "name": "__common__", "print_format_type": "Client", diff --git a/selling/Print Format/Sales Order Classic/Sales Order Classic.txt b/selling/Print Format/Sales Order Classic/Sales Order Classic.txt index 7f2748ac0c..1d36ee6a77 100644 --- a/selling/Print Format/Sales Order Classic/Sales Order Classic.txt +++ b/selling/Print Format/Sales Order Classic/Sales Order Classic.txt @@ -2,14 +2,14 @@ { "creation": "2013-04-19 13:30:51", "docstatus": 0, - "modified": "2013-08-07 19:45:49", + "modified": "2013-12-26 17:35:51", "modified_by": "Administrator", "owner": "Administrator" }, { "doc_type": "Sales Order", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n\n", + "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", "module": "Selling", "name": "__common__", "print_format_type": "Client", diff --git a/selling/Print Format/Sales Order Modern/Sales Order Modern.txt b/selling/Print Format/Sales Order Modern/Sales Order Modern.txt index e4102b2359..157c8eb29c 100644 --- a/selling/Print Format/Sales Order Modern/Sales Order Modern.txt +++ b/selling/Print Format/Sales Order Modern/Sales Order Modern.txt @@ -2,14 +2,14 @@ { "creation": "2013-04-19 13:30:51", "docstatus": 0, - "modified": "2013-08-07 20:12:23", + "modified": "2013-12-26 17:34:24", "modified_by": "Administrator", "owner": "Administrator" }, { "doc_type": "Sales Order", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n\n", + "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", "module": "Selling", "name": "__common__", "print_format_type": "Client", diff --git a/selling/Print Format/Sales Order Spartan/Sales Order Spartan.txt b/selling/Print Format/Sales Order Spartan/Sales Order Spartan.txt index 105b65b21b..8dce87eca4 100644 --- a/selling/Print Format/Sales Order Spartan/Sales Order Spartan.txt +++ b/selling/Print Format/Sales Order Spartan/Sales Order Spartan.txt @@ -2,14 +2,14 @@ { "creation": "2013-04-19 13:30:51", "docstatus": 0, - "modified": "2013-08-07 19:45:59", + "modified": "2013-12-26 17:35:29", "modified_by": "Administrator", "owner": "Administrator" }, { "doc_type": "Sales Order", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n\n", + "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", "module": "Selling", "name": "__common__", "print_format_type": "Client", diff --git a/selling/doctype/quotation/quotation.txt b/selling/doctype/quotation/quotation.txt index 93346d3029..ce8a0d502b 100644 --- a/selling/doctype/quotation/quotation.txt +++ b/selling/doctype/quotation/quotation.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 19:29:08", "docstatus": 0, - "modified": "2013-12-14 17:25:46", + "modified": "2013-12-26 17:54:55", "modified_by": "Administrator", "owner": "Administrator" }, @@ -458,6 +458,13 @@ "print_hide": 1, "read_only": 1 }, + { + "doctype": "DocField", + "fieldname": "flat_discount", + "fieldtype": "Currency", + "label": "Flat Discount", + "options": "Company:company:default_currency" + }, { "doctype": "DocField", "fieldname": "totals", @@ -863,7 +870,6 @@ "cancel": 0, "create": 0, "doctype": "DocPerm", - "match": "customer", "role": "Customer", "submit": 0, "write": 0 diff --git a/selling/doctype/sales_order/sales_order.txt b/selling/doctype/sales_order/sales_order.txt index 7a1af77947..34309cc1a5 100644 --- a/selling/doctype/sales_order/sales_order.txt +++ b/selling/doctype/sales_order/sales_order.txt @@ -2,7 +2,7 @@ { "creation": "2013-06-18 12:39:59", "docstatus": 0, - "modified": "2013-11-03 14:20:16", + "modified": "2013-12-26 17:55:43", "modified_by": "Administrator", "owner": "Administrator" }, @@ -477,6 +477,13 @@ "read_only": 1, "width": "150px" }, + { + "doctype": "DocField", + "fieldname": "flat_discount", + "fieldtype": "Currency", + "label": "Flat Discount", + "options": "Company:company:default_currency" + }, { "doctype": "DocField", "fieldname": "totals", diff --git a/stock/Print Format/Delivery Note Classic/Delivery Note Classic.txt b/stock/Print Format/Delivery Note Classic/Delivery Note Classic.txt index 163dffaa87..d16b67fea6 100644 --- a/stock/Print Format/Delivery Note Classic/Delivery Note Classic.txt +++ b/stock/Print Format/Delivery Note Classic/Delivery Note Classic.txt @@ -2,14 +2,14 @@ { "creation": "2013-04-19 13:31:11", "docstatus": 0, - "modified": "2013-08-07 19:44:55", + "modified": "2013-12-26 17:36:51", "modified_by": "Administrator", "owner": "Administrator" }, { "doc_type": "Delivery Note", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n\n", + "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", "module": "Stock", "name": "__common__", "print_format_type": "Client", diff --git a/stock/Print Format/Delivery Note Modern/Delivery Note Modern.txt b/stock/Print Format/Delivery Note Modern/Delivery Note Modern.txt index f4323a9e1f..9965634355 100644 --- a/stock/Print Format/Delivery Note Modern/Delivery Note Modern.txt +++ b/stock/Print Format/Delivery Note Modern/Delivery Note Modern.txt @@ -2,14 +2,14 @@ { "creation": "2013-04-19 13:31:11", "docstatus": 0, - "modified": "2013-08-07 20:12:29", + "modified": "2013-12-26 17:36:26", "modified_by": "Administrator", "owner": "Administrator" }, { "doc_type": "Delivery Note", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n\n", + "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", "module": "Stock", "name": "__common__", "print_format_type": "Client", diff --git a/stock/Print Format/Delivery Note Spartan/Delivery Note Spartan.txt b/stock/Print Format/Delivery Note Spartan/Delivery Note Spartan.txt index 03fbef521e..2623d76183 100644 --- a/stock/Print Format/Delivery Note Spartan/Delivery Note Spartan.txt +++ b/stock/Print Format/Delivery Note Spartan/Delivery Note Spartan.txt @@ -2,14 +2,14 @@ { "creation": "2013-04-19 13:31:11", "docstatus": 0, - "modified": "2013-08-07 19:44:37", + "modified": "2013-12-26 17:37:14", "modified_by": "Administrator", "owner": "Administrator" }, { "doc_type": "Delivery Note", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n\n", + "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", "module": "Stock", "name": "__common__", "print_format_type": "Client", diff --git a/stock/doctype/delivery_note/delivery_note.txt b/stock/doctype/delivery_note/delivery_note.txt index 480d45d014..9784b5a8fc 100644 --- a/stock/doctype/delivery_note/delivery_note.txt +++ b/stock/doctype/delivery_note/delivery_note.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 19:29:09", "docstatus": 0, - "modified": "2013-12-14 17:26:12", + "modified": "2013-12-26 18:01:33", "modified_by": "Administrator", "owner": "Administrator" }, @@ -465,7 +465,7 @@ "fieldname": "other_charges_total_export", "fieldtype": "Currency", "label": "Taxes and Charges Total", - "options": "company", + "options": "Company:company:default_currency", "print_hide": 1, "read_only": 1 }, @@ -487,6 +487,13 @@ "read_only": 1, "width": "150px" }, + { + "doctype": "DocField", + "fieldname": "flat_discount", + "fieldtype": "Currency", + "label": "Flat Discount", + "options": "Company:company:default_currency" + }, { "doctype": "DocField", "fieldname": "totals", @@ -1058,7 +1065,7 @@ }, { "doctype": "DocPerm", - "match": "customer", + "match": "customer_name", "role": "Customer" } ] \ No newline at end of file From 13fa595282788ff67c6bfcabe53942582a03daf7 Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Thu, 26 Dec 2013 18:14:44 +0530 Subject: [PATCH 005/107] [flat discount] pos print format fixed --- accounts/Print Format/POS Invoice/POS Invoice.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/accounts/Print Format/POS Invoice/POS Invoice.txt b/accounts/Print Format/POS Invoice/POS Invoice.txt index d2cfa6d18a..0907c4a865 100644 --- a/accounts/Print Format/POS Invoice/POS Invoice.txt +++ b/accounts/Print Format/POS Invoice/POS Invoice.txt @@ -2,14 +2,14 @@ { "creation": "2011-12-21 11:08:55", "docstatus": 0, - "modified": "2013-12-26 14:19:13", + "modified": "2013-12-26 18:13:48", "modified_by": "Administrator", "owner": "Administrator" }, { "doc_type": "Sales Invoice", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n \n \n \n \n \n \n \n
RECEIPT NO: DATE:
M/s
\n\n
\n\n\n", + "html": "\n\n\n\n\n\n\n\n\n \n \n \n \n \n \n \n
RECEIPT NO: DATE:
M/s
\n\n
\n\n\n", "module": "Accounts", "name": "__common__", "print_format_type": "Client", From 2b1d8854d5aa8c9cf85a34d344a1d283097a7797 Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Thu, 26 Dec 2013 20:31:42 +0530 Subject: [PATCH 006/107] [flat discount] added flat discount in pos --- accounts/doctype/sales_invoice/pos.js | 82 ++++++++++++++++----------- patches/patch_list.py | 29 ++++++---- 2 files changed, 67 insertions(+), 44 deletions(-) diff --git a/accounts/doctype/sales_invoice/pos.js b/accounts/doctype/sales_invoice/pos.js index adbdca1b63..81f6ae9124 100644 --- a/accounts/doctype/sales_invoice/pos.js +++ b/accounts/doctype/sales_invoice/pos.js @@ -30,12 +30,14 @@ erpnext.POS = Class.extend({ \
\
\ - \ - \ - \ - \ - \ -
Net Total
\ +
\ + \ + \ + \ + \ + \ +
Net Total
\ +
\ \ +
\ + \ + \ + \ + \ + \ +
Flat Discount\ + \ +
\ +
\
\ \ \ @@ -82,6 +95,10 @@ erpnext.POS = Class.extend({ me.refresh(); }); + this.wrapper.find('input.flat-discount').on("change", function() { + wn.model.set_value(me.frm.doctype, me.frm.docname, "flat_discount", this.value); + }); + this.call_function("delete-items", function() {me.remove_selected_item();}); this.call_function("make-payment", function() {me.make_payment();}); }, @@ -112,9 +129,9 @@ erpnext.POS = Class.extend({ }, make: function() { this.make_party(); - this.make_item_group(); - this.make_search(); this.make_barcode(); + this.make_search(); + this.make_item_group(); this.make_item_list(); }, make_party: function() { @@ -137,23 +154,23 @@ erpnext.POS = Class.extend({ me.party.toLowerCase(), this.value); }); }, - make_item_group: function() { + make_barcode: function() { var me = this; - this.item_group = wn.ui.form.make_control({ + this.barcode = wn.ui.form.make_control({ df: { - "fieldtype": "Link", - "options": "Item Group", - "label": "Item Group", - "fieldname": "pos_item_group", - "placeholder": "Item Group" + "fieldtype": "Data", + "label": "Barcode", + "fieldname": "pos_barcode", + "placeholder": "Barcode / Serial No" }, - parent: this.wrapper.find(".item-group-area"), + parent: this.wrapper.find(".barcode-area"), only_input: true, }); - this.item_group.make_input(); - this.item_group.$input.on("change", function() { - if(!me.item_group.autocomplete_open) - me.make_item_list(); + this.barcode.make_input(); + this.barcode.$input.on("keypress", function() { + if(me.barcode_timeout) + clearTimeout(me.barcode_timeout); + me.barcode_timeout = setTimeout(function() { me.add_item_thru_barcode(); }, 1000); }); }, make_search: function() { @@ -176,23 +193,23 @@ erpnext.POS = Class.extend({ me.item_timeout = setTimeout(function() { me.make_item_list(); }, 1000); }); }, - make_barcode: function() { + make_item_group: function() { var me = this; - this.barcode = wn.ui.form.make_control({ + this.item_group = wn.ui.form.make_control({ df: { - "fieldtype": "Data", - "label": "Barcode", - "fieldname": "pos_barcode", - "placeholder": "Barcode / Serial No" + "fieldtype": "Link", + "options": "Item Group", + "label": "Item Group", + "fieldname": "pos_item_group", + "placeholder": "Item Group" }, - parent: this.wrapper.find(".barcode-area"), + parent: this.wrapper.find(".item-group-area"), only_input: true, }); - this.barcode.make_input(); - this.barcode.$input.on("keypress", function() { - if(me.barcode_timeout) - clearTimeout(me.barcode_timeout); - me.barcode_timeout = setTimeout(function() { me.add_item_thru_barcode(); }, 1000); + this.item_group.make_input(); + this.item_group.$input.on("change", function() { + if(!me.item_group.autocomplete_open) + me.make_item_list(); }); }, make_item_list: function() { @@ -321,6 +338,7 @@ erpnext.POS = Class.extend({ refresh: function() { var me = this; this.party_field.set_input(this.frm.doc[this.party.toLowerCase()]); + this.wrapper.find('input.flat-discount').val(this.frm.doc.flat_discount); this.barcode.set_input(""); this.show_items_in_item_cart(); diff --git a/patches/patch_list.py b/patches/patch_list.py index 608ba77168..b567eb1c19 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -173,18 +173,18 @@ patch_list = [ "patches.july_2013.p05_custom_doctypes_in_list_view", "patches.july_2013.p06_same_sales_rate", "patches.july_2013.p07_repost_billed_amt_in_sales_cycle", - "execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Classic') # 2013-07-22", - "execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Modern') # 2013-07-22", - "execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Spartan') # 2013-07-22", - "execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Classic') # 2013-07-22", - "execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Modern') # 2013-07-22", - "execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Spartan') # 2013-07-22", - "execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Classic') # 2013-07-22", - "execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Modern') # 2013-07-22", - "execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Spartan') # 2013-07-22", - "execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Classic') # 2013-07-22", - "execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Modern') # 2013-07-22", - "execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Spartan') # 2013-07-22", + "execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Classic') # 2013-12-26", + "execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Modern') # 2013-12-26", + "execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Spartan') # 2013-12-26", + "execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Classic') # 2013-12-26", + "execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Modern') # 2013-12-26", + "execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Spartan') # 2013-12-26", + "execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Classic') # 2013-12-26", + "execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Modern') # 2013-12-26", + "execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Spartan') # 2013-12-26", + "execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Classic') # 2013-12-26", + "execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Modern') # 2013-12-26", + "execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Spartan') # 2013-12-26", "patches.july_2013.p08_custom_print_format_net_total_export", "patches.july_2013.p09_remove_website_pyc", "patches.july_2013.p10_change_partner_user_to_website_user", @@ -263,4 +263,9 @@ patch_list = [ "patches.1311.p08_email_digest_recipients", "execute:webnotes.delete_doc('DocType', 'Warehouse Type')", "patches.1312.p02_update_item_details_in_item_price", + "execute:webnotes.reload_doc('accounts', 'Print Format', 'POS Invoice') # 2013-12-26", + "execute:webnotes.reload_doc('accounts', 'doctype', 'sales_invoice') # 2013-12-26", + "execute:webnotes.reload_doc('selling', 'doctype', 'sales_order') # 2013-12-26", + "execute:webnotes.reload_doc('selling', 'doctype', 'quotation') # 2013-12-26", + "execute:webnotes.reload_doc('stock', 'doctype', 'delivery_note') # 2013-12-26", ] \ No newline at end of file From 31ccf9a80bd7fa61e3debe40904995995cd370c0 Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Fri, 27 Dec 2013 14:21:39 +0530 Subject: [PATCH 007/107] [flat discount] fixed test cases for stock entry --- accounts/doctype/sales_invoice/pos.js | 3 ++- buying/doctype/purchase_order/test_purchase_order.py | 1 - stock/doctype/stock_entry/stock_entry.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/accounts/doctype/sales_invoice/pos.js b/accounts/doctype/sales_invoice/pos.js index 81f6ae9124..9e11fa80d2 100644 --- a/accounts/doctype/sales_invoice/pos.js +++ b/accounts/doctype/sales_invoice/pos.js @@ -53,7 +53,8 @@ erpnext.POS = Class.extend({
\
\ \ - \ + \ + \ \
Flat DiscountFlat Discount\ \ diff --git a/buying/doctype/purchase_order/test_purchase_order.py b/buying/doctype/purchase_order/test_purchase_order.py index f6c435c6fb..23d5ea4dca 100644 --- a/buying/doctype/purchase_order/test_purchase_order.py +++ b/buying/doctype/purchase_order/test_purchase_order.py @@ -1,7 +1,6 @@ # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt - from __future__ import unicode_literals import unittest import webnotes diff --git a/stock/doctype/stock_entry/stock_entry.py b/stock/doctype/stock_entry/stock_entry.py index 2e7e2a4066..8eddbd4560 100644 --- a/stock/doctype/stock_entry/stock_entry.py +++ b/stock/doctype/stock_entry/stock_entry.py @@ -290,7 +290,7 @@ class DocType(StockController): if not returnable_qty: webnotes.throw("{item}: {item_code} {returned}".format( item=_("Item"), item_code=item.item_code, - returned=_("already returned though some other documents"))) + returned=_("already returned though some other documents")), StockOverReturnError) elif item.transfer_qty > returnable_qty: webnotes.throw("{item}: {item_code}, {returned}: {qty}".format( item=_("Item"), item_code=item.item_code, From a1ffacaf0bb3e9b76f22e96708d69f9c14ea6c42 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 2 Jan 2014 16:30:16 +0530 Subject: [PATCH 008/107] Valuation related charges should only go to stock items --- controllers/accounts_controller.py | 3 --- controllers/buying_controller.py | 38 +++++++++++++++++------------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/controllers/accounts_controller.py b/controllers/accounts_controller.py index 5388ee120a..11480c9ebe 100644 --- a/controllers/accounts_controller.py +++ b/controllers/accounts_controller.py @@ -231,9 +231,6 @@ class AccountsController(TransactionBase): # tax_amount represents the amount of tax for the current step current_tax_amount = self.get_current_tax_amount(item, tax, item_tax_map) - if hasattr(self, "set_item_tax_amount"): - self.set_item_tax_amount(item, tax, current_tax_amount) - # case when net total is 0 but there is an actual type charge # in this case add the actual amount to tax.tax_amount # and tax.grand_total_for_current_item for the first such iteration diff --git a/controllers/buying_controller.py b/controllers/buying_controller.py index 35b9d25279..4aa08d6c55 100644 --- a/controllers/buying_controller.py +++ b/controllers/buying_controller.py @@ -163,30 +163,36 @@ class BuyingController(StockController): if not self.meta.get_field("item_tax_amount", parentfield=self.fname): for item in self.item_doclist: del item.fields["item_tax_amount"] - - def set_item_tax_amount(self, item, tax, current_tax_amount): + + # update valuation rate + def update_valuation_rate(self, parentfield): """ item_tax_amount is the total tax amount applied on that item stored for valuation TODO: rename item_tax_amount to valuation_tax_amount """ - if tax.category in ["Valuation", "Valuation and Total"] and \ - self.meta.get_field("item_tax_amount", parentfield=self.fname): - item.item_tax_amount += flt(current_tax_amount, self.precision("item_tax_amount", item)) - - # update valuation rate - def update_valuation_rate(self, parentfield): - for item in self.doclist.get({"parentfield": parentfield}): - item.conversion_factor = item.conversion_factor or flt(webnotes.conn.get_value( - "UOM Conversion Detail", {"parent": item.item_code, "uom": item.uom}, - "conversion_factor")) or 1 + stock_items = self.get_stock_items() + + stock_items_amount = sum([flt(d.amount) for d in + self.doclist.get({"parentfield": parentfield}) + if d.item_code and d.item_code in stock_items]) - if item.item_code and item.qty: + total_valuation_amount = sum([flt(d.tax_amount) for d in + self.doclist.get({"parentfield": "purchase_tax_details"}) + if d.category in ["Valuation", "Valuation and Total"]]) + + + for item in self.doclist.get({"parentfield": parentfield}): + if item.item_code and item.qty and item.item_code in stock_items: + item.item_tax_amount = flt(flt(item.amount) * total_valuation_amount \ + / stock_items_amount, self.precision("item_tax_amount", item)) + self.round_floats_in(item) - - # if no item code, which is sometimes the case in purchase invoice, - # then it is not possible to track valuation against it + + item.conversion_factor = item.conversion_factor or flt(webnotes.conn.get_value( + "UOM Conversion Detail", {"parent": item.item_code, "uom": item.uom}, + "conversion_factor")) or 1 qty_in_stock_uom = flt(item.qty * item.conversion_factor) item.valuation_rate = ((item.amount + item.item_tax_amount + item.rm_supp_cost) / qty_in_stock_uom) From df07c964f74e5527d2ab1a0aaffb2cdd96807619 Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Thu, 2 Jan 2014 17:42:01 +0600 Subject: [PATCH 009/107] bumped to version 3.4.4 --- config.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.json b/config.json index c09c2afac9..e8955b178c 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,6 @@ { "app_name": "ERPNext", - "app_version": "3.4.3", + "app_version": "3.4.4", "base_template": "app/portal/templates/base.html", "modules": { "Accounts": { @@ -74,5 +74,5 @@ "type": "module" } }, - "requires_framework_version": "==3.4.2" + "requires_framework_version": "==3.4.3" } \ No newline at end of file From 064d2ba16a8b012e1c0fdf55d1f7c2d0952d1c88 Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Mon, 30 Dec 2013 19:36:58 +0530 Subject: [PATCH 010/107] fixed sr no in maintenance schedule --- .../maintenance_schedule.js | 118 +++++++------ .../maintenance_schedule.py | 156 ++++++++---------- .../maintenance_schedule_detail.txt | 4 +- 3 files changed, 136 insertions(+), 142 deletions(-) diff --git a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js index 75773e07ac..bcb1bf33b6 100644 --- a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js +++ b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js @@ -5,107 +5,115 @@ wn.provide("erpnext.support"); // TODO commonify this code erpnext.support.MaintenanceSchedule = wn.ui.form.Controller.extend({ refresh: function() { - if (this.frm.doc.docstatus===0) { - cur_frm.add_custom_button(wn._('From Sales Order'), + if (this.frm.doc.docstatus === 0) { + this.frm.add_custom_button(wn._('From Sales Order'), function() { wn.model.map_current_doc({ method: "erpnext.selling.doctype.sales_order.sales_order.make_maintenance_schedule", source_doctype: "Sales Order", get_query_filters: { docstatus: 1, - order_type: cur_frm.doc.order_type, - customer: cur_frm.doc.customer || undefined, - company: cur_frm.doc.company + order_type: me.frm.doc.order_type, + customer: me.frm.doc.customer || undefined, + company: me.frm.doc.company } - }) + }); }); - } else if (this.frm.doc.docstatus===1) { - cur_frm.add_custom_button(wn._("Make Maintenance Visit"), function() { + } else if (this.frm.doc.docstatus === 1) { + this.frm.add_custom_button(wn._("Make Maintenance Visit"), function() { wn.model.open_mapped_doc({ method: "erpnext.support.doctype.maintenance_schedule.maintenance_schedule.make_maintenance_visit", source_name: cur_frm.doc.name }) - }) + }); } }, customer: function() { var me = this; if(this.frm.doc.customer) { return this.frm.call({ - doc: this.frm.doc, + doc: me.frm.doc, method: "set_customer_defaults", }); - } - }, + } + }, }); $.extend(cur_frm.cscript, new erpnext.support.MaintenanceSchedule({frm: cur_frm})); cur_frm.cscript.onload = function(doc, dt, dn) { - if(!doc.status) set_multiple(dt,dn,{status:'Draft'}); - - if(doc.__islocal){ - set_multiple(dt,dn,{transaction_date:get_today()}); - hide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']); - } + if(!doc.status) + set_multiple(dt, dn, { status:'Draft' }); + + if (doc.__islocal) { + set_multiple(dt, dn, { transaction_date:get_today() }); + hide_field(['customer_address', 'contact_person', 'customer_name', 'address_display', + 'contact_display', 'contact_mobile', 'contact_email', 'territory', 'customer_group']); + } } -cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) { - if(doc.customer) return get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1); +cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc, dt, dn) { + if (doc.customer) { + return get_server_fields('get_customer_address', + JSON.stringify({customer: doc.customer, address: doc.customer_address, + contact: doc.contact_person}), '', doc, dt, dn, 1); + } } cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) { - return{ - filters:{ 'customer': doc.customer} - } + return { + filters:{ 'customer': doc.customer } + } } cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) { - return{ - filters:{ 'customer': doc.customer} - } + return { + filters:{ 'customer': doc.customer } + } } // cur_frm.fields_dict['item_maintenance_detail'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) { - return{ - filters:{ 'is_service_item': "Yes"} - } + return { + filters:{ 'is_service_item': "Yes" } + } } cur_frm.cscript.item_code = function(doc, cdt, cdn) { - var fname = cur_frm.cscript.fname; - var d = locals[cdt][cdn]; - if (d.item_code) { - return get_server_fields('get_item_details',d.item_code, 'item_maintenance_detail',doc,cdt,cdn,1); - } + var fname = cur_frm.cscript.fname; + var d = locals[cdt][cdn]; + if (d.item_code) { + return get_server_fields('get_item_details', d.item_code, 'item_maintenance_detail', + doc, cdt, cdn, 1); + } } cur_frm.cscript.periodicity = function(doc, cdt, cdn){ - var d = locals[cdt][cdn]; - if(d.start_date && d.end_date){ - arg = {} - arg.start_date = d.start_date; - arg.end_date = d.end_date; - arg.periodicity = d.periodicity; - return get_server_fields('get_no_of_visits',docstring(arg),'item_maintenance_detail',doc, cdt, cdn, 1); - } - else{ - msgprint(wn._("Please enter Start Date and End Date")); - } + var d = locals[cdt][cdn]; + if(d.start_date && d.end_date) { + arg = {} + arg.start_date = d.start_date; + arg.end_date = d.end_date; + arg.periodicity = d.periodicity; + return get_server_fields('get_no_of_visits', docstring(arg), + 'item_maintenance_detail', doc, cdt, cdn, 1); + } else { + msgprint(wn._("Please enter Start Date and End Date")); + } } cur_frm.cscript.generate_schedule = function(doc, cdt, cdn) { - if (!doc.__islocal) { - return $c('runserverobj', args={'method':'generate_schedule', 'docs':wn.model.compress(make_doclist(cdt,cdn))}, - function(r,rt){ - refresh_field('maintenance_schedule_detail'); - } - ); - } else { - alert(wn._("Please save the document before generating maintenance schedule")); - } + if (!doc.__islocal) { + return $c('runserverobj', args={'method':'generate_schedule', + 'docs':wn.model.compress(make_doclist(cdt,cdn))}, + function(r, rt) { + refresh_field('maintenance_schedule_detail'); + }); + } else { + msgprint(wn._("Please save the document before generating maintenance schedule")); + } } cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) { - return{ query: "erpnext.controllers.queries.customer_query" } } + return { query: "erpnext.controllers.queries.customer_query" } +} diff --git a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py index 8263b19667..270f954922 100644 --- a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py +++ b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py @@ -7,10 +7,7 @@ import webnotes from webnotes.utils import add_days, cstr, getdate from webnotes.model.doc import addchild from webnotes.model.bean import getlist -from webnotes import msgprint - - - +from webnotes import msgprint, throw, _ from erpnext.utilities.transaction_base import TransactionBase, delete_events class DocType(TransactionBase): @@ -19,7 +16,8 @@ class DocType(TransactionBase): self.doclist = doclist def get_item_details(self, item_code): - item = webnotes.conn.sql("select item_name, description from `tabItem` where name = '%s'" %(item_code), as_dict=1) + item = webnotes.conn.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 '' @@ -28,13 +26,14 @@ class DocType(TransactionBase): def generate_schedule(self): self.doclist = self.doc.clear_table(self.doclist, 'maintenance_schedule_detail') - count = 0 - webnotes.conn.sql("delete from `tabMaintenance Schedule Detail` where parent='%s'" %(self.doc.name)) + webnotes.conn.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 =[] + count = 1 + 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): + 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 @@ -43,7 +42,7 @@ class DocType(TransactionBase): if d.serial_no: child.serial_no = d.serial_no child.idx = count - count = count+1 + count = count + 1 child.incharge_name = d.incharge_name child.save(1) @@ -51,8 +50,7 @@ class DocType(TransactionBase): def on_submit(self): if not getlist(self.doclist, 'maintenance_schedule_detail'): - msgprint("Please click on 'Generate Schedule' to get schedule") - raise Exception + throw("Please click on 'Generate Schedule' to get schedule") self.check_serial_no_added() self.validate_serial_no_warranty() self.validate_schedule() @@ -66,9 +64,9 @@ class DocType(TransactionBase): email_map[d.incharge_name] = webnotes.bean("Sales Person", d.incharge_name).run_method("get_email_id") - scheduled_date =webnotes.conn.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 =webnotes.conn.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]: @@ -91,90 +89,80 @@ class DocType(TransactionBase): #---------------------- def create_schedule_list(self, start_date, end_date, no_of_visit): schedule_list = [] - start_date1 = start_date + start_date_copy = 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) + add_by = date_diff / no_of_visit + + while (getdate(start_date_copy) < getdate(end_date)): + start_date_copy = add_days(start_date_copy, add_by) if len(schedule_list) < no_of_visit: - schedule_list.append(getdate(start_date1)) + schedule_list.append(getdate(start_date_copy)) 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 + args = eval(arg) + if getdate(args['start_date']) >= getdate(args['end_date']): + throw(_("Start date should be less than end date.")) + + period = (getdate(args['end_date']) - getdate(args['start_date'])).days + 1 + + if (args['periodicity'] == 'Yearly' or args['periodicity'] == 'Half Yearly' or + args['periodicity'] == 'Quarterly') and period < 365: + throw(cstr(args['periodicity']) + " periodicity can be set for period of atleast 1 year or more only") + elif args['periodicity'] == 'Monthly' and period < 30: + throw("Monthly periodicity can be set for period of atleast 1 month or more") + elif args['periodicity'] == 'Weekly' and period < 7: + throw("Weekly periodicity can be set for period of atleast 1 week or more") def get_no_of_visits(self, arg): - arg1 = eval(arg) + args = eval(arg) self.validate_period(arg) - period = (getdate(arg1['end_date'])-getdate(arg1['start_date'])).days+1 - - count =0 - if arg1['periodicity'] == 'Weekly': + period = (getdate(args['end_date']) - getdate(args['start_date'])).days + 1 + count = 0 + + if args['periodicity'] == 'Weekly': count = period/7 - elif arg1['periodicity'] == 'Monthly': + elif args['periodicity'] == 'Monthly': count = period/30 - elif arg1['periodicity'] == 'Quarterly': + elif args['periodicity'] == 'Quarterly': count = period/91 - elif arg1['periodicity'] == 'Half Yearly': + elif args['periodicity'] == 'Half Yearly': count = period/182 - elif arg1['periodicity'] == 'Yearly': + elif args['periodicity'] == 'Yearly': count = period/365 - ret = {'no_of_visits':count} + 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 + throw(_("Please enter Maintaince Details first")) for d in getlist(self.doclist, 'item_maintenance_detail'): if not d.item_code: - msgprint("Please select item code") - raise Exception + throw(_("Please select item code")) 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 + throw(_("Please select Start Date and End Date for item") + " " + d.item_code) elif not d.no_of_visits: - msgprint("Please mention no of visits required") - raise Exception + throw(_("Please mention no of visits required")) elif not d.incharge_name: - msgprint("Please select Incharge Person's name") - raise Exception + throw(_("Please select Incharge Person's name")) 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 + throw(_("Start date should be less than end date for item") + " " + d.item_code) #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 = webnotes.conn.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) + chk = webnotes.conn.sql("""select ms.name from `tabMaintenance Schedule` ms, + `tabMaintenance Schedule Item` msi where msi.parent=ms.name and + msi.prevdoc_docname=%s and ms.docstatus=1""", d.prevdoc_docname) if chk: - msgprint("Maintenance Schedule against "+d.prevdoc_docname+" already exist") - raise Exception + throw("Maintenance Schedule against " + d.prevdoc_docname + " already exist") def validate_serial_no(self): @@ -185,13 +173,13 @@ class DocType(TransactionBase): cur_s_no = cur_serial_no.split(',') for x in cur_s_no: - chk = webnotes.conn.sql("select name, status from `tabSerial No` where docstatus!=2 and name=%s", (x)) + chk = webnotes.conn.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 + throw("Serial no " + x + " does not exist in system.") def validate(self): self.validate_maintenance_detail() @@ -208,13 +196,13 @@ class DocType(TransactionBase): cur_s_no = cur_serial_no.split(',') for x in cur_s_no: - dt = webnotes.conn.sql("select delivery_date from `tabSerial No` where name = %s", x) + dt = webnotes.conn.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 + throw("Maintenance start date can not be before delivery date " + dt.strftime('%Y-%m-%d') + " for serial no " + x) #update amc expiry date in serial no #------------------------------------------ @@ -224,7 +212,8 @@ class DocType(TransactionBase): cur_s_no = cur_serial_no.split(',') for x in cur_s_no: - webnotes.conn.sql("update `tabSerial No` set amc_expiry_date = '%s', maintenance_status = 'Under AMC' where name = '%s'"% (amc_end_date,x)) + webnotes.conn.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') @@ -233,16 +222,16 @@ class DocType(TransactionBase): for d in getlist(self.doclist, 'item_maintenance_detail'): if cstr(d.serial_no).strip(): dt = webnotes.conn.sql("""select warranty_expiry_date, amc_expiry_date - from `tabSerial No` where name = %s""", d.serial_no, as_dict=1) + from `tabSerial No` where name=%s""", d.serial_no, as_dict=1) if dt[0]['warranty_expiry_date'] and dt[0]['warranty_expiry_date'] >= d.start_date: - webnotes.msgprint("""Serial No: %s is already under warranty upto %s. + throw("""Serial No: %s is already under warranty upto %s. Please check AMC Start Date.""" % - (d.serial_no, dt[0]["warranty_expiry_date"]), raise_exception=1) + (d.serial_no, dt[0]["warranty_expiry_date"])) if dt[0]['amc_expiry_date'] and dt[0]['amc_expiry_date'] >= d.start_date: - webnotes.msgprint("""Serial No: %s is already under AMC upto %s. + throw("""Serial No: %s is already under AMC upto %s. Please check AMC Start Date.""" % - (d.serial_no, dt[0]["amc_expiry_date"]), raise_exception=1) + (d.serial_no, dt[0]["amc_expiry_date"])) def validate_schedule(self): item_lst1 =[] @@ -256,13 +245,11 @@ class DocType(TransactionBase): 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 + throw("Maintenance Schedule is not generated for all the items. Please click on 'Generate Schedule'") 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 + throw("Maintenance Schedule is not generated for item "+x+". Please click on 'Generate Schedule'") #check if serial no present in item maintenance table #----------------------------------------------------------- @@ -275,18 +262,15 @@ class DocType(TransactionBase): 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 - - - + throw("Please click on 'Generate Schedule' to fetch serial no added for item "+m.item_code) + 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') delete_events(self.doc.doctype, self.doc.name) - + def on_trash(self): delete_events(self.doc.doctype, self.doc.name) diff --git a/erpnext/support/doctype/maintenance_schedule_detail/maintenance_schedule_detail.txt b/erpnext/support/doctype/maintenance_schedule_detail/maintenance_schedule_detail.txt index 8b52d8b671..7a79d8d659 100644 --- a/erpnext/support/doctype/maintenance_schedule_detail/maintenance_schedule_detail.txt +++ b/erpnext/support/doctype/maintenance_schedule_detail/maintenance_schedule_detail.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:28:05", "docstatus": 0, - "modified": "2013-12-20 19:23:20", + "modified": "2013-12-30 19:32:30", "modified_by": "Administrator", "owner": "Administrator" }, @@ -52,6 +52,7 @@ "search_index": 0 }, { + "allow_on_submit": 1, "doctype": "DocField", "fieldname": "scheduled_date", "fieldtype": "Date", @@ -78,6 +79,7 @@ "report_hide": 1 }, { + "allow_on_submit": 1, "doctype": "DocField", "fieldname": "incharge_name", "fieldtype": "Link", From 5c96b75a68a13b346e67e7ed8181c80693672c54 Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Tue, 31 Dec 2013 17:45:20 +0530 Subject: [PATCH 011/107] fixed maintenance schedule --- erpnext/hr/doctype/employee/employee.js | 10 +- .../hr/doctype/holiday_list/holiday_list.py | 12 +- erpnext/patches.txt | 3 +- ...to_sales_person_in_maintenance_schedule.py | 9 + erpnext/selling/doctype/lead/lead.js | 8 +- .../authorization_rule/authorization_rule.js | 175 +++++++++--------- .../doctype/sales_person/sales_person.js | 18 +- .../doctype/sales_person/sales_person.py | 7 +- .../maintenance_schedule.js | 6 +- .../maintenance_schedule.py | 52 ++++-- .../maintenance_schedule_detail.txt | 10 +- .../maintenance_schedule_item.txt | 6 +- .../maintenance_schedules.txt | 4 +- 13 files changed, 170 insertions(+), 150 deletions(-) create mode 100644 erpnext/patches/4_0/update_incharge_name_to_sales_person_in_maintenance_schedule.py diff --git a/erpnext/hr/doctype/employee/employee.js b/erpnext/hr/doctype/employee/employee.js index 23d50670fb..7ee88f7068 100644 --- a/erpnext/hr/doctype/employee/employee.js +++ b/erpnext/hr/doctype/employee/employee.js @@ -4,10 +4,10 @@ wn.provide("erpnext.hr"); erpnext.hr.EmployeeController = wn.ui.form.Controller.extend({ setup: function() { - this.frm.fields_dict.user_id.get_query = function(doc,cdt,cdn) { - return { query:"webnotes.core.doctype.profile.profile.profile_query"} } - this.frm.fields_dict.reports_to.get_query = function(doc,cdt,cdn) { - return{ query: "erpnext.controllers.queries.employee_query"} } + this.frm.fields_dict.user_id.get_query = function(doc, cdt, cdn) { + return { query:"webnotes.core.doctype.profile.profile.profile_query"} } + this.frm.fields_dict.reports_to.get_query = function(doc, cdt, cdn) { + return { query: "erpnext.controllers.queries.employee_query"} } }, onload: function() { @@ -93,4 +93,4 @@ erpnext.hr.EmployeeController = wn.ui.form.Controller.extend({ }); }, }); -cur_frm.cscript = new erpnext.hr.EmployeeController({frm: cur_frm}); \ No newline at end of file +cur_frm.cscript = new erpnext.hr.EmployeeController({frm: cur_frm}); diff --git a/erpnext/hr/doctype/holiday_list/holiday_list.py b/erpnext/hr/doctype/holiday_list/holiday_list.py index 1045077e77..9f28e4c6b4 100644 --- a/erpnext/hr/doctype/holiday_list/holiday_list.py +++ b/erpnext/hr/doctype/holiday_list/holiday_list.py @@ -8,9 +8,7 @@ from webnotes.utils import add_days, add_years, cint, getdate from webnotes.model import db_exists from webnotes.model.doc import addchild, make_autoname from webnotes.model.bean import copy_doclist -from webnotes import msgprint - - +from webnotes import msgprint, throw, _ import datetime class DocType: @@ -19,7 +17,7 @@ class DocType: self.doclist = doclist def autoname(self): - self.doc.name = make_autoname(self.doc.fiscal_year +"/"+ self.doc.holiday_list_name+"/.###") + self.doc.name = make_autoname(self.doc.fiscal_year + "/" + self.doc.holiday_list_name + "/.###") def validate(self): self.update_default_holiday_list() @@ -38,11 +36,9 @@ class DocType: def validate_values(self): if not self.doc.fiscal_year: - msgprint("Please select Fiscal Year") - raise Exception + throw(_("Please select Fiscal Year")) if not self.doc.weekly_off: - msgprint("Please select weekly off day") - raise Exception + throw(_("Please select weekly off day")) def get_fy_start_end_dates(self): return webnotes.conn.sql("""select year_start_date, year_end_date diff --git a/erpnext/patches.txt b/erpnext/patches.txt index c1ab098298..051c5c7347 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -1,3 +1,4 @@ erpnext.patches.4_0.update_user_properties erpnext.patches.4_0.move_warehouse_user_to_restrictions -erpnext.patches.4_0.new_permissions \ No newline at end of file +erpnext.patches.4_0.new_permissions +erpnext.patches.4_0.update_incharge_name_to_sales_person_in_maintenance_schedule \ No newline at end of file diff --git a/erpnext/patches/4_0/update_incharge_name_to_sales_person_in_maintenance_schedule.py b/erpnext/patches/4_0/update_incharge_name_to_sales_person_in_maintenance_schedule.py new file mode 100644 index 0000000000..7c81ef5acd --- /dev/null +++ b/erpnext/patches/4_0/update_incharge_name_to_sales_person_in_maintenance_schedule.py @@ -0,0 +1,9 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import webnotes + +def execute(): + webnotes.conn.sql("""update `tabMaintenance Schedule Detail` set sales_person=incharge_name""") + webnotes.conn.sql("""update `tabMaintenance Schedule Item` set sales_person=incharge_name""") \ No newline at end of file diff --git a/erpnext/selling/doctype/lead/lead.js b/erpnext/selling/doctype/lead/lead.js index 41f679e34a..228d790e9e 100644 --- a/erpnext/selling/doctype/lead/lead.js +++ b/erpnext/selling/doctype/lead/lead.js @@ -7,18 +7,18 @@ wn.provide("erpnext"); erpnext.LeadController = wn.ui.form.Controller.extend({ setup: function() { - this.frm.fields_dict.customer.get_query = function(doc,cdt,cdn) { + this.frm.fields_dict.customer.get_query = function(doc, cdt, cdn) { return { query: "erpnext.controllers.queries.customer_query" } } }, onload: function() { if(cur_frm.fields_dict.lead_owner.df.options.match(/^Profile/)) { - cur_frm.fields_dict.lead_owner.get_query = function(doc,cdt,cdn) { + cur_frm.fields_dict.lead_owner.get_query = function(doc, cdt, cdn) { return { query:"webnotes.core.doctype.profile.profile.profile_query" } } } if(cur_frm.fields_dict.contact_by.df.options.match(/^Profile/)) { - cur_frm.fields_dict.contact_by.get_query = function(doc,cdt,cdn) { + cur_frm.fields_dict.contact_by.get_query = function(doc, cdt, cdn) { return { query:"webnotes.core.doctype.profile.profile.profile_query" } } } @@ -90,4 +90,4 @@ erpnext.LeadController = wn.ui.form.Controller.extend({ } }); -$.extend(cur_frm.cscript, new erpnext.LeadController({frm: cur_frm})); \ No newline at end of file +$.extend(cur_frm.cscript, new erpnext.LeadController({frm: cur_frm})); diff --git a/erpnext/setup/doctype/authorization_rule/authorization_rule.js b/erpnext/setup/doctype/authorization_rule/authorization_rule.js index 66b14a85ba..b814965ddd 100644 --- a/erpnext/setup/doctype/authorization_rule/authorization_rule.js +++ b/erpnext/setup/doctype/authorization_rule/authorization_rule.js @@ -1,114 +1,113 @@ // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors // License: GNU General Public License v3. See license.txt - - -//--------- ONLOAD ------------- -cur_frm.cscript.onload = function(doc, cdt, cdn) { - -} - // Settings Module +cur_frm.cscript.refresh = function(doc, cdt, cdn) { + if (doc.based_on == 'Grand Total' || doc.based_on == 'Average Discount' || doc.based_on == 'Not Applicable') + hide_field('master_name'); + else + unhide_field('master_name'); -cur_frm.cscript.refresh = function(doc,cdt,cdn){ - + if (doc.based_on == 'Not Applicable') + hide_field('value'); + else + unhide_field('value'); - if(doc.based_on == 'Grand Total' || doc.based_on == 'Average Discount' || doc.based_on == 'Not Applicable') hide_field('master_name'); - else unhide_field('master_name'); - - if(doc.based_on == 'Not Applicable') hide_field('value'); - else unhide_field('value'); - - if(doc.transaction == 'Appraisal'){ - hide_field(['master_name','system_role', 'system_user']); - unhide_field(['to_emp','to_designation']); - if(doc.transaction == 'Appraisal') hide_field('value'); - else unhide_field('value'); - } - else { - unhide_field(['master_name','system_role', 'system_user','value']); - hide_field(['to_emp','to_designation']); - } + if (doc.transaction == 'Appraisal') { + hide_field(['master_name','system_role', 'system_user']); + unhide_field(['to_emp','to_designation']); + + if (doc.transaction == 'Appraisal') + hide_field('value'); + else + unhide_field('value'); + } + else { + unhide_field(['master_name','system_role', 'system_user','value']); + hide_field(['to_emp','to_designation']); + } } -cur_frm.cscript.based_on = function(doc){ - if(doc.based_on == 'Grand Total' || doc.based_on == 'Average Discount' || doc.based_on == 'Not Applicable'){ - doc.master_name = ''; - refresh_field('master_name'); - hide_field('master_name'); - } - else{ - unhide_field('master_name'); - } - - if(doc.based_on == 'Not Applicable') { - doc.value =0; - refresh_field('value'); - hide_field('value'); - } - else unhide_field('value'); +cur_frm.cscript.based_on = function(doc) { + if (doc.based_on == 'Grand Total' || doc.based_on == 'Average Discount' || doc.based_on == 'Not Applicable') { + doc.master_name = ''; + refresh_field('master_name'); + hide_field('master_name'); + } + else + unhide_field('master_name'); + + if (doc.based_on == 'Not Applicable') { + doc.value =0; + refresh_field('value'); + hide_field('value'); + } + else + unhide_field('value'); } -cur_frm.cscript.transaction = function(doc,cdt,cdn){ - if (doc.transaction == 'Appraisal'){ - doc.master_name = doc.system_role = doc.system_user = ''; - refresh_many(['master_name','system_role', 'system_user']); - hide_field(['master_name','system_role', 'system_user']); - unhide_field(['to_emp','to_designation']); - doc.value =0; - refresh_many('value'); - hide_field('value'); - } - else { - unhide_field(['master_name','system_role', 'system_user','value']); - hide_field(['to_emp','to_designation']); - } - - if(doc.transaction == 'Appraisal') doc.based_on == 'Not Applicable'; +cur_frm.cscript.transaction = function(doc, cdt, cdn){ + if (doc.transaction == 'Appraisal') { + doc.based_on == 'Not Applicable'; + doc.master_name = doc.system_role = doc.system_user = ''; + refresh_many(['master_name','system_role', 'system_user', 'based_on']); + hide_field(['master_name','system_role', 'system_user']); + unhide_field(['to_emp','to_designation']); + doc.value = 0; + refresh_many('value'); + hide_field('value'); + } + else { + unhide_field(['master_name','system_role', 'system_user','value']); + hide_field(['to_emp','to_designation']); + } + } +cur_frm.fields_dict.system_user.get_query = function(doc, cdt, cdn) { + return { query:"webnotes.core.doctype.profile.profile.profile_query" } +} -cur_frm.fields_dict.system_user.get_query = function(doc,cdt,cdn) { - return{ query:"webnotes.core.doctype.profile.profile.profile_query" } } - -cur_frm.fields_dict.approving_user.get_query = function(doc,cdt,cdn) { - return{ query:"webnotes.core.doctype.profile.profile.profile_query" } } +cur_frm.fields_dict.approving_user.get_query = function(doc, cdt, cdn) { + return { query:"webnotes.core.doctype.profile.profile.profile_query" } +} cur_frm.fields_dict['approving_role'].get_query = cur_frm.fields_dict['system_role'].get_query; // System Role Trigger // ----------------------- cur_frm.fields_dict['system_role'].get_query = function(doc) { - return{ - filters:[ - ['Role', 'name', 'not in', 'Administrator, Guest, All'] - ] - } + return { + filters:[ + ['Role', 'name', 'not in', 'Administrator, Guest, All'] + ] + } } // Master Name Trigger // -------------------- -cur_frm.fields_dict['master_name'].get_query = function(doc){ - if(doc.based_on == 'Customerwise Discount') - return { - doctype: "Customer", - filters:[ - ['Customer', 'docstatus', '!=', 2] - ] - } - else if(doc.based_on == 'Itemwise Discount') - return { - doctype: "Item", - query: "erpnext.controllers.queries.item_query" - } - else - return { - filters: [ - ['Item', 'name', '=', 'cheating done to avoid null'] - ] - } +cur_frm.fields_dict['master_name'].get_query = function(doc) { + if (doc.based_on == 'Customerwise Discount') + return { + doctype: "Customer", + filters:[ + ['Customer', 'docstatus', '!=', 2] + ] + } + else if (doc.based_on == 'Itemwise Discount') + return { + doctype: "Item", + query: "erpnext.controllers.queries.item_query" + } + else + return { + filters: [ + ['Item', 'name', '=', 'cheating done to avoid null'] + ] + } } -cur_frm.fields_dict.to_emp.get_query = function(doc,cdt,cdn) { - return{ query: "erpnext.controllers.queries.employee_query" } } \ No newline at end of file +cur_frm.fields_dict.to_emp.get_query = function(doc, cdt, cdn) { + return { query: "erpnext.controllers.queries.employee_query" } +} diff --git a/erpnext/setup/doctype/sales_person/sales_person.js b/erpnext/setup/doctype/sales_person/sales_person.js index 19c13b18a4..22f3f98bf2 100644 --- a/erpnext/setup/doctype/sales_person/sales_person.js +++ b/erpnext/setup/doctype/sales_person/sales_person.js @@ -15,15 +15,10 @@ cur_frm.cscript.set_root_readonly = function(doc) { } } - -cur_frm.cscript.onload = function(){ - -} - //get query select sales person -cur_frm.fields_dict['parent_sales_person'].get_query = function(doc,cdt,cdn) { +cur_frm.fields_dict['parent_sales_person'].get_query = function(doc, cdt, cdn) { return{ - filters:[ + filters: [ ['Sales Person', 'is_group', '=', 'Yes'], ['Sales Person', 'name', '!=', doc.sales_person_name] ] @@ -31,10 +26,11 @@ cur_frm.fields_dict['parent_sales_person'].get_query = function(doc,cdt,cdn) { } cur_frm.fields_dict['target_details'].grid.get_field("item_group").get_query = function(doc, cdt, cdn) { - return{ - filters:{ 'is_group': "No" } + return { + filters: { 'is_group': "No" } } } -cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) { - return{ query: "erpnext.controllers.queries.employee_query" } } +cur_frm.fields_dict.employee.get_query = function(doc, cdt, cdn) { + return { query: "erpnext.controllers.queries.employee_query" } +} \ No newline at end of file diff --git a/erpnext/setup/doctype/sales_person/sales_person.py b/erpnext/setup/doctype/sales_person/sales_person.py index cf20087e04..41a986fc30 100644 --- a/erpnext/setup/doctype/sales_person/sales_person.py +++ b/erpnext/setup/doctype/sales_person/sales_person.py @@ -3,10 +3,8 @@ from __future__ import unicode_literals import webnotes - from webnotes.model.bean import getlist from webnotes.utils import flt - from webnotes.utils.nestedset import DocTypeNestedSet class DocType(DocTypeNestedSet): @@ -18,8 +16,7 @@ class DocType(DocTypeNestedSet): def validate(self): for d in getlist(self.doclist, 'target_details'): if not flt(d.target_qty) and not flt(d.target_amount): - webnotes.msgprint("Either target qty or target amount is mandatory.") - raise Exception + webnotes.throw(_("Either target qty or target amount is mandatory.")) def on_update(self): super(DocType, self).on_update() @@ -28,7 +25,7 @@ class DocType(DocTypeNestedSet): def get_email_id(self): profile = webnotes.conn.get_value("Employee", self.doc.employee, "user_id") if not profile: - webnotes.msgprint("User ID (Profile) no set for Employee %s" % self.doc.employee, + webnotes.msgprint("User ID (Profile) not set for Employee %s" % self.doc.employee, raise_exception=True) else: return webnotes.conn.get_value("Profile", profile, "email") or profile diff --git a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js index bcb1bf33b6..2ee8b80e47 100644 --- a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js +++ b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js @@ -5,6 +5,8 @@ wn.provide("erpnext.support"); // TODO commonify this code erpnext.support.MaintenanceSchedule = wn.ui.form.Controller.extend({ refresh: function() { + var me = this; + if (this.frm.doc.docstatus === 0) { this.frm.add_custom_button(wn._('From Sales Order'), function() { @@ -23,7 +25,7 @@ erpnext.support.MaintenanceSchedule = wn.ui.form.Controller.extend({ this.frm.add_custom_button(wn._("Make Maintenance Visit"), function() { wn.model.open_mapped_doc({ method: "erpnext.support.doctype.maintenance_schedule.maintenance_schedule.make_maintenance_visit", - source_name: cur_frm.doc.name + source_name: me.frm.doc.name }) }); } @@ -42,7 +44,7 @@ erpnext.support.MaintenanceSchedule = wn.ui.form.Controller.extend({ $.extend(cur_frm.cscript, new erpnext.support.MaintenanceSchedule({frm: cur_frm})); cur_frm.cscript.onload = function(doc, dt, dn) { - if(!doc.status) + if (!doc.status) set_multiple(dt, dn, { status:'Draft' }); if (doc.__islocal) { diff --git a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py index 270f954922..4fdc9ea37d 100644 --- a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py +++ b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py @@ -32,7 +32,7 @@ class DocType(TransactionBase): self.validate_maintenance_detail() count = 1 s_list = [] - s_list = self.create_schedule_list(d.start_date, d.end_date, d.no_of_visits) + s_list = self.create_schedule_list(d.start_date, d.end_date, d.no_of_visits, d.sales_person) for i in range(d.no_of_visits): child = addchild(self.doc, 'maintenance_schedule_detail', 'Maintenance Schedule Detail', self.doclist) @@ -43,7 +43,7 @@ class DocType(TransactionBase): child.serial_no = d.serial_no child.idx = count count = count + 1 - child.incharge_name = d.incharge_name + child.sales_person = d.sales_person child.save(1) self.on_update() @@ -55,26 +55,26 @@ class DocType(TransactionBase): self.validate_serial_no_warranty() self.validate_schedule() - email_map ={} + 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: - email_map[d.incharge_name] = webnotes.bean("Sales Person", - d.incharge_name).run_method("get_email_id") + if d.sales_person not in email_map: + sp = webnotes.bean("Sales Person", d.sales_person).make_controller() + email_map[d.sales_person] = sp.get_email_id() - scheduled_date =webnotes.conn.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 = webnotes.conn.sql("""select scheduled_date from + `tabMaintenance Schedule Detail` where sales_person=%s and item_code=%s and + parent=%s""", (d.sales_person, d.item_code, self.doc.name), as_dict=1) for key in scheduled_date: - if email_map[d.incharge_name]: + if email_map[d.sales_person]: description = "Reference: %s, Item Code: %s and Customer: %s" % \ (self.doc.name, d.item_code, self.doc.customer) webnotes.bean({ "doctype": "Event", - "owner": email_map[d.incharge_name] or self.doc.owner, + "owner": email_map[d.sales_person] or self.doc.owner, "subject": description, "description": description, "starts_on": key["scheduled_date"] + " 10:00:00", @@ -87,7 +87,7 @@ class DocType(TransactionBase): #get schedule dates #---------------------- - def create_schedule_list(self, start_date, end_date, no_of_visit): + def create_schedule_list(self, start_date, end_date, no_of_visit, sales_person): schedule_list = [] start_date_copy = start_date date_diff = (getdate(end_date) - getdate(start_date)).days @@ -96,9 +96,29 @@ class DocType(TransactionBase): while (getdate(start_date_copy) < getdate(end_date)): start_date_copy = add_days(start_date_copy, add_by) if len(schedule_list) < no_of_visit: - schedule_list.append(getdate(start_date_copy)) + schedule_date = self.validate_schedule_date_for_holiday_list(getdate(start_date_copy), + sales_person) + if schedule_date > getdate(end_date): + schedule_date = getdate(end_date) + schedule_list.append(schedule_date) + return schedule_list - + + def validate_schedule_date_for_holiday_list(self, schedule_date, sales_person): + validated = False + + holiday_list = webnotes.conn.sql_list("""select h.holiday_date from `tabEmployee` emp, + `tabSales Person` sp, `tabHoliday` h where sp.name=%s and emp.name=sp.employee + and h.parent=emp.holiday_list""", sales_person) + + while not validated: + if schedule_date in holiday_list: + schedule_date = add_days(schedule_date, 1) + else: + validated = True + + return schedule_date + #validate date range and periodicity selected #------------------------------------------------- def validate_period(self, arg): @@ -147,7 +167,7 @@ class DocType(TransactionBase): throw(_("Please select Start Date and End Date for item") + " " + d.item_code) elif not d.no_of_visits: throw(_("Please mention no of visits required")) - elif not d.incharge_name: + elif not d.sales_person: throw(_("Please select Incharge Person's name")) if getdate(d.start_date) >= getdate(d.end_date): @@ -297,7 +317,7 @@ def make_maintenance_visit(source_name, target_doclist=None): "field_map": { "parent": "prevdoc_docname", "parenttype": "prevdoc_doctype", - "incharge_name": "service_person" + "sales_person": "service_person" } } }, target_doclist) diff --git a/erpnext/support/doctype/maintenance_schedule_detail/maintenance_schedule_detail.txt b/erpnext/support/doctype/maintenance_schedule_detail/maintenance_schedule_detail.txt index 7a79d8d659..8ed6856d24 100644 --- a/erpnext/support/doctype/maintenance_schedule_detail/maintenance_schedule_detail.txt +++ b/erpnext/support/doctype/maintenance_schedule_detail/maintenance_schedule_detail.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:28:05", "docstatus": 0, - "modified": "2013-12-30 19:32:30", + "modified": "2013-12-31 12:13:38", "modified_by": "Administrator", "owner": "Administrator" }, @@ -52,7 +52,7 @@ "search_index": 0 }, { - "allow_on_submit": 1, + "allow_on_submit": 0, "doctype": "DocField", "fieldname": "scheduled_date", "fieldtype": "Date", @@ -79,13 +79,13 @@ "report_hide": 1 }, { - "allow_on_submit": 1, + "allow_on_submit": 0, "doctype": "DocField", - "fieldname": "incharge_name", + "fieldname": "sales_person", "fieldtype": "Link", "in_filter": 1, "in_list_view": 1, - "label": "Incharge Name", + "label": "Sales Person", "oldfieldname": "incharge_name", "oldfieldtype": "Link", "options": "Sales Person", diff --git a/erpnext/support/doctype/maintenance_schedule_item/maintenance_schedule_item.txt b/erpnext/support/doctype/maintenance_schedule_item/maintenance_schedule_item.txt index f42b48bf55..43d281d9e6 100644 --- a/erpnext/support/doctype/maintenance_schedule_item/maintenance_schedule_item.txt +++ b/erpnext/support/doctype/maintenance_schedule_item/maintenance_schedule_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:28:05", "docstatus": 0, - "modified": "2013-12-20 19:23:20", + "modified": "2013-12-31 12:08:32", "modified_by": "Administrator", "owner": "Administrator" }, @@ -112,10 +112,10 @@ }, { "doctype": "DocField", - "fieldname": "incharge_name", + "fieldname": "sales_person", "fieldtype": "Link", "in_filter": 1, - "label": "Sales Person Incharge", + "label": "Sales Person", "oldfieldname": "incharge_name", "oldfieldtype": "Link", "options": "Sales Person", diff --git a/erpnext/support/report/maintenance_schedules/maintenance_schedules.txt b/erpnext/support/report/maintenance_schedules/maintenance_schedules.txt index 766eb20151..eec3d7f852 100644 --- a/erpnext/support/report/maintenance_schedules/maintenance_schedules.txt +++ b/erpnext/support/report/maintenance_schedules/maintenance_schedules.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-06 14:25:21", "docstatus": 0, - "modified": "2013-10-09 12:23:27", + "modified": "2013-12-31 12:24:48", "modified_by": "Administrator", "owner": "Administrator" }, @@ -10,7 +10,7 @@ "doctype": "Report", "is_standard": "Yes", "name": "__common__", - "query": "SELECT\n ms_sch.scheduled_date as \"Schedule Date:Date:120\",\n\tms_sch.item_code as \"Item Code:Link/Item:120\",\n\tms_sch.item_name as \"Item Name::120\",\n\tms_sch.serial_no as \"Serial No::120\",\n\tms_sch.incharge_name as \"Incharge::120\",\n\tms.customer_name as \"Customer:Link/Customer:120\",\n\tms.address_display as \"Customer Address::120\",\n\tms_item.prevdoc_docname as \"Sales Order:Link/Sales Order:120\",\n\tms.company as \"Company:Link/Company:120\"\n\t\nFROM\n\t`tabMaintenance Schedule` ms, \n `tabMaintenance Schedule Detail` ms_sch, \n `tabMaintenance Schedule Item` ms_item\nWHERE\n\tms.name = ms_sch.parent and ms.name = ms_item.parent and ms.docstatus = 1\nORDER BY\n\tms_sch.scheduled_date asc, ms_sch.item_code asc", + "query": "SELECT\n ms_sch.scheduled_date as \"Schedule Date:Date:120\",\n\tms_sch.item_code as \"Item Code:Link/Item:120\",\n\tms_sch.item_name as \"Item Name::120\",\n\tms_sch.serial_no as \"Serial No::120\",\n\tms_sch.sales_person as \"Sales Person::120\",\n\tms.customer_name as \"Customer:Link/Customer:120\",\n\tms.address_display as \"Customer Address::120\",\n\tms_item.prevdoc_docname as \"Sales Order:Link/Sales Order:120\",\n\tms.company as \"Company:Link/Company:120\"\n\t\nFROM\n\t`tabMaintenance Schedule` ms, \n `tabMaintenance Schedule Detail` ms_sch, \n `tabMaintenance Schedule Item` ms_item\nWHERE\n\tms.name = ms_sch.parent and ms.name = ms_item.parent and ms.docstatus = 1\nORDER BY\n\tms_sch.scheduled_date asc, ms_sch.item_code asc", "ref_doctype": "Maintenance Schedule", "report_name": "Maintenance Schedules", "report_type": "Query Report" From 28acaeb3456e31351e3dd32c0ba6d886c70a7442 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 3 Jan 2014 11:16:16 +0530 Subject: [PATCH 012/107] Fixes in valuation rate calculation in purchase receipt --- controllers/buying_controller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/buying_controller.py b/controllers/buying_controller.py index 4aa08d6c55..f014f72ee5 100644 --- a/controllers/buying_controller.py +++ b/controllers/buying_controller.py @@ -184,7 +184,7 @@ class BuyingController(StockController): for item in self.doclist.get({"parentfield": parentfield}): - if item.item_code and item.qty and item.item_code in stock_items: + if item.item_code and item.qty and stock_items_amount and item.item_code in stock_items: item.item_tax_amount = flt(flt(item.amount) * total_valuation_amount \ / stock_items_amount, self.precision("item_tax_amount", item)) From a4db83a934eb4fefd356ae6f55d88f97e3d45af9 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 3 Jan 2014 12:13:18 +0530 Subject: [PATCH 013/107] Fixes in valuation rate calculation in purchase receipt --- .../purchase_invoice/purchase_invoice.py | 12 ------------ accounts/utils.py | 2 ++ controllers/buying_controller.py | 17 +++++++++++------ 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.py b/accounts/doctype/purchase_invoice/purchase_invoice.py index 404627af25..0b8ad46dd0 100644 --- a/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -350,7 +350,6 @@ class DocType(BuyingController): # item gl entries stock_item_and_auto_accounting_for_stock = False stock_items = self.get_stock_items() - # rounding_diff = 0.0 for item in self.doclist.get({"parentfield": "entries"}): if auto_accounting_for_stock and item.item_code in stock_items: if flt(item.valuation_rate): @@ -361,11 +360,6 @@ class DocType(BuyingController): valuation_amt = item.amount + item.item_tax_amount + item.rm_supp_cost - # rounding_diff += (flt(item.amount, self.precision("amount", item)) + - # flt(item.item_tax_amount, self.precision("item_tax_amount", item)) + - # flt(item.rm_supp_cost, self.precision("rm_supp_cost", item)) - - # valuation_amt) - gl_entries.append( self.get_gl_dict({ "account": item.expense_head, @@ -392,12 +386,6 @@ class DocType(BuyingController): # this will balance out valuation amount included in cost of goods sold expenses_included_in_valuation = \ self.get_company_default("expenses_included_in_valuation") - - # if rounding_diff: - # import operator - # cost_center_with_max_value = max(valuation_tax.iteritems(), - # key=operator.itemgetter(1))[0] - # valuation_tax[cost_center_with_max_value] -= flt(rounding_diff) for cost_center, amount in valuation_tax.items(): gl_entries.append( diff --git a/accounts/utils.py b/accounts/utils.py index 8971c80f99..a5fb390e9f 100644 --- a/accounts/utils.py +++ b/accounts/utils.py @@ -31,6 +31,8 @@ def get_fiscal_years(date=None, fiscal_year=None, label="Date", verbose=1): if not fy: error_msg = """%s %s not in any Fiscal Year""" % (label, formatdate(date)) + error_msg = """{msg}: {date}""".format(msg=_("Fiscal Year does not exist for date"), + date=formatdate(date)) if verbose: webnotes.msgprint(error_msg) raise FiscalYearError, error_msg diff --git a/controllers/buying_controller.py b/controllers/buying_controller.py index f014f72ee5..3c6981d6cb 100644 --- a/controllers/buying_controller.py +++ b/controllers/buying_controller.py @@ -174,9 +174,11 @@ class BuyingController(StockController): """ stock_items = self.get_stock_items() - stock_items_amount = sum([flt(d.amount) for d in - self.doclist.get({"parentfield": parentfield}) - if d.item_code and d.item_code in stock_items]) + stock_items_qty, stock_items_amount = 0, 0 + for d in self.doclist.get({"parentfield": parentfield}): + if d.item_code and d.item_code in stock_items: + stock_items_qty += flt(d.qty) + stock_items_amount += flt(d.amount) total_valuation_amount = sum([flt(d.tax_amount) for d in self.doclist.get({"parentfield": "purchase_tax_details"}) @@ -184,9 +186,12 @@ class BuyingController(StockController): for item in self.doclist.get({"parentfield": parentfield}): - if item.item_code and item.qty and stock_items_amount and item.item_code in stock_items: - item.item_tax_amount = flt(flt(item.amount) * total_valuation_amount \ - / stock_items_amount, self.precision("item_tax_amount", item)) + if item.item_code and item.qty and item.item_code in stock_items: + item_proportion = flt(item.amount) / stock_items_amount if stock_items_amount \ + else flt(item.qty) / stock_items_qty + + item.item_tax_amount = flt(item_proportion * total_valuation_amount, + self.precision("item_tax_amount", item)) self.round_floats_in(item) From 6472bdace2b67e023563c2ca00b41cdfb2c9683e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 3 Jan 2014 12:30:24 +0530 Subject: [PATCH 014/107] Fixes in general ledger report --- accounts/doctype/journal_voucher/journal_voucher.js | 3 ++- accounts/doctype/purchase_invoice/purchase_invoice.js | 3 ++- accounts/doctype/sales_invoice/sales_invoice.js | 3 ++- accounts/report/general_ledger/general_ledger.py | 2 +- public/js/controllers/stock_controller.js | 3 ++- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/accounts/doctype/journal_voucher/journal_voucher.js b/accounts/doctype/journal_voucher/journal_voucher.js index 6b94ba170a..e5cea8cc79 100644 --- a/accounts/doctype/journal_voucher/journal_voucher.js +++ b/accounts/doctype/journal_voucher/journal_voucher.js @@ -120,7 +120,8 @@ cur_frm.cscript.refresh = function(doc) { "voucher_no": doc.name, "from_date": doc.posting_date, "to_date": doc.posting_date, - "company": doc.company + "company": doc.company, + group_by_voucher: 0 }; wn.set_route("query-report", "General Ledger"); }, "icon-table"); diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.js b/accounts/doctype/purchase_invoice/purchase_invoice.js index 0bdc70e13d..1055bdd25d 100644 --- a/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -35,7 +35,8 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ "voucher_no": doc.name, "from_date": doc.posting_date, "to_date": doc.posting_date, - "company": doc.company + "company": doc.company, + group_by_voucher: 0 }; wn.set_route("query-report", "General Ledger"); }, "icon-table"); diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js index a390fb4ed7..3bdef5bb56 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.js +++ b/accounts/doctype/sales_invoice/sales_invoice.js @@ -54,7 +54,8 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte "voucher_no": doc.name, "from_date": doc.posting_date, "to_date": doc.posting_date, - "company": doc.company + "company": doc.company, + group_by_voucher: 0 }; wn.set_route("query-report", "General Ledger"); }, "icon-table"); diff --git a/accounts/report/general_ledger/general_ledger.py b/accounts/report/general_ledger/general_ledger.py index 2efc8241c0..855b7d1c7a 100644 --- a/accounts/report/general_ledger/general_ledger.py +++ b/accounts/report/general_ledger/general_ledger.py @@ -136,7 +136,7 @@ def get_accountwise_gle(filters, gl_entries, gle_map): or cstr(gle.is_advance) == "Yes"): gle_map[gle.account].opening += amount opening += amount - elif gle.posting_date < filters.to_date: + elif gle.posting_date <= filters.to_date: gle_map[gle.account].entries.append(gle) gle_map[gle.account].total_debit += flt(gle.debit) gle_map[gle.account].total_credit += flt(gle.credit) diff --git a/public/js/controllers/stock_controller.js b/public/js/controllers/stock_controller.js index d2fb904419..6a4261c22a 100644 --- a/public/js/controllers/stock_controller.js +++ b/public/js/controllers/stock_controller.js @@ -28,7 +28,8 @@ erpnext.stock.StockController = wn.ui.form.Controller.extend({ voucher_no: me.frm.doc.name, from_date: me.frm.doc.posting_date, to_date: me.frm.doc.posting_date, - company: me.frm.doc.company + company: me.frm.doc.company, + group_by_voucher: false }; wn.set_route("query-report", "General Ledger"); }, "icon-table"); From b0a9581e59c6d7c8c1148afefb26c528bd464c2d Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Fri, 3 Jan 2014 12:44:00 +0530 Subject: [PATCH 015/107] fixed accounts receivable for customer name --- .../accounts_receivable.py | 43 +++++++++++++------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/accounts/report/accounts_receivable/accounts_receivable.py b/accounts/report/accounts_receivable/accounts_receivable.py index 945bae434a..1c76f9baf1 100644 --- a/accounts/report/accounts_receivable/accounts_receivable.py +++ b/accounts/report/accounts_receivable/accounts_receivable.py @@ -18,16 +18,23 @@ class AccountsReceivableReport(object): return self.get_columns(), self.get_data() def get_columns(self): - return [ + columns = [ "Posting Date:Date:80", "Account:Link/Account:150", "Voucher Type::110", "Voucher No::120", "::30", "Due Date:Date:80", "Invoiced Amount:Currency:100", "Payment Received:Currency:100", "Outstanding Amount:Currency:100", "Age:Int:50", "0-30:Currency:100", - "30-60:Currency:100", "60-90:Currency:100", "90-Above:Currency:100", - "Customer:Link/Customer:200", "Territory:Link/Territory:80", "Remarks::200" + "30-60:Currency:100", "60-90:Currency:100", "90-Above:Currency:100" ] + naming_by = self.get_selling_settings() + if naming_by[0].value == "Naming Series": + columns += ["Customer:Link/Customer:200"] + + columns += ["Customer Name::110", "Territory:Link/Territory:80", "Remarks::200"] + + return columns + def get_data(self): data = [] future_vouchers = self.get_entries_after(self.filters.report_date) @@ -42,10 +49,15 @@ class AccountsReceivableReport(object): gle.voucher_type, gle.voucher_no, due_date, invoiced_amount, payment_received, outstanding_amount] - entry_date = due_date if self.filters.ageing_based_on=="Due Date" \ + entry_date = due_date if self.filters.ageing_based_on == "Due Date" \ else gle.posting_date row += get_ageing_data(self.age_as_on, entry_date, outstanding_amount) - row += [self.get_customer(gle.account), self.get_territory(gle.account), gle.remarks] + + naming_by = self.get_selling_settings() + if naming_by[0].value == "Naming Series": + row += [self.get_customer(gle.account)] + + row += [self.get_customer_name(gle.account), self.get_territory(gle.account), gle.remarks] data.append(row) for i in range(0,len(data)): @@ -53,7 +65,11 @@ class AccountsReceivableReport(object): % ("/".join(["#Form", data[i][2], data[i][3]]),)) return data - + + def get_selling_settings(self): + return webnotes.conn.sql("""select value from `tabSingles` where + doctype='Selling Settings' and field='cust_master_name'""", as_dict=1) + def get_entries_after(self, report_date): # returns a distinct list return list(set([(e.voucher_type, e.voucher_no) for e in self.get_gl_entries() @@ -77,18 +93,21 @@ class AccountsReceivableReport(object): return flt(gle.debit) - flt(gle.credit) - payment_received def get_customer(self, account): + return self.get_account_map().get(account).get("customer") or "" + + def get_customer_name(self, account): return self.get_account_map().get(account).get("customer_name") or "" - + def get_territory(self, account): return self.get_account_map().get(account).get("territory") or "" def get_account_map(self): if not hasattr(self, "account_map"): self.account_map = dict(((r.name, r) for r in webnotes.conn.sql("""select - account.name, customer.name as customer_name, customer.territory - from `tabAccount` account, `tabCustomer` customer - where account.master_type="Customer" - and customer.name=account.master_name""", as_dict=True))) + acc.name, cust.name as customer, cust.customer_name, cust.territory + from `tabAccount` acc, `tabCustomer` cust + where acc.master_type="Customer" + and cust.name=acc.master_name""", as_dict=True))) return self.account_map @@ -164,4 +183,4 @@ def get_ageing_data(age_as_on, entry_date, outstanding_amount): if index is None: index = 3 outstanding_range[index] = outstanding_amount - return [age] + outstanding_range + return [age] + outstanding_range \ No newline at end of file From b4eba77f7b00d92a25335d6cfc2adf454763601d Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Fri, 3 Jan 2014 12:58:04 +0530 Subject: [PATCH 016/107] fixed accounts receivable --- .../accounts_receivable/accounts_receivable.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/accounts/report/accounts_receivable/accounts_receivable.py b/accounts/report/accounts_receivable/accounts_receivable.py index 1c76f9baf1..0407039e41 100644 --- a/accounts/report/accounts_receivable/accounts_receivable.py +++ b/accounts/report/accounts_receivable/accounts_receivable.py @@ -26,9 +26,8 @@ class AccountsReceivableReport(object): "Outstanding Amount:Currency:100", "Age:Int:50", "0-30:Currency:100", "30-60:Currency:100", "60-90:Currency:100", "90-Above:Currency:100" ] - - naming_by = self.get_selling_settings() - if naming_by[0].value == "Naming Series": + + if self.get_customer_naming() == "Naming Series": columns += ["Customer:Link/Customer:200"] columns += ["Customer Name::110", "Territory:Link/Territory:80", "Remarks::200"] @@ -53,8 +52,7 @@ class AccountsReceivableReport(object): else gle.posting_date row += get_ageing_data(self.age_as_on, entry_date, outstanding_amount) - naming_by = self.get_selling_settings() - if naming_by[0].value == "Naming Series": + if self.get_customer_naming() == "Naming Series": row += [self.get_customer(gle.account)] row += [self.get_customer_name(gle.account), self.get_territory(gle.account), gle.remarks] @@ -66,9 +64,8 @@ class AccountsReceivableReport(object): return data - def get_selling_settings(self): - return webnotes.conn.sql("""select value from `tabSingles` where - doctype='Selling Settings' and field='cust_master_name'""", as_dict=1) + def get_customer_naming(self): + return webnotes.conn.get_value("Selling Settings", None, "cust_master_name") def get_entries_after(self, report_date): # returns a distinct list From 8a0b7cece13a46b1f62f1dc7a70002f24a3f6731 Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Fri, 3 Jan 2014 13:21:38 +0530 Subject: [PATCH 017/107] accounts receivable fixed --- .../accounts_receivable.py | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/accounts/report/accounts_receivable/accounts_receivable.py b/accounts/report/accounts_receivable/accounts_receivable.py index 0407039e41..781db2aaf3 100644 --- a/accounts/report/accounts_receivable/accounts_receivable.py +++ b/accounts/report/accounts_receivable/accounts_receivable.py @@ -15,26 +15,28 @@ class AccountsReceivableReport(object): else self.filters.report_date def run(self): - return self.get_columns(), self.get_data() + customer_naming_by = webnotes.conn.get_value("Selling Settings", None, "cust_master_name") + return self.get_columns(customer_naming_by), self.get_data(customer_naming_by) - def get_columns(self): + def get_columns(self, customer_naming_by): columns = [ "Posting Date:Date:80", "Account:Link/Account:150", "Voucher Type::110", "Voucher No::120", "::30", "Due Date:Date:80", "Invoiced Amount:Currency:100", "Payment Received:Currency:100", "Outstanding Amount:Currency:100", "Age:Int:50", "0-30:Currency:100", - "30-60:Currency:100", "60-90:Currency:100", "90-Above:Currency:100" + "30-60:Currency:100", "60-90:Currency:100", "90-Above:Currency:100", + "Customer:Link/Customer:200" ] - if self.get_customer_naming() == "Naming Series": - columns += ["Customer:Link/Customer:200"] + if customer_naming_by == "Naming Series": + columns += ["Customer Name::110"] - columns += ["Customer Name::110", "Territory:Link/Territory:80", "Remarks::200"] + columns += ["Territory:Link/Territory:80", "Remarks::200"] return columns - def get_data(self): + def get_data(self, customer_naming_by): data = [] future_vouchers = self.get_entries_after(self.filters.report_date) for gle in self.get_entries_till(self.filters.report_date): @@ -50,23 +52,21 @@ class AccountsReceivableReport(object): outstanding_amount] entry_date = due_date if self.filters.ageing_based_on == "Due Date" \ else gle.posting_date - row += get_ageing_data(self.age_as_on, entry_date, outstanding_amount) + row += get_ageing_data(self.age_as_on, entry_date, outstanding_amount) + \ + [self.get_customer(gle.account)] - if self.get_customer_naming() == "Naming Series": - row += [self.get_customer(gle.account)] + if customer_naming_by == "Naming Series": + row += [self.get_customer_name(gle.account)] - row += [self.get_customer_name(gle.account), self.get_territory(gle.account), gle.remarks] + row += [self.get_territory(gle.account), gle.remarks] data.append(row) - for i in range(0,len(data)): + for i in range(0, len(data)): data[i].insert(4, """""" \ % ("/".join(["#Form", data[i][2], data[i][3]]),)) return data - def get_customer_naming(self): - return webnotes.conn.get_value("Selling Settings", None, "cust_master_name") - def get_entries_after(self, report_date): # returns a distinct list return list(set([(e.voucher_type, e.voucher_no) for e in self.get_gl_entries() @@ -163,7 +163,7 @@ class AccountsReceivableReport(object): def execute(filters=None): return AccountsReceivableReport(filters).run() - + def get_ageing_data(age_as_on, entry_date, outstanding_amount): # [0-30, 30-60, 60-90, 90-above] outstanding_range = [0.0, 0.0, 0.0, 0.0] From 866103bf666cd6bec9e96e478f8bf701207fb614 Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Fri, 3 Jan 2014 13:57:06 +0600 Subject: [PATCH 018/107] bumped to version 3.4.5 --- config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.json b/config.json index e8955b178c..89c1332005 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,6 @@ { "app_name": "ERPNext", - "app_version": "3.4.4", + "app_version": "3.4.5", "base_template": "app/portal/templates/base.html", "modules": { "Accounts": { From 33f6b9d6e8079df15c32773008f7c68fadbb4715 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 3 Jan 2014 15:12:16 +0530 Subject: [PATCH 019/107] Unlinked message listing all linked entries while cancelling an accounting trandsaction --- accounts/utils.py | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/accounts/utils.py b/accounts/utils.py index a5fb390e9f..fdd57b35c2 100644 --- a/accounts/utils.py +++ b/accounts/utils.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals import webnotes -from webnotes.utils import nowdate, nowtime, cstr, flt, now, getdate, add_months +from webnotes.utils import nowdate, cstr, flt, now, getdate, add_months from webnotes.model.doc import addchild from webnotes import msgprint, _ from webnotes.utils import formatdate @@ -64,7 +64,6 @@ def get_balance_on(account=None, date=None): try: year_start_date = get_fiscal_year(date, verbose=0)[1] except FiscalYearError, e: - from webnotes.utils import getdate if getdate(date) > getdate(nowdate()): # if fiscal year not found and the date is greater than today # get fiscal year for today's date and its corresponding year start date @@ -222,17 +221,26 @@ def get_cost_center_list(doctype, txt, searchfield, start, page_len, filters): tuple(filter_values + ["%%%s%%" % txt, start, page_len])) def remove_against_link_from_jv(ref_type, ref_no, against_field): - webnotes.conn.sql("""update `tabJournal Voucher Detail` set `%s`=null, - modified=%s, modified_by=%s - where `%s`=%s and docstatus < 2""" % (against_field, "%s", "%s", against_field, "%s"), - (now(), webnotes.session.user, ref_no)) + linked_jv = webnotes.conn.sql_list("""select parent from `tabJournal Voucher Detail` + where `%s`=%s and docstatus < 2""" % (against_field, "%s"), (ref_no)) + + if linked_jv: + webnotes.conn.sql("""update `tabJournal Voucher Detail` set `%s`=null, + modified=%s, modified_by=%s + where `%s`=%s and docstatus < 2""" % (against_field, "%s", "%s", against_field, "%s"), + (now(), webnotes.session.user, ref_no)) - webnotes.conn.sql("""update `tabGL Entry` - set against_voucher_type=null, against_voucher=null, - modified=%s, modified_by=%s - where against_voucher_type=%s and against_voucher=%s - and voucher_no != ifnull(against_voucher, '')""", - (now(), webnotes.session.user, ref_type, ref_no)) + webnotes.conn.sql("""update `tabGL Entry` + set against_voucher_type=null, against_voucher=null, + modified=%s, modified_by=%s + where against_voucher_type=%s and against_voucher=%s + and voucher_no != ifnull(against_voucher, '')""", + (now(), webnotes.session.user, ref_type, ref_no)) + + webnotes.msgprint("{msg} {linked_jv}".format(msg = _("""Following linked Journal Vouchers \ + made against this transaction has been unlinked. You can link them again with other \ + transactions via Payment Reconciliation Tool."""), linked_jv="\n".join(linked_jv))) + @webnotes.whitelist() def get_company_default(company, fieldname): @@ -370,4 +378,4 @@ def get_account_for(account_for_doctype, account_for): account_for_field = "account_type" return webnotes.conn.get_value("Account", {account_for_field: account_for_doctype, - "master_name": account_for}) + "master_name": account_for}) \ No newline at end of file From 7f0406f281a5d38f442244fd7373a9daf29975e4 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 3 Jan 2014 17:43:19 +0530 Subject: [PATCH 020/107] Chekc over billing validation considering tolerance --- controllers/accounts_controller.py | 35 ++++++++++++++++++------- controllers/status_updater.py | 41 ++++++++++++++++-------------- 2 files changed, 48 insertions(+), 28 deletions(-) diff --git a/controllers/accounts_controller.py b/controllers/accounts_controller.py index 11480c9ebe..1a399219e4 100644 --- a/controllers/accounts_controller.py +++ b/controllers/accounts_controller.py @@ -381,24 +381,41 @@ class AccountsController(TransactionBase): }) def validate_multiple_billing(self, ref_dt, item_ref_dn, based_on, parentfield): + from controllers.status_updater import get_tolerance_for + item_tolerance = {} + global_tolerance = None + for item in self.doclist.get({"parentfield": "entries"}): if item.fields.get(item_ref_dn): already_billed = webnotes.conn.sql("""select sum(%s) from `tab%s` where %s=%s and docstatus=1""" % (based_on, self.tname, item_ref_dn, '%s'), item.fields[item_ref_dn])[0][0] - max_allowed_amt = flt(webnotes.conn.get_value(ref_dt + " Item", - item.fields[item_ref_dn], based_on), self.precision(based_on, item)) - total_billed_amt = flt(flt(already_billed) + flt(item.fields[based_on]), self.precision(based_on, item)) + + ref_amt = flt(webnotes.conn.get_value(ref_dt + " Item", + item.fields[item_ref_dn], based_on), self.precision(based_on, item)) + + tolerance, item_tolerance, global_tolerance = get_tolerance_for(item.item_code, + item_tolerance, global_tolerance) - if max_allowed_amt and total_billed_amt - max_allowed_amt > 0.02: - webnotes.msgprint(_("Row ")+ cstr(item.idx) + ": " + cstr(item.item_code) + - _(" will be over-billed against mentioned ") + cstr(ref_dt) + - _(". Max allowed " + cstr(based_on) + ": " + cstr(max_allowed_amt)), - raise_exception=1) - + max_allowed_amt = flt(ref_amt * (100 + tolerance) / 100) + + if total_billed_amt - max_allowed_amt > 0.01: + reduce_by = total_billed_amt - max_allowed_amt + + webnotes.throw(_("Row #") + cstr(item.idx) + ": " + + _(" Max amount allowed for Item ") + cstr(item.item_code) + + _(" against ") + ref_dt + " " + + cstr(item.fields[ref_dt.lower().replace(" ", "_")]) + _(" is ") + + cstr(max_allowed_amt) + ". \n" + + _("""If you want to increase your overflow tolerance, please increase \ + tolerance % in Global Defaults or Item master. + Or, you must reduce the amount by """) + cstr(reduce_by) + "\n" + + _("""Also, please check if the order item has already been billed \ + in the Sales Order""")) + def get_company_default(self, fieldname): from accounts.utils import get_company_default return get_company_default(self.doc.company, fieldname) diff --git a/controllers/status_updater.py b/controllers/status_updater.py index b2745268f7..a285c4798d 100644 --- a/controllers/status_updater.py +++ b/controllers/status_updater.py @@ -151,7 +151,9 @@ class StatusUpdater(DocListController): """ # check if overflow is within tolerance - tolerance = self.get_tolerance_for(item['item_code']) + tolerance, self.tolerance, self.global_tolerance = get_tolerance_for(item['item_code'], + self.tolerance, self.global_tolerance) + overflow_percent = ((item[args['target_field']] - item[args['target_ref_field']]) / item[args['target_ref_field']]) * 100 @@ -170,23 +172,6 @@ class StatusUpdater(DocListController): Also, please check if the order item has already been billed in the Sales Order""" % item, raise_exception=1) - - def get_tolerance_for(self, item_code): - """ - Returns the tolerance for the item, if not set, returns global tolerance - """ - if self.tolerance.get(item_code): return self.tolerance[item_code] - - tolerance = flt(webnotes.conn.get_value('Item',item_code,'tolerance') or 0) - - if not tolerance: - if self.global_tolerance == None: - self.global_tolerance = flt(webnotes.conn.get_value('Global Defaults', None, - 'tolerance')) - tolerance = self.global_tolerance - - self.tolerance[item_code] = tolerance - return tolerance def update_qty(self, change_modified=True): @@ -245,4 +230,22 @@ class StatusUpdater(DocListController): set %(status_field)s = if(ifnull(%(target_parent_field)s,0)<0.001, 'Not %(keyword)s', if(%(target_parent_field)s>=99.99, 'Fully %(keyword)s', 'Partly %(keyword)s')) - where name='%(name)s'""" % args) \ No newline at end of file + where name='%(name)s'""" % args) + +def get_tolerance_for(item_code, item_tolerance={}, global_tolerance=None): + """ + Returns the tolerance for the item, if not set, returns global tolerance + """ + if item_tolerance.get(item_code): + return item_tolerance[item_code], item_tolerance, global_tolerance + + tolerance = flt(webnotes.conn.get_value('Item',item_code,'tolerance') or 0) + + if not tolerance: + if global_tolerance == None: + global_tolerance = flt(webnotes.conn.get_value('Global Defaults', None, + 'tolerance')) + tolerance = global_tolerance + + item_tolerance[item_code] = tolerance + return tolerance, item_tolerance, global_tolerance \ No newline at end of file From b476c989a40da3d025155311fcbc945468a860d6 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 3 Jan 2014 17:43:52 +0530 Subject: [PATCH 021/107] Fixes test cases for date and year mismatch --- accounts/doctype/sales_invoice/test_sales_invoice.py | 9 +++++---- buying/doctype/purchase_order/test_purchase_order.py | 7 ++++--- .../doctype/production_order/test_production_order.py | 3 ++- selling/doctype/quotation/test_quotation.py | 1 + selling/doctype/sales_order/test_sales_order.py | 1 + stock/doctype/material_request/test_material_request.py | 1 + 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/accounts/doctype/sales_invoice/test_sales_invoice.py b/accounts/doctype/sales_invoice/test_sales_invoice.py index 5a573f9441..e98dfdc2a0 100644 --- a/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -565,16 +565,17 @@ class TestSalesInvoice(unittest.TestCase): where against_invoice=%s""", si.doc.name)) def test_recurring_invoice(self): - from webnotes.utils import now_datetime, get_first_day, get_last_day, add_to_date - today = now_datetime().date() - + from webnotes.utils import get_first_day, get_last_day, add_to_date, nowdate, getdate + from accounts.utils import get_fiscal_year + today = nowdate() base_si = webnotes.bean(copy=test_records[0]) base_si.doc.fields.update({ "convert_into_recurring_invoice": 1, "recurring_type": "Monthly", "notification_email_address": "test@example.com, test1@example.com, test2@example.com", - "repeat_on_day_of_month": today.day, + "repeat_on_day_of_month": getdate(today).day, "posting_date": today, + "fiscal_year": get_fiscal_year(today)[0], "invoice_period_from_date": get_first_day(today), "invoice_period_to_date": get_last_day(today) }) diff --git a/buying/doctype/purchase_order/test_purchase_order.py b/buying/doctype/purchase_order/test_purchase_order.py index f6c435c6fb..e1933982c4 100644 --- a/buying/doctype/purchase_order/test_purchase_order.py +++ b/buying/doctype/purchase_order/test_purchase_order.py @@ -22,7 +22,7 @@ class TestPurchaseOrder(unittest.TestCase): pr = make_purchase_receipt(po.doc.name) pr[0]["supplier_warehouse"] = "_Test Warehouse 1 - _TC" - + pr[0]["posting_date"] = "2013-05-12" self.assertEquals(pr[0]["doctype"], "Purchase Receipt") self.assertEquals(len(pr), len(test_records[0])) @@ -52,7 +52,7 @@ class TestPurchaseOrder(unittest.TestCase): self.assertEquals(pr[0]["doctype"], "Purchase Receipt") self.assertEquals(len(pr), len(test_records[0])) - + pr[0]["posting_date"] = "2013-05-12" pr[0].naming_series = "_T-Purchase Receipt-" pr[1].qty = 4.0 pr_bean = webnotes.bean(pr) @@ -66,6 +66,7 @@ class TestPurchaseOrder(unittest.TestCase): pr1 = make_purchase_receipt(po.doc.name) pr1[0].naming_series = "_T-Purchase Receipt-" + pr1[0]["posting_date"] = "2013-05-12" pr1[1].qty = 8 pr1_bean = webnotes.bean(pr1) pr1_bean.insert() @@ -88,7 +89,7 @@ class TestPurchaseOrder(unittest.TestCase): self.assertEquals(pi[0]["doctype"], "Purchase Invoice") self.assertEquals(len(pi), len(test_records[0])) - + pi[0]["posting_date"] = "2013-05-12" pi[0].bill_no = "NA" webnotes.bean(pi).insert() diff --git a/manufacturing/doctype/production_order/test_production_order.py b/manufacturing/doctype/production_order/test_production_order.py index 52697292c8..ca28708cc1 100644 --- a/manufacturing/doctype/production_order/test_production_order.py +++ b/manufacturing/doctype/production_order/test_production_order.py @@ -34,6 +34,7 @@ class TestProductionOrder(unittest.TestCase): stock_entry = webnotes.bean(stock_entry) stock_entry.doc.fg_completed_qty = 4 + stock_entry.doc.posting_date = "2013-05-12" stock_entry.run_method("get_items") stock_entry.submit() @@ -50,7 +51,7 @@ class TestProductionOrder(unittest.TestCase): stock_entry = make_stock_entry(pro_order, "Manufacture/Repack") stock_entry = webnotes.bean(stock_entry) - + stock_entry.doc.posting_date = "2013-05-12" stock_entry.doc.fg_completed_qty = 15 stock_entry.run_method("get_items") stock_entry.insert() diff --git a/selling/doctype/quotation/test_quotation.py b/selling/doctype/quotation/test_quotation.py index 8f0e644cb9..327d72f2e0 100644 --- a/selling/doctype/quotation/test_quotation.py +++ b/selling/doctype/quotation/test_quotation.py @@ -28,6 +28,7 @@ class TestQuotation(unittest.TestCase): sales_order[0]["delivery_date"] = "2014-01-01" sales_order[0]["naming_series"] = "_T-Quotation-" + sales_order[0]["transaction_date"] = "2013-05-12" webnotes.bean(sales_order).insert() diff --git a/selling/doctype/sales_order/test_sales_order.py b/selling/doctype/sales_order/test_sales_order.py index 1549b24c89..a6fe8fb5bb 100644 --- a/selling/doctype/sales_order/test_sales_order.py +++ b/selling/doctype/sales_order/test_sales_order.py @@ -53,6 +53,7 @@ class TestSalesOrder(unittest.TestCase): self.assertEquals(len([d for d in si if d["doctype"]=="Sales Invoice Item"]), 1) si = webnotes.bean(si) + si.doc.posting_date = "2013-10-10" si.insert() si.submit() diff --git a/stock/doctype/material_request/test_material_request.py b/stock/doctype/material_request/test_material_request.py index c19bfd3928..81ae27d8c2 100644 --- a/stock/doctype/material_request/test_material_request.py +++ b/stock/doctype/material_request/test_material_request.py @@ -125,6 +125,7 @@ class TestMaterialRequest(unittest.TestCase): from stock.doctype.material_request.material_request import make_purchase_order po_doclist = make_purchase_order(mr.doc.name) po_doclist[0].supplier = "_Test Supplier" + po_doclist[0].transaction_date = "2013-07-07" po_doclist[1].qty = 27.0 po_doclist[2].qty = 1.5 po_doclist[1].schedule_date = "2013-07-09" From 57738a0ff3e0880d40515b5be46a4b89aaab6962 Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Fri, 3 Jan 2014 18:15:07 +0530 Subject: [PATCH 022/107] flat discount replaced to discount amount --- .../Print Format/POS Invoice/POS Invoice.txt | 2 +- .../Sales Invoice Classic.txt | 2 +- .../Sales Invoice Modern.txt | 2 +- .../Sales Invoice Spartan.txt | 2 +- erpnext/accounts/doctype/sales_invoice/pos.js | 12 +++--- .../doctype/sales_invoice/sales_invoice.py | 4 +- .../doctype/sales_invoice/sales_invoice.txt | 6 +-- .../sales_invoice/test_sales_invoice.py | 10 ++--- .../sales_taxes_and_charges.txt | 6 +-- .../sales_taxes_and_charges_master.js | 8 ++-- .../report/sales_register/sales_register.py | 4 +- .../purchase_common/purchase_common.js | 4 +- erpnext/controllers/accounts_controller.py | 42 +++++++++---------- erpnext/controllers/buying_controller.py | 6 +-- erpnext/controllers/selling_controller.py | 28 ++++++------- erpnext/patches.txt | 20 ++++++++- erpnext/public/js/transaction.js | 37 +++++++++------- .../Quotation Classic/Quotation Classic.txt | 2 +- .../Quotation Modern/Quotation Modern.txt | 2 +- .../Quotation Spartan/Quotation Spartan.txt | 2 +- .../Sales Order Classic.txt | 2 +- .../Sales Order Modern/Sales Order Modern.txt | 2 +- .../Sales Order Spartan.txt | 2 +- .../selling/doctype/quotation/quotation.txt | 6 +-- .../doctype/sales_order/sales_order.txt | 6 +-- erpnext/selling/sales_common.js | 38 ++++++++--------- .../Delivery Note Classic.txt | 2 +- .../Delivery Note Modern.txt | 2 +- .../Delivery Note Spartan.txt | 2 +- .../doctype/delivery_note/delivery_note.txt | 6 +-- 30 files changed, 144 insertions(+), 125 deletions(-) diff --git a/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt b/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt index 0907c4a865..980195642f 100644 --- a/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt +++ b/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt @@ -9,7 +9,7 @@ { "doc_type": "Sales Invoice", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n \n \n \n \n \n \n \n
RECEIPT NO: DATE:
M/s
\n\n
\n\n\n", + "html": "\n\n\n\n\n\n\n\n\n \n \n \n \n \n \n \n
RECEIPT NO: DATE:
M/s
\n\n
\n\n\n", "module": "Accounts", "name": "__common__", "print_format_type": "Client", diff --git a/erpnext/accounts/Print Format/Sales Invoice Classic/Sales Invoice Classic.txt b/erpnext/accounts/Print Format/Sales Invoice Classic/Sales Invoice Classic.txt index 4e8b12b943..09fcb91476 100644 --- a/erpnext/accounts/Print Format/Sales Invoice Classic/Sales Invoice Classic.txt +++ b/erpnext/accounts/Print Format/Sales Invoice Classic/Sales Invoice Classic.txt @@ -9,7 +9,7 @@ { "doc_type": "Sales Invoice", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", + "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", "module": "Accounts", "name": "__common__", "print_format_type": "Client", diff --git a/erpnext/accounts/Print Format/Sales Invoice Modern/Sales Invoice Modern.txt b/erpnext/accounts/Print Format/Sales Invoice Modern/Sales Invoice Modern.txt index 6808c009e6..a85a11abc8 100644 --- a/erpnext/accounts/Print Format/Sales Invoice Modern/Sales Invoice Modern.txt +++ b/erpnext/accounts/Print Format/Sales Invoice Modern/Sales Invoice Modern.txt @@ -9,7 +9,7 @@ { "doc_type": "Sales Invoice", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", + "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", "module": "Accounts", "name": "__common__", "print_format_type": "Client", diff --git a/erpnext/accounts/Print Format/Sales Invoice Spartan/Sales Invoice Spartan.txt b/erpnext/accounts/Print Format/Sales Invoice Spartan/Sales Invoice Spartan.txt index 45905fc2e1..e0850e1e9a 100644 --- a/erpnext/accounts/Print Format/Sales Invoice Spartan/Sales Invoice Spartan.txt +++ b/erpnext/accounts/Print Format/Sales Invoice Spartan/Sales Invoice Spartan.txt @@ -9,7 +9,7 @@ { "doc_type": "Sales Invoice", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", + "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", "module": "Accounts", "name": "__common__", "print_format_type": "Client", diff --git a/erpnext/accounts/doctype/sales_invoice/pos.js b/erpnext/accounts/doctype/sales_invoice/pos.js index 1da6f735f6..1b14f05dc1 100644 --- a/erpnext/accounts/doctype/sales_invoice/pos.js +++ b/erpnext/accounts/doctype/sales_invoice/pos.js @@ -50,13 +50,13 @@ erpnext.POS = Class.extend({
\
\ -
\ +
\ \ \ - \ + \ \ \ \ @@ -96,8 +96,8 @@ erpnext.POS = Class.extend({ me.refresh(); }); - this.wrapper.find('input.flat-discount').on("change", function() { - wn.model.set_value(me.frm.doctype, me.frm.docname, "flat_discount", this.value); + this.wrapper.find('input.discount-amount').on("change", function() { + wn.model.set_value(me.frm.doctype, me.frm.docname, "discount_amount", this.value); }); this.call_function("delete-items", function() {me.remove_selected_item();}); @@ -339,7 +339,7 @@ erpnext.POS = Class.extend({ refresh: function() { var me = this; this.party_field.set_input(this.frm.doc[this.party.toLowerCase()]); - this.wrapper.find('input.flat-discount').val(this.frm.doc.flat_discount); + this.wrapper.find('input.discount-amount').val(this.frm.doc.discount_amount); this.barcode.set_input(""); this.show_items_in_item_cart(); diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 55c2ecaa59..4a059441fe 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -556,12 +556,12 @@ class DocType(SellingController): def make_tax_gl_entries(self, gl_entries): for tax in self.doclist.get({"parentfield": "other_charges"}): - if flt(tax.tax_amount_after_flat_discount): + if flt(tax.tax_amount_after_discount_amount): gl_entries.append( self.get_gl_dict({ "account": tax.account_head, "against": self.doc.debit_to, - "credit": flt(tax.tax_amount_after_flat_discount), + "credit": flt(tax.tax_amount_after_discount_amount), "remarks": self.doc.remarks, "cost_center": tax.cost_center }) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt b/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt index 0fcb79d86b..66f7d32c3d 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 19:29:05", "docstatus": 0, - "modified": "2013-12-26 17:50:21", + "modified": "2014-01-03 14:52:16", "modified_by": "Administrator", "owner": "Administrator" }, @@ -457,9 +457,9 @@ }, { "doctype": "DocField", - "fieldname": "flat_discount", + "fieldname": "discount_amount", "fieldtype": "Currency", - "label": "Flat Discount", + "label": "Discount Amount", "options": "Company:company:default_currency", "print_hide": 0 }, diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index 4b49eb4715..709507abc1 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -136,9 +136,9 @@ class TestSalesInvoice(unittest.TestCase): self.assertEquals(si.doc.grand_total, 1627.05) self.assertEquals(si.doc.grand_total_export, 32.54) - def test_sales_invoice_flat_discount(self): + def test_sales_invoice_discount_amount(self): si = webnotes.bean(copy=test_records[3]) - si.doc.flat_discount = 104.95 + si.doc.discount_amount = 104.95 si.doclist.append({ "doctype": "Sales Taxes and Charges", "parentfield": "other_charges", @@ -174,7 +174,7 @@ class TestSalesInvoice(unittest.TestCase): # check tax calculation expected_values = { - "keys": ["tax_amount", "tax_amount_after_flat_discount", "total"], + "keys": ["tax_amount", "tax_amount_after_discount_amount", "total"], "_Test Account Excise Duty - _TC": [140, 130.31, 1293.76], "_Test Account Education Cess - _TC": [2.8, 2.61, 1296.37], "_Test Account S&H Education Cess - _TC": [1.4, 1.31, 1297.68], @@ -193,9 +193,9 @@ class TestSalesInvoice(unittest.TestCase): self.assertEquals(si.doc.grand_total, 1500) self.assertEquals(si.doc.grand_total_export, 1500) - def test_flat_discount_gl_entry(self): + def test_discount_amount_gl_entry(self): si = webnotes.bean(copy=test_records[3]) - si.doc.flat_discount = 104.95 + si.doc.discount_amount = 104.95 si.doclist.append({ "doctype": "Sales Taxes and Charges", "parentfield": "other_charges", diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt index 1b3b6f8939..f3c41a649f 100644 --- a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt +++ b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt @@ -2,7 +2,7 @@ { "creation": "2013-04-24 11:39:32", "docstatus": 0, - "modified": "2013-12-20 19:21:45", + "modified": "2014-01-03 15:04:25", "modified_by": "Administrator", "owner": "Administrator" }, @@ -133,10 +133,10 @@ }, { "doctype": "DocField", - "fieldname": "tax_amount_after_flat_discount", + "fieldname": "tax_amount_after_discount_amount", "fieldtype": "Currency", "hidden": 1, - "label": "Tax Amount After Flat Discount", + "label": "Tax Amount After Discount Amount", "options": "Company:company:default_currency", "read_only": 1 }, diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js index 2ac6be7a25..0e9b3db6c0 100644 --- a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js +++ b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js @@ -19,7 +19,7 @@ cur_frm.pformat.net_total_export = function(doc) { return ''; } -cur_frm.pformat.flat_discount = function(doc) { +cur_frm.pformat.discount_amount = function(doc) { return ''; } @@ -77,9 +77,9 @@ cur_frm.pformat.other_charges= function(doc){ } } - // flat discount - if(!print_hide('flat_discount') && doc.flat_discount) { - out += make_row('Flat Discount', doc.flat_discount, 0); + // Discount Amount + if(!print_hide('discount_amount') && doc.discount_amount) { + out += make_row('Discount Amount', convert_rate(doc.discount_amount), 0); } // grand total diff --git a/erpnext/accounts/report/sales_register/sales_register.py b/erpnext/accounts/report/sales_register/sales_register.py index 98ef93662d..8fab6a9d97 100644 --- a/erpnext/accounts/report/sales_register/sales_register.py +++ b/erpnext/accounts/report/sales_register/sales_register.py @@ -79,7 +79,7 @@ def get_columns(invoice_list): tax_accounts = webnotes.conn.sql_list("""select distinct account_head from `tabSales Taxes and Charges` where parenttype = 'Sales Invoice' - and docstatus = 1 and ifnull(tax_amount_after_flat_discount, 0) != 0 + and docstatus = 1 and ifnull(tax_amount_after_discount_amount, 0) != 0 and parent in (%s) order by account_head""" % ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list])) @@ -127,7 +127,7 @@ def get_invoice_income_map(invoice_list): def get_invoice_tax_map(invoice_list, invoice_income_map, income_accounts): tax_details = webnotes.conn.sql("""select parent, account_head, - sum(tax_amount_after_flat_discount) as tax_amount + sum(tax_amount_after_discount_amount) as tax_amount from `tabSales Taxes and Charges` where parent in (%s) group by parent, account_head""" % ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1) diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js index 29e4781d29..f528f6cf1b 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.js +++ b/erpnext/buying/doctype/purchase_common/purchase_common.js @@ -362,9 +362,9 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ } if(this.frm.tax_doclist.length) { - if(!wn.meta.get_docfield(this.frm.tax_doclist[0].doctype, "tax_amount_after_flat_discount", this.frm.doctype)) { + if(!wn.meta.get_docfield(this.frm.tax_doclist[0].doctype, "tax_amount_after_discount_amount", this.frm.doctype)) { $.each(this.frm.tax_doclist, function(i, tax) { - delete tax["tax_amount_after_flat_discount"]; + delete tax["tax_amount_after_discount_amount"]; }); } } diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 9b8dc2963d..e7393eb735 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -16,10 +16,7 @@ class AccountsController(TransactionBase): self.set_missing_values(for_validate=True) self.validate_date_with_fiscal_year() if self.meta.get_field("currency"): - self.flat_discount_applied = False self.calculate_taxes_and_totals() - if hasattr(self, "apply_flat_discount"): - self.apply_flat_discount() self.validate_value("grand_total", ">=", 0) self.set_total_in_words() @@ -136,6 +133,12 @@ class AccountsController(TransactionBase): self.doclist.append(tax) def calculate_taxes_and_totals(self): + self.discount_amount_applied = False + self._calculate_taxes_and_totals() + if self.meta.get_field(self.doc.doctype, "discount_amount"): + self.apply_discount_amount() + + def _calculate_taxes_and_totals(self): # validate conversion rate company_currency = get_company_currency(self.doc.company) if not self.doc.currency or self.doc.currency == company_currency: @@ -148,10 +151,6 @@ class AccountsController(TransactionBase): self.doc.conversion_rate = flt(self.doc.conversion_rate) self.item_doclist = self.doclist.get({"parentfield": self.fname}) self.tax_doclist = self.doclist.get({"parentfield": self.other_fname}) - - # for buying - if not hasattr(self, "flat_discount_applied"): - self.flat_discount_applied = False self.calculate_item_values() self.initialize_taxes() @@ -164,17 +163,14 @@ class AccountsController(TransactionBase): self.calculate_totals() self._cleanup() - # TODO - # print format: show net_total_export instead of net_total - def initialize_taxes(self): for tax in self.tax_doclist: tax.item_wise_tax_detail = {} - tax_fields = ["total", "tax_amount_after_flat_discount", + tax_fields = ["total", "tax_amount_after_discount_amount", "tax_amount_for_current_item", "grand_total_for_current_item", "tax_fraction_for_current_item", "grand_total_fraction_for_current_item"] - if not self.flat_discount_applied: + if not self.discount_amount_applied: tax_fields.append("tax_amount") for fieldname in tax_fields: @@ -261,10 +257,10 @@ class AccountsController(TransactionBase): tax.tax_amount_for_current_item = current_tax_amount # accumulate tax amount into tax.tax_amount - if not self.flat_discount_applied: + if not self.discount_amount_applied: tax.tax_amount += current_tax_amount - tax.tax_amount_after_flat_discount += current_tax_amount + tax.tax_amount_after_discount_amount += current_tax_amount if tax.category: # if just for valuation, do not add the tax amount in total @@ -291,21 +287,21 @@ class AccountsController(TransactionBase): if n == len(self.item_doclist) - 1: self.round_off_totals(tax) - # adjust flat discount loss in last tax iteration - if i == (len(self.tax_doclist) - 1) and self.flat_discount_applied: - self.adjust_flat_discount_loss(tax) + # adjust Discount Amount loss in last tax iteration + if i == (len(self.tax_doclist) - 1) and self.discount_amount_applied: + self.adjust_discount_amount_loss(tax) def round_off_totals(self, tax): tax.total = flt(tax.total, self.precision("total", tax)) tax.tax_amount = flt(tax.tax_amount, self.precision("tax_amount", tax)) - tax.tax_amount_after_flat_discount = flt(tax.tax_amount_after_flat_discount, + tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount, self.precision("tax_amount", tax)) - def adjust_flat_discount_loss(self, tax): - flat_discount_loss = self.doc.grand_total - self.doc.flat_discount - tax.total - tax.tax_amount_after_flat_discount = flt(tax.tax_amount_after_flat_discount + - flat_discount_loss, self.precision("tax_amount", tax)) - tax.total = flt(tax.total + flat_discount_loss, self.precision("total", tax)) + def adjust_discount_amount_loss(self, tax): + discount_amount_loss = self.doc.grand_total - flt(self.doc.discount_amount) - tax.total + tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount + + discount_amount_loss, self.precision("tax_amount", tax)) + tax.total = flt(tax.total + discount_amount_loss, self.precision("total", tax)) def get_current_tax_amount(self, item, tax, item_tax_map): tax_rate = self._get_tax_rate(tax, item_tax_map) diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index be07670450..f630f5ae83 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -147,7 +147,7 @@ class BuyingController(StockController): def _cleanup(self): super(BuyingController, self)._cleanup() - # except in purchase invoice, rate field is purchase_rate + # except in purchase invoice, rate field is purchase_rate # reset fieldname of rate if self.doc.doctype != "Purchase Invoice": df = self.meta.get_field("rate", parentfield=self.fname) @@ -161,9 +161,9 @@ class BuyingController(StockController): for item in self.item_doclist: del item.fields["item_tax_amount"] - if not self.meta.get_field("tax_amount_after_flat_discount", parentfield=self.other_fname): + if not self.meta.get_field("tax_amount_after_discount_amount", parentfield=self.other_fname): for tax in self.tax_doclist: - del tax.fields["tax_amount_after_flat_discount"] + del tax.fields["tax_amount_after_discount_amount"] def set_item_tax_amount(self, item, tax, current_tax_amount): """ diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py index 9e0fa1b2aa..04bcfaeb04 100644 --- a/erpnext/controllers/selling_controller.py +++ b/erpnext/controllers/selling_controller.py @@ -121,7 +121,7 @@ class SellingController(StockController): cumulated_tax_fraction += tax.tax_fraction_for_current_item - if cumulated_tax_fraction and not self.flat_discount_applied: + if cumulated_tax_fraction and not self.discount_amount_applied: item.amount = flt((item.export_amount * self.doc.conversion_rate) / (1 + cumulated_tax_fraction), self.precision("amount", item)) @@ -158,7 +158,7 @@ class SellingController(StockController): return current_tax_fraction def calculate_item_values(self): - if not self.flat_discount_applied: + if not self.discount_amount_applied: for item in self.item_doclist: self.round_floats_in(item) @@ -193,25 +193,25 @@ class SellingController(StockController): self.doc.other_charges_total = flt(self.doc.grand_total - self.doc.net_total, self.precision("other_charges_total")) self.doc.other_charges_total_export = flt(self.doc.grand_total_export - - self.doc.net_total_export + flt(self.doc.flat_discount), self.precision("other_charges_total_export")) + self.doc.net_total_export + flt(self.doc.discount_amount), self.precision("other_charges_total_export")) self.doc.rounded_total = _round(self.doc.grand_total) self.doc.rounded_total_export = _round(self.doc.grand_total_export) - def apply_flat_discount(self): - if self.doc.flat_discount: - total_amount_for_flat_discount = self.get_flat_discountable_amount() + def apply_discount_amount(self): + if self.doc.discount_amount: + grand_total_for_discount_amount = self.get_grand_total_for_discount_amount() - if total_amount_for_flat_discount: - # calculate item amount after flat discount + if grand_total_for_discount_amount: + # calculate item amount after Discount Amount for item in self.item_doclist: - distributed_amount = self.doc.flat_discount * item.amount / total_amount_for_flat_discount + distributed_amount = flt(self.doc.discount_amount) * item.amount / grand_total_for_discount_amount item.amount = flt(item.amount - distributed_amount, self.precision("amount", item)) - self.flat_discount_applied = True - self.calculate_taxes_and_totals() + self.discount_amount_applied = True + self._calculate_taxes_and_totals() - def get_flat_discountable_amount(self): + def get_grand_total_for_discount_amount(self): actual_taxes_dict = {} for tax in self.tax_doclist: @@ -222,9 +222,9 @@ class SellingController(StockController): flt(tax.rate) / 100 actual_taxes_dict.setdefault(tax.idx, actual_tax_amount) - total_amount_for_flat_discount = flt(self.doc.grand_total - sum(actual_taxes_dict.values()), + grand_total_for_discount_amount = flt(self.doc.grand_total - sum(actual_taxes_dict.values()), self.precision("grand_total")) - return total_amount_for_flat_discount + return grand_total_for_discount_amount def calculate_outstanding_amount(self): # NOTE: diff --git a/erpnext/patches.txt b/erpnext/patches.txt index c1ab098298..f39e214245 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -1,3 +1,21 @@ erpnext.patches.4_0.update_user_properties erpnext.patches.4_0.move_warehouse_user_to_restrictions -erpnext.patches.4_0.new_permissions \ No newline at end of file +erpnext.patches.4_0.new_permissions + +execute:webnotes.reload_doc('accounts', 'doctype', 'sales_invoice') # 2014-01-03 +execute:webnotes.reload_doc('selling', 'doctype', 'sales_order') # 2014-01-03 +execute:webnotes.reload_doc('selling', 'doctype', 'quotation') # 2014-01-03 +execute:webnotes.reload_doc('stock', 'doctype', 'delivery_note') # 2014-01-03 +execute:webnotes.reload_doc('accounts', 'Print Format', 'POS Invoice') # 2014-01-03 +execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Classic') # 2014-01-03 +execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Modern') # 2014-01-03 +execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Spartan') # 2014-01-03 +execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Classic') # 2014-01-03 +execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Modern') # 2014-01-03 +execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Spartan') # 2014-01-03 +execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Classic') # 2014-01-03 +execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Modern') # 2014-01-03 +execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Spartan') # 2014-01-03 +execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Classic') # 2014-01-03 +execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Modern') # 2014-01-03 +execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Spartan') # 2014-01-03 \ No newline at end of file diff --git a/erpnext/public/js/transaction.js b/erpnext/public/js/transaction.js index e716c278ae..7db7aef51d 100644 --- a/erpnext/public/js/transaction.js +++ b/erpnext/public/js/transaction.js @@ -146,9 +146,7 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ }, validate: function() { - this.flat_discount_applied = false; this.calculate_taxes_and_totals(); - this.apply_flat_discount && this.apply_flat_discount(); }, set_default_values: function() { @@ -513,6 +511,13 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ }, calculate_taxes_and_totals: function() { + this.discount_amount_applied = false; + this._calculate_taxes_and_totals(); + if (wn.meta.get_docfield(this.frm.doc.doctype, "discount_amount")) + this.apply_discount_amount(); + }, + + _calculate_taxes_and_totals: function() { this.validate_conversion_rate(); this.frm.item_doclist = this.get_item_doclist(); this.frm.tax_doclist = this.get_tax_doclist(); @@ -524,7 +529,7 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ this.calculate_taxes(); this.calculate_totals(); this._cleanup(); - + this.show_item_wise_taxes(); }, @@ -533,11 +538,11 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ $.each(this.frm.tax_doclist, function(i, tax) { tax.item_wise_tax_detail = {}; - tax_fields = ["total", "tax_amount_after_flat_discount", + tax_fields = ["total", "tax_amount_after_discount_amount", "tax_amount_for_current_item", "grand_total_for_current_item", "tax_fraction_for_current_item", "grand_total_fraction_for_current_item"] - if (!me.flat_discount_applied) + if (!me.discount_amount_applied) tax_fields.push("tax_amount"); $.each(tax_fields, function(i, fieldname) { tax[fieldname] = 0.0 }); @@ -581,10 +586,10 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ tax.tax_amount_for_current_item = current_tax_amount; // accumulate tax amount into tax.tax_amount - if (!me.flat_discount_applied) + if (!me.discount_amount_applied) tax.tax_amount += current_tax_amount; - tax.tax_amount_after_flat_discount += current_tax_amount; + tax.tax_amount_after_discount_amount += current_tax_amount; // for buying if(tax.category) { @@ -614,9 +619,9 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ if (n == me.frm.item_doclist.length - 1) { me.round_off_totals(tax); - // adjust flat discount loss in last tax iteration - if ((i == me.frm.tax_doclist.length - 1) && me.flat_discount_applied) - me.adjust_flat_discount_loss(tax); + // adjust Discount Amount loss in last tax iteration + if ((i == me.frm.tax_doclist.length - 1) && me.discount_amount_applied) + me.adjust_discount_amount_loss(tax); } }); }); @@ -625,15 +630,15 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ round_off_totals: function(tax) { tax.total = flt(tax.total, precision("total", tax)); tax.tax_amount = flt(tax.tax_amount, precision("tax_amount", tax)); - tax.tax_amount_after_flat_discount = flt(tax.tax_amount_after_flat_discount, + tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount, precision("tax_amount", tax)); }, - adjust_flat_discount_loss: function(tax) { - var flat_discount_loss = this.frm.doc.grand_total - this.frm.doc.flat_discount - tax.total; - tax.tax_amount_after_flat_discount = flt(tax.tax_amount_after_flat_discount + - flat_discount_loss, precision("tax_amount", tax)); - tax.total = flt(tax.total + flat_discount_loss, precision("total", tax)); + adjust_discount_amount_loss: function(tax) { + var discount_amount_loss = this.frm.doc.grand_total - flt(this.frm.doc.discount_amount) - tax.total; + tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount + + discount_amount_loss, precision("tax_amount", tax)); + tax.total = flt(tax.total + discount_amount_loss, precision("total", tax)); }, get_current_tax_amount: function(item, tax, item_tax_map) { diff --git a/erpnext/selling/Print Format/Quotation Classic/Quotation Classic.txt b/erpnext/selling/Print Format/Quotation Classic/Quotation Classic.txt index dc845290fe..05c3c598ca 100644 --- a/erpnext/selling/Print Format/Quotation Classic/Quotation Classic.txt +++ b/erpnext/selling/Print Format/Quotation Classic/Quotation Classic.txt @@ -9,7 +9,7 @@ { "doc_type": "Quotation", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n\n\n
Flat DiscountDiscount Amount\ - \
\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t
\n\t\t\t\t\t\n\t\t\t

\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
Name
Address
Contact
\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t
Quotation Date
\n
\n
\n\t\n\t\n
\n", + "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", "module": "Selling", "name": "__common__", "print_format_type": "Client", diff --git a/erpnext/selling/Print Format/Quotation Modern/Quotation Modern.txt b/erpnext/selling/Print Format/Quotation Modern/Quotation Modern.txt index 8b4b0d8f65..35850e62eb 100644 --- a/erpnext/selling/Print Format/Quotation Modern/Quotation Modern.txt +++ b/erpnext/selling/Print Format/Quotation Modern/Quotation Modern.txt @@ -9,7 +9,7 @@ { "doc_type": "Quotation", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", + "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", "module": "Selling", "name": "__common__", "print_format_type": "Client", diff --git a/erpnext/selling/Print Format/Quotation Spartan/Quotation Spartan.txt b/erpnext/selling/Print Format/Quotation Spartan/Quotation Spartan.txt index c4a1362ad3..3b4452666b 100644 --- a/erpnext/selling/Print Format/Quotation Spartan/Quotation Spartan.txt +++ b/erpnext/selling/Print Format/Quotation Spartan/Quotation Spartan.txt @@ -9,7 +9,7 @@ { "doc_type": "Quotation", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", + "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", "module": "Selling", "name": "__common__", "print_format_type": "Client", diff --git a/erpnext/selling/Print Format/Sales Order Classic/Sales Order Classic.txt b/erpnext/selling/Print Format/Sales Order Classic/Sales Order Classic.txt index 1d36ee6a77..7ee19c0f2d 100644 --- a/erpnext/selling/Print Format/Sales Order Classic/Sales Order Classic.txt +++ b/erpnext/selling/Print Format/Sales Order Classic/Sales Order Classic.txt @@ -9,7 +9,7 @@ { "doc_type": "Sales Order", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", + "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", "module": "Selling", "name": "__common__", "print_format_type": "Client", diff --git a/erpnext/selling/Print Format/Sales Order Modern/Sales Order Modern.txt b/erpnext/selling/Print Format/Sales Order Modern/Sales Order Modern.txt index 157c8eb29c..7cf481d7b8 100644 --- a/erpnext/selling/Print Format/Sales Order Modern/Sales Order Modern.txt +++ b/erpnext/selling/Print Format/Sales Order Modern/Sales Order Modern.txt @@ -9,7 +9,7 @@ { "doc_type": "Sales Order", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", + "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", "module": "Selling", "name": "__common__", "print_format_type": "Client", diff --git a/erpnext/selling/Print Format/Sales Order Spartan/Sales Order Spartan.txt b/erpnext/selling/Print Format/Sales Order Spartan/Sales Order Spartan.txt index 8dce87eca4..8da27b7d70 100644 --- a/erpnext/selling/Print Format/Sales Order Spartan/Sales Order Spartan.txt +++ b/erpnext/selling/Print Format/Sales Order Spartan/Sales Order Spartan.txt @@ -9,7 +9,7 @@ { "doc_type": "Sales Order", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", + "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", "module": "Selling", "name": "__common__", "print_format_type": "Client", diff --git a/erpnext/selling/doctype/quotation/quotation.txt b/erpnext/selling/doctype/quotation/quotation.txt index 5453cb4e18..4795653262 100644 --- a/erpnext/selling/doctype/quotation/quotation.txt +++ b/erpnext/selling/doctype/quotation/quotation.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 19:29:08", "docstatus": 0, - "modified": "2013-12-26 17:54:55", + "modified": "2014-01-03 14:54:05", "modified_by": "Administrator", "owner": "Administrator" }, @@ -462,9 +462,9 @@ }, { "doctype": "DocField", - "fieldname": "flat_discount", + "fieldname": "discount_amount", "fieldtype": "Currency", - "label": "Flat Discount", + "label": "Discount Amount", "options": "Company:company:default_currency" }, { diff --git a/erpnext/selling/doctype/sales_order/sales_order.txt b/erpnext/selling/doctype/sales_order/sales_order.txt index 2469a467f6..2dc62f334a 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.txt +++ b/erpnext/selling/doctype/sales_order/sales_order.txt @@ -2,7 +2,7 @@ { "creation": "2013-06-18 12:39:59", "docstatus": 0, - "modified": "2013-12-26 17:55:43", + "modified": "2014-01-03 14:51:19", "modified_by": "Administrator", "owner": "Administrator" }, @@ -482,9 +482,9 @@ }, { "doctype": "DocField", - "fieldname": "flat_discount", + "fieldname": "discount_amount", "fieldtype": "Currency", - "label": "Flat Discount", + "label": "Discount Amount", "options": "Company:company:default_currency" }, { diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js index 4562c2b217..330e725ed8 100644 --- a/erpnext/selling/sales_common.js +++ b/erpnext/selling/sales_common.js @@ -226,10 +226,8 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ this.calculate_taxes_and_totals(); }, - flat_discount: function() { - this.flat_discount_applied = false; + discount_amount: function() { this.calculate_taxes_and_totals(); - this.apply_flat_discount(); }, commission_rate: function() { @@ -317,7 +315,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ calculate_item_values: function() { var me = this; - if (!this.flat_discount_applied) { + if (!this.discount_amount_applied) { $.each(this.frm.item_doclist, function(i, item) { wn.model.round_floats_in(item); item.export_amount = flt(item.export_rate * item.qty, precision("export_amount", item)); @@ -349,7 +347,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ cumulated_tax_fraction += tax.tax_fraction_for_current_item; }); - if(cumulated_tax_fraction && !me.flat_discount_applied) { + if(cumulated_tax_fraction && !me.discount_amount_applied) { item.amount = flt( (item.export_amount * me.frm.doc.conversion_rate) / (1 + cumulated_tax_fraction), precision("amount", item)); @@ -416,31 +414,33 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ this.frm.doc.other_charges_total = flt(this.frm.doc.grand_total - this.frm.doc.net_total, precision("other_charges_total")); this.frm.doc.other_charges_total_export = flt(this.frm.doc.grand_total_export - - this.frm.doc.net_total_export + this.frm.doc.flat_discount, + this.frm.doc.net_total_export + flt(this.frm.doc.discount_amount), precision("other_charges_total_export")); this.frm.doc.rounded_total = Math.round(this.frm.doc.grand_total); this.frm.doc.rounded_total_export = Math.round(this.frm.doc.grand_total_export); }, - apply_flat_discount: function() { + apply_discount_amount: function() { var me = this; var distributed_amount = 0.0; - if (this.frm.doc.flat_discount) { - var total_amount_for_flat_discount = this.get_flat_discountable_amount(); - // calculate item amount after flat discount - $.each(this.frm.item_doclist, function(i, item) { - distributed_amount = me.frm.doc.flat_discount * item.amount / total_amount_for_flat_discount; - item.amount = flt(item.amount - distributed_amount, precision("amount", item)); - }); + if (this.frm.doc.discount_amount) { + var grand_total_for_discount_amount = this.get_grand_total_for_discount_amount(); + // calculate item amount after Discount Amount + if (grand_total_for_discount_amount) { + $.each(this.frm.item_doclist, function(i, item) { + distributed_amount = flt(me.frm.doc.discount_amount) * item.amount / grand_total_for_discount_amount; + item.amount = flt(item.amount - distributed_amount, precision("amount", item)); + }); - this.flat_discount_applied = true; - this.calculate_taxes_and_totals(); + this.discount_amount_applied = true; + this._calculate_taxes_and_totals(); + } } }, - get_flat_discountable_amount: function() { + get_grand_total_for_discount_amount: function() { var me = this; var total_actual_tax = 0.0; var actual_taxes_dict = {}; @@ -459,9 +459,9 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ total_actual_tax += value; }); - total_amount_for_flat_discount = flt(this.frm.doc.grand_total - total_actual_tax, + grand_total_for_discount_amount = flt(this.frm.doc.grand_total - total_actual_tax, precision("grand_total")); - return total_amount_for_flat_discount; + return grand_total_for_discount_amount; }, calculate_outstanding_amount: function() { diff --git a/erpnext/stock/Print Format/Delivery Note Classic/Delivery Note Classic.txt b/erpnext/stock/Print Format/Delivery Note Classic/Delivery Note Classic.txt index d16b67fea6..d4c0cc1983 100644 --- a/erpnext/stock/Print Format/Delivery Note Classic/Delivery Note Classic.txt +++ b/erpnext/stock/Print Format/Delivery Note Classic/Delivery Note Classic.txt @@ -9,7 +9,7 @@ { "doc_type": "Delivery Note", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", + "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", "module": "Stock", "name": "__common__", "print_format_type": "Client", diff --git a/erpnext/stock/Print Format/Delivery Note Modern/Delivery Note Modern.txt b/erpnext/stock/Print Format/Delivery Note Modern/Delivery Note Modern.txt index 9965634355..3b36f6f1c0 100644 --- a/erpnext/stock/Print Format/Delivery Note Modern/Delivery Note Modern.txt +++ b/erpnext/stock/Print Format/Delivery Note Modern/Delivery Note Modern.txt @@ -9,7 +9,7 @@ { "doc_type": "Delivery Note", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", + "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", "module": "Stock", "name": "__common__", "print_format_type": "Client", diff --git a/erpnext/stock/Print Format/Delivery Note Spartan/Delivery Note Spartan.txt b/erpnext/stock/Print Format/Delivery Note Spartan/Delivery Note Spartan.txt index 2623d76183..072d411004 100644 --- a/erpnext/stock/Print Format/Delivery Note Spartan/Delivery Note Spartan.txt +++ b/erpnext/stock/Print Format/Delivery Note Spartan/Delivery Note Spartan.txt @@ -9,7 +9,7 @@ { "doc_type": "Delivery Note", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", + "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n", "module": "Stock", "name": "__common__", "print_format_type": "Client", diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.txt b/erpnext/stock/doctype/delivery_note/delivery_note.txt index c328874959..b2677a39e5 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.txt +++ b/erpnext/stock/doctype/delivery_note/delivery_note.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 19:29:09", "docstatus": 0, - "modified": "2013-12-26 18:01:33", + "modified": "2014-01-03 14:53:03", "modified_by": "Administrator", "owner": "Administrator" }, @@ -492,9 +492,9 @@ }, { "doctype": "DocField", - "fieldname": "flat_discount", + "fieldname": "discount_amount", "fieldtype": "Currency", - "label": "Flat Discount", + "label": "Discount Amount", "options": "Company:company:default_currency" }, { From 5d5fe5d9d50a94403ecb52e1814f1c8afc56eb13 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 3 Jan 2014 18:28:53 +0530 Subject: [PATCH 023/107] Cost center field added in Purchase Receipt Item table --- .../purchase_receipt_item/purchase_receipt_item.txt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt b/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt index 9a641c2ba3..1d9397909d 100755 --- a/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt +++ b/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 19:29:10", "docstatus": 0, - "modified": "2013-12-18 10:38:39", + "modified": "2014-01-03 18:28:20", "modified_by": "Administrator", "owner": "Administrator" }, @@ -334,6 +334,16 @@ "report_hide": 0, "reqd": 0 }, + { + "default": ":Company", + "depends_on": "eval:sys_defaults.auto_accounting_for_stock", + "doctype": "DocField", + "fieldname": "cost_center", + "fieldtype": "Link", + "label": "Cost Center", + "options": "Cost Center", + "print_hide": 1 + }, { "doctype": "DocField", "fieldname": "project_name", From a83337a2dd0102f26fd17e2d2d7da51cf059b843 Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Fri, 3 Jan 2014 19:10:11 +0600 Subject: [PATCH 024/107] bumped to version 3.4.6 --- config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.json b/config.json index 89c1332005..536e5af1ba 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,6 @@ { "app_name": "ERPNext", - "app_version": "3.4.5", + "app_version": "3.4.6", "base_template": "app/portal/templates/base.html", "modules": { "Accounts": { From 5dd92fd5d6759279edc7b66cefd87f1c703ac950 Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Fri, 3 Jan 2014 19:14:01 +0530 Subject: [PATCH 025/107] reload doc in maintenance schedule --- ...to_sales_person_in_maintenance_schedule.py | 3 ++ .../maintenance_schedule.py | 34 ++++++++++++++----- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/erpnext/patches/4_0/update_incharge_name_to_sales_person_in_maintenance_schedule.py b/erpnext/patches/4_0/update_incharge_name_to_sales_person_in_maintenance_schedule.py index 7c81ef5acd..2a488f4c8f 100644 --- a/erpnext/patches/4_0/update_incharge_name_to_sales_person_in_maintenance_schedule.py +++ b/erpnext/patches/4_0/update_incharge_name_to_sales_person_in_maintenance_schedule.py @@ -5,5 +5,8 @@ from __future__ import unicode_literals import webnotes def execute(): + webnotes.reload_doc("support", "doctype", "maintenance_schedule_detail") + webnotes.reload_doc("support", "doctype", "maintenance_schedule_item") + webnotes.conn.sql("""update `tabMaintenance Schedule Detail` set sales_person=incharge_name""") webnotes.conn.sql("""update `tabMaintenance Schedule Item` set sales_person=incharge_name""") \ No newline at end of file diff --git a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py index 4fdc9ea37d..865c21c59b 100644 --- a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py +++ b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py @@ -28,9 +28,9 @@ class DocType(TransactionBase): self.doclist = self.doc.clear_table(self.doclist, 'maintenance_schedule_detail') webnotes.conn.sql("""delete from `tabMaintenance Schedule Detail` where parent=%s""", (self.doc.name)) + count = 1 for d in getlist(self.doclist, 'item_maintenance_detail'): self.validate_maintenance_detail() - count = 1 s_list = [] s_list = self.create_schedule_list(d.start_date, d.end_date, d.no_of_visits, d.sales_person) for i in range(d.no_of_visits): @@ -105,17 +105,33 @@ class DocType(TransactionBase): return schedule_list def validate_schedule_date_for_holiday_list(self, schedule_date, sales_person): + from erpnext.accounts.utils import get_fiscal_year validated = False + fy_details = "" - holiday_list = webnotes.conn.sql_list("""select h.holiday_date from `tabEmployee` emp, - `tabSales Person` sp, `tabHoliday` h where sp.name=%s and emp.name=sp.employee - and h.parent=emp.holiday_list""", sales_person) + try: + fy_details = get_fiscal_year(date=schedule_date, verbose=0) + except Exception: + pass - while not validated: - if schedule_date in holiday_list: - schedule_date = add_days(schedule_date, 1) - else: - validated = True + if fy_details and fy_details[0]: + holiday_list = webnotes.conn.sql_list("""select h.holiday_date from `tabEmployee` emp, + `tabSales Person` sp, `tabHoliday` h, `tabHoliday List` hl + where sp.name=%s and emp.name=sp.employee + and hl.name=emp.holiday_list and + h.parent=hl.name and + hl.fiscal_year=%s""", (sales_person, fy_details[0])) + if not holiday_list: + holiday_list = webnotes.conn.sql("""select h.holiday_date from + `tabHoliday` h, `tabHoliday List` hl + where h.parent=hl.name and ifnull(hl.is_default, 0) = 1 + and hl.fiscal_year=%s""", fy_details[0]) + + while not validated and holiday_list: + if schedule_date in holiday_list: + schedule_date = add_days(schedule_date, -1) + else: + validated = True return schedule_date From 42db5d76a9d709749f4a0ff161cbbeff4dac48f9 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 6 Jan 2014 11:20:37 +0530 Subject: [PATCH 026/107] Fixes in overbilling validation --- controllers/accounts_controller.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/controllers/accounts_controller.py b/controllers/accounts_controller.py index 1a399219e4..778348d3cc 100644 --- a/controllers/accounts_controller.py +++ b/controllers/accounts_controller.py @@ -388,8 +388,9 @@ class AccountsController(TransactionBase): for item in self.doclist.get({"parentfield": "entries"}): if item.fields.get(item_ref_dn): already_billed = webnotes.conn.sql("""select sum(%s) from `tab%s` - where %s=%s and docstatus=1""" % (based_on, self.tname, item_ref_dn, '%s'), - item.fields[item_ref_dn])[0][0] + where %s=%s and docstatus=1 and parent != %s""" % + (based_on, self.tname, item_ref_dn, '%s', '%s'), + (item.fields[item_ref_dn], self.doc.name), debug=1)[0][0] total_billed_amt = flt(flt(already_billed) + flt(item.fields[based_on]), self.precision(based_on, item)) From b882fa14f4de7b7cc1ac8d5e946093b3ce78aa5d Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Mon, 6 Jan 2014 12:48:58 +0600 Subject: [PATCH 027/107] bumped to version 3.4.7 --- config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.json b/config.json index 536e5af1ba..26fc50dbb8 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,6 @@ { "app_name": "ERPNext", - "app_version": "3.4.6", + "app_version": "3.4.7", "base_template": "app/portal/templates/base.html", "modules": { "Accounts": { From 7e79f300a144a704a8f21f418aef641dbd7fcd68 Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Mon, 6 Jan 2014 12:23:29 +0530 Subject: [PATCH 028/107] accounts payable fixed --- .../accounts_payable/accounts_payable.py | 61 ++++++++++++------- 1 file changed, 39 insertions(+), 22 deletions(-) diff --git a/accounts/report/accounts_payable/accounts_payable.py b/accounts/report/accounts_payable/accounts_payable.py index f9266dc9ea..1bd8a9f323 100644 --- a/accounts/report/accounts_payable/accounts_payable.py +++ b/accounts/report/accounts_payable/accounts_payable.py @@ -9,18 +9,20 @@ from accounts.report.accounts_receivable.accounts_receivable import get_ageing_d def execute(filters=None): if not filters: filters = {} - columns = get_columns() + supplier_naming_by = webnotes.conn.get_value("Buying Settings", None, "supp_master_name") + columns = get_columns(supplier_naming_by) entries = get_gl_entries(filters) - account_supplier = dict(webnotes.conn.sql("""select account.name, supplier.supplier_name - from `tabAccount` account, `tabSupplier` supplier - where account.master_type="Supplier" and supplier.name=account.master_name""")) - + account_map = dict(((r.name, r) for r in webnotes.conn.sql("""select acc.name, + supp.supplier_name, supp.name as supplier + from `tabAccount` acc, `tabSupplier` supp + where acc.master_type="Supplier" and supp.name=acc.master_name""", as_dict=1))) + entries_after_report_date = [[gle.voucher_type, gle.voucher_no] for gle in get_gl_entries(filters, before_report_date=False)] - + account_supplier_type_map = get_account_supplier_type_map() voucher_detail_map = get_voucher_details() - + # Age of the invoice on this date age_on = getdate(filters.get("report_date")) > getdate(nowdate()) \ and nowdate() or filters.get("report_date") @@ -37,9 +39,7 @@ def execute(filters=None): if abs(flt(outstanding_amount)) > 0.01: paid_amount = invoiced_amount - outstanding_amount - row = [gle.posting_date, gle.account, account_supplier.get(gle.account, ""), - gle.voucher_type, gle.voucher_no, gle.remarks, - account_supplier_type_map.get(gle.account), + row = [gle.posting_date, gle.account, gle.voucher_type, gle.voucher_no, voucher_details.get("due_date", ""), voucher_details.get("bill_no", ""), voucher_details.get("bill_date", ""), invoiced_amount, paid_amount, outstanding_amount] @@ -50,21 +50,38 @@ def execute(filters=None): else: ageing_based_on_date = gle.posting_date - row += get_ageing_data(age_on, ageing_based_on_date, outstanding_amount) + row += get_ageing_data(age_on, ageing_based_on_date, outstanding_amount) + \ + [account_map.get(gle.account).get("supplier") or ""] + + if supplier_naming_by == "Naming Series": + row += [account_map.get(gle.account).get("supplier_name") or ""] + + row += [account_supplier_type_map.get(gle.account), gle.remarks] data.append(row) - + + for i in range(0, len(data)): + data[i].insert(4, """""" \ + % ("/".join(["#Form", data[i][2], data[i][3]]),)) + return columns, data -def get_columns(): - return [ - "Posting Date:Date:80", "Account:Link/Account:150", "Supplier::150", "Voucher Type::110", - "Voucher No::120", "Remarks::150", "Supplier Type:Link/Supplier Type:120", - "Due Date:Date:80", "Bill No::80", "Bill Date:Date:80", +def get_columns(supplier_naming_by): + columns = [ + "Posting Date:Date:80", "Account:Link/Account:150", "Voucher Type::110", + "Voucher No::120", "::30", "Due Date:Date:80", "Bill No::80", "Bill Date:Date:80", "Invoiced Amount:Currency:100", "Paid Amount:Currency:100", "Outstanding Amount:Currency:100", "Age:Int:50", "0-30:Currency:100", - "30-60:Currency:100", "60-90:Currency:100", "90-Above:Currency:100" + "30-60:Currency:100", "60-90:Currency:100", "90-Above:Currency:100", + "Supplier:Link/Supplier:150" ] - + + if supplier_naming_by == "Naming Series": + columns += ["Supplier Name::110"] + + columns += ["Supplier Type:Link/Supplier Type:120", "Remarks::150"] + + return columns + def get_gl_entries(filters, before_report_date=True): conditions, supplier_accounts = get_conditions(filters, before_report_date) gl_entries = [] @@ -102,10 +119,10 @@ def get_conditions(filters, before_report_date=True): def get_account_supplier_type_map(): account_supplier_type_map = {} - for each in webnotes.conn.sql("""select t2.name, t1.supplier_type from `tabSupplier` t1, - `tabAccount` t2 where t1.name = t2.master_name group by t2.name"""): + for each in webnotes.conn.sql("""select acc.name, supp.supplier_type from `tabSupplier` supp, + `tabAccount` acc where supp.name = acc.master_name group by acc.name"""): account_supplier_type_map[each[0]] = each[1] - + return account_supplier_type_map def get_voucher_details(): From 6b66c387ad3b5d5d83144c0dd41cc951f12f5fb9 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 6 Jan 2014 16:28:17 +0530 Subject: [PATCH 029/107] Fixes in item-wise sales/purchase register --- .../item_wise_purchase_register.py | 3 ++- .../item_wise_sales_register/item_wise_sales_register.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py b/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py index 7d81308a80..7d8a358aa1 100644 --- a/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py +++ b/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py @@ -12,7 +12,8 @@ def execute(filters=None): item_list = get_items(filters) aii_account_map = get_aii_accounts() - item_tax, tax_accounts = get_tax_accounts(item_list, columns) + if item_list: + item_tax, tax_accounts = get_tax_accounts(item_list, columns) data = [] for d in item_list: diff --git a/accounts/report/item_wise_sales_register/item_wise_sales_register.py b/accounts/report/item_wise_sales_register/item_wise_sales_register.py index dc5ecda3da..9f1fd87f70 100644 --- a/accounts/report/item_wise_sales_register/item_wise_sales_register.py +++ b/accounts/report/item_wise_sales_register/item_wise_sales_register.py @@ -11,7 +11,8 @@ def execute(filters=None): last_col = len(columns) item_list = get_items(filters) - item_tax, tax_accounts = get_tax_accounts(item_list, columns) + if item_list: + item_tax, tax_accounts = get_tax_accounts(item_list, columns) data = [] for d in item_list: @@ -39,7 +40,6 @@ def get_columns(): "Qty:Float:120", "Rate:Currency:120", "Amount:Currency:120" ] - def get_conditions(filters): conditions = "" From 01441ef37f7dbf6ca25f2197b6a08a1db5a26658 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 7 Jan 2014 11:59:36 +0530 Subject: [PATCH 030/107] Removed unwanted debug --- controllers/accounts_controller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/accounts_controller.py b/controllers/accounts_controller.py index 778348d3cc..be74fef02a 100644 --- a/controllers/accounts_controller.py +++ b/controllers/accounts_controller.py @@ -390,7 +390,7 @@ class AccountsController(TransactionBase): already_billed = webnotes.conn.sql("""select sum(%s) from `tab%s` where %s=%s and docstatus=1 and parent != %s""" % (based_on, self.tname, item_ref_dn, '%s', '%s'), - (item.fields[item_ref_dn], self.doc.name), debug=1)[0][0] + (item.fields[item_ref_dn], self.doc.name))[0][0] total_billed_amt = flt(flt(already_billed) + flt(item.fields[based_on]), self.precision(based_on, item)) From a11e14424c7e608b15c078be3547785c938b8202 Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Tue, 7 Jan 2014 12:02:45 +0530 Subject: [PATCH 031/107] fix branching, pip version and mysql-python version pinning in install_erpnext --- install_erpnext.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/install_erpnext.py b/install_erpnext.py index c95a03d3e5..01de4575b9 100644 --- a/install_erpnext.py +++ b/install_erpnext.py @@ -19,7 +19,7 @@ requirements = [ "jinja2", "markdown2", "markupsafe", - "mysql-python", + "mysql-python==1.2.4", "pygeoip", "python-dateutil", "python-memcached", @@ -148,13 +148,13 @@ def install_python_modules(): print "Installing Python Modules: (This may take some time)" print "-"*80 - if not exec_in_shell("which pip"): - exec_in_shell("easy_install pip") + if not exec_in_shell("which pip-2.7"): + exec_in_shell("easy_install-2.7 pip") - exec_in_shell("pip install --upgrade pip") - exec_in_shell("pip install --upgrade setuptools") - exec_in_shell("pip install --upgrade virtualenv") - exec_in_shell("pip install {}".format(' '.join(requirements))) + exec_in_shell("pip-2.7 install --upgrade pip") + exec_in_shell("pip-2.7 install --upgrade setuptools") + exec_in_shell("pip-2.7 install --upgrade virtualenv") + exec_in_shell("pip-2.7 install {}".format(' '.join(requirements))) def install_erpnext(install_path): print @@ -200,7 +200,7 @@ def setup_folders(install_path): app = os.path.join(install_path, "app") if not os.path.exists(app): print "Cloning erpnext" - exec_in_shell("cd %s && git clone https://github.com/webnotes/erpnext.git app" % install_path) + exec_in_shell("cd %s && git clone --branch master https://github.com/webnotes/erpnext.git app" % install_path) exec_in_shell("cd app && git config core.filemode false") if not os.path.exists(app): raise Exception, "Couldn't clone erpnext repository" @@ -208,7 +208,7 @@ def setup_folders(install_path): lib = os.path.join(install_path, "lib") if not os.path.exists(lib): print "Cloning wnframework" - exec_in_shell("cd %s && git clone https://github.com/webnotes/wnframework.git lib" % install_path) + exec_in_shell("cd %s && git clone --branch master https://github.com/webnotes/wnframework.git lib" % install_path) exec_in_shell("cd lib && git config core.filemode false") if not os.path.exists(lib): raise Exception, "Couldn't clone wnframework repository" From da282d405f857ddad3dc29993a7627b665906626 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 7 Jan 2014 12:41:09 +0530 Subject: [PATCH 032/107] Fixes in overbilling validation against DN/PR --- controllers/accounts_controller.py | 51 ++++++++++++++++-------------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/controllers/accounts_controller.py b/controllers/accounts_controller.py index be74fef02a..839dce0b4b 100644 --- a/controllers/accounts_controller.py +++ b/controllers/accounts_controller.py @@ -387,35 +387,38 @@ class AccountsController(TransactionBase): for item in self.doclist.get({"parentfield": "entries"}): if item.fields.get(item_ref_dn): - already_billed = webnotes.conn.sql("""select sum(%s) from `tab%s` - where %s=%s and docstatus=1 and parent != %s""" % - (based_on, self.tname, item_ref_dn, '%s', '%s'), - (item.fields[item_ref_dn], self.doc.name))[0][0] - - total_billed_amt = flt(flt(already_billed) + flt(item.fields[based_on]), - self.precision(based_on, item)) - ref_amt = flt(webnotes.conn.get_value(ref_dt + " Item", item.fields[item_ref_dn], based_on), self.precision(based_on, item)) + if not ref_amt: + webnotes.msgprint(_("As amount for item") + ": " + item.item_code + _(" in ") + + ref_dt + _(" is zero, system will not check for over-billed")) + else: + already_billed = webnotes.conn.sql("""select sum(%s) from `tab%s` + where %s=%s and docstatus=1 and parent != %s""" % + (based_on, self.tname, item_ref_dn, '%s', '%s'), + (item.fields[item_ref_dn], self.doc.name))[0][0] - tolerance, item_tolerance, global_tolerance = get_tolerance_for(item.item_code, - item_tolerance, global_tolerance) - - max_allowed_amt = flt(ref_amt * (100 + tolerance) / 100) + total_billed_amt = flt(flt(already_billed) + flt(item.fields[based_on]), + self.precision(based_on, item)) - if total_billed_amt - max_allowed_amt > 0.01: - reduce_by = total_billed_amt - max_allowed_amt + tolerance, item_tolerance, global_tolerance = get_tolerance_for(item.item_code, + item_tolerance, global_tolerance) - webnotes.throw(_("Row #") + cstr(item.idx) + ": " + - _(" Max amount allowed for Item ") + cstr(item.item_code) + - _(" against ") + ref_dt + " " + - cstr(item.fields[ref_dt.lower().replace(" ", "_")]) + _(" is ") + - cstr(max_allowed_amt) + ". \n" + - _("""If you want to increase your overflow tolerance, please increase \ - tolerance % in Global Defaults or Item master. - Or, you must reduce the amount by """) + cstr(reduce_by) + "\n" + - _("""Also, please check if the order item has already been billed \ - in the Sales Order""")) + max_allowed_amt = flt(ref_amt * (100 + tolerance) / 100) + + if total_billed_amt - max_allowed_amt > 0.01: + reduce_by = total_billed_amt - max_allowed_amt + + webnotes.throw(_("Row #") + cstr(item.idx) + ": " + + _(" Max amount allowed for Item ") + cstr(item.item_code) + + _(" against ") + ref_dt + " " + + cstr(item.fields[ref_dt.lower().replace(" ", "_")]) + _(" is ") + + cstr(max_allowed_amt) + ". \n" + + _("""If you want to increase your overflow tolerance, please increase \ + tolerance % in Global Defaults or Item master. + Or, you must reduce the amount by """) + cstr(reduce_by) + "\n" + + _("""Also, please check if the order item has already been billed \ + in the Sales Order""")) def get_company_default(self, fieldname): from accounts.utils import get_company_default From 777bff6e8df41ff6575141c54fc6d96ec5469a0e Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Tue, 7 Jan 2014 14:17:44 +0600 Subject: [PATCH 033/107] bumped to version 3.4.8 --- config.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.json b/config.json index 26fc50dbb8..078ca16188 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,6 @@ { "app_name": "ERPNext", - "app_version": "3.4.7", + "app_version": "3.4.8", "base_template": "app/portal/templates/base.html", "modules": { "Accounts": { @@ -74,5 +74,5 @@ "type": "module" } }, - "requires_framework_version": "==3.4.3" + "requires_framework_version": "==3.4.4" } \ No newline at end of file From 10fd91c78e0c27941164306d43fbc5d87470fa1c Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 7 Jan 2014 16:18:41 +0530 Subject: [PATCH 034/107] Close tickets automatically through scheduler --- startup/schedule_handlers.py | 4 ++++ support/doctype/support_ticket/get_support_mails.py | 5 ----- support/doctype/support_ticket/support_ticket.py | 7 ++++++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/startup/schedule_handlers.py b/startup/schedule_handlers.py index 252a091547..0cf06026d6 100644 --- a/startup/schedule_handlers.py +++ b/startup/schedule_handlers.py @@ -53,6 +53,10 @@ def execute_daily(): # email digest from setup.doctype.email_digest.email_digest import send run_fn(send) + + # auto close support tickets + from support.doctype.support_ticket.support_ticket import auto_close_tickets + run_fn(auto_close_tickets) def execute_weekly(): from setup.doctype.backup_manager.backup_manager import take_backups_weekly diff --git a/support/doctype/support_ticket/get_support_mails.py b/support/doctype/support_ticket/get_support_mails.py index 33cb023747..67ed9f6ae8 100644 --- a/support/doctype/support_ticket/get_support_mails.py +++ b/support/doctype/support_ticket/get_support_mails.py @@ -52,11 +52,6 @@ Original Query: subject = '['+cstr(d.name)+'] ' + cstr(d.subject), \ msg = cstr(response)) - def auto_close_tickets(self): - webnotes.conn.sql("""update `tabSupport Ticket` set status = 'Closed' - where status = 'Replied' - and date_sub(curdate(),interval 15 Day) > modified""") - def get_support_mails(): if cint(webnotes.conn.get_value('Email Settings', None, 'sync_support_mails')): SupportMailbox() diff --git a/support/doctype/support_ticket/support_ticket.py b/support/doctype/support_ticket/support_ticket.py index fd79583129..3030a146fe 100644 --- a/support/doctype/support_ticket/support_ticket.py +++ b/support/doctype/support_ticket/support_ticket.py @@ -66,4 +66,9 @@ class DocType(TransactionBase): def set_status(name, status): st = webnotes.bean("Support Ticket", name) st.doc.status = status - st.save() \ No newline at end of file + st.save() + +def auto_close_tickets(): + webnotes.conn.sql("""update `tabSupport Ticket` set status = 'Closed' + where status = 'Replied' + and date_sub(curdate(),interval 15 Day) > modified""") \ No newline at end of file From 69951e5d1ca6e42f3ec735c60f525add22680f43 Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Tue, 7 Jan 2014 18:24:40 +0530 Subject: [PATCH 035/107] fix installer python packages issue --- install_erpnext.py | 60 ++++++++++++++++------------------------------ 1 file changed, 20 insertions(+), 40 deletions(-) diff --git a/install_erpnext.py b/install_erpnext.py index 01de4575b9..e285d4bbfe 100644 --- a/install_erpnext.py +++ b/install_erpnext.py @@ -5,6 +5,7 @@ from __future__ import unicode_literals import os, sys import argparse +import subprocess is_redhat = is_debian = None root_password = None @@ -80,7 +81,7 @@ def validate_install(): return is_redhat, is_debian def install_using_yum(): - packages = "python python-setuptools gcc python-devel MySQL-python git memcached ntp vim-enhanced screen" + packages = "gcc MySQL-python git memcached ntp vim-enhanced screen" print "-"*80 print "Installing Packages: (This may take some time)" @@ -88,7 +89,10 @@ def install_using_yum(): print "-"*80 exec_in_shell("yum install -y %s" % packages) - if not exec_in_shell("which mysql"): + + try: + exec_in_shell("which mysql") + except subprocess.CalledProcessError: packages = "mysql mysql-server mysql-devel" print "Installing Packages:", packages exec_in_shell("yum install -y %s" % packages) @@ -101,26 +105,19 @@ def install_using_yum(): exec_in_shell('mysqladmin -u root password "%s"' % (root_password,)) print "Root password set as", root_password - # install htop - if not exec_in_shell("which htop"): - try: - exec_in_shell("cd /tmp && rpm -i --force http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm && yum install -y htop") - except: - pass - update_config_for_redhat() def update_config_for_redhat(): import re # set to autostart on startup - for service in ("mysqld", "memcached", "ntpd"): + for service in ("mysqld", "memcached"): exec_in_shell("chkconfig --level 2345 %s on" % service) exec_in_shell("service %s restart" % service) def install_using_apt(): exec_in_shell("apt-get update") - packages = "python python-setuptools python-dev build-essential python-pip python-mysqldb git memcached ntp vim screen htop" + packages = "python python-setuptools python-dev build-essential python-mysqldb git memcached ntp vim screen htop" print "-"*80 print "Installing Packages: (This may take some time)" print packages @@ -132,7 +129,9 @@ def install_using_apt(): exec_in_shell("echo mysql-server mysql-server/root_password password %s | sudo debconf-set-selections" % root_password) exec_in_shell("echo mysql-server mysql-server/root_password_again password %s | sudo debconf-set-selections" % root_password) - if not exec_in_shell("which mysql"): + try: + exec_in_shell("which mysql") + except subprocess.CalledProcessError: packages = "mysql-server libmysqlclient-dev" print "Installing Packages:", packages exec_in_shell("apt-get install -y %s" % packages) @@ -140,7 +139,7 @@ def install_using_apt(): update_config_for_debian() def update_config_for_debian(): - for service in ("mysql", "ntpd"): + for service in ("mysql",): exec_in_shell("service %s restart" % service) def install_python_modules(): @@ -148,13 +147,14 @@ def install_python_modules(): print "Installing Python Modules: (This may take some time)" print "-"*80 - if not exec_in_shell("which pip-2.7"): + try: + exec_in_shell("which pip2.7") + except subprocess.CalledProcessError: exec_in_shell("easy_install-2.7 pip") - exec_in_shell("pip-2.7 install --upgrade pip") - exec_in_shell("pip-2.7 install --upgrade setuptools") - exec_in_shell("pip-2.7 install --upgrade virtualenv") - exec_in_shell("pip-2.7 install {}".format(' '.join(requirements))) + exec_in_shell("pip2.7 install --upgrade setuptools --no-use-wheel") + exec_in_shell("pip2.7 install --upgrade setuptools") + exec_in_shell("pip2.7 install {}".format(' '.join(requirements))) def install_erpnext(install_path): print @@ -243,28 +243,8 @@ def post_install(install_path): def exec_in_shell(cmd): # using Popen instead of os.system - as recommended by python docs - from subprocess import Popen - import tempfile - - with tempfile.TemporaryFile() as stdout: - with tempfile.TemporaryFile() as stderr: - p = Popen(cmd, shell=True, stdout=stdout, stderr=stderr) - p.wait() - - stdout.seek(0) - out = stdout.read() - if out: out = out.decode('utf-8') - - stderr.seek(0) - err = stderr.read() - if err: err = err.decode('utf-8') - - if err and any((kw in err.lower() for kw in ["traceback", "error", "exception"])): - print out - raise Exception, err - else: - print "." - + import subprocess + out = subprocess.check_output(cmd, shell=True) return out def parse_args(): From 806017c92ab7b0bc2d0f5671dc55d16c88f0766d Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Tue, 7 Jan 2014 18:37:38 +0530 Subject: [PATCH 036/107] Price List and Item Price : Validfor Buying and Selling as separate check box --- accounts/doctype/pos_setting/pos_setting.js | 2 +- .../purchase_common/purchase_common.js | 2 +- buying/doctype/supplier/supplier.js | 2 +- buying/utils.py | 12 +-- controllers/accounts_controller.py | 18 ++-- .../p03_buying_selling_for_price_list.py | 21 +--- ...ice_list_and_item_details_in_item_price.py | 4 +- patches/patch_list.py | 1 + public/js/transaction.js | 9 +- selling/doctype/customer/customer.js | 2 +- selling/sales_common.js | 2 +- selling/utils/__init__.py | 14 ++- setup/page/setup_wizard/setup_wizard.py | 3 +- stock/doctype/item_price/item_price.js | 5 +- stock/doctype/item_price/item_price.py | 11 ++- stock/doctype/item_price/item_price.txt | 40 +++++--- stock/doctype/price_list/price_list.css | 7 -- stock/doctype/price_list/price_list.py | 15 ++- stock/doctype/price_list/price_list.txt | 19 ++-- stock/doctype/price_list/test_price_list.py | 8 +- stock/report/item_prices/item_prices.py | 4 +- utilities/demo/demo_docs/Item_Price.csv | 98 +++++++++---------- 22 files changed, 147 insertions(+), 152 deletions(-) delete mode 100644 stock/doctype/price_list/price_list.css diff --git a/accounts/doctype/pos_setting/pos_setting.js b/accounts/doctype/pos_setting/pos_setting.js index 8c5f254a52..dc13bb50ca 100755 --- a/accounts/doctype/pos_setting/pos_setting.js +++ b/accounts/doctype/pos_setting/pos_setting.js @@ -7,7 +7,7 @@ cur_frm.cscript.onload = function(doc,cdt,cdn){ }); cur_frm.set_query("selling_price_list", function() { - return { filters: { buying_or_selling: "Selling" } }; + return { filters: { selling: 1 } }; }); } diff --git a/buying/doctype/purchase_common/purchase_common.js b/buying/doctype/purchase_common/purchase_common.js index 9661f6edaf..14b8279245 100644 --- a/buying/doctype/purchase_common/purchase_common.js +++ b/buying/doctype/purchase_common/purchase_common.js @@ -22,7 +22,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ if(this.frm.fields_dict.buying_price_list) { this.frm.set_query("buying_price_list", function() { return{ - filters: { 'buying_or_selling': "Buying" } + filters: { 'buying': 1 } } }); } diff --git a/buying/doctype/supplier/supplier.js b/buying/doctype/supplier/supplier.js index 061861643d..ec4d3e606f 100644 --- a/buying/doctype/supplier/supplier.js +++ b/buying/doctype/supplier/supplier.js @@ -95,6 +95,6 @@ cur_frm.cscript.make_contact = function() { cur_frm.fields_dict['default_price_list'].get_query = function(doc,cdt,cdn) { return{ - filters:{'buying_or_selling': "Buying"} + filters:{'buying': 1} } } \ No newline at end of file diff --git a/buying/utils.py b/buying/utils.py index 0d9c8fa838..35d89c559d 100644 --- a/buying/utils.py +++ b/buying/utils.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals import webnotes -from webnotes import msgprint, _ +from webnotes import msgprint, _, throw from webnotes.utils import getdate, flt, add_days, cstr import json @@ -90,7 +90,7 @@ def _get_price_list_rate(args, item_bean, meta): # try fetching from price list if args.buying_price_list and args.price_list_currency: price_list_rate = webnotes.conn.sql("""select ref_rate from `tabItem Price` - where price_list=%s and item_code=%s and buying_or_selling='Buying'""", + where price_list=%s and item_code=%s and buying=1""", (args.buying_price_list, args.item_code), as_dict=1) if price_list_rate: @@ -122,14 +122,12 @@ def _validate_item_details(args, item): # validate if purchase item or subcontracted item if item.is_purchase_item != "Yes": - msgprint(_("Item") + (" %s: " % item.name) + _("not a purchase item"), - raise_exception=True) + throw(_("Item") + (" %s: " % item.name) + _("not a purchase item")) if args.is_subcontracted == "Yes" and item.is_sub_contracted_item != "Yes": - msgprint(_("Item") + (" %s: " % item.name) + + throw(_("Item") + (" %s: " % item.name) + _("not a sub-contracted item.") + - _("Please select a sub-contracted item or do not sub-contract the transaction."), - raise_exception=True) + _("Please select a sub-contracted item or do not sub-contract the transaction.")) def get_last_purchase_details(item_code, doc_name=None, conversion_rate=1.0): """returns last purchase details in stock uom""" diff --git a/controllers/accounts_controller.py b/controllers/accounts_controller.py index 1a399219e4..6660a93e4e 100644 --- a/controllers/accounts_controller.py +++ b/controllers/accounts_controller.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals import webnotes -from webnotes import _, msgprint +from webnotes import _, msgprint, throw from webnotes.utils import flt, cint, today, cstr from webnotes.model.code import get_obj from setup.utils import get_company_currency @@ -50,8 +50,8 @@ class AccountsController(TransactionBase): if accounts: if not filter(lambda x: cstr(x.freeze_account) in ["", "No"], accounts): - msgprint(_("Account for this ") + fieldname + _(" has been freezed. ") + - self.doc.doctype + _(" can not be made."), raise_exception=1) + throw(_("Account for this ") + fieldname + _(" has been freezed. ") + + self.doc.doctype + _(" can not be made.")) def set_price_list_currency(self, buying_or_selling): if self.meta.get_field("currency"): @@ -179,17 +179,17 @@ class AccountsController(TransactionBase): """ if tax.charge_type in ["On Previous Row Amount", "On Previous Row Total"] and \ (not tax.row_id or cint(tax.row_id) >= tax.idx): - msgprint((_("Row") + " # %(idx)s [%(taxes_doctype)s]: " + \ + throw((_("Row") + " # %(idx)s [%(taxes_doctype)s]: " + \ _("Please specify a valid") + " %(row_id_label)s") % { "idx": tax.idx, "taxes_doctype": tax.doctype, "row_id_label": self.meta.get_label("row_id", parentfield=self.other_fname) - }, raise_exception=True) + }) def validate_inclusive_tax(self, tax): def _on_previous_row_error(row_range): - msgprint((_("Row") + " # %(idx)s [%(doctype)s]: " + + throw((_("Row") + " # %(idx)s [%(doctype)s]: " + _("to be included in Item's rate, it is required that: ") + " [" + _("Row") + " # %(row_range)s] " + _("also be included in Item's rate")) % { "idx": tax.idx, @@ -200,12 +200,12 @@ class AccountsController(TransactionBase): parentfield=self.other_fname), "charge_type": tax.charge_type, "row_range": row_range - }, raise_exception=True) + }) if cint(tax.included_in_print_rate): if tax.charge_type == "Actual": # inclusive tax cannot be of type Actual - msgprint((_("Row") + throw((_("Row") + " # %(idx)s [%(doctype)s]: %(charge_type_label)s = \"%(charge_type)s\" " + "cannot be included in Item's rate") % { "idx": tax.idx, @@ -213,7 +213,7 @@ class AccountsController(TransactionBase): "charge_type_label": self.meta.get_label("charge_type", parentfield=self.other_fname), "charge_type": tax.charge_type, - }, raise_exception=True) + }) elif tax.charge_type == "On Previous Row Amount" and \ not cint(self.tax_doclist[tax.row_id - 1].included_in_print_rate): # referred row should also be inclusive diff --git a/patches/june_2013/p03_buying_selling_for_price_list.py b/patches/june_2013/p03_buying_selling_for_price_list.py index 2f92fe6a9e..15da085e53 100644 --- a/patches/june_2013/p03_buying_selling_for_price_list.py +++ b/patches/june_2013/p03_buying_selling_for_price_list.py @@ -8,20 +8,7 @@ from webnotes.utils import cint def execute(): webnotes.reload_doc("stock", "doctype", "price_list") webnotes.reload_doc("stock", "doctype", "item_price") - - try: - for price_list in webnotes.conn.sql_list("""select name from `tabPrice List`"""): - buying, selling = False, False - for b, s in webnotes.conn.sql("""select distinct buying, selling - from `tabItem Price` where price_list_name=%s""", price_list): - buying = buying or cint(b) - selling = selling or cint(s) - - buying_or_selling = "Selling" if selling else "Buying" - webnotes.conn.set_value("Price List", price_list, "buying_or_selling", buying_or_selling) - except webnotes.SQLError, e: - if e.args[0] == 1054: - webnotes.conn.sql("""update `tabPrice List` set buying_or_selling='Selling' - where ifnull(buying_or_selling, '')='' """) - else: - raise \ No newline at end of file + + webnotes.conn.sql("""update `tabPrice List` pl, `tabItem Price` ip + set pl.selling=ip.selling, pl.buying=ip.buying + where pl.name=ip.price_list_name""") \ No newline at end of file diff --git a/patches/october_2013/p02_update_price_list_and_item_details_in_item_price.py b/patches/october_2013/p02_update_price_list_and_item_details_in_item_price.py index 3b4ca833f1..b92f7d052a 100644 --- a/patches/october_2013/p02_update_price_list_and_item_details_in_item_price.py +++ b/patches/october_2013/p02_update_price_list_and_item_details_in_item_price.py @@ -12,9 +12,7 @@ def execute(): where ip.item_code=i.name""") webnotes.conn.sql("""update `tabItem Price` ip, `tabPrice List` pl - set ip.price_list=pl.name, ip.currency=pl.currency, - ip.buying_or_selling=pl.buying_or_selling - where ip.parent=pl.name""") + set ip.price_list=pl.name, ip.currency=pl.currency where ip.parent=pl.name""") webnotes.conn.sql("""update `tabItem Price` set parent=null, parenttype=null, parentfield=null, idx=null""") \ No newline at end of file diff --git a/patches/patch_list.py b/patches/patch_list.py index 608ba77168..d291d762c5 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -263,4 +263,5 @@ patch_list = [ "patches.1311.p08_email_digest_recipients", "execute:webnotes.delete_doc('DocType', 'Warehouse Type')", "patches.1312.p02_update_item_details_in_item_price", + "patches.1401.p01_make_buying_selling_as_check_box_in_price_list", ] \ No newline at end of file diff --git a/public/js/transaction.js b/public/js/transaction.js index 4c4a810ed2..0fe0535c6b 100644 --- a/public/js/transaction.js +++ b/public/js/transaction.js @@ -330,8 +330,7 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ doctype: tax.doctype, row_id_label: wn.meta.get_label(tax.doctype, "row_id", tax.name) }); - msgprint(msg); - throw msg; + wn.throw(msg); } }, @@ -347,8 +346,7 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ charge_type_label: wn.meta.get_label(tax.doctype, "charge_type", tax.name), charge_type: tax.charge_type }); - msgprint(msg); - throw msg; + wn.throw(msg); }; var on_previous_row_error = function(row_range) { @@ -363,8 +361,7 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ row_range: row_range, }); - msgprint(msg); - throw msg; + wn.throw(msg); }; if(cint(tax.included_in_print_rate)) { diff --git a/selling/doctype/customer/customer.js b/selling/doctype/customer/customer.js index 5e0ccc98f2..5d046904d3 100644 --- a/selling/doctype/customer/customer.js +++ b/selling/doctype/customer/customer.js @@ -122,6 +122,6 @@ cur_frm.fields_dict.lead_name.get_query = function(doc,cdt,cdn) { cur_frm.fields_dict['default_price_list'].get_query = function(doc,cdt,cdn) { return{ - filters:{'buying_or_selling': "Selling"} + filters:{'selling': 1} } } diff --git a/selling/sales_common.js b/selling/sales_common.js index dddc2b568d..f4f643015e 100644 --- a/selling/sales_common.js +++ b/selling/sales_common.js @@ -48,7 +48,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ if(this.frm.fields_dict.selling_price_list) { this.frm.set_query("selling_price_list", function() { - return { filters: { buying_or_selling: "Selling" } }; + return { filters: { selling: 1 } }; }); } diff --git a/selling/utils/__init__.py b/selling/utils/__init__.py index 5974da7d8b..85c20e86d8 100644 --- a/selling/utils/__init__.py +++ b/selling/utils/__init__.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals import webnotes -from webnotes import msgprint, _ +from webnotes import msgprint, _, throw from webnotes.utils import flt, cint, comma_and import json @@ -100,7 +100,7 @@ def _get_item_code(barcode=None, serial_no=None): where name=%s""", serial_no) if not item_code: - msgprint(_("No Item found with ") + input_type + ": %s" % (barcode or serial_no), raise_exception=True) + throw(_("No Item found with ") + input_type + ": %s" % (barcode or serial_no)) return item_code[0] @@ -111,14 +111,12 @@ def _validate_item_details(args, item): # validate if sales item or service item if args.order_type == "Maintenance": if item.is_service_item != "Yes": - msgprint(_("Item") + (" %s: " % item.name) + + throw(_("Item") + (" %s: " % item.name) + _("not a service item.") + - _("Please select a service item or change the order type to Sales."), - raise_exception=True) + _("Please select a service item or change the order type to Sales.")) elif item.is_sales_item != "Yes": - msgprint(_("Item") + (" %s: " % item.name) + _("not a sales item"), - raise_exception=True) + throw(_("Item") + (" %s: " % item.name) + _("not a sales item")) def _get_basic_details(args, item_bean, warehouse_fieldname): item = item_bean.doc @@ -147,7 +145,7 @@ def _get_basic_details(args, item_bean, warehouse_fieldname): def _get_price_list_rate(args, item_bean, meta): ref_rate = webnotes.conn.sql("""select ref_rate from `tabItem Price` - where price_list=%s and item_code=%s and buying_or_selling='Selling'""", + where price_list=%s and item_code=%s and selling=1""", (args.selling_price_list, args.item_code), as_dict=1) if not ref_rate: diff --git a/setup/page/setup_wizard/setup_wizard.py b/setup/page/setup_wizard/setup_wizard.py index c1d3571ea5..ededd472a8 100644 --- a/setup/page/setup_wizard/setup_wizard.py +++ b/setup/page/setup_wizard/setup_wizard.py @@ -98,7 +98,8 @@ def create_price_lists(args): { "doctype": "Price List", "price_list_name": "Standard " + pl_type, - "buying_or_selling": pl_type, + "buying": 1 if pl_type == "Buying" else 0, + "selling": 1 if pl_type == "Selling" else 0, "currency": args["currency"] }, { diff --git a/stock/doctype/item_price/item_price.js b/stock/doctype/item_price/item_price.js index bece26c6b5..9f38fdb18e 100644 --- a/stock/doctype/item_price/item_price.js +++ b/stock/doctype/item_price/item_price.js @@ -2,11 +2,10 @@ // License: GNU General Public License v3. See license.txt $.extend(cur_frm.cscript, { - onload: function () { - // Fetch price list details - cur_frm.add_fetch("price_list", "buying_or_selling", "buying_or_selling"); + cur_frm.add_fetch("price_list", "buying", "buying"); + cur_frm.add_fetch("price_list", "selling", "selling"); cur_frm.add_fetch("price_list", "currency", "currency"); // Fetch item details diff --git a/stock/doctype/item_price/item_price.py b/stock/doctype/item_price/item_price.py index 072d70096e..9a8e3d35fb 100644 --- a/stock/doctype/item_price/item_price.py +++ b/stock/doctype/item_price/item_price.py @@ -1,7 +1,5 @@ # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors -# MIT License. See license.txt - -# For license information, please see license.txt +# License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import webnotes @@ -19,8 +17,11 @@ class DocType: self.update_item_details() def update_price_list_details(self): - self.doc.buying_or_selling, self.doc.currency = webnotes.conn.get_value("Price List", - self.doc.price_list, ["buying_or_selling", "currency"]) + if not self.doc.selling and not self.doc.buying: + self.doc.buying, self.doc.selling = webnotes.conn.get_value("Price List", + self.doc.price_list, ["buying", "selling"]) + + self.doc.currency = webnotes.conn.get_value("Price List", self.doc.price_list, "currency") def update_item_details(self): self.doc.item_name, self.doc.item_description = webnotes.conn.get_value("Item", diff --git a/stock/doctype/item_price/item_price.txt b/stock/doctype/item_price/item_price.txt index fc411eb1d6..b25fd30812 100644 --- a/stock/doctype/item_price/item_price.txt +++ b/stock/doctype/item_price/item_price.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-02 16:29:48", "docstatus": 0, - "modified": "2013-10-31 12:59:02", + "modified": "2014-01-07 18:11:10", "modified_by": "Administrator", "owner": "Administrator" }, @@ -43,6 +43,13 @@ "doctype": "DocType", "name": "Item Price" }, + { + "doctype": "DocField", + "fieldname": "price_list_details", + "fieldtype": "Section Break", + "label": "Price List", + "options": "icon-tags" + }, { "doctype": "DocField", "fieldname": "price_list", @@ -52,6 +59,27 @@ "options": "Price List", "reqd": 1 }, + { + "doctype": "DocField", + "fieldname": "buying", + "fieldtype": "Check", + "in_list_view": 1, + "label": "Buying" + }, + { + "doctype": "DocField", + "fieldname": "selling", + "fieldtype": "Check", + "in_list_view": 1, + "label": "Selling" + }, + { + "doctype": "DocField", + "fieldname": "item_details", + "fieldtype": "Section Break", + "label": "Item", + "options": "icon-tag" + }, { "doctype": "DocField", "fieldname": "item_code", @@ -83,16 +111,6 @@ "fieldname": "col_br_1", "fieldtype": "Column Break" }, - { - "doctype": "DocField", - "fieldname": "buying_or_selling", - "fieldtype": "Select", - "in_filter": 1, - "in_list_view": 1, - "label": "Valid for Buying or Selling?", - "options": "Selling\nBuying", - "reqd": 0 - }, { "doctype": "DocField", "fieldname": "item_name", diff --git a/stock/doctype/price_list/price_list.css b/stock/doctype/price_list/price_list.css deleted file mode 100644 index 61b069442f..0000000000 --- a/stock/doctype/price_list/price_list.css +++ /dev/null @@ -1,7 +0,0 @@ -.table-grid tbody tr { - cursor: pointer; -} - -.table-grid thead tr { - height: 50px; -} \ No newline at end of file diff --git a/stock/doctype/price_list/price_list.py b/stock/doctype/price_list/price_list.py index d0e5d2b6d4..569e759159 100644 --- a/stock/doctype/price_list/price_list.py +++ b/stock/doctype/price_list/price_list.py @@ -3,16 +3,15 @@ from __future__ import unicode_literals import webnotes -from webnotes import msgprint, _ +from webnotes import msgprint, _, throw from webnotes.utils import comma_or, cint from webnotes.model.controller import DocListController import webnotes.defaults class DocType(DocListController): def validate(self): - if self.doc.buying_or_selling not in ["Buying", "Selling"]: - msgprint(_(self.meta.get_label("buying_or_selling")) + " " + _("must be one of") + " " + - comma_or(["Buying", "Selling"]), raise_exception=True) + if not self.doc.buying and not self.doc.selling: + throw(_("Price List must be one of Buying or Selling")) if not self.doclist.get({"parentfield": "valid_for_territories"}): # if no territory, set default territory @@ -34,15 +33,15 @@ class DocType(DocListController): cart_settings.validate_price_lists() def set_default_if_missing(self): - if self.doc.buying_or_selling=="Selling": + if self.doc.selling: if not webnotes.conn.get_value("Selling Settings", None, "selling_price_list"): webnotes.set_value("Selling Settings", "Selling Settings", "selling_price_list", self.doc.name) - elif self.doc.buying_or_selling=="Buying": + elif self.doc.buying: if not webnotes.conn.get_value("Buying Settings", None, "buying_price_list"): webnotes.set_value("Buying Settings", "Buying Settings", "buying_price_list", self.doc.name) def update_item_price(self): webnotes.conn.sql("""update `tabItem Price` set currency=%s, - buying_or_selling=%s, modified=NOW() where price_list=%s""", - (self.doc.currency, self.doc.buying_or_selling, self.doc.name)) \ No newline at end of file + buying=%s, selling=%s, modified=NOW() where price_list=%s""", + (self.doc.currency, self.doc.buying, self.doc.selling, self.doc.name)) \ No newline at end of file diff --git a/stock/doctype/price_list/price_list.txt b/stock/doctype/price_list/price_list.txt index d43076bcc8..69c3ecbc4c 100644 --- a/stock/doctype/price_list/price_list.txt +++ b/stock/doctype/price_list/price_list.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-25 11:35:09", "docstatus": 0, - "modified": "2013-10-31 19:24:33", + "modified": "2014-01-06 18:28:23", "modified_by": "Administrator", "owner": "Administrator" }, @@ -61,14 +61,19 @@ "reqd": 1 }, { - "default": "Selling", "doctype": "DocField", - "fieldname": "buying_or_selling", - "fieldtype": "Select", + "fieldname": "buying", + "fieldtype": "Check", "in_list_view": 1, - "label": "Valid for Buying or Selling?", - "options": "Buying\nSelling", - "reqd": 1 + "label": "Buying" + }, + { + "doctype": "DocField", + "fieldname": "selling", + "fieldtype": "Check", + "in_list_view": 1, + "label": "Selling", + "reqd": 0 }, { "doctype": "DocField", diff --git a/stock/doctype/price_list/test_price_list.py b/stock/doctype/price_list/test_price_list.py index 86dcd1a594..bdcacc3452 100644 --- a/stock/doctype/price_list/test_price_list.py +++ b/stock/doctype/price_list/test_price_list.py @@ -12,7 +12,7 @@ test_records = [ "doctype": "Price List", "price_list_name": "_Test Price List", "currency": "INR", - "buying_or_selling": "Selling" + "selling": 1 }, { "doctype": "Applicable Territory", @@ -25,7 +25,7 @@ test_records = [ "doctype": "Price List", "price_list_name": "_Test Price List 2", "currency": "INR", - "buying_or_selling": "Selling" + "selling": 1 }, { "doctype": "Applicable Territory", @@ -38,7 +38,7 @@ test_records = [ "doctype": "Price List", "price_list_name": "_Test Price List India", "currency": "INR", - "buying_or_selling": "Selling" + "selling": 1 }, { "doctype": "Applicable Territory", @@ -51,7 +51,7 @@ test_records = [ "doctype": "Price List", "price_list_name": "_Test Price List Rest of the World", "currency": "USD", - "buying_or_selling": "Selling" + "selling": 1 }, { "doctype": "Applicable Territory", diff --git a/stock/report/item_prices/item_prices.py b/stock/report/item_prices/item_prices.py index da8b5007d5..e744cc73e4 100644 --- a/stock/report/item_prices/item_prices.py +++ b/stock/report/item_prices/item_prices.py @@ -65,13 +65,13 @@ def get_price_list(): rate = {} - price_list = webnotes.conn.sql("""select item_code, buying_or_selling, + price_list = webnotes.conn.sql("""select item_code, buying, selling, concat(price_list, " - ", currency, " ", ref_rate) as price from `tabItem Price`""", as_dict=1) for j in price_list: if j.price: - rate.setdefault(j.item_code, {}).setdefault(j.buying_or_selling, []).append(j.price) + rate.setdefault(j.item_code, {}).setdefault("Buying" if j.buying else "Selling", []).append(j.price) item_rate_map = {} for item in rate: diff --git a/utilities/demo/demo_docs/Item_Price.csv b/utilities/demo/demo_docs/Item_Price.csv index d70b7b3e67..cd7a13937f 100644 --- a/utilities/demo/demo_docs/Item_Price.csv +++ b/utilities/demo/demo_docs/Item_Price.csv @@ -1,49 +1,49 @@ -Data Import Template,,,,,,, -Table:,Item Price,,,,,, -,,,,,,, -,,,,,,, -Notes:,,,,,,, -Please do not change the template headings.,,,,,,, -First data column must be blank.,,,,,,, -"If you are uploading new records, leave the ""name"""" (ID) column blank.""",,,,,,, -"If you are uploading new records, ""Naming Series"""" becomes mandatory"," if present.""",,,,,, -Only mandatory fields are necessary for new records. You can delete non-mandatory columns if you wish.,,,,,,, -"For updating, you can update only selective columns.",,,,,,, -You can only upload upto 5000 records in one go. (may be less in some cases),,,,,,, -,,,,,,, -DocType:,Item Price,,,,,, -Column Labels:,ID,Price List,Item Code,Rate,Valid for Buying or Selling?,Item Name,Item Description -Column Name:,name,price_list,item_code,ref_rate,buying_or_selling,item_name,item_description -Mandatory:,Yes,Yes,Yes,Yes,No,No,No -Type:,Data (text),Link,Link,Currency,Select,Data,Text -Info:,,Valid Price List,Valid Item,,"One of: Selling, Buying",, -Start entering data below this line,,,,,,, -,,Standard Buying,Base Bearing Plate,15,Buying,, -,,Standard Buying,Base Plate,20,Buying,, -,,Standard Buying,Bearing Block,10,Buying,, -,,Standard Buying,Bearing Collar,20,Buying,, -,,Standard Buying,Bearing Pipe,15,Buying,, -,,Standard Buying,Blade Rib,10,Buying,, -,,Standard Buying,Disc Collars,74,Buying,, -,,Standard Buying,External Disc,45,Buying,, -,,Standard Buying,Internal Disc,33,Buying,, -,,Standard Buying,Shaft,30,Buying,, -,,Standard Buying,Stand,40,Buying,, -,,Standard Buying,Upper Bearing Plate,50,Buying,, -,,Standard Buying,Wing Sheet,22,Buying,, -,,Standard Selling,Wind Turbine,21,Selling,, -,,Standard Selling,Wind Mill A Series,28,Selling,, -,,Standard Selling,Wind MIll C Series,14,Selling,, -,,Standard Selling,Base Bearing Plate,28,Selling,, -,,Standard Selling,Base Plate,21,Selling,, -,,Standard Selling,Bearing Block,14,Selling,, -,,Standard Selling,Bearing Collar,103.6,Selling,, -,,Standard Selling,Bearing Pipe,63,Selling,, -,,Standard Selling,Blade Rib,46.2,Selling,, -,,Standard Selling,Disc Collars,42,Selling,, -,,Standard Selling,External Disc,56,Selling,, -,,Standard Selling,Internal Disc,70,Selling,, -,,Standard Selling,Shaft,340,Selling,, -,,Standard Selling,Stand,400,Selling,, -,,Standard Selling,Upper Bearing Plate,300,Selling,, -,,Standard Selling,Wing Sheet,30.8,Selling,, \ No newline at end of file +Data Import Template,,,,,,,, +Table:,Item Price,,,,,,, +,,,,,,,, +,,,,,,,, +Notes:,,,,,,,, +Please do not change the template headings.,,,,,,,, +First data column must be blank.,,,,,,,, +"If you are uploading new records, leave the ""name"" (ID) column blank.",,,,,,,, +"If you are uploading new records, ""Naming Series"" becomes mandatory, if present.",,,,,,,, +Only mandatory fields are necessary for new records. You can delete non-mandatory columns if you wish.,,,,,,,, +"For updating, you can update only selective columns.",,,,,,,, +You can only upload upto 5000 records in one go. (may be less in some cases),,,,,,,, +,,,,,,,, +DocType:,Item Price,,,,,,, +Column Labels:,ID,Price List,Item Code,Rate,Buying,Selling,Item Name,Item Description +Column Name:,name,price_list,item_code,ref_rate,buying,selling,item_name,item_description +Mandatory:,Yes,Yes,Yes,Yes,No,No,No,No +Type:,Data (text),Link,Link,Currency,Check,Check,Data,Text +Info:,,Valid Price List,Valid Item,,0 or 1,0 or 1,, +Start entering data below this line,,,,,,,, +,,Standard Buying,Base Bearing Plate,15,1,,, +,,Standard Buying,Base Plate,20,1,,, +,,Standard Buying,Bearing Block,10,1,,, +,,Standard Buying,Bearing Collar,20,1,,, +,,Standard Buying,Bearing Pipe,15,1,,, +,,Standard Buying,Blade Rib,10,1,,, +,,Standard Buying,Disc Collars,74,1,,, +,,Standard Buying,External Disc,45,1,,, +,,Standard Buying,Internal Disc,33,1,,, +,,Standard Buying,Shaft,30,1,,, +,,Standard Buying,Stand,40,1,,, +,,Standard Buying,Upper Bearing Plate,50,1,,, +,,Standard Buying,Wing Sheet,22,1,,, +,,Standard Selling,Wind Turbine,21,,1,, +,,Standard Selling,Wind Mill A Series,28,,1,, +,,Standard Selling,Wind MIll C Series,14,,1,, +,,Standard Selling,Base Bearing Plate,28,,1,, +,,Standard Selling,Base Plate,21,,1,, +,,Standard Selling,Bearing Block,14,,1,, +,,Standard Selling,Bearing Collar,103.6,,1,, +,,Standard Selling,Bearing Pipe,63,,1,, +,,Standard Selling,Blade Rib,46.2,,1,, +,,Standard Selling,Disc Collars,42,,1,, +,,Standard Selling,External Disc,56,,1,, +,,Standard Selling,Internal Disc,70,,1,, +,,Standard Selling,Shaft,340,,1,, +,,Standard Selling,Stand,400,,1,, +,,Standard Selling,Upper Bearing Plate,300,,1,, +,,Standard Selling,Wing Sheet,30.8,,1,, From 029f698c657bfef53456403e920f8ab5514b4871 Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Tue, 7 Jan 2014 19:43:35 +0530 Subject: [PATCH 037/107] patch for item price and price list --- .../Print Format/POS Invoice/POS Invoice.txt | 4 +-- patches/1401/__init__.py | 0 ...ying_selling_as_check_box_in_price_list.py | 29 +++++++++++++++++++ stock/doctype/item_price/item_price.py | 7 ++--- stock/doctype/item_price/item_price.txt | 8 +++-- stock/doctype/price_list/price_list.py | 16 +++++----- .../item_wise_price_list_rate/__init__.py | 0 .../item_wise_price_list_rate.txt | 22 ++++++++++++++ 8 files changed, 68 insertions(+), 18 deletions(-) create mode 100644 patches/1401/__init__.py create mode 100644 patches/1401/p01_make_buying_selling_as_check_box_in_price_list.py create mode 100644 stock/report/item_wise_price_list_rate/__init__.py create mode 100644 stock/report/item_wise_price_list_rate/item_wise_price_list_rate.txt diff --git a/accounts/Print Format/POS Invoice/POS Invoice.txt b/accounts/Print Format/POS Invoice/POS Invoice.txt index aab8e18491..4f1b20a945 100644 --- a/accounts/Print Format/POS Invoice/POS Invoice.txt +++ b/accounts/Print Format/POS Invoice/POS Invoice.txt @@ -2,14 +2,14 @@ { "creation": "2011-12-21 11:08:55", "docstatus": 0, - "modified": "2013-09-13 17:17:47", + "modified": "2014-01-07 18:46:29", "modified_by": "Administrator", "owner": "Administrator" }, { "doc_type": "Sales Invoice", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n \n \n \n \n \n \n \n
RECEIPT NO: DATE:
M/s
\n\n
\n\n\n", + "html": "\n\n\n\n\n\n\n\n\n \n \n \n \n \n \n \n
RECEIPT NO: DATE:
M/s
\n\n
\n\n\n", "module": "Accounts", "name": "__common__", "print_format_type": "Client", diff --git a/patches/1401/__init__.py b/patches/1401/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/patches/1401/p01_make_buying_selling_as_check_box_in_price_list.py b/patches/1401/p01_make_buying_selling_as_check_box_in_price_list.py new file mode 100644 index 0000000000..d5eb3e8d36 --- /dev/null +++ b/patches/1401/p01_make_buying_selling_as_check_box_in_price_list.py @@ -0,0 +1,29 @@ +# Copyright (c) 2014, Web Notes Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import webnotes + +def execute(): + webnotes.reload_doc("stock", "doctype", "price_list") + webnotes.reload_doc("stock", "doctype", "item_price") + + if "buying_or_selling" in webnotes.conn.get_table_columns("Price List"): + webnotes.conn.sql("""update `tabPrice List` set + selling = + case + when buying_or_selling='Selling' + then 1 + end, + buying = + case + when buying_or_selling='Buying' + then 1 + end + """) + webnotes.conn.sql("""update `tabItem Price` ip, `tabPrice List` pl + set ip.buying=pl.buying, ip.selling=pl.selling + where ip.price_list=pl.name""") + + webnotes.conn.sql("""udpate `tabItem Price` set selling=1 where ifnull(selling, 0)=0 and + ifnull(buying, 0)=0""") \ No newline at end of file diff --git a/stock/doctype/item_price/item_price.py b/stock/doctype/item_price/item_price.py index 9a8e3d35fb..e2c9f2fcb0 100644 --- a/stock/doctype/item_price/item_price.py +++ b/stock/doctype/item_price/item_price.py @@ -17,11 +17,8 @@ class DocType: self.update_item_details() def update_price_list_details(self): - if not self.doc.selling and not self.doc.buying: - self.doc.buying, self.doc.selling = webnotes.conn.get_value("Price List", - self.doc.price_list, ["buying", "selling"]) - - self.doc.currency = webnotes.conn.get_value("Price List", self.doc.price_list, "currency") + self.doc.buying, self.doc.selling, self.doc.currency = webnotes.conn.get_value("Price List", + self.doc.price_list, ["buying", "selling", "currency"]) def update_item_details(self): self.doc.item_name, self.doc.item_description = webnotes.conn.get_value("Item", diff --git a/stock/doctype/item_price/item_price.txt b/stock/doctype/item_price/item_price.txt index b25fd30812..f329a5ff07 100644 --- a/stock/doctype/item_price/item_price.txt +++ b/stock/doctype/item_price/item_price.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-02 16:29:48", "docstatus": 0, - "modified": "2014-01-07 18:11:10", + "modified": "2014-01-07 19:16:49", "modified_by": "Administrator", "owner": "Administrator" }, @@ -64,14 +64,16 @@ "fieldname": "buying", "fieldtype": "Check", "in_list_view": 1, - "label": "Buying" + "label": "Buying", + "read_only": 1 }, { "doctype": "DocField", "fieldname": "selling", "fieldtype": "Check", "in_list_view": 1, - "label": "Selling" + "label": "Selling", + "read_only": 1 }, { "doctype": "DocField", diff --git a/stock/doctype/price_list/price_list.py b/stock/doctype/price_list/price_list.py index 569e759159..40841cfaac 100644 --- a/stock/doctype/price_list/price_list.py +++ b/stock/doctype/price_list/price_list.py @@ -4,14 +4,14 @@ from __future__ import unicode_literals import webnotes from webnotes import msgprint, _, throw -from webnotes.utils import comma_or, cint +from webnotes.utils import cint from webnotes.model.controller import DocListController import webnotes.defaults class DocType(DocListController): def validate(self): - if not self.doc.buying and not self.doc.selling: - throw(_("Price List must be one of Buying or Selling")) + if not cint(self.doc.buying) and not cint(self.doc.selling): + throw(_("Price List must be applicable for Buying or Selling")) if not self.doclist.get({"parentfield": "valid_for_territories"}): # if no territory, set default territory @@ -24,24 +24,24 @@ class DocType(DocListController): else: # at least one territory self.validate_table_has_rows("valid_for_territories") - + def on_update(self): self.set_default_if_missing() self.update_item_price() cart_settings = webnotes.get_obj("Shopping Cart Settings") if cint(cart_settings.doc.enabled): cart_settings.validate_price_lists() - + def set_default_if_missing(self): - if self.doc.selling: + if cint(self.doc.selling): if not webnotes.conn.get_value("Selling Settings", None, "selling_price_list"): webnotes.set_value("Selling Settings", "Selling Settings", "selling_price_list", self.doc.name) - elif self.doc.buying: + elif cint(self.doc.buying): if not webnotes.conn.get_value("Buying Settings", None, "buying_price_list"): webnotes.set_value("Buying Settings", "Buying Settings", "buying_price_list", self.doc.name) def update_item_price(self): webnotes.conn.sql("""update `tabItem Price` set currency=%s, buying=%s, selling=%s, modified=NOW() where price_list=%s""", - (self.doc.currency, self.doc.buying, self.doc.selling, self.doc.name)) \ No newline at end of file + (self.doc.currency, cint(self.doc.buying), cint(self.doc.selling), self.doc.name)) \ No newline at end of file diff --git a/stock/report/item_wise_price_list_rate/__init__.py b/stock/report/item_wise_price_list_rate/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/stock/report/item_wise_price_list_rate/item_wise_price_list_rate.txt b/stock/report/item_wise_price_list_rate/item_wise_price_list_rate.txt new file mode 100644 index 0000000000..f4d1d67ca4 --- /dev/null +++ b/stock/report/item_wise_price_list_rate/item_wise_price_list_rate.txt @@ -0,0 +1,22 @@ +[ + { + "creation": "2013-09-25 10:21:15", + "docstatus": 0, + "modified": "2014-01-07 18:35:22", + "modified_by": "Administrator", + "owner": "Administrator" + }, + { + "doctype": "Report", + "is_standard": "Yes", + "json": "{\"filters\":[[\"Item Price\",\"price_list\",\"like\",\"%\"],[\"Item Price\",\"item_code\",\"like\",\"%\"]],\"columns\":[[\"name\",\"Item Price\"],[\"price_list\",\"Item Price\"],[\"item_code\",\"Item Price\"],[\"item_name\",\"Item Price\"],[\"item_description\",\"Item Price\"],[\"ref_rate\",\"Item Price\"],[\"buying\",\"Item Price\"],[\"selling\",\"Item Price\"],[\"currency\",\"Item Price\"]],\"sort_by\":\"Item Price.modified\",\"sort_order\":\"desc\",\"sort_by_next\":\"\",\"sort_order_next\":\"desc\"}", + "name": "__common__", + "ref_doctype": "Price List", + "report_name": "Item-wise Price List Rate", + "report_type": "Report Builder" + }, + { + "doctype": "Report", + "name": "Item-wise Price List Rate" + } +] \ No newline at end of file From 8d0ef21911df9cc4daba5a10bf94f588941d4e69 Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Tue, 7 Jan 2014 19:45:33 +0530 Subject: [PATCH 038/107] pos invoice print format changes --- accounts/Print Format/POS Invoice/POS Invoice.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/accounts/Print Format/POS Invoice/POS Invoice.txt b/accounts/Print Format/POS Invoice/POS Invoice.txt index 4f1b20a945..4710a4e562 100644 --- a/accounts/Print Format/POS Invoice/POS Invoice.txt +++ b/accounts/Print Format/POS Invoice/POS Invoice.txt @@ -2,14 +2,14 @@ { "creation": "2011-12-21 11:08:55", "docstatus": 0, - "modified": "2014-01-07 18:46:29", + "modified": "2014-01-07 19:44:47", "modified_by": "Administrator", "owner": "Administrator" }, { "doc_type": "Sales Invoice", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n \n \n \n \n \n \n \n
RECEIPT NO: DATE:
M/s
\n\n
\n\n\n", + "html": "\n\n\n\n\n\n\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\n\t
RECEIPT NO: DATE:
M/s
\n\t\n\t
\n\n", "module": "Accounts", "name": "__common__", "print_format_type": "Client", From 9e2358c54473501bdb6e6b0baee22ee797319c01 Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Tue, 7 Jan 2014 22:15:04 +0600 Subject: [PATCH 039/107] bumped to version 3.4.9 --- config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.json b/config.json index 078ca16188..d88d22438b 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,6 @@ { "app_name": "ERPNext", - "app_version": "3.4.8", + "app_version": "3.4.9", "base_template": "app/portal/templates/base.html", "modules": { "Accounts": { From d659343541284611afec55a474abc3a9c555d446 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 8 Jan 2014 17:29:23 +0530 Subject: [PATCH 040/107] Payment Reconciliation: Fix for outstanding voucher query --- .../payment_to_invoice_matching_tool.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 dea5fb59c9..fc58418245 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 @@ -140,13 +140,13 @@ def gl_entry_details(doctype, txt, searchfield, start, page_len, filters): and ifnull(gle.%(account_type)s, 0) > 0 and (select ifnull(abs(sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))), 0) from `tabGL Entry` - where against_voucher_type = '%(dt)s' + where account = '%(acc)s' + and against_voucher_type = '%(dt)s' and against_voucher = gle.voucher_no and voucher_no != gle.voucher_no) - != abs(ifnull(gle.debit, 0) - ifnull(gle.credit, 0) - ) - and if(gle.voucher_type='Sales Invoice', (select is_pos from `tabSales Invoice` - where name=gle.voucher_no), 0)=0 + != abs(ifnull(gle.debit, 0) - ifnull(gle.credit, 0)) + and if(gle.voucher_type='Sales Invoice', ifnull((select is_pos from `tabSales Invoice` + where name=gle.voucher_no), 0), 0)=0 %(mcond)s ORDER BY gle.posting_date desc, gle.voucher_no desc limit %(start)s, %(page_len)s""" % { From f7a102ffe334876fb481219a764529f318aee52d Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Wed, 8 Jan 2014 19:35:01 +0530 Subject: [PATCH 041/107] POS print format fixed --- accounts/Print Format/POS Invoice/POS Invoice.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/accounts/Print Format/POS Invoice/POS Invoice.txt b/accounts/Print Format/POS Invoice/POS Invoice.txt index aab8e18491..7f1bba4c96 100644 --- a/accounts/Print Format/POS Invoice/POS Invoice.txt +++ b/accounts/Print Format/POS Invoice/POS Invoice.txt @@ -2,14 +2,14 @@ { "creation": "2011-12-21 11:08:55", "docstatus": 0, - "modified": "2013-09-13 17:17:47", + "modified": "2014-01-08 19:32:16", "modified_by": "Administrator", "owner": "Administrator" }, { "doc_type": "Sales Invoice", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n \n \n \n \n \n \n \n
RECEIPT NO: DATE:
M/s
\n\n
\n\n\n", + "html": "\n\t\n\n\t\t\n\t\t\n\n\t\t\n\t\t\n\t\n\n\t\n\t\t\n\t\t
\n\t\t
\n\t\t
\n\t\t
\n\t\t
\n\t\n", "module": "Accounts", "name": "__common__", "print_format_type": "Client", From 102b417b52f6781e7959e5aa8849d63ba78d4fd6 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 9 Jan 2014 11:39:06 +0530 Subject: [PATCH 042/107] Fix: Typo on patch --- .../1401/p01_make_buying_selling_as_check_box_in_price_list.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/1401/p01_make_buying_selling_as_check_box_in_price_list.py b/patches/1401/p01_make_buying_selling_as_check_box_in_price_list.py index d5eb3e8d36..b764a7f935 100644 --- a/patches/1401/p01_make_buying_selling_as_check_box_in_price_list.py +++ b/patches/1401/p01_make_buying_selling_as_check_box_in_price_list.py @@ -25,5 +25,5 @@ def execute(): set ip.buying=pl.buying, ip.selling=pl.selling where ip.price_list=pl.name""") - webnotes.conn.sql("""udpate `tabItem Price` set selling=1 where ifnull(selling, 0)=0 and + webnotes.conn.sql("""update `tabItem Price` set selling=1 where ifnull(selling, 0)=0 and ifnull(buying, 0)=0""") \ No newline at end of file From 4bbf91bea18518d56b99e04059d346e2ba548609 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 9 Jan 2014 12:44:44 +0530 Subject: [PATCH 043/107] Added match condition in general ledger report --- accounts/report/general_ledger/general_ledger.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/accounts/report/general_ledger/general_ledger.py b/accounts/report/general_ledger/general_ledger.py index 855b7d1c7a..2f5716ece3 100644 --- a/accounts/report/general_ledger/general_ledger.py +++ b/accounts/report/general_ledger/general_ledger.py @@ -72,6 +72,11 @@ def get_conditions(filters): if filters.get("voucher_no"): conditions.append("voucher_no=%(voucher_no)s") + + + from webnotes.widgets.reportview import build_match_conditions + match_conditions = build_match_conditions("GL Entry") + if match_conditions: conditions.append(match_conditions) return "and {}".format(" and ".join(conditions)) if conditions else "" From cdbd4218a825f605ec15569ab6713683a6d112bb Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 9 Jan 2014 15:49:26 +0530 Subject: [PATCH 044/107] Accounts Receivable fix for partial payment in pos --- .../accounts_receivable/accounts_receivable.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/accounts/report/accounts_receivable/accounts_receivable.py b/accounts/report/accounts_receivable/accounts_receivable.py index 945bae434a..26e1c8cd47 100644 --- a/accounts/report/accounts_receivable/accounts_receivable.py +++ b/accounts/report/accounts_receivable/accounts_receivable.py @@ -65,15 +65,23 @@ class AccountsReceivableReport(object): if getdate(e.posting_date) <= report_date) def is_receivable(self, gle, future_vouchers): - return ((not gle.against_voucher) or (gle.against_voucher==gle.voucher_no) or - ((gle.against_voucher_type, gle.against_voucher) in future_vouchers)) + return ( + # advance + (not gle.against_voucher) or + + # sales invoice + (gle.against_voucher==gle.voucher_no and gle.debit > 0) or + + # entries adjusted with future vouchers + ((gle.against_voucher_type, gle.against_voucher) in future_vouchers) + ) def get_outstanding_amount(self, gle, report_date): payment_received = 0.0 for e in self.get_gl_entries_for(gle.account, gle.voucher_type, gle.voucher_no): if getdate(e.posting_date) <= report_date and e.name!=gle.name: payment_received += (flt(e.credit) - flt(e.debit)) - + return flt(gle.debit) - flt(gle.credit) - payment_received def get_customer(self, account): From 11bf06ad76a6c510eafa2b9d4c6066ccd9f893cd Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Thu, 9 Jan 2014 16:22:09 +0600 Subject: [PATCH 045/107] bumped to version 3.5.0 --- config.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.json b/config.json index d88d22438b..65fa55c02d 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,6 @@ { "app_name": "ERPNext", - "app_version": "3.4.9", + "app_version": "3.5.0", "base_template": "app/portal/templates/base.html", "modules": { "Accounts": { @@ -74,5 +74,5 @@ "type": "module" } }, - "requires_framework_version": "==3.4.4" + "requires_framework_version": "==3.5.0" } \ No newline at end of file From aeb68b28998b5261a046e5002bb391aeacba20e8 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 9 Jan 2014 15:54:18 +0530 Subject: [PATCH 046/107] Accounts Receivable fix for partial payment in pos --- accounts/report/accounts_receivable/accounts_receivable.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accounts/report/accounts_receivable/accounts_receivable.py b/accounts/report/accounts_receivable/accounts_receivable.py index 26e1c8cd47..7758b24744 100644 --- a/accounts/report/accounts_receivable/accounts_receivable.py +++ b/accounts/report/accounts_receivable/accounts_receivable.py @@ -34,7 +34,7 @@ class AccountsReceivableReport(object): for gle in self.get_entries_till(self.filters.report_date): if self.is_receivable(gle, future_vouchers): outstanding_amount = self.get_outstanding_amount(gle, self.filters.report_date) - if abs(outstanding_amount) > 0.01: + if abs(outstanding_amount) > 0.0: due_date = self.get_due_date(gle) invoiced_amount = gle.debit if (gle.debit > 0) else 0 payment_received = invoiced_amount - outstanding_amount From 3e846d19d44fb46579b8ff42d5913651bc21cbf5 Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Thu, 9 Jan 2014 16:26:53 +0600 Subject: [PATCH 047/107] bumped to version 3.5.1 --- config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.json b/config.json index 65fa55c02d..8499ee84d3 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,6 @@ { "app_name": "ERPNext", - "app_version": "3.5.0", + "app_version": "3.5.1", "base_template": "app/portal/templates/base.html", "modules": { "Accounts": { From 68b0d54b4b814dd3781fad07c1a2bd43b46ad59f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 9 Jan 2014 17:25:55 +0530 Subject: [PATCH 048/107] Set default accounts in company related to perpetual inventory, only it is enabled --- setup/doctype/company/company.py | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/setup/doctype/company/company.py b/setup/doctype/company/company.py index 12281b4415..88d9dcaaa5 100644 --- a/setup/doctype/company/company.py +++ b/setup/doctype/company/company.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals import webnotes from webnotes import _, msgprint -from webnotes.utils import cstr +from webnotes.utils import cstr, cint import webnotes.defaults @@ -237,21 +237,28 @@ class DocType: account.insert() def set_default_accounts(self): - accounts = { + def _set_default_accounts(accounts): + for a in accounts: + account_name = accounts[a] + " - " + self.doc.abbr + if not self.doc.fields.get(a) and webnotes.conn.exists("Account", account_name): + webnotes.conn.set(self.doc, a, account_name) + + _set_default_accounts({ "default_income_account": "Sales", "default_expense_account": "Cost of Goods Sold", "receivables_group": "Accounts Receivable", "payables_group": "Accounts Payable", - "default_cash_account": "Cash", - "stock_received_but_not_billed": "Stock Received But Not Billed", - "stock_adjustment_account": "Stock Adjustment", - "expenses_included_in_valuation": "Expenses Included In Valuation" - } + "default_cash_account": "Cash" + }) + + if cint(webnotes.conn.get_value("Accounts Settings", None, "auto_accounting_for_stock")): + _set_default_accounts({ + "stock_received_but_not_billed": "Stock Received But Not Billed", + "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.get(a) and webnotes.conn.exists("Account", account_name): - webnotes.conn.set(self.doc, a, account_name) def create_default_cost_center(self): cc_list = [ From f3ded044e0686164f7271c130d8b2ad05bef7809 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 9 Jan 2014 17:38:50 +0530 Subject: [PATCH 049/107] Monthly Salary Register: Month is now optional --- hr/report/monthly_salary_register/monthly_salary_register.js | 2 +- hr/report/monthly_salary_register/monthly_salary_register.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hr/report/monthly_salary_register/monthly_salary_register.js b/hr/report/monthly_salary_register/monthly_salary_register.js index 5d3abccde9..32b4ef35fb 100644 --- a/hr/report/monthly_salary_register/monthly_salary_register.js +++ b/hr/report/monthly_salary_register/monthly_salary_register.js @@ -7,7 +7,7 @@ wn.query_reports["Monthly Salary Register"] = { "fieldname":"month", "label": wn._("Month"), "fieldtype": "Select", - "options": "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug\nSep\nOct\nNov\nDec", + "options": "\nJan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug\nSep\nOct\nNov\nDec", "default": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"][wn.datetime.str_to_obj(wn.datetime.get_today()).getMonth()], }, diff --git a/hr/report/monthly_salary_register/monthly_salary_register.py b/hr/report/monthly_salary_register/monthly_salary_register.py index 8bd8f36ac8..9b8a84fd91 100644 --- a/hr/report/monthly_salary_register/monthly_salary_register.py +++ b/hr/report/monthly_salary_register/monthly_salary_register.py @@ -59,8 +59,8 @@ def get_columns(salary_slips): def get_salary_slips(filters): conditions, filters = get_conditions(filters) - salary_slips = webnotes.conn.sql("""select * from `tabSalary Slip` where docstatus = 1 %s""" % - conditions, filters, as_dict=1) + salary_slips = webnotes.conn.sql("""select * from `tabSalary Slip` where docstatus = 1 %s + order by employee, month""" % conditions, filters, as_dict=1) if not salary_slips: msgprint(_("No salary slip found for month: ") + cstr(filters.get("month")) + From 371663169c7d93f294d190c2c844a0293cf0543a Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Fri, 10 Jan 2014 15:05:44 +0530 Subject: [PATCH 050/107] pos view showing inclusive taxes --- accounts/doctype/sales_invoice/pos.js | 51 +++++++++++++++------------ 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/accounts/doctype/sales_invoice/pos.js b/accounts/doctype/sales_invoice/pos.js index adbdca1b63..ce3784abd3 100644 --- a/accounts/doctype/sales_invoice/pos.js +++ b/accounts/doctype/sales_invoice/pos.js @@ -60,10 +60,16 @@ erpnext.POS = Class.extend({
\
\

\ - \ - \ +
\ +
\ + \ +
\ +
\ + \ +
\ +
\

\ \
\ @@ -82,7 +88,7 @@ erpnext.POS = Class.extend({ me.refresh(); }); - this.call_function("delete-items", function() {me.remove_selected_item();}); + this.call_function("remove-items", function() {me.remove_selected_items();}); this.call_function("make-payment", function() {me.make_payment();}); }, check_transaction_type: function() { @@ -333,7 +339,7 @@ erpnext.POS = Class.extend({ } this.disable_text_box_and_button(); - this.make_payment_button(); + this.hide_payment_button(); // If quotation to is not Customer then remove party if (this.frm.doctype == "Quotation") { @@ -370,21 +376,21 @@ erpnext.POS = Class.extend({ var taxes = wn.model.get_children(this.sales_or_purchase + " Taxes and Charges", this.frm.doc.name, this.frm.cscript.other_fname, this.frm.doctype); $(this.wrapper).find(".tax-table") - .toggle((taxes && taxes.length && - flt(me.frm.doc.other_charges_total_export || - me.frm.doc.other_charges_added_import) != 0.0) ? true : false) + .toggle((taxes && taxes.length) ? true : false) .find("tbody").empty(); $.each(taxes, function(i, d) { - $(repl('\ - %(description)s %(rate)s\ - %(tax_amount)s\ - ', { - description: d.description, - rate: ((d.charge_type == "Actual") ? '' : ("(" + d.rate + "%)")), - tax_amount: format_currency(flt(d.tax_amount)/flt(me.frm.doc.conversion_rate), - me.frm.doc.currency) - })).appendTo(".tax-table tbody"); + if (d.tax_amount) { + $(repl('\ + %(description)s %(rate)s\ + %(tax_amount)s\ + ', { + description: d.description, + rate: ((d.charge_type == "Actual") ? '' : ("(" + d.rate + "%)")), + tax_amount: format_currency(flt(d.tax_amount)/flt(me.frm.doc.conversion_rate), + me.frm.doc.currency) + })).appendTo(".tax-table tbody"); + } }); }, set_totals: function() { @@ -427,7 +433,7 @@ erpnext.POS = Class.extend({ $(this.wrapper).find('input, button').each(function () { $(this).prop('disabled', true); }); - $(this.wrapper).find(".delete-items").hide(); + $(this.wrapper).find(".remove-items").hide(); $(this.wrapper).find(".make-payment").hide(); } else { @@ -437,14 +443,14 @@ erpnext.POS = Class.extend({ $(this.wrapper).find(".make-payment").show(); } }, - make_payment_button: function() { + hide_payment_button: function() { var me = this; // Show Make Payment button only in Sales Invoice if (this.frm.doctype != "Sales Invoice") $(this.wrapper).find(".make-payment").hide(); }, refresh_delete_btn: function() { - $(this.wrapper).find(".delete-items").toggle($(".item-cart .warning").length ? true : false); + $(this.wrapper).find(".remove-items").toggle($(".item-cart .warning").length ? true : false); }, add_item_thru_barcode: function() { var me = this; @@ -466,7 +472,7 @@ erpnext.POS = Class.extend({ } }); }, - remove_selected_item: function() { + remove_selected_items: function() { var me = this; var selected_items = []; var no_of_items = $(this.wrapper).find("#cart tbody tr").length; @@ -487,6 +493,7 @@ erpnext.POS = Class.extend({ } } }); + this.refresh_grid(); }, refresh_grid: function() { From 03463ef73bf373af5a2415b093018c1e978f6a9a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 10 Jan 2014 16:28:41 +0530 Subject: [PATCH 051/107] Move related property setters to custom field property --- patches/1401/__init__.py | 0 ...elated_property_setters_to_custom_field.py | 35 +++++++++++++++++++ patches/patch_list.py | 1 + 3 files changed, 36 insertions(+) create mode 100644 patches/1401/__init__.py create mode 100644 patches/1401/p01_move_related_property_setters_to_custom_field.py diff --git a/patches/1401/__init__.py b/patches/1401/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/patches/1401/p01_move_related_property_setters_to_custom_field.py b/patches/1401/p01_move_related_property_setters_to_custom_field.py new file mode 100644 index 0000000000..6b28553977 --- /dev/null +++ b/patches/1401/p01_move_related_property_setters_to_custom_field.py @@ -0,0 +1,35 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +import webnotes +from webnotes.model.meta import get_field + +def execute(): + webnotes.reload_doc("core", "doctype", "custom_field") + + custom_fields = {} + for cf in webnotes.conn.sql("""select dt, fieldname from `tabCustom Field`""", as_dict=1): + custom_fields.setdefault(cf.dt, []).append(cf.fieldname) + + delete_list = [] + for ps in webnotes.conn.sql("""select * from `tabProperty Setter`""", as_dict=1): + if ps.field_name in custom_fields.get(ps.doc_type, []): + + if ps.property == "previous_field": + property_name = "insert_after" + + field_meta = get_field(ps.doc_type, ps.value) + property_value = field_meta.label if field_meta else "" + else: + property_name = ps.property + property_value =ps.value + + webnotes.conn.sql("""update `tabCustom Field` + set %s=%s where dt=%s and fieldname=%s""" % (property_name, '%s', '%s', '%s'), + (property_value, ps.doc_type, ps.field_name)) + + delete_list.append(ps.name) + + if delete_list: + webnotes.conn.sql("""delete from `tabProperty Setter` where name in (%s)""" % + ', '.join(['%s']*len(delete_list)), tuple(delete_list)) \ No newline at end of file diff --git a/patches/patch_list.py b/patches/patch_list.py index 608ba77168..e4d2975ea3 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -263,4 +263,5 @@ patch_list = [ "patches.1311.p08_email_digest_recipients", "execute:webnotes.delete_doc('DocType', 'Warehouse Type')", "patches.1312.p02_update_item_details_in_item_price", + "patches.1401.p01_move_related_property_setters_to_custom_field", ] \ No newline at end of file From 35a9d585b4f767c0b8447dafb6dc2b96819707bb Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 13 Jan 2014 12:24:27 +0530 Subject: [PATCH 052/107] Bank Reconciliation Statement: Show balance in debit or credit column based on account type --- .../bank_reconciliation_statement.js | 4 +- .../bank_reconciliation_statement.py | 53 ++++++++----------- 2 files changed, 26 insertions(+), 31 deletions(-) diff --git a/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js b/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js index b93f182f31..7f32e261c7 100644 --- a/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js +++ b/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js @@ -8,6 +8,7 @@ wn.query_reports["Bank Reconciliation Statement"] = { "label": wn._("Bank Account"), "fieldtype": "Link", "options": "Account", + "reqd": 1, "get_query": function() { return { "query": "accounts.utils.get_account_list", @@ -22,7 +23,8 @@ wn.query_reports["Bank Reconciliation Statement"] = { "fieldname":"report_date", "label": wn._("Date"), "fieldtype": "Date", - "default": get_today() + "default": get_today(), + "reqd": 1 }, ] } \ No newline at end of file diff --git a/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py b/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py index 431a6496d2..5672497189 100644 --- a/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py +++ b/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py @@ -3,13 +3,14 @@ from __future__ import unicode_literals import webnotes -from webnotes import _, msgprint from webnotes.utils import flt def execute(filters=None): if not filters: filters = {} - - columns = get_columns() + + debit_or_credit = webnotes.conn.get_value("Account", filters["account"], "debit_or_credit") + + columns = get_columns() data = get_entries(filters) from accounts.utils import get_balance_on @@ -20,47 +21,39 @@ def execute(filters=None): total_debit += flt(d[4]) total_credit += flt(d[5]) - if webnotes.conn.get_value("Account", filters["account"], "debit_or_credit") == 'Debit': + if debit_or_credit == 'Debit': bank_bal = flt(balance_as_per_company) - flt(total_debit) + flt(total_credit) else: bank_bal = flt(balance_as_per_company) + flt(total_debit) - flt(total_credit) data += [ - ["", "", "", "Balance as per company books", balance_as_per_company, ""], + get_balance_row("Balance as per company books", balance_as_per_company, debit_or_credit), ["", "", "", "Amounts not reflected in bank", total_debit, total_credit], - ["", "", "", "Balance as per bank", bank_bal, ""] + get_balance_row("Balance as per bank", bank_bal, debit_or_credit) ] - - return columns, data + return columns, data def get_columns(): return ["Journal Voucher:Link/Journal Voucher:140", "Posting Date:Date:100", "Clearance Date:Date:110", "Against Account:Link/Account:200", "Debit:Currency:120", "Credit:Currency:120" ] - -def get_conditions(filters): - conditions = "" - if not filters.get("account"): - msgprint(_("Please select Bank Account"), raise_exception=1) - else: - conditions += " and jvd.account = %(account)s" - - if not filters.get("report_date"): - msgprint(_("Please select Date on which you want to run the report"), raise_exception=1) - else: - conditions += """ and jv.posting_date <= %(report_date)s - and ifnull(jv.clearance_date, '4000-01-01') > %(report_date)s""" - - return conditions def get_entries(filters): - conditions = get_conditions(filters) - entries = webnotes.conn.sql("""select jv.name, jv.posting_date, jv.clearance_date, - jvd.against_account, jvd.debit, jvd.credit - from `tabJournal Voucher Detail` jvd, `tabJournal Voucher` jv - where jvd.parent = jv.name and jv.docstatus=1 and ifnull(jv.cheque_no, '')!= '' %s - order by jv.name DESC""" % conditions, filters, as_list=1) + entries = webnotes.conn.sql("""select + jv.name, jv.posting_date, jv.clearance_date, jvd.against_account, jvd.debit, jvd.credit + from + `tabJournal Voucher Detail` jvd, `tabJournal Voucher` jv + where jvd.parent = jv.name and jv.docstatus=1 and ifnull(jv.cheque_no, '')!= '' + and jvd.account = %(account)s and jv.posting_date <= %(report_date)s + and ifnull(jv.clearance_date, '4000-01-01') > %(report_date)s + order by jv.name DESC""", filters, as_list=1) - return entries \ No newline at end of file + return entries + +def get_balance_row(label, amount, debit_or_credit): + if debit_or_credit == "Debit": + return ["", "", "", label, amount, 0] + else: + return ["", "", "", label, 0, amount] \ No newline at end of file From 14bf711d04e31cc5cb45ab0799ed6dab3a8ebcf5 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 13 Jan 2014 13:28:07 +0530 Subject: [PATCH 053/107] Fixes in frozen accounts validation --- accounts/doctype/gl_entry/gl_entry.py | 3 ++- controllers/accounts_controller.py | 15 +++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/accounts/doctype/gl_entry/gl_entry.py b/accounts/doctype/gl_entry/gl_entry.py index d3c6317787..694917ffcd 100644 --- a/accounts/doctype/gl_entry/gl_entry.py +++ b/accounts/doctype/gl_entry/gl_entry.py @@ -146,11 +146,12 @@ def update_outstanding_amt(account, against_voucher_type, against_voucher, on_ca webnotes.conn.sql("update `tab%s` set outstanding_amount=%s where name='%s'" % (against_voucher_type, bal, against_voucher)) -def validate_frozen_account(account, adv_adj): +def validate_frozen_account(account, adv_adj=None): frozen_account = webnotes.conn.get_value("Account", account, "freeze_account") if frozen_account == 'Yes' and not adv_adj: frozen_accounts_modifier = webnotes.conn.get_value( 'Accounts Settings', None, 'frozen_accounts_modifier') + if not frozen_accounts_modifier: webnotes.throw(account + _(" is a frozen account. \ Either make the account active or assign role in Accounts Settings \ diff --git a/controllers/accounts_controller.py b/controllers/accounts_controller.py index a65bf260ee..8d33327569 100644 --- a/controllers/accounts_controller.py +++ b/controllers/accounts_controller.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals import webnotes -from webnotes import _, msgprint, throw +from webnotes import _, throw from webnotes.utils import flt, cint, today, cstr from webnotes.model.code import get_obj from setup.utils import get_company_currency @@ -44,14 +44,13 @@ class AccountsController(TransactionBase): def validate_for_freezed_account(self): for fieldname in ["customer", "supplier"]: if self.meta.get_field(fieldname) and self.doc.fields.get(fieldname): - accounts = webnotes.conn.get_values("Account", {"master_type": fieldname.title(), - "master_name": self.doc.fields[fieldname], "company": self.doc.company}, - "freeze_account", as_dict=1) - + accounts = webnotes.conn.get_values("Account", + {"master_type": fieldname.title(), "master_name": self.doc.fields[fieldname], + "company": self.doc.company}, "name") if accounts: - if not filter(lambda x: cstr(x.freeze_account) in ["", "No"], accounts): - throw(_("Account for this ") + fieldname + _(" has been freezed. ") + - self.doc.doctype + _(" can not be made.")) + from accounts.doctype.gl_entry.gl_entry import validate_frozen_account + for account in accounts: + validate_frozen_account(account[0]) def set_price_list_currency(self, buying_or_selling): if self.meta.get_field("currency"): From 0b3c10601c6eedffcdfcbf2f91c4a238b2aa6ac9 Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Mon, 13 Jan 2014 13:34:34 +0530 Subject: [PATCH 054/107] Increase and decrease quantity buttons in POS --- accounts/doctype/sales_invoice/pos.js | 39 ++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/accounts/doctype/sales_invoice/pos.js b/accounts/doctype/sales_invoice/pos.js index ce3784abd3..1d58f2d2dc 100644 --- a/accounts/doctype/sales_invoice/pos.js +++ b/accounts/doctype/sales_invoice/pos.js @@ -19,8 +19,10 @@ erpnext.POS = Class.extend({ \ \ \ - \ - \ + \ + \ + \ + \ \ \ \ @@ -357,8 +359,18 @@ erpnext.POS = Class.extend({ $(repl('\ \ - \ + \ + \ \ ', { @@ -370,6 +382,11 @@ erpnext.POS = Class.extend({ } )).appendTo($items); }); + + this.wrapper.find(".increase-qty, .decrease-qty").on("click", function() { + var item_code = $(this).closest("tr").attr("id"); + me.selected_item_qty_operation(item_code, $(this).attr("class")); + }); }, show_taxes: function() { var me = this; @@ -501,6 +518,22 @@ erpnext.POS = Class.extend({ this.frm.script_manager.trigger("calculate_taxes_and_totals"); this.refresh(); }, + selected_item_qty_operation: function(item_code, operation) { + var me = this; + var child = wn.model.get_children(this.frm.doctype + " Item", this.frm.doc.name, + this.frm.cscript.fname, this.frm.doctype); + + $.each(child, function(i, d) { + if (d.item_code == item_code) { + if (operation == "increase-qty") + d.qty += 1; + else if (operation == "decrease-qty") + d.qty != 1 ? d.qty -= 1 : d.qty = 1; + + me.refresh(); + } + }); + }, make_payment: function() { var me = this; var no_of_items = $(this.wrapper).find("#cart tbody tr").length; From c43d58ac79d6144eb6252ff611cc9605f290006d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 13 Jan 2014 17:55:24 +0530 Subject: [PATCH 055/107] Delete Property Setters for Custom Fields, and set them inside Custom Field --- ...elated_property_setters_to_custom_field.py | 32 +++++++------------ 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/patches/1401/p01_move_related_property_setters_to_custom_field.py b/patches/1401/p01_move_related_property_setters_to_custom_field.py index 6b28553977..cf9221bcfd 100644 --- a/patches/1401/p01_move_related_property_setters_to_custom_field.py +++ b/patches/1401/p01_move_related_property_setters_to_custom_field.py @@ -2,34 +2,24 @@ # License: GNU General Public License v3. See license.txt import webnotes -from webnotes.model.meta import get_field def execute(): webnotes.reload_doc("core", "doctype", "custom_field") - custom_fields = {} - for cf in webnotes.conn.sql("""select dt, fieldname from `tabCustom Field`""", as_dict=1): - custom_fields.setdefault(cf.dt, []).append(cf.fieldname) - + cf_doclist = webnotes.get_doctype("Custom Field") + delete_list = [] - for ps in webnotes.conn.sql("""select * from `tabProperty Setter`""", as_dict=1): - if ps.field_name in custom_fields.get(ps.doc_type, []): - - if ps.property == "previous_field": - property_name = "insert_after" + for d in webnotes.conn.sql("""select cf.name as cf_name, ps.property, + ps.value, ps.name as ps_name + from `tabProperty Setter` ps, `tabCustom Field` cf + where ps.doctype_or_field = 'DocField' and ps.property != 'previous_field' + and ps.doc_type=cf.dt and ps.field_name=cf.fieldname""", as_dict=1): + if cf_doclist.get_field(d.property): + webnotes.conn.sql("""update `tabCustom Field` + set `%s`=%s where name=%s""" % (d.property, '%s', '%s'), (d.value, d.cf_name)) - field_meta = get_field(ps.doc_type, ps.value) - property_value = field_meta.label if field_meta else "" - else: - property_name = ps.property - property_value =ps.value + delete_list.append(d.ps_name) - webnotes.conn.sql("""update `tabCustom Field` - set %s=%s where dt=%s and fieldname=%s""" % (property_name, '%s', '%s', '%s'), - (property_value, ps.doc_type, ps.field_name)) - - delete_list.append(ps.name) - if delete_list: webnotes.conn.sql("""delete from `tabProperty Setter` where name in (%s)""" % ', '.join(['%s']*len(delete_list)), tuple(delete_list)) \ No newline at end of file From 1e347910d5a7e30dea13883fa5f6b651efa93146 Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Mon, 13 Jan 2014 19:07:07 +0600 Subject: [PATCH 056/107] bumped to version 3.6.0 --- config.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.json b/config.json index 8499ee84d3..8e033d52a2 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,6 @@ { "app_name": "ERPNext", - "app_version": "3.5.1", + "app_version": "3.6.0", "base_template": "app/portal/templates/base.html", "modules": { "Accounts": { @@ -74,5 +74,5 @@ "type": "module" } }, - "requires_framework_version": "==3.5.0" + "requires_framework_version": "==3.7.0" } \ No newline at end of file From b9b6a6cea5ad443a4f3e7124b95d8ca8b6b08481 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 13 Jan 2014 21:21:56 +0530 Subject: [PATCH 057/107] Moved webnotes scheduler event hooks --- erpnext/hooks.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/erpnext/hooks.txt b/erpnext/hooks.txt index 9d4291b2e3..0c8b71a98f 100644 --- a/erpnext/hooks.txt +++ b/erpnext/hooks.txt @@ -46,13 +46,9 @@ standard_queries = Customer:erpnext.selling.utils.get_customer_list scheduler_event = all:erpnext.support.doctype.support_ticket.get_support_mails.get_support_mails scheduler_event = all:erpnext.hr.doctype.job_applicant.get_job_applications.get_job_applications scheduler_event = all:erpnext.selling.doctype.lead.get_leads.get_leads -scheduler_event = all:webnotes.utils.email_lib.bulk.flush #### Daily -scheduler_event = daily:webnotes.core.doctype.event.event.send_event_digest -scheduler_event = daily:webnotes.core.doctype.notification_count.notification_count.delete_event_notification_count -scheduler_event = daily:webnotes.utils.email_lib.bulk.clear_outbox scheduler_event = daily:erpnext.accounts.doctype.sales_invoice.sales_invoice.manage_recurring_invoices scheduler_event = daily:erpnext.setup.doctype.backup_manager.backup_manager.take_backups_daily scheduler_event = daily:erpnext.stock.utils.reorder_item From d23ae108ae4537748ac4e0aade597423c71aae5a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 14 Jan 2014 15:52:09 +0530 Subject: [PATCH 058/107] Fixes in Comment, if comment by not mentioned, consider owner --- startup/event_handlers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/startup/event_handlers.py b/startup/event_handlers.py index f0323ea36a..b04b588505 100644 --- a/startup/event_handlers.py +++ b/startup/event_handlers.py @@ -70,6 +70,6 @@ def on_build(): def comment_added(doc): """add comment to feed""" - home.make_feed('Comment', doc.comment_doctype, doc.comment_docname, doc.comment_by, - '"' + doc.comment + '"', '#6B24B3') + home.make_feed('Comment', doc.comment_doctype, doc.comment_docname, + doc.comment_by or doc.owner, '"' + doc.comment + '"', '#6B24B3') From d91af2853eff03635fcb69f1ffff3fab847bd4f4 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 14 Jan 2014 15:56:52 +0530 Subject: [PATCH 059/107] Allowed import for customer issue --- support/doctype/customer_issue/customer_issue.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/support/doctype/customer_issue/customer_issue.txt b/support/doctype/customer_issue/customer_issue.txt index f9fbc6bd6a..76d49a8199 100644 --- a/support/doctype/customer_issue/customer_issue.txt +++ b/support/doctype/customer_issue/customer_issue.txt @@ -2,11 +2,12 @@ { "creation": "2013-01-10 16:34:30", "docstatus": 0, - "modified": "2013-11-02 16:59:22", + "modified": "2014-01-14 15:56:22", "modified_by": "Administrator", "owner": "harshada@webnotestech.com" }, { + "allow_import": 1, "autoname": "naming_series:", "doctype": "DocType", "icon": "icon-bug", From 3a193708927cee8b5c788c75221ec47a0f54e24e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 14 Jan 2014 17:44:34 +0530 Subject: [PATCH 060/107] Rounding issue and divisional loss adjustment --- .../purchase_invoice/purchase_invoice.py | 3 +- controllers/accounts_controller.py | 28 +++++++++++------- controllers/buying_controller.py | 16 +++++++--- .../production_order/test_production_order.py | 2 ++ public/js/transaction.js | 29 ++++++++++++++----- 5 files changed, 55 insertions(+), 23 deletions(-) diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.py b/accounts/doctype/purchase_invoice/purchase_invoice.py index 0b8ad46dd0..06b7a3ad2e 100644 --- a/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -358,7 +358,8 @@ class DocType(BuyingController): # expense will be booked in sales invoice stock_item_and_auto_accounting_for_stock = True - valuation_amt = item.amount + item.item_tax_amount + item.rm_supp_cost + valuation_amt = flt(item.amount + item.item_tax_amount + item.rm_supp_cost, + self.precision("amount", item)) gl_entries.append( self.get_gl_dict({ diff --git a/controllers/accounts_controller.py b/controllers/accounts_controller.py index 8d33327569..e5b0b9d75b 100644 --- a/controllers/accounts_controller.py +++ b/controllers/accounts_controller.py @@ -223,20 +223,22 @@ class AccountsController(TransactionBase): _on_previous_row_error("1 - %d" % (tax.row_id,)) def calculate_taxes(self): - for item in self.item_doclist: + # maintain actual tax rate based on idx + actual_tax_dict = dict([[tax.idx, tax.rate] for tax in self.tax_doclist + if tax.charge_type == "Actual"]) + + for n, item in enumerate(self.item_doclist): item_tax_map = self._load_item_tax_rate(item.item_tax_rate) for i, tax in enumerate(self.tax_doclist): # tax_amount represents the amount of tax for the current step current_tax_amount = self.get_current_tax_amount(item, tax, item_tax_map) - - # case when net total is 0 but there is an actual type charge - # in this case add the actual amount to tax.tax_amount - # and tax.grand_total_for_current_item for the first such iteration - if tax.charge_type=="Actual" and \ - not (current_tax_amount or self.doc.net_total or tax.tax_amount): - zero_net_total_adjustment = flt(tax.rate, self.precision("tax_amount", tax)) - current_tax_amount += zero_net_total_adjustment + + # Adjust divisional loss to the last item + if tax.charge_type == "Actual": + actual_tax_dict[tax.idx] -= current_tax_amount + if n == len(self.item_doclist) - 1: + current_tax_amount += actual_tax_dict[tax.idx] # store tax_amount for current item as it will be used for # charge type = 'On Previous Row Amount' @@ -248,7 +250,8 @@ class AccountsController(TransactionBase): if tax.category: # if just for valuation, do not add the tax amount in total # hence, setting it as 0 for further steps - current_tax_amount = 0.0 if (tax.category == "Valuation") else current_tax_amount + current_tax_amount = 0.0 if (tax.category == "Valuation") \ + else current_tax_amount current_tax_amount *= -1.0 if (tax.add_deduct_tax == "Deduct") else 1.0 @@ -267,6 +270,11 @@ class AccountsController(TransactionBase): # in tax.total, accumulate grand total of each item tax.total += tax.grand_total_for_current_item + # set precision in the last item iteration + if n == len(self.item_doclist) - 1: + tax.total = flt(tax.total, self.precision("total", tax)) + tax.tax_amount = flt(tax.tax_amount, self.precision("tax_amount", tax)) + def get_current_tax_amount(self, item, tax, item_tax_map): tax_rate = self._get_tax_rate(tax, item_tax_map) current_tax_amount = 0.0 diff --git a/controllers/buying_controller.py b/controllers/buying_controller.py index 3c6981d6cb..7954ca0abb 100644 --- a/controllers/buying_controller.py +++ b/controllers/buying_controller.py @@ -175,23 +175,31 @@ class BuyingController(StockController): stock_items = self.get_stock_items() stock_items_qty, stock_items_amount = 0, 0 + last_stock_item_idx = 1 for d in self.doclist.get({"parentfield": parentfield}): if d.item_code and d.item_code in stock_items: stock_items_qty += flt(d.qty) stock_items_amount += flt(d.amount) + last_stock_item_idx = d.idx total_valuation_amount = sum([flt(d.tax_amount) for d in self.doclist.get({"parentfield": "purchase_tax_details"}) if d.category in ["Valuation", "Valuation and Total"]]) - - for item in self.doclist.get({"parentfield": parentfield}): + + valuation_amount_adjustment = total_valuation_amount + for i, item in enumerate(self.doclist.get({"parentfield": parentfield})): if item.item_code and item.qty and item.item_code in stock_items: item_proportion = flt(item.amount) / stock_items_amount if stock_items_amount \ else flt(item.qty) / stock_items_qty - item.item_tax_amount = flt(item_proportion * total_valuation_amount, - self.precision("item_tax_amount", item)) + if i == (last_stock_item_idx - 1): + item.item_tax_amount = flt(valuation_amount_adjustment, + self.precision("item_tax_amount", item)) + else: + item.item_tax_amount = flt(item_proportion * total_valuation_amount, + self.precision("item_tax_amount", item)) + valuation_amount_adjustment -= item.item_tax_amount self.round_floats_in(item) diff --git a/manufacturing/doctype/production_order/test_production_order.py b/manufacturing/doctype/production_order/test_production_order.py index ca28708cc1..da45a9bdb6 100644 --- a/manufacturing/doctype/production_order/test_production_order.py +++ b/manufacturing/doctype/production_order/test_production_order.py @@ -35,6 +35,7 @@ class TestProductionOrder(unittest.TestCase): stock_entry.doc.fg_completed_qty = 4 stock_entry.doc.posting_date = "2013-05-12" + stock_entry.doc.fiscal_year = "_Test Fiscal Year 2013" stock_entry.run_method("get_items") stock_entry.submit() @@ -52,6 +53,7 @@ class TestProductionOrder(unittest.TestCase): stock_entry = make_stock_entry(pro_order, "Manufacture/Repack") stock_entry = webnotes.bean(stock_entry) stock_entry.doc.posting_date = "2013-05-12" + stock_entry.doc.fiscal_year = "_Test Fiscal Year 2013" stock_entry.doc.fg_completed_qty = 15 stock_entry.run_method("get_items") stock_entry.insert() diff --git a/public/js/transaction.js b/public/js/transaction.js index 0fe0535c6b..1e03833bd6 100644 --- a/public/js/transaction.js +++ b/public/js/transaction.js @@ -540,6 +540,14 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ calculate_taxes: function() { var me = this; + var actual_tax_dict = {}; + + // maintain actual tax rate based on idx + $.each(this.frm.tax_doclist, function(i, tax) { + if (tax.charge_type == "Actual") { + actual_tax_dict[tax.idx] = flt(tax.rate); + } + }); $.each(this.frm.item_doclist, function(n, item) { var item_tax_map = me._load_item_tax_rate(item.item_tax_rate); @@ -549,15 +557,15 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ var current_tax_amount = me.get_current_tax_amount(item, tax, item_tax_map); me.set_item_tax_amount && me.set_item_tax_amount(item, tax, current_tax_amount); - - // case when net total is 0 but there is an actual type charge - // in this case add the actual amount to tax.tax_amount - // and tax.grand_total_for_current_item for the first such iteration - if(tax.charge_type == "Actual" && - !(current_tax_amount || me.frm.doc.net_total || tax.tax_amount)) { - var zero_net_total_adjustment = flt(tax.rate, precision("tax_amount", tax)); - current_tax_amount += zero_net_total_adjustment; + + // Adjust divisional loss to the last item + if (tax.charge_type == "Actual") { + actual_tax_dict[tax.idx] -= current_tax_amount; + if (n == me.frm.item_doclist.length - 1) { + current_tax_amount += actual_tax_dict[tax.idx] } + } + // store tax_amount for current item as it will be used for // charge type = 'On Previous Row Amount' @@ -589,6 +597,11 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ // in tax.total, accumulate grand total for each item tax.total += tax.grand_total_for_current_item; + + if (n == me.frm.item_doclist.length - 1) { + tax.total = flt(tax.total, precision("total", tax)); + tax.tax_amount = flt(tax.tax_amount, precision("tax_amount", tax)); + } }); }); }, From ee6200576a53ad6ca8de685b028ddb44c2b30e96 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 14 Jan 2014 18:34:10 +0530 Subject: [PATCH 061/107] Highest priority to user properties while fetching warehouse from item --- selling/utils/__init__.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/selling/utils/__init__.py b/selling/utils/__init__.py index 85c20e86d8..f495f58e44 100644 --- a/selling/utils/__init__.py +++ b/selling/utils/__init__.py @@ -3,8 +3,8 @@ from __future__ import unicode_literals import webnotes -from webnotes import msgprint, _, throw -from webnotes.utils import flt, cint, comma_and +from webnotes import _, throw +from webnotes.utils import flt, cint import json def get_customer_list(doctype, txt, searchfield, start, page_len, filters): @@ -121,10 +121,16 @@ def _validate_item_details(args, item): def _get_basic_details(args, item_bean, warehouse_fieldname): item = item_bean.doc + from webnotes.defaults import get_user_default_as_list + user_default_warehouse_list = get_user_default_as_list('warehouse') + user_default_warehouse = user_default_warehouse_list[0] \ + if len(user_default_warehouse_list)==1 else "" + out = webnotes._dict({ "item_code": item.name, "description": item.description_html or item.description, - warehouse_fieldname: item.default_warehouse or args.get(warehouse_fieldname), + warehouse_fieldname: user_default_warehouse or item.default_warehouse \ + or args.get(warehouse_fieldname), "income_account": item.default_income_account or args.income_account \ or webnotes.conn.get_value("Company", args.company, "default_income_account"), "expense_account": item.purchase_account or args.expense_account \ From f55d9414cd23612bc2e5c29907b63e0e439dfcd3 Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Tue, 14 Jan 2014 19:19:14 +0600 Subject: [PATCH 062/107] bumped to version 3.6.1 --- config.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.json b/config.json index 8e033d52a2..45acaf2cd3 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,6 @@ { "app_name": "ERPNext", - "app_version": "3.6.0", + "app_version": "3.6.1", "base_template": "app/portal/templates/base.html", "modules": { "Accounts": { @@ -74,5 +74,5 @@ "type": "module" } }, - "requires_framework_version": "==3.7.0" + "requires_framework_version": "==3.7.1" } \ No newline at end of file From c5d4fc38aa57e4bde919d5e8e1859fcd11e3e4d3 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 15 Jan 2014 10:54:07 +0530 Subject: [PATCH 063/107] Fixes in monthly salary register --- .../monthly_salary_register/monthly_salary_register.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hr/report/monthly_salary_register/monthly_salary_register.py b/hr/report/monthly_salary_register/monthly_salary_register.py index 9b8a84fd91..42c62e474b 100644 --- a/hr/report/monthly_salary_register/monthly_salary_register.py +++ b/hr/report/monthly_salary_register/monthly_salary_register.py @@ -50,9 +50,9 @@ def get_columns(salary_slips): where ifnull(d_modified_amount, 0) != 0 and parent in (%s)""" % (', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips])) - columns = columns + [(e + ":Link/Earning Type:120") for e in earning_types] + \ + columns = columns + [(e + ":Currency:120") for e in earning_types] + \ ["Arrear Amount:Currency:120", "Leave Encashment Amount:Currency:150", - "Gross Pay:Currency:120"] + [(d + ":Link/Deduction Type:120") for d in ded_types] + \ + "Gross Pay:Currency:120"] + [(d + ":Currency:120") for d in ded_types] + \ ["Total Deduction:Currency:120", "Net Pay:Currency:120"] return columns, earning_types, ded_types @@ -102,6 +102,6 @@ def get_ss_ded_map(salary_slips): ss_ded_map = {} for d in ss_deductions: ss_ded_map.setdefault(d.parent, webnotes._dict()).setdefault(d.d_type, []) - ss_ded_map[d.parent][d.e_type] = flt(d.d_modified_amount) + ss_ded_map[d.parent][d.d_type] = flt(d.d_modified_amount) return ss_ded_map \ No newline at end of file From 6a749e3a8e2bf98fd1deb39997c70c6de6ebd5fc Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Wed, 15 Jan 2014 11:43:47 +0530 Subject: [PATCH 064/107] removed while loop --- .../maintenance_schedule.py | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py index 865c21c59b..bd928b5268 100644 --- a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py +++ b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals import webnotes -from webnotes.utils import add_days, cstr, getdate +from webnotes.utils import add_days, cstr, getdate, cint from webnotes.model.doc import addchild from webnotes.model.bean import getlist from webnotes import msgprint, throw, _ @@ -93,14 +93,15 @@ class DocType(TransactionBase): date_diff = (getdate(end_date) - getdate(start_date)).days add_by = date_diff / no_of_visit - while (getdate(start_date_copy) < getdate(end_date)): - start_date_copy = add_days(start_date_copy, add_by) - if len(schedule_list) < no_of_visit: - schedule_date = self.validate_schedule_date_for_holiday_list(getdate(start_date_copy), - sales_person) - if schedule_date > getdate(end_date): - schedule_date = getdate(end_date) - schedule_list.append(schedule_date) + for visit in range(0, cint(no_of_visit)): + if (getdate(start_date_copy) < getdate(end_date)): + start_date_copy = add_days(start_date_copy, add_by) + if len(schedule_list) < no_of_visit: + schedule_date = self.validate_schedule_date_for_holiday_list(getdate(start_date_copy), + sales_person) + if schedule_date > getdate(end_date): + schedule_date = getdate(end_date) + schedule_list.append(schedule_date) return schedule_list @@ -115,6 +116,7 @@ class DocType(TransactionBase): pass if fy_details and fy_details[0]: + # check holiday list in employee master holiday_list = webnotes.conn.sql_list("""select h.holiday_date from `tabEmployee` emp, `tabSales Person` sp, `tabHoliday` h, `tabHoliday List` hl where sp.name=%s and emp.name=sp.employee @@ -122,12 +124,13 @@ class DocType(TransactionBase): h.parent=hl.name and hl.fiscal_year=%s""", (sales_person, fy_details[0])) if not holiday_list: + # check global holiday list holiday_list = webnotes.conn.sql("""select h.holiday_date from `tabHoliday` h, `tabHoliday List` hl where h.parent=hl.name and ifnull(hl.is_default, 0) = 1 and hl.fiscal_year=%s""", fy_details[0]) - while not validated and holiday_list: + if not validated and holiday_list: if schedule_date in holiday_list: schedule_date = add_days(schedule_date, -1) else: From 2a79b0070034e73e7fd873b6c941c0999e1f4e72 Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Wed, 15 Jan 2014 11:54:05 +0530 Subject: [PATCH 065/107] minor fix --- erpnext/setup/doctype/sales_person/sales_person.py | 3 +-- .../doctype/maintenance_schedule/maintenance_schedule.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/erpnext/setup/doctype/sales_person/sales_person.py b/erpnext/setup/doctype/sales_person/sales_person.py index 41a986fc30..41f461be76 100644 --- a/erpnext/setup/doctype/sales_person/sales_person.py +++ b/erpnext/setup/doctype/sales_person/sales_person.py @@ -25,8 +25,7 @@ class DocType(DocTypeNestedSet): def get_email_id(self): profile = webnotes.conn.get_value("Employee", self.doc.employee, "user_id") if not profile: - webnotes.msgprint("User ID (Profile) not set for Employee %s" % self.doc.employee, - raise_exception=True) + webnotes.throw("User ID (Profile) not set for Employee %s" % self.doc.employee) else: return webnotes.conn.get_value("Profile", profile, "email") or profile \ No newline at end of file diff --git a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py index bd928b5268..8f75247d1f 100644 --- a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py +++ b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py @@ -93,7 +93,7 @@ class DocType(TransactionBase): date_diff = (getdate(end_date) - getdate(start_date)).days add_by = date_diff / no_of_visit - for visit in range(0, cint(no_of_visit)): + for visit in range(cint(no_of_visit)): if (getdate(start_date_copy) < getdate(end_date)): start_date_copy = add_days(start_date_copy, add_by) if len(schedule_list) < no_of_visit: From a6df26839dea38b04a17ecf29fafd2f60bc73d8b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 15 Jan 2014 12:21:14 +0530 Subject: [PATCH 066/107] Higher priority to user's default price list over customer's default price list --- utilities/transaction_base.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/utilities/transaction_base.py b/utilities/transaction_base.py index 5c28d8d8b6..f783faa9ec 100644 --- a/utilities/transaction_base.py +++ b/utilities/transaction_base.py @@ -79,9 +79,10 @@ class TransactionBase(StatusUpdater): """ customer_defaults = self.get_customer_defaults() - customer_defaults["selling_price_list"] = customer_defaults.get("price_list") or \ - webnotes.conn.get_value("Customer Group", self.doc.customer_group, "default_price_list") or \ - self.doc.selling_price_list + customer_defaults["selling_price_list"] = self.get_user_default_price_list("Selling") or \ + customer_defaults.get("price_list") or \ + webnotes.conn.get_value("Customer Group", self.doc.customer_group, + "default_price_list") or self.doc.selling_price_list for fieldname, val in customer_defaults.items(): if self.meta.get_field(fieldname): @@ -90,6 +91,12 @@ class TransactionBase(StatusUpdater): if self.meta.get_field("sales_team") and self.doc.customer: self.set_sales_team_for_customer() + def get_user_default_price_list(self, price_list_for): + from webnotes.defaults import get_user_default_as_list + user_default_price_list = get_user_default_as_list("selling_price_list" + if price_list_for=="Selling" else "buying_price_list") + return user_default_price_list[0] if len(user_default_price_list)==1 else "" + def set_sales_team_for_customer(self): from webnotes.model import default_fields @@ -120,8 +127,9 @@ class TransactionBase(StatusUpdater): out["supplier_name"] = supplier.supplier_name if supplier.default_currency: out["currency"] = supplier.default_currency - if supplier.default_price_list: - out["buying_price_list"] = supplier.default_price_list + + out["buying_price_list"] = self.get_user_default_price_list("Buying") or \ + supplier.default_price_list or self.doc.buying_price_list return out From 76dd468f0ed39d5bd09fb06107b7fd479e5deb02 Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Wed, 15 Jan 2014 14:23:38 +0530 Subject: [PATCH 067/107] update about erpnext with version number --- public/js/conf.js | 15 ++++++++------- public/js/toolbar.js | 4 ++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/public/js/conf.js b/public/js/conf.js index 929bfcaa59..1fe21c7611 100644 --- a/public/js/conf.js +++ b/public/js/conf.js @@ -24,16 +24,17 @@ $(document).bind('toolbar_setup', function() { wn.provide('wn.ui.misc'); wn.ui.misc.about = function() { if(!wn.ui.misc.about_dialog) { - var d = new wn.ui.Dialog({title: wn._('About ERPNext')}) + var d = new wn.ui.Dialog({title: wn._('About')}) $(d.body).html(repl("
\ -

"+wn._("ERPNext is an open-source web based ERP made by Web Notes Technologies Pvt Ltd.\ - to provide an integrated tool to manage most processes in a small organization.\ - For more information about Web Notes, or to buy hosting servies, go to ")+ - "https://erpnext.com.

\ -

"+wn._("To report an issue, go to ")+"GitHub Issues

\ -
\ +

ERPNext

\ +

v" + wn.boot.app_version + "

\ +

"+wn._("An open source ERP made for the web.

") + + "

"+wn._("To report an issue, go to ")+"GitHub Issues

\ +

http://erpnext.org.

\

License: GNU General Public License Version 3

\ +
\ +

© 2014 Web Notes Technologies Pvt. Ltd and contributers

\
", wn.app)); wn.ui.misc.about_dialog = d; diff --git a/public/js/toolbar.js b/public/js/toolbar.js index e0affaf61d..1d6fa919b2 100644 --- a/public/js/toolbar.js +++ b/public/js/toolbar.js @@ -21,6 +21,6 @@ erpnext.toolbar.setup = function() { '+wn._('Live Chat')+''); } - $("#toolbar-tools").append('
  • \ + $("#toolbar-tools").append('
  • \ Latest Updates
  • '); -} \ No newline at end of file +} From a682d45846de23f3c03382a4d371befe2b5342f7 Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Wed, 15 Jan 2014 16:39:01 +0530 Subject: [PATCH 068/107] webnotes/erpnext # 1320 - hide fields fix --- accounts/doctype/pos_setting/pos_setting.txt | 4 ++-- .../doctype/purchase_receipt_item/purchase_receipt_item.txt | 4 ++-- stock/doctype/stock_entry_detail/stock_entry_detail.txt | 6 +++--- stock/doctype/stock_reconciliation/stock_reconciliation.txt | 5 +++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/accounts/doctype/pos_setting/pos_setting.txt b/accounts/doctype/pos_setting/pos_setting.txt index 09a3757985..4319c268ed 100755 --- a/accounts/doctype/pos_setting/pos_setting.txt +++ b/accounts/doctype/pos_setting/pos_setting.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 12:15:51", "docstatus": 0, - "modified": "2013-11-02 16:58:38", + "modified": "2014-01-15 16:23:58", "modified_by": "Administrator", "owner": "Administrator" }, @@ -154,7 +154,7 @@ "reqd": 1 }, { - "depends_on": "eval:sys_defaults.auto_accounting_for_stock", + "depends_on": "eval:cint(sys_defaults.auto_accounting_for_stock)", "doctype": "DocField", "fieldname": "expense_account", "fieldtype": "Link", diff --git a/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt b/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt index 1d9397909d..9bc66a42da 100755 --- a/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt +++ b/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 19:29:10", "docstatus": 0, - "modified": "2014-01-03 18:28:20", + "modified": "2014-01-15 16:00:44", "modified_by": "Administrator", "owner": "Administrator" }, @@ -336,7 +336,7 @@ }, { "default": ":Company", - "depends_on": "eval:sys_defaults.auto_accounting_for_stock", + "depends_on": "eval:cint(sys_defaults.auto_accounting_for_stock)", "doctype": "DocField", "fieldname": "cost_center", "fieldtype": "Link", diff --git a/stock/doctype/stock_entry_detail/stock_entry_detail.txt b/stock/doctype/stock_entry_detail/stock_entry_detail.txt index b97928b961..25835e0bf3 100644 --- a/stock/doctype/stock_entry_detail/stock_entry_detail.txt +++ b/stock/doctype/stock_entry_detail/stock_entry_detail.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-29 18:22:12", "docstatus": 0, - "modified": "2013-11-08 16:15:44", + "modified": "2014-01-15 16:08:45", "modified_by": "Administrator", "owner": "Administrator" }, @@ -165,7 +165,7 @@ "read_only": 1 }, { - "depends_on": "eval:sys_defaults.auto_accounting_for_stock", + "depends_on": "eval:cint(sys_defaults.auto_accounting_for_stock)", "doctype": "DocField", "fieldname": "expense_account", "fieldtype": "Link", @@ -175,7 +175,7 @@ }, { "default": ":Company", - "depends_on": "eval:sys_defaults.auto_accounting_for_stock", + "depends_on": "eval:cint(sys_defaults.auto_accounting_for_stock)", "doctype": "DocField", "fieldname": "cost_center", "fieldtype": "Link", diff --git a/stock/doctype/stock_reconciliation/stock_reconciliation.txt b/stock/doctype/stock_reconciliation/stock_reconciliation.txt index c9959d36e3..7d5021c89e 100644 --- a/stock/doctype/stock_reconciliation/stock_reconciliation.txt +++ b/stock/doctype/stock_reconciliation/stock_reconciliation.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-28 10:35:31", "docstatus": 0, - "modified": "2013-09-24 15:35:12", + "modified": "2014-01-15 15:45:07", "modified_by": "Administrator", "owner": "Administrator" }, @@ -102,7 +102,7 @@ "reqd": 1 }, { - "depends_on": "eval:sys_defaults.auto_accounting_for_stock", + "depends_on": "eval:cint(sys_defaults.auto_accounting_for_stock)", "doctype": "DocField", "fieldname": "expense_account", "fieldtype": "Link", @@ -110,6 +110,7 @@ "options": "Account" }, { + "depends_on": "eval:cint(sys_defaults.auto_accounting_for_stock)", "doctype": "DocField", "fieldname": "cost_center", "fieldtype": "Link", From 39eb7faeb9148cb667834cbdce00eab926ac2a25 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 15 Jan 2014 17:36:18 +0530 Subject: [PATCH 069/107] Update billing percentage and status from SI/PI in SO/PO, when net total is zero --- .../accounts_settings/accounts_settings.py | 8 +++- .../purchase_invoice/purchase_invoice.py | 3 +- .../doctype/sales_invoice/sales_invoice.py | 2 + controllers/status_updater.py | 37 +++++++++++++++++++ 4 files changed, 48 insertions(+), 2 deletions(-) diff --git a/accounts/doctype/accounts_settings/accounts_settings.py b/accounts/doctype/accounts_settings/accounts_settings.py index a6e993863d..2475fdaf66 100644 --- a/accounts/doctype/accounts_settings/accounts_settings.py +++ b/accounts/doctype/accounts_settings/accounts_settings.py @@ -6,6 +6,7 @@ from __future__ import unicode_literals import webnotes from webnotes import _ +from webnotes.utils import cint class DocType: def __init__(self, d, dl): @@ -14,7 +15,12 @@ class DocType: def on_update(self): webnotes.conn.set_default("auto_accounting_for_stock", self.doc.auto_accounting_for_stock) - if self.doc.auto_accounting_for_stock: + if cint(self.doc.auto_accounting_for_stock): + # set default perpetual account in company + for company in webnotes.conn.sql("select name from tabCompany"): + webnotes.bean("Company", company[0]).save() + + # Create account head for warehouses warehouse_list = webnotes.conn.sql("select name, company from tabWarehouse", as_dict=1) warehouse_with_no_company = [d.name for d in warehouse_list if not d.company] if warehouse_with_no_company: diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.py b/accounts/doctype/purchase_invoice/purchase_invoice.py index 06b7a3ad2e..fcd6846507 100644 --- a/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -302,6 +302,7 @@ class DocType(BuyingController): self.make_gl_entries() self.update_against_document_in_jv() self.update_prevdoc_status() + self.update_billing_status_for_zero_amount_refdoc("Purchase Order") def make_gl_entries(self): auto_accounting_for_stock = \ @@ -421,7 +422,7 @@ class DocType(BuyingController): remove_against_link_from_jv(self.doc.doctype, self.doc.name, "against_voucher") self.update_prevdoc_status() - + self.update_billing_status_for_zero_amount_refdoc("Purchase Order") self.make_cancel_gl_entries() def on_update(self): diff --git a/accounts/doctype/sales_invoice/sales_invoice.py b/accounts/doctype/sales_invoice/sales_invoice.py index bfba30fa1b..a39702b3fc 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.py +++ b/accounts/doctype/sales_invoice/sales_invoice.py @@ -88,6 +88,7 @@ class DocType(SellingController): self.update_status_updater_args() self.update_prevdoc_status() + self.update_billing_status_for_zero_amount_refdoc("Sales Order") # this sequence because outstanding may get -ve self.make_gl_entries() @@ -114,6 +115,7 @@ class DocType(SellingController): self.update_status_updater_args() self.update_prevdoc_status() + self.update_billing_status_for_zero_amount_refdoc("Sales Order") self.make_cancel_gl_entries() diff --git a/controllers/status_updater.py b/controllers/status_updater.py index a285c4798d..1743887bf7 100644 --- a/controllers/status_updater.py +++ b/controllers/status_updater.py @@ -232,6 +232,43 @@ class StatusUpdater(DocListController): 'Fully %(keyword)s', 'Partly %(keyword)s')) where name='%(name)s'""" % args) + + def update_billing_status_for_zero_amount_refdoc(self, ref_dt): + ref_fieldname = ref_dt.lower().replace(" ", "_") + zero_amount_refdoc = [] + all_zero_amount_refdoc = webnotes.conn.sql_list("""select name from `tab%s` + where docstatus=1 and net_total = 0""" % ref_dt) + + for item in self.doclist.get({"parentfield": "entries"}): + if item.fields.get(ref_fieldname) \ + and item.fields.get(ref_fieldname) in all_zero_amount_refdoc \ + and item.fields.get(ref_fieldname) not in zero_amount_refdoc: + zero_amount_refdoc.append(item.fields[ref_fieldname]) + + if zero_amount_refdoc: + self.update_biling_status(zero_amount_refdoc, ref_dt, ref_fieldname) + + def update_biling_status(self, zero_amount_refdoc, ref_dt, ref_fieldname): + for ref_dn in zero_amount_refdoc: + ref_doc_qty = flt(webnotes.conn.sql("""select sum(ifnull(qty, 0)) from `tab%s Item` + where parent=%s""" % (ref_dt, '%s'), (ref_dn))[0][0]) + + billed_qty = flt(webnotes.conn.sql("""select sum(ifnull(qty, 0)) + from `tab%s Item` where %s=%s and docstatus=1""" % + (self.doc.doctype, ref_fieldname, '%s'), (ref_dn))[0][0]) + + per_billed = ((ref_doc_qty if billed_qty > ref_doc_qty else billed_qty)\ + / ref_doc_qty)*100 + webnotes.conn.set_value(ref_dt, ref_dn, "per_billed", per_billed) + + from webnotes.model.meta import has_field + if has_field(ref_dt, "billing_status"): + if per_billed < 0.001: billing_status = "Not Billed" + elif per_billed >= 99.99: billing_status = "Fully Billed" + else: billing_status = "Partly Billed" + + webnotes.conn.set_value(ref_dt, ref_dn, "billing_status", billing_status) + def get_tolerance_for(item_code, item_tolerance={}, global_tolerance=None): """ Returns the tolerance for the item, if not set, returns global tolerance From 5cdb8cea135f2df03e8a662fe37be28cc5735794 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 16 Jan 2014 12:08:12 +0530 Subject: [PATCH 070/107] Reset filters in Item Price report on each route --- stock/doctype/item/item.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/stock/doctype/item/item.js b/stock/doctype/item/item.js index c9aa75e7b7..e18a0f2809 100644 --- a/stock/doctype/item/item.js +++ b/stock/doctype/item/item.js @@ -29,10 +29,7 @@ cur_frm.cscript.make_dashboard = function() { cur_frm.cscript.edit_prices_button = function() { cur_frm.add_custom_button("Add / Edit Prices", function() { - wn.route_options = { - "item_code": cur_frm.doc.name - }; - wn.set_route("Report", "Item Price"); + wn.set_route("Report", "Item Price", {"item_code": cur_frm.doc.name}); }, "icon-money"); } From e31a97f3558479d6b6a989e1d716e21351c62547 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 16 Jan 2014 14:24:32 +0530 Subject: [PATCH 071/107] Calculate taxes and charges total in server side --- .../purchase_common/purchase_common.js | 30 +++++++++++-------- controllers/buying_controller.py | 22 ++++++++++++-- controllers/selling_controller.py | 3 +- 3 files changed, 40 insertions(+), 15 deletions(-) diff --git a/buying/doctype/purchase_common/purchase_common.js b/buying/doctype/purchase_common/purchase_common.js index 14b8279245..e3957ab847 100644 --- a/buying/doctype/purchase_common/purchase_common.js +++ b/buying/doctype/purchase_common/purchase_common.js @@ -302,11 +302,11 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ calculate_totals: function() { var tax_count = this.frm.tax_doclist.length; - this.frm.doc.grand_total = flt( - tax_count ? this.frm.tax_doclist[tax_count - 1].total : this.frm.doc.net_total, + this.frm.doc.grand_total = flt(tax_count ? + this.frm.tax_doclist[tax_count - 1].total : this.frm.doc.net_total, precision("grand_total")); - this.frm.doc.grand_total_import = flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate, - precision("grand_total_import")); + this.frm.doc.grand_total_import = flt(this.frm.doc.grand_total / + this.frm.doc.conversion_rate, precision("grand_total_import")); this.frm.doc.total_tax = flt(this.frm.doc.grand_total - this.frm.doc.net_total, precision("total_tax")); @@ -321,20 +321,26 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ } // other charges added/deducted + this.frm.doc.other_charges_added = 0.0 + this.frm.doc.other_charges_deducted = 0.0 if(tax_count) { this.frm.doc.other_charges_added = wn.utils.sum($.map(this.frm.tax_doclist, - function(tax) { return (tax.add_deduct_tax == "Add" && in_list(["Valuation and Total", "Total"], tax.category)) ? tax.tax_amount : 0.0; })); + function(tax) { return (tax.add_deduct_tax == "Add" + && in_list(["Valuation and Total", "Total"], tax.category)) ? + tax.tax_amount : 0.0; })); this.frm.doc.other_charges_deducted = wn.utils.sum($.map(this.frm.tax_doclist, - function(tax) { return (tax.add_deduct_tax == "Deduct" && in_list(["Valuation and Total", "Total"], tax.category)) ? tax.tax_amount : 0.0; })); + function(tax) { return (tax.add_deduct_tax == "Deduct" + && in_list(["Valuation and Total", "Total"], tax.category)) ? + tax.tax_amount : 0.0; })); - wn.model.round_floats_in(this.frm.doc, ["other_charges_added", "other_charges_deducted"]); - - this.frm.doc.other_charges_added_import = flt(this.frm.doc.other_charges_added / this.frm.doc.conversion_rate, - precision("other_charges_added_import")); - this.frm.doc.other_charges_deducted_import = flt(this.frm.doc.other_charges_deducted / this.frm.doc.conversion_rate, - precision("other_charges_deducted_import")); + wn.model.round_floats_in(this.frm.doc, + ["other_charges_added", "other_charges_deducted"]); } + this.frm.doc.other_charges_added_import = flt(this.frm.doc.other_charges_added / + this.frm.doc.conversion_rate, precision("other_charges_added_import")); + this.frm.doc.other_charges_deducted_import = flt(this.frm.doc.other_charges_deducted / + this.frm.doc.conversion_rate, precision("other_charges_deducted_import")); }, _cleanup: function() { diff --git a/controllers/buying_controller.py b/controllers/buying_controller.py index 7954ca0abb..bdc7327c5f 100644 --- a/controllers/buying_controller.py +++ b/controllers/buying_controller.py @@ -124,8 +124,8 @@ class BuyingController(StockController): self.round_floats_in(self.doc, ["net_total", "net_total_import"]) def calculate_totals(self): - self.doc.grand_total = flt(self.tax_doclist and \ - self.tax_doclist[-1].total or self.doc.net_total, self.precision("grand_total")) + self.doc.grand_total = flt(self.tax_doclist[-1].total if self.tax_doclist + else self.doc.net_total, self.precision("grand_total")) self.doc.grand_total_import = flt(self.doc.grand_total / self.doc.conversion_rate, self.precision("grand_total_import")) @@ -137,6 +137,24 @@ class BuyingController(StockController): if self.meta.get_field("rounded_total_import"): self.doc.rounded_total_import = _round(self.doc.grand_total_import) + + if self.meta.get_field("other_charges_added"): + self.doc.other_charges_added = flt(sum([flt(d.tax_amount) for d in self.tax_doclist + if d.add_deduct_tax=="Add" and d.category in ["Valuation and Total", "Total"]]), + self.precision("other_charges_added")) + + if self.meta.get_field("other_charges_deducted"): + self.doc.other_charges_deducted = flt(sum([flt(d.tax_amount) for d in self.tax_doclist + if d.add_deduct_tax=="Deduct" and d.category in ["Valuation and Total", "Total"]]), + self.precision("other_charges_deducted")) + + if self.meta.get_field("other_charges_added_import"): + self.doc.other_charges_added_import = flt(self.doc.other_charges_added / + self.doc.conversion_rate, self.precision("other_charges_added_import")) + + if self.meta.get_field("other_charges_deducted_import"): + self.doc.other_charges_deducted_import = flt(self.doc.other_charges_deducted / + self.doc.conversion_rate, self.precision("other_charges_deducted_import")) def calculate_outstanding_amount(self): if self.doc.doctype == "Purchase Invoice" and self.doc.docstatus < 2: diff --git a/controllers/selling_controller.py b/controllers/selling_controller.py index 67c1462662..4806c73a81 100644 --- a/controllers/selling_controller.py +++ b/controllers/selling_controller.py @@ -191,7 +191,8 @@ class SellingController(StockController): self.doc.other_charges_total = flt(self.doc.grand_total - self.doc.net_total, self.precision("other_charges_total")) - self.doc.other_charges_total_export = flt(self.doc.grand_total_export - self.doc.net_total_export, + self.doc.other_charges_total_export = flt( + self.doc.grand_total_export - self.doc.net_total_export, self.precision("other_charges_total_export")) self.doc.rounded_total = _round(self.doc.grand_total) From 6933617538236c33f1ae2c103483b4161dc1dab3 Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Thu, 16 Jan 2014 16:59:22 +0600 Subject: [PATCH 072/107] bumped to version 3.6.2 --- config.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.json b/config.json index 45acaf2cd3..c2524671a0 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,6 @@ { "app_name": "ERPNext", - "app_version": "3.6.1", + "app_version": "3.6.2", "base_template": "app/portal/templates/base.html", "modules": { "Accounts": { @@ -74,5 +74,5 @@ "type": "module" } }, - "requires_framework_version": "==3.7.1" + "requires_framework_version": "==3.7.2" } \ No newline at end of file From f6b77479d75318ee2cfe17c68d63a40ac14e6160 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 16 Jan 2014 18:18:49 +0530 Subject: [PATCH 073/107] Patch: Update billing status for zero value order --- hr/doctype/salary_manager/salary_manager.js | 2 +- ...ate_billing_status_for_zero_value_order.py | 29 +++++++++++++++++++ patches/patch_list.py | 1 + 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 patches/1401/update_billing_status_for_zero_value_order.py diff --git a/hr/doctype/salary_manager/salary_manager.js b/hr/doctype/salary_manager/salary_manager.js index 032c29e509..ec485ca671 100644 --- a/hr/doctype/salary_manager/salary_manager.js +++ b/hr/doctype/salary_manager/salary_manager.js @@ -43,7 +43,7 @@ cur_frm.cscript.make_jv = function(doc, dt, dn) { jv = locals['Journal Voucher'][jv]; jv.voucher_type = 'Bank Voucher'; jv.user_remark = wn._('Payment of salary for the month: ') + doc.month + - wn._('and fiscal year: ') + doc.fiscal_year; + wn._(' and fiscal year: ') + doc.fiscal_year; jv.fiscal_year = doc.fiscal_year; jv.company = doc.company; jv.posting_date = dateutil.obj_to_str(new Date()); diff --git a/patches/1401/update_billing_status_for_zero_value_order.py b/patches/1401/update_billing_status_for_zero_value_order.py new file mode 100644 index 0000000000..afeed55ed4 --- /dev/null +++ b/patches/1401/update_billing_status_for_zero_value_order.py @@ -0,0 +1,29 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +import webnotes +from webnotes.utils import flt + +def execute(): + for order_type in ["Sales", "Purchase"]: + for d in webnotes.conn.sql("""select par.name, sum(ifnull(child.qty, 0)) as total_qty + from `tab%s Order` par, `tab%s Order Item` child + where par.name = child.parent and par.docstatus = 1 + and ifnull(par.net_total, 0) = 0 group by par.name""" % + (order_type, order_type), as_dict=1): + + billed_qty = flt(webnotes.conn.sql("""select sum(ifnull(qty, 0)) + from `tab%s Invoice Item` where %s=%s and docstatus=1""" % + (order_type, "sales_order" if order_type=="Sales" else "purchase_order", '%s'), + (d.name))[0][0]) + + per_billed = ((d.total_qty if billed_qty > d.total_qty else billed_qty)\ + / d.total_qty)*100 + webnotes.conn.set_value(order_type+ " Order", d.name, "per_billed", per_billed) + + if order_type == "Sales": + if per_billed < 0.001: billing_status = "Not Billed" + elif per_billed >= 99.99: billing_status = "Fully Billed" + else: billing_status = "Partly Billed" + + webnotes.conn.set_value("Sales Order", d.name, "billing_status", billing_status) \ No newline at end of file diff --git a/patches/patch_list.py b/patches/patch_list.py index 04a9288c60..2598ae8c94 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -265,4 +265,5 @@ patch_list = [ "patches.1312.p02_update_item_details_in_item_price", "patches.1401.p01_move_related_property_setters_to_custom_field", "patches.1401.p01_make_buying_selling_as_check_box_in_price_list", + "patches.1401.update_billing_status_for_zero_value_order", ] \ No newline at end of file From e1e63a91d6f4571621cf519ce9c337085b216f3a Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Fri, 17 Jan 2014 11:12:20 +0530 Subject: [PATCH 074/107] Allow renaming of campaign --- accounts/doctype/sales_invoice/sales_invoice.txt | 4 ++-- selling/doctype/campaign/campaign.js | 13 +------------ selling/doctype/campaign/campaign.txt | 3 ++- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/accounts/doctype/sales_invoice/sales_invoice.txt b/accounts/doctype/sales_invoice/sales_invoice.txt index 99bfe5cdf0..0433f31ad6 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.txt +++ b/accounts/doctype/sales_invoice/sales_invoice.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 19:29:05", "docstatus": 0, - "modified": "2013-11-18 15:16:50", + "modified": "2014-01-16 15:36:16", "modified_by": "Administrator", "owner": "Administrator" }, @@ -1091,7 +1091,7 @@ "fieldtype": "Select", "label": "Recurring Type", "no_copy": 1, - "options": "Monthly\nQuarterly\nHalf-yearly\nYearly", + "options": "\nMonthly\nQuarterly\nHalf-yearly\nYearly", "print_hide": 1, "read_only": 0 }, diff --git a/selling/doctype/campaign/campaign.js b/selling/doctype/campaign/campaign.js index 6271a163cb..33479579a5 100644 --- a/selling/doctype/campaign/campaign.js +++ b/selling/doctype/campaign/campaign.js @@ -1,13 +1,2 @@ // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors -// License: GNU General Public License v3. See license.txt - - - -//--------- ONLOAD ------------- -cur_frm.cscript.onload = function(doc, cdt, cdn) { - -} - -cur_frm.cscript.refresh = function(doc, cdt, cdn) { - -} \ No newline at end of file +// License: GNU General Public License v3. See license.txt \ No newline at end of file diff --git a/selling/doctype/campaign/campaign.txt b/selling/doctype/campaign/campaign.txt index 7025bf5654..7170e051d6 100644 --- a/selling/doctype/campaign/campaign.txt +++ b/selling/doctype/campaign/campaign.txt @@ -2,11 +2,12 @@ { "creation": "2013-01-10 16:34:18", "docstatus": 0, - "modified": "2013-07-05 14:29:57", + "modified": "2014-01-16 12:52:19", "modified_by": "Administrator", "owner": "Administrator" }, { + "allow_rename": 1, "autoname": "field:campaign_name", "description": "Keep Track of Sales Campaigns. Keep track of Leads, Quotations, Sales Order etc from Campaigns to gauge Return on Investment. ", "doctype": "DocType", From f32314dd0b2fbbe0d183f77ad8ac5af4ef42a223 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 17 Jan 2014 11:53:25 +0530 Subject: [PATCH 075/107] Do not set income/expense account automatically in company master --- setup/doctype/company/company.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/setup/doctype/company/company.py b/setup/doctype/company/company.py index 88d9dcaaa5..34e5ca4a59 100644 --- a/setup/doctype/company/company.py +++ b/setup/doctype/company/company.py @@ -244,8 +244,6 @@ class DocType: webnotes.conn.set(self.doc, a, account_name) _set_default_accounts({ - "default_income_account": "Sales", - "default_expense_account": "Cost of Goods Sold", "receivables_group": "Accounts Receivable", "payables_group": "Accounts Payable", "default_cash_account": "Cash" @@ -257,8 +255,6 @@ class DocType: "stock_adjustment_account": "Stock Adjustment", "expenses_included_in_valuation": "Expenses Included In Valuation" }) - - def create_default_cost_center(self): cc_list = [ From bc99c9d6e0d7871decb8b092c94bad70db520e67 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 17 Jan 2014 12:04:24 +0530 Subject: [PATCH 076/107] Priority to user's deafult price list over customer's default price list --- utilities/transaction_base.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/utilities/transaction_base.py b/utilities/transaction_base.py index f783faa9ec..6c515a52b6 100644 --- a/utilities/transaction_base.py +++ b/utilities/transaction_base.py @@ -78,8 +78,9 @@ class TransactionBase(StatusUpdater): 3. Clears existing Sales Team and fetches the one mentioned in Customer """ customer_defaults = self.get_customer_defaults() - - customer_defaults["selling_price_list"] = self.get_user_default_price_list("Selling") or \ + + customer_defaults["selling_price_list"] = \ + self.get_user_default_price_list("selling_price_list") or \ customer_defaults.get("price_list") or \ webnotes.conn.get_value("Customer Group", self.doc.customer_group, "default_price_list") or self.doc.selling_price_list @@ -91,11 +92,11 @@ class TransactionBase(StatusUpdater): if self.meta.get_field("sales_team") and self.doc.customer: self.set_sales_team_for_customer() - def get_user_default_price_list(self, price_list_for): - from webnotes.defaults import get_user_default_as_list - user_default_price_list = get_user_default_as_list("selling_price_list" - if price_list_for=="Selling" else "buying_price_list") - return user_default_price_list[0] if len(user_default_price_list)==1 else "" + def get_user_default_price_list(self, price_list): + from webnotes.defaults import get_defaults_for + user_default_price_list = get_defaults_for(webnotes.session.user).get(price_list) + return cstr(user_default_price_list) \ + if not isinstance(user_default_price_list, list) else "" def set_sales_team_for_customer(self): from webnotes.model import default_fields @@ -128,7 +129,7 @@ class TransactionBase(StatusUpdater): if supplier.default_currency: out["currency"] = supplier.default_currency - out["buying_price_list"] = self.get_user_default_price_list("Buying") or \ + out["buying_price_list"] = self.get_user_default_price_list("buying_price_list") or \ supplier.default_price_list or self.doc.buying_price_list return out From da08124df2d7cc1ba7ce47ede4b8b988ce3b7f77 Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Fri, 17 Jan 2014 15:27:19 +0530 Subject: [PATCH 077/107] remove mysql-python pinning to 1.2.4 --- install_erpnext.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_erpnext.py b/install_erpnext.py index e285d4bbfe..8e1448362b 100644 --- a/install_erpnext.py +++ b/install_erpnext.py @@ -20,7 +20,7 @@ requirements = [ "jinja2", "markdown2", "markupsafe", - "mysql-python==1.2.4", + "mysql-python", "pygeoip", "python-dateutil", "python-memcached", From 96db41d996472f7f40a8267171dd01cf51de0d44 Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Fri, 17 Jan 2014 17:26:31 +0600 Subject: [PATCH 078/107] bumped to version 3.6.3 --- config.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.json b/config.json index c2524671a0..450e2bca6d 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,6 @@ { "app_name": "ERPNext", - "app_version": "3.6.2", + "app_version": "3.6.3", "base_template": "app/portal/templates/base.html", "modules": { "Accounts": { @@ -74,5 +74,5 @@ "type": "module" } }, - "requires_framework_version": "==3.7.2" + "requires_framework_version": "==3.7.3" } \ No newline at end of file From 8a4111fe0eca17c786c4eb6ea5ad6cd03ea2fa6c Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Fri, 17 Jan 2014 18:50:44 +0530 Subject: [PATCH 079/107] decimal places fixed in item prices report --- stock/report/item_prices/item_prices.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stock/report/item_prices/item_prices.py b/stock/report/item_prices/item_prices.py index e744cc73e4..18228ff64b 100644 --- a/stock/report/item_prices/item_prices.py +++ b/stock/report/item_prices/item_prices.py @@ -15,8 +15,8 @@ def execute(filters=None): bom_rate = get_item_bom_rate() val_rate_map = get_valuation_rate() - precision = get_currency_precision or 2 - + precision = get_currency_precision() or 2 + data = [] for item in sorted(item_map): data.append([item, item_map[item]["item_name"], From ed87335513986af2ba6766e331906078c830a9bd Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Fri, 17 Jan 2014 18:57:21 +0530 Subject: [PATCH 080/107] decimal places fix in item prices report --- stock/report/item_prices/item_prices.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stock/report/item_prices/item_prices.py b/stock/report/item_prices/item_prices.py index e744cc73e4..5eee7df42d 100644 --- a/stock/report/item_prices/item_prices.py +++ b/stock/report/item_prices/item_prices.py @@ -15,7 +15,7 @@ def execute(filters=None): bom_rate = get_item_bom_rate() val_rate_map = get_valuation_rate() - precision = get_currency_precision or 2 + precision = get_currency_precision() or 2 data = [] for item in sorted(item_map): From 529709e08b08ba51479d6a69a55662107361cc17 Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Mon, 20 Jan 2014 16:39:03 +0530 Subject: [PATCH 081/107] patch for enabling all price list --- patches/1401/enable_all_price_list.py | 9 +++++++++ patches/patch_list.py | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 patches/1401/enable_all_price_list.py diff --git a/patches/1401/enable_all_price_list.py b/patches/1401/enable_all_price_list.py new file mode 100644 index 0000000000..9cf141fe67 --- /dev/null +++ b/patches/1401/enable_all_price_list.py @@ -0,0 +1,9 @@ +# Copyright (c) 2014, Web Notes Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import webnotes + +def execute(): + webnotes.reload_doc("stock", "doctype", "price_list") + webnotes.conn.sql("""update `tabPrice List` set enabled=1""") \ No newline at end of file diff --git a/patches/patch_list.py b/patches/patch_list.py index 5bf730af0b..89e33091bf 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -266,5 +266,5 @@ patch_list = [ "patches.1401.p01_move_related_property_setters_to_custom_field", "patches.1401.p01_make_buying_selling_as_check_box_in_price_list", "patches.1401.update_billing_status_for_zero_value_order", - "execute:webnotes.reload_doc('stock', 'doctype', 'price_list') #2014-01-20", + "patches.1401.enable_all_price_list", ] \ No newline at end of file From 719f2803b3ca826860c4bfbbbe374bc613e733c6 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 20 Jan 2014 17:01:28 +0530 Subject: [PATCH 082/107] Fixed conflict while merging with develop branch --- .../doctype/stock_reconciliation/stock_reconciliation.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.txt b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.txt index 0a639d5e74..6f9d04d492 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.txt +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.txt @@ -2,11 +2,7 @@ { "creation": "2013-03-28 10:35:31", "docstatus": 0, -<<<<<<< HEAD:erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.txt - "modified": "2013-12-20 16:06:50", -======= "modified": "2014-01-15 15:45:07", ->>>>>>> dbb495548352d46b30bf84fb4b29ef4a247cb21c:stock/doctype/stock_reconciliation/stock_reconciliation.txt "modified_by": "Administrator", "owner": "Administrator" }, From 9e056ec1ced1474ccc4229abe7f4955406c84ba1 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 20 Jan 2014 17:46:37 +0530 Subject: [PATCH 083/107] Auto closing of tickets through schedulers --- erpnext/hooks.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/hooks.txt b/erpnext/hooks.txt index 0c8b71a98f..a52ea2d29a 100644 --- a/erpnext/hooks.txt +++ b/erpnext/hooks.txt @@ -53,6 +53,7 @@ scheduler_event = daily:erpnext.accounts.doctype.sales_invoice.sales_invoice.man scheduler_event = daily:erpnext.setup.doctype.backup_manager.backup_manager.take_backups_daily scheduler_event = daily:erpnext.stock.utils.reorder_item scheduler_event = daily:erpnext.setup.doctype.email_digest.email_digest.send +scheduler_event = daily:support.doctype.support_ticket.support_ticket.auto_close_tickets #### Weekly From f96bcf943b0fe5522b428c8bfa22c239d6943062 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 20 Jan 2014 17:52:13 +0530 Subject: [PATCH 084/107] added explicit delete perimssions --- erpnext/accounts/doctype/account/account.txt | 19 ++++++++++--------- .../budget_distribution.txt | 6 ++++-- .../doctype/cost_center/cost_center.txt | 7 ++++--- .../doctype/fiscal_year/fiscal_year.txt | 6 ++++-- .../journal_voucher/journal_voucher.txt | 5 ++++- .../period_closing_voucher.txt | 3 ++- .../purchase_invoice/purchase_invoice.txt | 7 ++++++- .../purchase_taxes_and_charges_master.txt | 7 ++++--- .../doctype/sales_invoice/sales_invoice.txt | 5 ++++- .../sales_taxes_and_charges_master.txt | 9 +++++---- .../doctype/shipping_rule/shipping_rule.txt | 6 +++++- .../doctype/purchase_order/purchase_order.txt | 6 +++++- .../quality_inspection/quality_inspection.txt | 3 ++- erpnext/buying/doctype/supplier/supplier.txt | 7 ++++--- .../supplier_quotation/supplier_quotation.txt | 7 ++++++- erpnext/hr/doctype/appraisal/appraisal.txt | 6 +++++- erpnext/hr/doctype/attendance/attendance.txt | 3 ++- erpnext/hr/doctype/branch/branch.txt | 5 +++-- .../doctype/deduction_type/deduction_type.txt | 5 +++-- erpnext/hr/doctype/department/department.txt | 5 +++-- .../hr/doctype/designation/designation.txt | 5 +++-- .../hr/doctype/earning_type/earning_type.txt | 5 +++-- erpnext/hr/doctype/employee/employee.txt | 9 +++++---- .../employment_type/employment_type.txt | 5 +++-- .../doctype/expense_claim/expense_claim.txt | 5 ++++- erpnext/hr/doctype/grade/grade.txt | 5 +++-- .../hr/doctype/holiday_list/holiday_list.txt | 5 +++-- .../doctype/job_applicant/job_applicant.txt | 3 ++- .../hr/doctype/job_opening/job_opening.txt | 3 ++- .../leave_allocation/leave_allocation.txt | 3 ++- .../leave_application/leave_application.txt | 8 +++++++- erpnext/hr/doctype/leave_type/leave_type.txt | 5 +++-- .../hr/doctype/salary_slip/salary_slip.txt | 4 +++- erpnext/manufacturing/doctype/bom/bom.txt | 3 ++- .../production_order/production_order.txt | 3 ++- .../doctype/workstation/workstation.txt | 5 +++-- erpnext/projects/doctype/project/project.txt | 7 ++++--- erpnext/projects/doctype/task/task.txt | 5 +++-- .../projects/doctype/time_log/time_log.txt | 3 ++- .../doctype/time_log_batch/time_log_batch.txt | 3 ++- erpnext/selling/doctype/campaign/campaign.txt | 9 +++++---- erpnext/selling/doctype/customer/customer.txt | 8 ++++++-- .../installation_note/installation_note.txt | 4 +++- erpnext/selling/doctype/lead/lead.txt | 7 ++++--- .../doctype/opportunity/opportunity.txt | 3 ++- .../selling/doctype/quotation/quotation.txt | 7 ++++++- .../selling/doctype/sales_bom/sales_bom.txt | 9 +++++---- .../doctype/sales_order/sales_order.txt | 6 +++++- .../authorization_rule/authorization_rule.txt | 5 +++-- erpnext/setup/doctype/brand/brand.txt | 7 ++++++- erpnext/setup/doctype/company/company.txt | 6 ++++-- erpnext/setup/doctype/currency/currency.txt | 10 +++++++--- .../currency_exchange/currency_exchange.txt | 6 +++++- .../doctype/customer_group/customer_group.txt | 9 +++++---- .../doctype/email_digest/email_digest.txt | 7 ++++--- .../setup/doctype/item_group/item_group.txt | 10 ++++++++-- .../doctype/print_heading/print_heading.txt | 5 +++-- .../quotation_lost_reason.txt | 5 +++-- .../doctype/sales_partner/sales_partner.txt | 9 +++++---- .../doctype/sales_person/sales_person.txt | 9 +++++---- .../doctype/supplier_type/supplier_type.txt | 9 +++++---- .../terms_and_conditions.txt | 11 ++++++----- erpnext/setup/doctype/territory/territory.txt | 9 +++++---- erpnext/setup/doctype/uom/uom.txt | 9 +++++---- erpnext/stock/doctype/batch/batch.txt | 5 +++-- .../doctype/delivery_note/delivery_note.txt | 7 ++++++- erpnext/stock/doctype/item/item.txt | 9 +++++---- .../stock/doctype/item_price/item_price.txt | 3 ++- .../material_request/material_request.txt | 3 ++- .../doctype/packing_slip/packing_slip.txt | 3 ++- .../stock/doctype/price_list/price_list.txt | 8 ++++++-- .../purchase_receipt/purchase_receipt.txt | 6 +++++- erpnext/stock/doctype/serial_no/serial_no.txt | 9 +++++---- .../stock/doctype/stock_entry/stock_entry.txt | 3 ++- .../stock_reconciliation.txt | 3 ++- erpnext/stock/doctype/warehouse/warehouse.txt | 9 +++++++-- .../doctype/customer_issue/customer_issue.txt | 5 +++-- .../maintenance_schedule.txt | 3 ++- .../maintenance_visit/maintenance_visit.txt | 3 ++- .../doctype/support_ticket/support_ticket.txt | 9 +++++---- erpnext/utilities/doctype/contact/contact.txt | 17 +++++++++++++---- erpnext/utilities/doctype/note/note.txt | 3 ++- 82 files changed, 335 insertions(+), 173 deletions(-) diff --git a/erpnext/accounts/doctype/account/account.txt b/erpnext/accounts/doctype/account/account.txt index 50a6d6da37..e2622155eb 100644 --- a/erpnext/accounts/doctype/account/account.txt +++ b/erpnext/accounts/doctype/account/account.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-30 12:49:46", "docstatus": 0, - "modified": "2013-12-20 19:23:54", + "modified": "2014-01-20 17:48:20", "modified_by": "Administrator", "owner": "Administrator" }, @@ -28,6 +28,7 @@ }, { "amend": 0, + "cancel": 0, "doctype": "DocPerm", "name": "__common__", "parent": "Account", @@ -254,8 +255,8 @@ "read_only": 1 }, { - "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "permlevel": 0, @@ -264,8 +265,8 @@ "write": 1 }, { - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "email": 1, "permlevel": 0, @@ -274,8 +275,8 @@ "write": 0 }, { - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "email": 1, "permlevel": 0, @@ -284,8 +285,8 @@ "write": 0 }, { - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "email": 1, "permlevel": 0, @@ -294,16 +295,16 @@ "write": 0 }, { - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "permlevel": 2, "role": "Auditor", "write": 0 }, { - "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "export": 0, @@ -315,16 +316,16 @@ "write": 1 }, { - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "permlevel": 2, "role": "Accounts Manager", "write": 1 }, { - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "permlevel": 2, "role": "Accounts User", diff --git a/erpnext/accounts/doctype/budget_distribution/budget_distribution.txt b/erpnext/accounts/doctype/budget_distribution/budget_distribution.txt index 992c8bec81..48d6e7b54a 100644 --- a/erpnext/accounts/doctype/budget_distribution/budget_distribution.txt +++ b/erpnext/accounts/doctype/budget_distribution/budget_distribution.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:05", "docstatus": 0, - "modified": "2013-12-20 19:23:58", + "modified": "2014-01-20 17:48:27", "modified_by": "Administrator", "owner": "Administrator" }, @@ -24,6 +24,7 @@ "permlevel": 0 }, { + "cancel": 0, "doctype": "DocPerm", "name": "__common__", "parent": "Budget Distribution", @@ -79,8 +80,8 @@ }, { "amend": 0, - "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "permlevel": 0, @@ -88,6 +89,7 @@ "write": 1 }, { + "delete": 0, "doctype": "DocPerm", "permlevel": 2 } diff --git a/erpnext/accounts/doctype/cost_center/cost_center.txt b/erpnext/accounts/doctype/cost_center/cost_center.txt index 3f1fab279d..66864bce4c 100644 --- a/erpnext/accounts/doctype/cost_center/cost_center.txt +++ b/erpnext/accounts/doctype/cost_center/cost_center.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-23 19:57:17", "docstatus": 0, - "modified": "2013-12-20 19:24:00", + "modified": "2014-01-20 17:48:30", "modified_by": "Administrator", "owner": "Administrator" }, @@ -30,6 +30,7 @@ }, { "amend": 0, + "cancel": 0, "doctype": "DocPerm", "email": 1, "name": "__common__", @@ -185,15 +186,15 @@ "report_hide": 1 }, { - "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Accounts Manager", "write": 1 }, { - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Accounts User", "write": 0 diff --git a/erpnext/accounts/doctype/fiscal_year/fiscal_year.txt b/erpnext/accounts/doctype/fiscal_year/fiscal_year.txt index afa4858969..27fac8df25 100644 --- a/erpnext/accounts/doctype/fiscal_year/fiscal_year.txt +++ b/erpnext/accounts/doctype/fiscal_year/fiscal_year.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-22 16:50:25", "docstatus": 0, - "modified": "2013-12-20 19:24:08", + "modified": "2014-01-20 17:48:46", "modified_by": "Administrator", "owner": "Administrator" }, @@ -81,8 +81,9 @@ "reqd": 0 }, { - "cancel": 1, + "cancel": 0, "create": 1, + "delete": 1, "doctype": "DocPerm", "report": 1, "role": "System Manager", @@ -90,6 +91,7 @@ "write": 1 }, { + "delete": 0, "doctype": "DocPerm", "role": "All" } diff --git a/erpnext/accounts/doctype/journal_voucher/journal_voucher.txt b/erpnext/accounts/doctype/journal_voucher/journal_voucher.txt index 9de2abb642..73710f935d 100644 --- a/erpnext/accounts/doctype/journal_voucher/journal_voucher.txt +++ b/erpnext/accounts/doctype/journal_voucher/journal_voucher.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-25 10:53:52", "docstatus": 0, - "modified": "2013-12-20 19:24:11", + "modified": "2014-01-20 17:48:51", "modified_by": "Administrator", "owner": "Administrator" }, @@ -474,6 +474,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Accounts User", "submit": 1, @@ -483,6 +484,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Accounts Manager", "submit": 1, @@ -492,6 +494,7 @@ "amend": 0, "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Auditor", "submit": 0, diff --git a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.txt b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.txt index 37a22a0497..170f49f1fa 100644 --- a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.txt +++ b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:07", "docstatus": 0, - "modified": "2013-12-20 19:24:15", + "modified": "2014-01-20 17:48:59", "modified_by": "Administrator", "owner": "jai@webnotestech.com" }, @@ -27,6 +27,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt index 6df4df40d3..5dbe9f649e 100755 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-21 16:16:39", "docstatus": 0, - "modified": "2013-12-20 19:24:18", + "modified": "2014-01-20 17:49:04", "modified_by": "Administrator", "owner": "Administrator" }, @@ -771,6 +771,7 @@ "amend": 0, "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Accounts User", "submit": 0, @@ -780,6 +781,7 @@ "amend": 0, "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Purchase User", "submit": 0, @@ -789,6 +791,7 @@ "amend": 0, "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Supplier", "submit": 0, @@ -798,6 +801,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Accounts Manager", "submit": 1, @@ -807,6 +811,7 @@ "amend": 0, "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Auditor", "submit": 0, diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.txt b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.txt index 1430c43d2e..bdaf00cf03 100644 --- a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.txt +++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:08", "docstatus": 0, - "modified": "2013-12-20 19:24:24", + "modified": "2014-01-20 17:49:14", "modified_by": "Administrator", "owner": "wasim@webnotestech.com" }, @@ -25,6 +25,7 @@ "permlevel": 0 }, { + "cancel": 0, "doctype": "DocPerm", "email": 1, "name": "__common__", @@ -78,15 +79,15 @@ }, { "amend": 0, - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Purchase Manager", "write": 0 }, { - "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Purchase Master Manager", "write": 1 diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt b/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt index 33b386ffe3..a3be27dcf8 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 19:29:05", "docstatus": 0, - "modified": "2014-01-16 15:36:16", + "modified": "2014-01-20 17:49:20", "modified_by": "Administrator", "owner": "Administrator" }, @@ -1214,6 +1214,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Accounts Manager", "submit": 1, @@ -1223,12 +1224,14 @@ "amend": 1, "cancel": 0, "create": 1, + "delete": 0, "doctype": "DocPerm", "role": "Accounts User", "submit": 1, "write": 1 }, { + "delete": 0, "doctype": "DocPerm", "role": "Customer" } diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.txt b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.txt index 485aa94ac1..11e3b317e4 100644 --- a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.txt +++ b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:09", "docstatus": 0, - "modified": "2013-12-20 19:24:34", + "modified": "2014-01-20 17:49:25", "modified_by": "Administrator", "owner": "Administrator" }, @@ -26,6 +26,7 @@ }, { "amend": 0, + "cancel": 0, "doctype": "DocPerm", "email": 1, "name": "__common__", @@ -101,22 +102,22 @@ "reqd": 1 }, { - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Sales User", "write": 0 }, { - "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Accounts Manager", "write": 1 }, { - "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Sales Master Manager", "write": 1 diff --git a/erpnext/accounts/doctype/shipping_rule/shipping_rule.txt b/erpnext/accounts/doctype/shipping_rule/shipping_rule.txt index 082cddcaeb..c1e2e90bb7 100644 --- a/erpnext/accounts/doctype/shipping_rule/shipping_rule.txt +++ b/erpnext/accounts/doctype/shipping_rule/shipping_rule.txt @@ -2,7 +2,7 @@ { "creation": "2013-06-25 11:48:03", "docstatus": 0, - "modified": "2013-12-20 19:24:35", + "modified": "2014-01-20 17:49:27", "modified_by": "Administrator", "owner": "Administrator" }, @@ -133,16 +133,19 @@ "reqd": 1 }, { + "delete": 0, "doctype": "DocPerm", "role": "Accounts User" }, { + "delete": 0, "doctype": "DocPerm", "role": "Sales User" }, { "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Accounts Manager", "write": 1 @@ -150,6 +153,7 @@ { "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Sales Master Manager", "write": 1 diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.txt b/erpnext/buying/doctype/purchase_order/purchase_order.txt index 0266b80e32..2790e41088 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.txt +++ b/erpnext/buying/doctype/purchase_order/purchase_order.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-21 16:16:39", "docstatus": 0, - "modified": "2013-12-20 19:24:20", + "modified": "2014-01-20 17:49:08", "modified_by": "Administrator", "owner": "Administrator" }, @@ -672,6 +672,7 @@ "amend": 0, "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Material User", "submit": 0, @@ -681,6 +682,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Purchase Manager", "submit": 1, @@ -690,12 +692,14 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Purchase User", "submit": 1, "write": 1 }, { + "delete": 0, "doctype": "DocPerm", "role": "Supplier" } diff --git a/erpnext/buying/doctype/quality_inspection/quality_inspection.txt b/erpnext/buying/doctype/quality_inspection/quality_inspection.txt index aa8aa18394..899d3f863d 100644 --- a/erpnext/buying/doctype/quality_inspection/quality_inspection.txt +++ b/erpnext/buying/doctype/quality_inspection/quality_inspection.txt @@ -2,7 +2,7 @@ { "creation": "2013-04-30 13:13:03", "docstatus": 0, - "modified": "2013-12-20 19:24:24", + "modified": "2014-01-20 17:49:14", "modified_by": "Administrator", "owner": "Administrator" }, @@ -27,6 +27,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/buying/doctype/supplier/supplier.txt b/erpnext/buying/doctype/supplier/supplier.txt index c76eb653cf..5c305f5cd0 100644 --- a/erpnext/buying/doctype/supplier/supplier.txt +++ b/erpnext/buying/doctype/supplier/supplier.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:11", "docstatus": 0, - "modified": "2013-12-20 19:24:36", + "modified": "2014-01-20 17:49:29", "modified_by": "Administrator", "owner": "Administrator" }, @@ -28,6 +28,7 @@ }, { "amend": 0, + "cancel": 0, "doctype": "DocPerm", "email": 1, "name": "__common__", @@ -210,15 +211,15 @@ "print_hide": 1 }, { - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Purchase Manager", "write": 0 }, { - "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Purchase Master Manager", "write": 1 diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.txt b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.txt index f3bc30c738..e1441e5289 100644 --- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.txt +++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-21 16:16:45", "docstatus": 0, - "modified": "2013-12-20 19:24:36", + "modified": "2014-01-20 17:49:29", "modified_by": "Administrator", "owner": "Administrator" }, @@ -598,6 +598,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Manufacturing Manager", "submit": 1, @@ -607,6 +608,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Purchase Manager", "submit": 1, @@ -616,6 +618,7 @@ "amend": 1, "cancel": 0, "create": 1, + "delete": 0, "doctype": "DocPerm", "role": "Purchase User", "submit": 0, @@ -625,6 +628,7 @@ "amend": 0, "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Material User", "submit": 0, @@ -634,6 +638,7 @@ "amend": 0, "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Supplier", "submit": 0, diff --git a/erpnext/hr/doctype/appraisal/appraisal.txt b/erpnext/hr/doctype/appraisal/appraisal.txt index c7d9aafbbb..c82f8481bb 100644 --- a/erpnext/hr/doctype/appraisal/appraisal.txt +++ b/erpnext/hr/doctype/appraisal/appraisal.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:12", "docstatus": 0, - "modified": "2013-12-20 19:23:55", + "modified": "2014-01-20 17:48:22", "modified_by": "Administrator", "owner": "ashwini@webnotestech.com" }, @@ -230,6 +230,8 @@ "width": "150px" }, { + "cancel": 0, + "delete": 0, "doctype": "DocPerm", "match": "owner", "role": "Employee", @@ -238,6 +240,7 @@ { "amend": 1, "cancel": 1, + "delete": 1, "doctype": "DocPerm", "role": "System Manager", "submit": 1 @@ -245,6 +248,7 @@ { "amend": 1, "cancel": 1, + "delete": 1, "doctype": "DocPerm", "role": "HR User", "submit": 1 diff --git a/erpnext/hr/doctype/attendance/attendance.txt b/erpnext/hr/doctype/attendance/attendance.txt index 7d383fb9e4..894e981860 100644 --- a/erpnext/hr/doctype/attendance/attendance.txt +++ b/erpnext/hr/doctype/attendance/attendance.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:13", "docstatus": 0, - "modified": "2013-12-20 19:23:55", + "modified": "2014-01-20 17:48:23", "modified_by": "Administrator", "owner": "ashwini@webnotestech.com" }, @@ -28,6 +28,7 @@ { "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/hr/doctype/branch/branch.txt b/erpnext/hr/doctype/branch/branch.txt index 13aa087b24..6ef13e2abb 100644 --- a/erpnext/hr/doctype/branch/branch.txt +++ b/erpnext/hr/doctype/branch/branch.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:13", "docstatus": 0, - "modified": "2013-12-20 19:23:57", + "modified": "2014-01-20 17:48:26", "modified_by": "Administrator", "owner": "Administrator" }, @@ -25,8 +25,9 @@ "permlevel": 0 }, { - "cancel": 1, + "cancel": 0, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/hr/doctype/deduction_type/deduction_type.txt b/erpnext/hr/doctype/deduction_type/deduction_type.txt index e24064e14d..b70cf35b91 100644 --- a/erpnext/hr/doctype/deduction_type/deduction_type.txt +++ b/erpnext/hr/doctype/deduction_type/deduction_type.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-22 16:50:30", "docstatus": 0, - "modified": "2013-12-20 19:24:02", + "modified": "2014-01-20 17:48:34", "modified_by": "Administrator", "owner": "Administrator" }, @@ -25,8 +25,9 @@ "permlevel": 0 }, { - "cancel": 1, + "cancel": 0, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/hr/doctype/department/department.txt b/erpnext/hr/doctype/department/department.txt index 4cfdcaf8ca..269afa758f 100644 --- a/erpnext/hr/doctype/department/department.txt +++ b/erpnext/hr/doctype/department/department.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-05 11:48:26", "docstatus": 0, - "modified": "2013-12-20 19:24:04", + "modified": "2014-01-20 17:48:38", "modified_by": "Administrator", "owner": "Administrator" }, @@ -24,8 +24,9 @@ "permlevel": 0 }, { - "cancel": 1, + "cancel": 0, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/hr/doctype/designation/designation.txt b/erpnext/hr/doctype/designation/designation.txt index f9b48e46c2..e8debd1b2f 100644 --- a/erpnext/hr/doctype/designation/designation.txt +++ b/erpnext/hr/doctype/designation/designation.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:13", "docstatus": 0, - "modified": "2013-12-20 19:24:04", + "modified": "2014-01-20 17:48:38", "modified_by": "Administrator", "owner": "Administrator" }, @@ -25,8 +25,9 @@ "permlevel": 0 }, { - "cancel": 1, + "cancel": 0, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/hr/doctype/earning_type/earning_type.txt b/erpnext/hr/doctype/earning_type/earning_type.txt index c5ead6366e..9d3b90f80f 100644 --- a/erpnext/hr/doctype/earning_type/earning_type.txt +++ b/erpnext/hr/doctype/earning_type/earning_type.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-24 11:03:32", "docstatus": 0, - "modified": "2013-12-20 19:24:05", + "modified": "2014-01-20 17:48:38", "modified_by": "Administrator", "owner": "Administrator" }, @@ -25,8 +25,9 @@ "permlevel": 0 }, { - "cancel": 1, + "cancel": 0, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/hr/doctype/employee/employee.txt b/erpnext/hr/doctype/employee/employee.txt index f8b08e08d4..16314dba62 100644 --- a/erpnext/hr/doctype/employee/employee.txt +++ b/erpnext/hr/doctype/employee/employee.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-07 09:04:18", "docstatus": 0, - "modified": "2013-12-23 19:35:27", + "modified": "2014-01-20 17:48:40", "modified_by": "Administrator", "owner": "Administrator" }, @@ -28,6 +28,7 @@ }, { "amend": 0, + "cancel": 0, "doctype": "DocPerm", "email": 1, "name": "__common__", @@ -750,23 +751,23 @@ "read_only": 1 }, { - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Employee", "write": 0 }, { - "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "restrict": 0, "role": "HR User", "write": 1 }, { - "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "restrict": 1, "role": "HR Manager", diff --git a/erpnext/hr/doctype/employment_type/employment_type.txt b/erpnext/hr/doctype/employment_type/employment_type.txt index a13fd872b7..a91e145a5e 100644 --- a/erpnext/hr/doctype/employment_type/employment_type.txt +++ b/erpnext/hr/doctype/employment_type/employment_type.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:14", "docstatus": 0, - "modified": "2013-12-20 19:24:07", + "modified": "2014-01-20 17:48:43", "modified_by": "Administrator", "owner": "Administrator" }, @@ -24,8 +24,9 @@ "permlevel": 0 }, { - "cancel": 1, + "cancel": 0, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.txt b/erpnext/hr/doctype/expense_claim/expense_claim.txt index 5e65aa8ba6..98e1782697 100644 --- a/erpnext/hr/doctype/expense_claim/expense_claim.txt +++ b/erpnext/hr/doctype/expense_claim/expense_claim.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:14", "docstatus": 0, - "modified": "2013-12-20 19:24:07", + "modified": "2014-01-20 17:48:44", "modified_by": "Administrator", "owner": "harshada@webnotestech.com" }, @@ -221,6 +221,7 @@ "width": "160px" }, { + "delete": 0, "doctype": "DocPerm", "match": "owner", "role": "Employee" @@ -228,6 +229,7 @@ { "amend": 1, "cancel": 1, + "delete": 1, "doctype": "DocPerm", "role": "Expense Approver", "submit": 1 @@ -235,6 +237,7 @@ { "amend": 1, "cancel": 1, + "delete": 1, "doctype": "DocPerm", "role": "HR User", "submit": 1 diff --git a/erpnext/hr/doctype/grade/grade.txt b/erpnext/hr/doctype/grade/grade.txt index 4743bf1ccc..dcadd634a2 100644 --- a/erpnext/hr/doctype/grade/grade.txt +++ b/erpnext/hr/doctype/grade/grade.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:14", "docstatus": 0, - "modified": "2013-12-20 19:24:08", + "modified": "2014-01-20 17:48:46", "modified_by": "Administrator", "owner": "Administrator" }, @@ -30,8 +30,9 @@ "reqd": 1 }, { - "cancel": 1, + "cancel": 0, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/hr/doctype/holiday_list/holiday_list.txt b/erpnext/hr/doctype/holiday_list/holiday_list.txt index 8f0832b130..3122583866 100644 --- a/erpnext/hr/doctype/holiday_list/holiday_list.txt +++ b/erpnext/hr/doctype/holiday_list/holiday_list.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:14", "docstatus": 0, - "modified": "2013-12-20 19:24:08", + "modified": "2014-01-20 17:48:46", "modified_by": "Administrator", "owner": "Administrator" }, @@ -23,8 +23,9 @@ "permlevel": 0 }, { - "cancel": 1, + "cancel": 0, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/hr/doctype/job_applicant/job_applicant.txt b/erpnext/hr/doctype/job_applicant/job_applicant.txt index 8f0d41ae3a..fd463fb7e9 100644 --- a/erpnext/hr/doctype/job_applicant/job_applicant.txt +++ b/erpnext/hr/doctype/job_applicant/job_applicant.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-29 19:25:37", "docstatus": 0, - "modified": "2013-12-20 19:24:10", + "modified": "2014-01-20 17:48:50", "modified_by": "Administrator", "owner": "Administrator" }, @@ -27,6 +27,7 @@ { "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/hr/doctype/job_opening/job_opening.txt b/erpnext/hr/doctype/job_opening/job_opening.txt index dcf76ddb3a..b118b6a8d1 100644 --- a/erpnext/hr/doctype/job_opening/job_opening.txt +++ b/erpnext/hr/doctype/job_opening/job_opening.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-15 16:13:36", "docstatus": 0, - "modified": "2013-12-20 19:24:11", + "modified": "2014-01-20 17:48:51", "modified_by": "Administrator", "owner": "Administrator" }, @@ -26,6 +26,7 @@ { "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/hr/doctype/leave_allocation/leave_allocation.txt b/erpnext/hr/doctype/leave_allocation/leave_allocation.txt index 6e5fe64019..41584c97be 100644 --- a/erpnext/hr/doctype/leave_allocation/leave_allocation.txt +++ b/erpnext/hr/doctype/leave_allocation/leave_allocation.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-20 19:10:38", "docstatus": 0, - "modified": "2013-12-20 19:24:12", + "modified": "2014-01-20 17:48:54", "modified_by": "Administrator", "owner": "Administrator" }, @@ -28,6 +28,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/hr/doctype/leave_application/leave_application.txt b/erpnext/hr/doctype/leave_application/leave_application.txt index 24de6a82fc..038c29ddef 100644 --- a/erpnext/hr/doctype/leave_application/leave_application.txt +++ b/erpnext/hr/doctype/leave_application/leave_application.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-20 11:18:11", "docstatus": 0, - "modified": "2013-12-23 19:53:41", + "modified": "2014-01-20 17:48:55", "modified_by": "Administrator", "owner": "Administrator" }, @@ -230,6 +230,7 @@ }, { "create": 1, + "delete": 0, "doctype": "DocPerm", "email": 1, "permlevel": 0, @@ -242,6 +243,7 @@ "amend": 0, "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "permlevel": 1, "role": "All", @@ -251,6 +253,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "permlevel": 0, @@ -265,6 +268,7 @@ "amend": 1, "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "email": 1, "permlevel": 0, @@ -278,6 +282,7 @@ "amend": 0, "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "permlevel": 1, "report": 1, @@ -289,6 +294,7 @@ "amend": 0, "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "permlevel": 1, "report": 1, diff --git a/erpnext/hr/doctype/leave_type/leave_type.txt b/erpnext/hr/doctype/leave_type/leave_type.txt index adae0d9836..13d7e725be 100644 --- a/erpnext/hr/doctype/leave_type/leave_type.txt +++ b/erpnext/hr/doctype/leave_type/leave_type.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-21 09:55:58", "docstatus": 0, - "modified": "2013-12-20 19:24:13", + "modified": "2014-01-20 17:48:56", "modified_by": "Administrator", "owner": "Administrator" }, @@ -24,8 +24,9 @@ "permlevel": 0 }, { - "cancel": 1, + "cancel": 0, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.txt b/erpnext/hr/doctype/salary_slip/salary_slip.txt index 1f94aa83e0..e47e8d834e 100644 --- a/erpnext/hr/doctype/salary_slip/salary_slip.txt +++ b/erpnext/hr/doctype/salary_slip/salary_slip.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:15", "docstatus": 0, - "modified": "2013-12-20 19:24:27", + "modified": "2014-01-20 17:49:18", "modified_by": "Administrator", "owner": "Administrator" }, @@ -390,12 +390,14 @@ }, { "amend": 0, + "delete": 0, "doctype": "DocPerm", "role": "HR User" }, { "amend": 1, "cancel": 1, + "delete": 1, "doctype": "DocPerm", "role": "HR Manager" } diff --git a/erpnext/manufacturing/doctype/bom/bom.txt b/erpnext/manufacturing/doctype/bom/bom.txt index 505d8d75aa..4afc160fb8 100644 --- a/erpnext/manufacturing/doctype/bom/bom.txt +++ b/erpnext/manufacturing/doctype/bom/bom.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-22 15:11:38", "docstatus": 0, - "modified": "2013-12-20 19:23:57", + "modified": "2014-01-20 17:48:26", "modified_by": "Administrator", "owner": "Administrator" }, @@ -36,6 +36,7 @@ { "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/manufacturing/doctype/production_order/production_order.txt b/erpnext/manufacturing/doctype/production_order/production_order.txt index ed1c66886b..41ef1ce639 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.txt +++ b/erpnext/manufacturing/doctype/production_order/production_order.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:16", "docstatus": 0, - "modified": "2013-12-20 19:24:16", + "modified": "2014-01-20 17:49:01", "modified_by": "Administrator", "owner": "Administrator" }, @@ -28,6 +28,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/manufacturing/doctype/workstation/workstation.txt b/erpnext/manufacturing/doctype/workstation/workstation.txt index 306ca4ecef..b8355bfe6d 100644 --- a/erpnext/manufacturing/doctype/workstation/workstation.txt +++ b/erpnext/manufacturing/doctype/workstation/workstation.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:17", "docstatus": 0, - "modified": "2013-12-20 19:24:41", + "modified": "2014-01-20 17:49:35", "modified_by": "Administrator", "owner": "Administrator" }, @@ -24,8 +24,9 @@ "permlevel": 0 }, { - "cancel": 1, + "cancel": 0, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/projects/doctype/project/project.txt b/erpnext/projects/doctype/project/project.txt index a1967bb310..4f7e38dcc3 100644 --- a/erpnext/projects/doctype/project/project.txt +++ b/erpnext/projects/doctype/project/project.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-07 11:55:07", "docstatus": 0, - "modified": "2013-12-20 19:24:17", + "modified": "2014-01-20 17:49:02", "modified_by": "Administrator", "owner": "Administrator" }, @@ -28,6 +28,7 @@ }, { "amend": 0, + "cancel": 0, "doctype": "DocPerm", "name": "__common__", "parent": "Project", @@ -289,8 +290,8 @@ "search_index": 1 }, { - "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "permlevel": 0, @@ -299,8 +300,8 @@ "write": 1 }, { - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "permlevel": 1, "role": "All" diff --git a/erpnext/projects/doctype/task/task.txt b/erpnext/projects/doctype/task/task.txt index 7ddd51a494..670eaa18c2 100644 --- a/erpnext/projects/doctype/task/task.txt +++ b/erpnext/projects/doctype/task/task.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-29 19:25:50", "docstatus": 0, - "modified": "2013-12-20 19:24:38", + "modified": "2014-01-20 17:49:32", "modified_by": "Administrator", "owner": "Administrator" }, @@ -26,8 +26,9 @@ "permlevel": 0 }, { - "cancel": 1, + "cancel": 0, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/projects/doctype/time_log/time_log.txt b/erpnext/projects/doctype/time_log/time_log.txt index 2ad9d647b9..556597a4a7 100644 --- a/erpnext/projects/doctype/time_log/time_log.txt +++ b/erpnext/projects/doctype/time_log/time_log.txt @@ -2,7 +2,7 @@ { "creation": "2013-04-03 16:38:41", "docstatus": 0, - "modified": "2013-12-20 19:24:39", + "modified": "2014-01-20 17:49:34", "modified_by": "Administrator", "owner": "Administrator" }, @@ -28,6 +28,7 @@ { "amend": 1, "cancel": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/projects/doctype/time_log_batch/time_log_batch.txt b/erpnext/projects/doctype/time_log_batch/time_log_batch.txt index 458f0ed31b..bc803ea2b6 100644 --- a/erpnext/projects/doctype/time_log_batch/time_log_batch.txt +++ b/erpnext/projects/doctype/time_log_batch/time_log_batch.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-28 17:57:33", "docstatus": 0, - "modified": "2013-12-20 19:24:39", + "modified": "2014-01-20 17:49:34", "modified_by": "Administrator", "owner": "Administrator" }, @@ -28,6 +28,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/selling/doctype/campaign/campaign.txt b/erpnext/selling/doctype/campaign/campaign.txt index eb7cb89822..55c459cea3 100644 --- a/erpnext/selling/doctype/campaign/campaign.txt +++ b/erpnext/selling/doctype/campaign/campaign.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:18", "docstatus": 0, - "modified": "2014-01-16 12:52:19", + "modified": "2014-01-20 17:48:27", "modified_by": "Administrator", "owner": "Administrator" }, @@ -27,6 +27,7 @@ }, { "amend": 0, + "cancel": 0, "doctype": "DocPerm", "email": 1, "name": "__common__", @@ -77,8 +78,8 @@ "width": "300px" }, { - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "import": 0, "report": 0, @@ -86,16 +87,16 @@ "write": 0 }, { - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "report": 1, "role": "Sales User", "write": 0 }, { - "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "report": 1, "role": "Sales Master Manager", diff --git a/erpnext/selling/doctype/customer/customer.txt b/erpnext/selling/doctype/customer/customer.txt index aaf4b9d6d6..6eabaf0a37 100644 --- a/erpnext/selling/doctype/customer/customer.txt +++ b/erpnext/selling/doctype/customer/customer.txt @@ -2,7 +2,7 @@ { "creation": "2013-06-11 14:26:44", "docstatus": 0, - "modified": "2013-12-25 11:15:05", + "modified": "2014-01-20 17:48:32", "modified_by": "Administrator", "owner": "Administrator" }, @@ -345,6 +345,7 @@ "amend": 0, "cancel": 0, "create": 1, + "delete": 0, "doctype": "DocPerm", "email": 1, "permlevel": 0, @@ -355,14 +356,16 @@ "write": 1 }, { + "delete": 0, "doctype": "DocPerm", "permlevel": 1, "role": "Sales User" }, { "amend": 0, - "cancel": 1, + "cancel": 0, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "permlevel": 0, @@ -373,6 +376,7 @@ "write": 1 }, { + "delete": 0, "doctype": "DocPerm", "permlevel": 1, "role": "Sales Master Manager", diff --git a/erpnext/selling/doctype/installation_note/installation_note.txt b/erpnext/selling/doctype/installation_note/installation_note.txt index d23a68ac18..8f01a19aa5 100644 --- a/erpnext/selling/doctype/installation_note/installation_note.txt +++ b/erpnext/selling/doctype/installation_note/installation_note.txt @@ -2,7 +2,7 @@ { "creation": "2013-04-30 13:13:06", "docstatus": 0, - "modified": "2013-12-20 19:24:08", + "modified": "2014-01-20 17:48:47", "modified_by": "Administrator", "owner": "Administrator" }, @@ -257,6 +257,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "permlevel": 0, @@ -268,6 +269,7 @@ "amend": 0, "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "permlevel": 1, "submit": 0 diff --git a/erpnext/selling/doctype/lead/lead.txt b/erpnext/selling/doctype/lead/lead.txt index dc8bcdbb1a..caf677f524 100644 --- a/erpnext/selling/doctype/lead/lead.txt +++ b/erpnext/selling/doctype/lead/lead.txt @@ -2,7 +2,7 @@ { "creation": "2013-04-10 11:45:37", "docstatus": 0, - "modified": "2013-12-20 19:24:12", + "modified": "2014-01-20 17:48:53", "modified_by": "Administrator", "owner": "Administrator" }, @@ -26,6 +26,7 @@ }, { "amend": 0, + "cancel": 0, "create": 1, "doctype": "DocPerm", "email": 1, @@ -398,12 +399,12 @@ "print_hide": 1 }, { - "cancel": 1, + "delete": 1, "doctype": "DocPerm", "role": "Sales Manager" }, { - "cancel": 0, + "delete": 0, "doctype": "DocPerm", "role": "Sales User" } diff --git a/erpnext/selling/doctype/opportunity/opportunity.txt b/erpnext/selling/doctype/opportunity/opportunity.txt index d0dc0f54b6..613ed7b4d1 100644 --- a/erpnext/selling/doctype/opportunity/opportunity.txt +++ b/erpnext/selling/doctype/opportunity/opportunity.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-07 18:50:30", "docstatus": 0, - "modified": "2013-12-20 19:24:15", + "modified": "2014-01-20 17:48:58", "modified_by": "Administrator", "owner": "Administrator" }, @@ -30,6 +30,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/selling/doctype/quotation/quotation.txt b/erpnext/selling/doctype/quotation/quotation.txt index 4795653262..f12a2a738e 100644 --- a/erpnext/selling/doctype/quotation/quotation.txt +++ b/erpnext/selling/doctype/quotation/quotation.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 19:29:08", "docstatus": 0, - "modified": "2014-01-03 14:54:05", + "modified": "2014-01-20 17:49:16", "modified_by": "Administrator", "owner": "Administrator" }, @@ -853,6 +853,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Sales Manager", "submit": 1, @@ -862,6 +863,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Sales User", "submit": 1, @@ -871,6 +873,7 @@ "amend": 0, "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Customer", "submit": 0, @@ -880,6 +883,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Maintenance Manager", "submit": 1, @@ -889,6 +893,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Maintenance User", "submit": 1, diff --git a/erpnext/selling/doctype/sales_bom/sales_bom.txt b/erpnext/selling/doctype/sales_bom/sales_bom.txt index cd1ea28d85..ae40e10f80 100644 --- a/erpnext/selling/doctype/sales_bom/sales_bom.txt +++ b/erpnext/selling/doctype/sales_bom/sales_bom.txt @@ -2,7 +2,7 @@ { "creation": "2013-06-20 11:53:21", "docstatus": 0, - "modified": "2013-12-20 19:24:28", + "modified": "2014-01-20 17:49:19", "modified_by": "Administrator", "owner": "Administrator" }, @@ -26,6 +26,7 @@ }, { "amend": 0, + "cancel": 0, "doctype": "DocPerm", "email": 1, "name": "__common__", @@ -78,22 +79,22 @@ "reqd": 1 }, { - "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Material Manager", "write": 1 }, { - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Material User", "write": 0 }, { - "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Sales User", "write": 1 diff --git a/erpnext/selling/doctype/sales_order/sales_order.txt b/erpnext/selling/doctype/sales_order/sales_order.txt index 2dc62f334a..d187f67b89 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.txt +++ b/erpnext/selling/doctype/sales_order/sales_order.txt @@ -2,7 +2,7 @@ { "creation": "2013-06-18 12:39:59", "docstatus": 0, - "modified": "2014-01-03 14:51:19", + "modified": "2014-01-20 17:49:23", "modified_by": "Administrator", "owner": "Administrator" }, @@ -909,6 +909,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "report": 1, "role": "Sales User", @@ -919,6 +920,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "report": 1, "role": "Maintenance User", @@ -926,10 +928,12 @@ "write": 1 }, { + "delete": 0, "doctype": "DocPerm", "role": "Accounts User" }, { + "delete": 0, "doctype": "DocPerm", "role": "Customer" } diff --git a/erpnext/setup/doctype/authorization_rule/authorization_rule.txt b/erpnext/setup/doctype/authorization_rule/authorization_rule.txt index 36467f2f4f..24b91d58ab 100644 --- a/erpnext/setup/doctype/authorization_rule/authorization_rule.txt +++ b/erpnext/setup/doctype/authorization_rule/authorization_rule.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:22", "docstatus": 0, - "modified": "2013-12-20 19:23:55", + "modified": "2014-01-20 17:48:24", "modified_by": "Administrator", "owner": "Administrator" }, @@ -25,8 +25,9 @@ "permlevel": 0 }, { - "cancel": 1, + "cancel": 0, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/setup/doctype/brand/brand.txt b/erpnext/setup/doctype/brand/brand.txt index 3dcb016166..3e67b9ff62 100644 --- a/erpnext/setup/doctype/brand/brand.txt +++ b/erpnext/setup/doctype/brand/brand.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:27:54", "docstatus": 0, - "modified": "2013-12-20 19:23:58", + "modified": "2014-01-20 17:48:27", "modified_by": "Administrator", "owner": "Administrator" }, @@ -62,6 +62,7 @@ { "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Material Master Manager", "write": 1 @@ -70,20 +71,24 @@ "amend": 0, "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Material User", "submit": 0, "write": 0 }, { + "delete": 0, "doctype": "DocPerm", "role": "Sales User" }, { + "delete": 0, "doctype": "DocPerm", "role": "Purchase User" }, { + "delete": 0, "doctype": "DocPerm", "role": "Accounts User" } diff --git a/erpnext/setup/doctype/company/company.txt b/erpnext/setup/doctype/company/company.txt index 1e763ea678..4159c51834 100644 --- a/erpnext/setup/doctype/company/company.txt +++ b/erpnext/setup/doctype/company/company.txt @@ -2,7 +2,7 @@ { "creation": "2013-04-10 08:35:39", "docstatus": 0, - "modified": "2013-12-20 19:23:59", + "modified": "2014-01-20 17:48:28", "modified_by": "Administrator", "owner": "Administrator" }, @@ -351,8 +351,9 @@ }, { "amend": 0, - "cancel": 1, + "cancel": 0, "create": 1, + "delete": 1, "doctype": "DocPerm", "report": 1, "role": "System Manager", @@ -360,6 +361,7 @@ "write": 1 }, { + "delete": 0, "doctype": "DocPerm", "role": "All" } diff --git a/erpnext/setup/doctype/currency/currency.txt b/erpnext/setup/doctype/currency/currency.txt index 709e360204..6bd2b1ca35 100644 --- a/erpnext/setup/doctype/currency/currency.txt +++ b/erpnext/setup/doctype/currency/currency.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-28 10:06:02", "docstatus": 0, - "modified": "2013-12-20 19:24:00", + "modified": "2014-01-20 17:48:31", "modified_by": "Administrator", "owner": "Administrator" }, @@ -90,8 +90,9 @@ "options": "\n#,###.##\n#.###,##\n# ###.##\n#,###.###\n#,##,###.##\n#.###\n#,###" }, { - "cancel": 1, + "cancel": 0, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Accounts Manager", "submit": 0, @@ -99,8 +100,9 @@ }, { "amend": 0, - "cancel": 1, + "cancel": 0, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Sales Master Manager", "submit": 0, @@ -110,12 +112,14 @@ "amend": 0, "cancel": 0, "create": 1, + "delete": 0, "doctype": "DocPerm", "role": "Purchase Master Manager", "submit": 0, "write": 1 }, { + "delete": 0, "doctype": "DocPerm", "role": "All" } diff --git a/erpnext/setup/doctype/currency_exchange/currency_exchange.txt b/erpnext/setup/doctype/currency_exchange/currency_exchange.txt index f0f5c39cc8..adaf12508a 100644 --- a/erpnext/setup/doctype/currency_exchange/currency_exchange.txt +++ b/erpnext/setup/doctype/currency_exchange/currency_exchange.txt @@ -2,7 +2,7 @@ { "creation": "2013-06-20 15:40:29", "docstatus": 0, - "modified": "2013-12-20 19:24:00", + "modified": "2014-01-20 17:48:31", "modified_by": "Administrator", "owner": "Administrator" }, @@ -63,19 +63,23 @@ { "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Accounts Manager", "write": 1 }, { + "delete": 0, "doctype": "DocPerm", "role": "Accounts User" }, { + "delete": 0, "doctype": "DocPerm", "role": "Sales User" }, { + "delete": 0, "doctype": "DocPerm", "role": "Purchase User" } diff --git a/erpnext/setup/doctype/customer_group/customer_group.txt b/erpnext/setup/doctype/customer_group/customer_group.txt index 5b7158fbf6..59f52c6727 100644 --- a/erpnext/setup/doctype/customer_group/customer_group.txt +++ b/erpnext/setup/doctype/customer_group/customer_group.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:23", "docstatus": 0, - "modified": "2013-12-20 19:24:01", + "modified": "2014-01-20 17:48:33", "modified_by": "Administrator", "owner": "Administrator" }, @@ -29,6 +29,7 @@ }, { "amend": 0, + "cancel": 0, "doctype": "DocPerm", "email": 1, "name": "__common__", @@ -141,22 +142,22 @@ "report_hide": 1 }, { - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Sales Manager", "write": 0 }, { - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Sales User", "write": 0 }, { - "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Sales Master Manager", "write": 1 diff --git a/erpnext/setup/doctype/email_digest/email_digest.txt b/erpnext/setup/doctype/email_digest/email_digest.txt index ca35916437..2ac3998a7d 100644 --- a/erpnext/setup/doctype/email_digest/email_digest.txt +++ b/erpnext/setup/doctype/email_digest/email_digest.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-21 14:15:31", "docstatus": 0, - "modified": "2013-12-20 19:24:05", + "modified": "2014-01-20 17:48:39", "modified_by": "Administrator", "owner": "Administrator" }, @@ -24,6 +24,7 @@ "permlevel": 0 }, { + "cancel": 0, "doctype": "DocPerm", "name": "__common__", "parent": "Email Digest", @@ -348,8 +349,8 @@ "label": "Stub" }, { - "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "permlevel": 0, @@ -359,8 +360,8 @@ }, { "amend": 0, - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "permlevel": 1 } diff --git a/erpnext/setup/doctype/item_group/item_group.txt b/erpnext/setup/doctype/item_group/item_group.txt index 83e32b218b..71be22519c 100644 --- a/erpnext/setup/doctype/item_group/item_group.txt +++ b/erpnext/setup/doctype/item_group/item_group.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-28 10:35:29", "docstatus": 0, - "modified": "2013-12-20 19:24:10", + "modified": "2014-01-20 17:48:49", "modified_by": "Administrator", "owner": "Administrator" }, @@ -184,6 +184,7 @@ "amend": 0, "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Material Manager", "submit": 0, @@ -193,28 +194,33 @@ "amend": 0, "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Material User", "submit": 0, "write": 0 }, { - "cancel": 1, + "cancel": 0, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Material Master Manager", "submit": 0, "write": 1 }, { + "delete": 0, "doctype": "DocPerm", "role": "Sales User" }, { + "delete": 0, "doctype": "DocPerm", "role": "Purchase User" }, { + "delete": 0, "doctype": "DocPerm", "role": "Accounts User" } diff --git a/erpnext/setup/doctype/print_heading/print_heading.txt b/erpnext/setup/doctype/print_heading/print_heading.txt index 861e5479ab..d566f8dee2 100644 --- a/erpnext/setup/doctype/print_heading/print_heading.txt +++ b/erpnext/setup/doctype/print_heading/print_heading.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:24", "docstatus": 0, - "modified": "2013-12-20 19:24:16", + "modified": "2014-01-20 17:49:01", "modified_by": "Administrator", "owner": "Administrator" }, @@ -25,8 +25,9 @@ "permlevel": 0 }, { - "cancel": 1, + "cancel": 0, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/setup/doctype/quotation_lost_reason/quotation_lost_reason.txt b/erpnext/setup/doctype/quotation_lost_reason/quotation_lost_reason.txt index 6fccf61dfb..00e9c6ea4e 100644 --- a/erpnext/setup/doctype/quotation_lost_reason/quotation_lost_reason.txt +++ b/erpnext/setup/doctype/quotation_lost_reason/quotation_lost_reason.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:24", "docstatus": 0, - "modified": "2013-12-20 19:24:26", + "modified": "2014-01-20 17:49:17", "modified_by": "Administrator", "owner": "Administrator" }, @@ -25,8 +25,9 @@ }, { "amend": 0, - "cancel": 1, + "cancel": 0, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/setup/doctype/sales_partner/sales_partner.txt b/erpnext/setup/doctype/sales_partner/sales_partner.txt index 6ab274cc77..b09b81d572 100644 --- a/erpnext/setup/doctype/sales_partner/sales_partner.txt +++ b/erpnext/setup/doctype/sales_partner/sales_partner.txt @@ -2,7 +2,7 @@ { "creation": "2013-04-12 15:34:06", "docstatus": 0, - "modified": "2013-12-20 19:24:34", + "modified": "2014-01-20 17:49:25", "modified_by": "Administrator", "owner": "Administrator" }, @@ -28,6 +28,7 @@ }, { "amend": 0, + "cancel": 0, "doctype": "DocPerm", "email": 1, "name": "__common__", @@ -221,22 +222,22 @@ "label": "Description" }, { - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Sales Manager", "write": 0 }, { - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Sales User", "write": 0 }, { - "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Sales Master Manager", "write": 1 diff --git a/erpnext/setup/doctype/sales_person/sales_person.txt b/erpnext/setup/doctype/sales_person/sales_person.txt index 76d9811122..724dc4cd0e 100644 --- a/erpnext/setup/doctype/sales_person/sales_person.txt +++ b/erpnext/setup/doctype/sales_person/sales_person.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:24", "docstatus": 0, - "modified": "2013-12-20 19:24:34", + "modified": "2014-01-20 17:49:25", "modified_by": "Administrator", "owner": "Administrator" }, @@ -29,6 +29,7 @@ }, { "amend": 0, + "cancel": 0, "doctype": "DocPerm", "email": 1, "name": "__common__", @@ -174,22 +175,22 @@ "print_hide": 1 }, { - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Sales Manager", "write": 0 }, { - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Sales User", "write": 0 }, { - "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Sales Master Manager", "write": 1 diff --git a/erpnext/setup/doctype/supplier_type/supplier_type.txt b/erpnext/setup/doctype/supplier_type/supplier_type.txt index c7c2b57f62..5154f15a98 100644 --- a/erpnext/setup/doctype/supplier_type/supplier_type.txt +++ b/erpnext/setup/doctype/supplier_type/supplier_type.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:24", "docstatus": 0, - "modified": "2013-12-20 19:24:38", + "modified": "2014-01-20 17:49:31", "modified_by": "Administrator", "owner": "Administrator" }, @@ -26,6 +26,7 @@ }, { "amend": 0, + "cancel": 0, "doctype": "DocPerm", "email": 1, "name": "__common__", @@ -61,22 +62,22 @@ "reqd": 1 }, { - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Purchase Manager", "write": 0 }, { - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Purchase User", "write": 0 }, { - "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Purchase Master Manager", "write": 1 diff --git a/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.txt b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.txt index e3ff486ea9..16493799ca 100644 --- a/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.txt +++ b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:24", "docstatus": 0, - "modified": "2013-12-20 19:24:39", + "modified": "2014-01-20 17:49:33", "modified_by": "Administrator", "owner": "Administrator" }, @@ -26,6 +26,7 @@ "permlevel": 0 }, { + "cancel": 0, "doctype": "DocPerm", "email": 1, "name": "__common__", @@ -72,30 +73,30 @@ }, { "amend": 0, - "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Sales Master Manager", "write": 1 }, { "amend": 0, - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Sales User", "write": 0 }, { - "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "System Manager", "write": 1 }, { - "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Accounts User", "write": 1 diff --git a/erpnext/setup/doctype/territory/territory.txt b/erpnext/setup/doctype/territory/territory.txt index 00b7aac422..3eb766d4e0 100644 --- a/erpnext/setup/doctype/territory/territory.txt +++ b/erpnext/setup/doctype/territory/territory.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:24", "docstatus": 0, - "modified": "2013-12-20 19:24:39", + "modified": "2014-01-20 17:49:33", "modified_by": "Administrator", "owner": "Administrator" }, @@ -31,6 +31,7 @@ }, { "amend": 0, + "cancel": 0, "doctype": "DocPerm", "email": 1, "name": "__common__", @@ -177,22 +178,22 @@ "options": "Budget Distribution" }, { - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Sales Manager", "write": 0 }, { - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Sales User", "write": 0 }, { - "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Sales Master Manager", "write": 1 diff --git a/erpnext/setup/doctype/uom/uom.txt b/erpnext/setup/doctype/uom/uom.txt index 070c5a4148..edff5b1d7b 100644 --- a/erpnext/setup/doctype/uom/uom.txt +++ b/erpnext/setup/doctype/uom/uom.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:24", "docstatus": 0, - "modified": "2013-12-20 19:24:40", + "modified": "2014-01-20 17:49:34", "modified_by": "Administrator", "owner": "Administrator" }, @@ -25,6 +25,7 @@ }, { "amend": 0, + "cancel": 0, "doctype": "DocPerm", "email": 1, "name": "__common__", @@ -58,22 +59,22 @@ "label": "Must be Whole Number" }, { - "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Material Master Manager", "write": 1 }, { - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Material Manager", "write": 0 }, { - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Material User", "write": 0 diff --git a/erpnext/stock/doctype/batch/batch.txt b/erpnext/stock/doctype/batch/batch.txt index 17145fffa7..c08573b507 100644 --- a/erpnext/stock/doctype/batch/batch.txt +++ b/erpnext/stock/doctype/batch/batch.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-05 14:50:38", "docstatus": 0, - "modified": "2013-12-20 19:23:55", + "modified": "2014-01-20 17:48:24", "modified_by": "Administrator", "owner": "harshada@webnotestech.com" }, @@ -26,8 +26,9 @@ "permlevel": 0 }, { - "cancel": 1, + "cancel": 0, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.txt b/erpnext/stock/doctype/delivery_note/delivery_note.txt index b2677a39e5..63b62d604c 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.txt +++ b/erpnext/stock/doctype/delivery_note/delivery_note.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 19:29:09", "docstatus": 0, - "modified": "2014-01-03 14:53:03", + "modified": "2014-01-20 17:48:35", "modified_by": "Administrator", "owner": "Administrator" }, @@ -1035,6 +1035,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Material User", "submit": 1, @@ -1044,6 +1045,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Material Manager", "submit": 1, @@ -1053,6 +1055,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Sales User", "submit": 1, @@ -1061,12 +1064,14 @@ { "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Accounts User", "submit": 0, "write": 0 }, { + "delete": 0, "doctype": "DocPerm", "role": "Customer" } diff --git a/erpnext/stock/doctype/item/item.txt b/erpnext/stock/doctype/item/item.txt index cc12fdaebf..8da0d4cf33 100644 --- a/erpnext/stock/doctype/item/item.txt +++ b/erpnext/stock/doctype/item/item.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-03 10:45:46", "docstatus": 0, - "modified": "2013-12-20 19:24:09", + "modified": "2014-01-20 17:48:47", "modified_by": "Administrator", "owner": "Administrator" }, @@ -30,6 +30,7 @@ "permlevel": 0 }, { + "cancel": 0, "doctype": "DocPerm", "email": 1, "name": "__common__", @@ -847,8 +848,8 @@ "read_only": 0 }, { - "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "import": 1, "role": "Material Master Manager", @@ -856,16 +857,16 @@ }, { "amend": 0, - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Material Manager", "write": 0 }, { "amend": 0, - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Material User", "write": 0 diff --git a/erpnext/stock/doctype/item_price/item_price.txt b/erpnext/stock/doctype/item_price/item_price.txt index 281b7a6e37..338e759b04 100644 --- a/erpnext/stock/doctype/item_price/item_price.txt +++ b/erpnext/stock/doctype/item_price/item_price.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-02 16:29:48", "docstatus": 0, - "modified": "2014-01-07 19:16:49", + "modified": "2014-01-20 17:48:50", "modified_by": "Administrator", "owner": "Administrator" }, @@ -30,6 +30,7 @@ { "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/stock/doctype/material_request/material_request.txt b/erpnext/stock/doctype/material_request/material_request.txt index 8762c03edd..cb027918bd 100644 --- a/erpnext/stock/doctype/material_request/material_request.txt +++ b/erpnext/stock/doctype/material_request/material_request.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-07 14:48:38", "docstatus": 0, - "modified": "2013-12-20 19:24:14", + "modified": "2014-01-20 17:48:57", "modified_by": "Administrator", "owner": "Administrator" }, @@ -30,6 +30,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/stock/doctype/packing_slip/packing_slip.txt b/erpnext/stock/doctype/packing_slip/packing_slip.txt index 065a056ef5..2f8ccc3fc7 100644 --- a/erpnext/stock/doctype/packing_slip/packing_slip.txt +++ b/erpnext/stock/doctype/packing_slip/packing_slip.txt @@ -2,7 +2,7 @@ { "creation": "2013-04-11 15:32:24", "docstatus": 0, - "modified": "2013-12-20 19:24:15", + "modified": "2014-01-20 17:48:59", "modified_by": "Administrator", "owner": "Administrator" }, @@ -30,6 +30,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/stock/doctype/price_list/price_list.txt b/erpnext/stock/doctype/price_list/price_list.txt index 69d72d9337..41d9c47400 100644 --- a/erpnext/stock/doctype/price_list/price_list.txt +++ b/erpnext/stock/doctype/price_list/price_list.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-25 11:35:09", "docstatus": 0, - "modified": "2014-01-06 18:28:23", + "modified": "2014-01-20 17:48:59", "modified_by": "Administrator", "owner": "Administrator" }, @@ -92,6 +92,7 @@ "amend": 0, "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Sales User", "submit": 0, @@ -99,20 +100,23 @@ }, { "amend": 0, - "cancel": 1, + "cancel": 0, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Sales Master Manager", "submit": 0, "write": 1 }, { + "delete": 0, "doctype": "DocPerm", "role": "Purchase User" }, { "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Purchase Master Manager", "write": 1 diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt index fca3e39007..960bb210fa 100755 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-21 16:16:39", "docstatus": 0, - "modified": "2013-12-20 19:24:23", + "modified": "2014-01-20 17:49:12", "modified_by": "Administrator", "owner": "Administrator" }, @@ -809,6 +809,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Material Manager", "submit": 1, @@ -818,6 +819,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Material User", "submit": 1, @@ -827,12 +829,14 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Purchase User", "submit": 1, "write": 1 }, { + "delete": 0, "doctype": "DocPerm", "role": "Supplier" } diff --git a/erpnext/stock/doctype/serial_no/serial_no.txt b/erpnext/stock/doctype/serial_no/serial_no.txt index 09995704fa..3588493a20 100644 --- a/erpnext/stock/doctype/serial_no/serial_no.txt +++ b/erpnext/stock/doctype/serial_no/serial_no.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-16 10:59:15", "docstatus": 0, - "modified": "2013-12-20 19:24:34", + "modified": "2014-01-20 17:49:26", "modified_by": "Administrator", "owner": "Administrator" }, @@ -29,6 +29,7 @@ "permlevel": 0 }, { + "cancel": 0, "doctype": "DocPerm", "email": 1, "name": "__common__", @@ -451,24 +452,24 @@ "search_index": 1 }, { - "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Material Master Manager", "write": 1 }, { "amend": 0, - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Material Manager", "write": 0 }, { "amend": 0, - "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Material User", "write": 0 diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.txt b/erpnext/stock/doctype/stock_entry/stock_entry.txt index 84023ab2be..01cfed84b6 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.txt +++ b/erpnext/stock/doctype/stock_entry/stock_entry.txt @@ -2,7 +2,7 @@ { "creation": "2013-04-09 11:43:55", "docstatus": 0, - "modified": "2013-12-20 19:24:35", + "modified": "2014-01-20 17:49:27", "modified_by": "Administrator", "owner": "Administrator" }, @@ -38,6 +38,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.txt b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.txt index 6f9d04d492..90f5bc8e69 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.txt +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-28 10:35:31", "docstatus": 0, - "modified": "2014-01-15 15:45:07", + "modified": "2014-01-20 17:49:28", "modified_by": "Administrator", "owner": "Administrator" }, @@ -32,6 +32,7 @@ "amend": 0, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "name": "__common__", "parent": "Stock Reconciliation", diff --git a/erpnext/stock/doctype/warehouse/warehouse.txt b/erpnext/stock/doctype/warehouse/warehouse.txt index 629a508d80..dc6a09844d 100644 --- a/erpnext/stock/doctype/warehouse/warehouse.txt +++ b/erpnext/stock/doctype/warehouse/warehouse.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-07 18:50:32", "docstatus": 0, - "modified": "2013-12-27 17:55:48", + "modified": "2014-01-20 17:49:34", "modified_by": "Administrator", "owner": "Administrator" }, @@ -176,8 +176,9 @@ }, { "amend": 0, - "cancel": 1, + "cancel": 0, "create": 1, + "delete": 1, "doctype": "DocPerm", "role": "Material Master Manager", "submit": 0, @@ -187,20 +188,24 @@ "amend": 0, "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "role": "Material User", "submit": 0, "write": 0 }, { + "delete": 0, "doctype": "DocPerm", "role": "Sales User" }, { + "delete": 0, "doctype": "DocPerm", "role": "Purchase User" }, { + "delete": 0, "doctype": "DocPerm", "role": "Accounts User" } diff --git a/erpnext/support/doctype/customer_issue/customer_issue.txt b/erpnext/support/doctype/customer_issue/customer_issue.txt index cc17fec7c9..d8b8a0bc63 100644 --- a/erpnext/support/doctype/customer_issue/customer_issue.txt +++ b/erpnext/support/doctype/customer_issue/customer_issue.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:30", "docstatus": 0, - "modified": "2014-01-14 15:56:22", + "modified": "2014-01-20 17:48:34", "modified_by": "Administrator", "owner": "harshada@webnotestech.com" }, @@ -26,8 +26,9 @@ }, { "amend": 0, - "cancel": 1, + "cancel": 0, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.txt b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.txt index ff97b957bf..5321ed9003 100644 --- a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.txt +++ b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:30", "docstatus": 0, - "modified": "2013-12-20 19:24:13", + "modified": "2014-01-20 17:48:56", "modified_by": "Administrator", "owner": "Administrator" }, @@ -27,6 +27,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/support/doctype/maintenance_visit/maintenance_visit.txt b/erpnext/support/doctype/maintenance_visit/maintenance_visit.txt index 2b2986edc2..7693d39da7 100644 --- a/erpnext/support/doctype/maintenance_visit/maintenance_visit.txt +++ b/erpnext/support/doctype/maintenance_visit/maintenance_visit.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:31", "docstatus": 0, - "modified": "2013-12-20 19:24:13", + "modified": "2014-01-20 17:48:57", "modified_by": "Administrator", "owner": "ashwini@webnotestech.com" }, @@ -27,6 +27,7 @@ "amend": 1, "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", diff --git a/erpnext/support/doctype/support_ticket/support_ticket.txt b/erpnext/support/doctype/support_ticket/support_ticket.txt index 59093f772f..2eac196af6 100644 --- a/erpnext/support/doctype/support_ticket/support_ticket.txt +++ b/erpnext/support/doctype/support_ticket/support_ticket.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-01 10:36:25", "docstatus": 0, - "modified": "2013-12-20 19:24:38", + "modified": "2014-01-20 17:49:31", "modified_by": "Administrator", "owner": "Administrator" }, @@ -25,6 +25,7 @@ }, { "amend": 0, + "cancel": 0, "create": 1, "doctype": "DocPerm", "email": 1, @@ -273,17 +274,17 @@ "print_hide": 1 }, { - "cancel": 0, + "delete": 0, "doctype": "DocPerm", "role": "Guest" }, { - "cancel": 0, + "delete": 0, "doctype": "DocPerm", "role": "Customer" }, { - "cancel": 1, + "delete": 1, "doctype": "DocPerm", "role": "Support Team" } diff --git a/erpnext/utilities/doctype/contact/contact.txt b/erpnext/utilities/doctype/contact/contact.txt index 65c22b32a0..5a3e32d650 100644 --- a/erpnext/utilities/doctype/contact/contact.txt +++ b/erpnext/utilities/doctype/contact/contact.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:32", "docstatus": 0, - "modified": "2013-12-20 19:23:59", + "modified": "2014-01-20 17:48:29", "modified_by": "Administrator", "owner": "Administrator" }, @@ -26,6 +26,7 @@ "permlevel": 0 }, { + "cancel": 0, "create": 1, "doctype": "DocPerm", "email": 1, @@ -242,50 +243,58 @@ "print_hide": 1 }, { - "cancel": 1, + "delete": 1, "doctype": "DocPerm", "role": "System Manager" }, { "amend": 0, - "cancel": 1, + "delete": 1, "doctype": "DocPerm", "role": "Sales Master Manager" }, { - "cancel": 1, + "delete": 1, "doctype": "DocPerm", "role": "Purchase Master Manager" }, { + "delete": 0, "doctype": "DocPerm", "role": "Sales Manager" }, { + "delete": 0, "doctype": "DocPerm", "role": "Purchase Manager" }, { + "delete": 0, "doctype": "DocPerm", "role": "Maintenance Manager" }, { + "delete": 0, "doctype": "DocPerm", "role": "Accounts Manager" }, { + "delete": 0, "doctype": "DocPerm", "role": "Sales User" }, { + "delete": 0, "doctype": "DocPerm", "role": "Purchase User" }, { + "delete": 0, "doctype": "DocPerm", "role": "Maintenance User" }, { + "delete": 0, "doctype": "DocPerm", "role": "Accounts User" } diff --git a/erpnext/utilities/doctype/note/note.txt b/erpnext/utilities/doctype/note/note.txt index 055619a550..b7c4f8bab8 100644 --- a/erpnext/utilities/doctype/note/note.txt +++ b/erpnext/utilities/doctype/note/note.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 13:41:00", "docstatus": 0, - "modified": "2013-12-20 19:24:14", + "modified": "2014-01-20 17:48:58", "modified_by": "Administrator", "owner": "Administrator" }, @@ -27,6 +27,7 @@ { "cancel": 1, "create": 1, + "delete": 1, "doctype": "DocPerm", "email": 1, "name": "__common__", From afe93d633ca0320d5e57fbb4b2049be71bbc5524 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 20 Jan 2014 18:28:48 +0530 Subject: [PATCH 085/107] Increased remarks width in general ledger --- accounts/report/general_ledger/general_ledger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accounts/report/general_ledger/general_ledger.py b/accounts/report/general_ledger/general_ledger.py index 2f5716ece3..4b1a63b8b3 100644 --- a/accounts/report/general_ledger/general_ledger.py +++ b/accounts/report/general_ledger/general_ledger.py @@ -34,7 +34,7 @@ def validate_filters(filters, account_details): def get_columns(): return ["Posting Date:Date:100", "Account:Link/Account:200", "Debit:Float:100", "Credit:Float:100", "Voucher Type::120", "Voucher No::160", "Link::20", - "Against Account::120", "Cost Center:Link/Cost Center:100", "Remarks::200"] + "Against Account::120", "Cost Center:Link/Cost Center:100", "Remarks::400"] def get_result(filters, account_details): gl_entries = get_gl_entries(filters) From 872e4d1f3d660355ceec220967983aa4ee19e7f2 Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Mon, 20 Jan 2014 19:51:25 +0600 Subject: [PATCH 086/107] bumped to version 3.6.4 --- config.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.json b/config.json index 450e2bca6d..5a916c569b 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,6 @@ { "app_name": "ERPNext", - "app_version": "3.6.3", + "app_version": "3.6.4", "base_template": "app/portal/templates/base.html", "modules": { "Accounts": { @@ -74,5 +74,5 @@ "type": "module" } }, - "requires_framework_version": "==3.7.3" + "requires_framework_version": "==3.7.4" } \ No newline at end of file From b2f2df4c64609fcc3dc6fe0d049886baaf2b688d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 21 Jan 2014 11:58:17 +0530 Subject: [PATCH 087/107] General ledger: opening balance issue fixed --- accounts/report/general_ledger/general_ledger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accounts/report/general_ledger/general_ledger.py b/accounts/report/general_ledger/general_ledger.py index 4b1a63b8b3..02e970b39c 100644 --- a/accounts/report/general_ledger/general_ledger.py +++ b/accounts/report/general_ledger/general_ledger.py @@ -138,7 +138,7 @@ def get_accountwise_gle(filters, gl_entries, gle_map): for gle in gl_entries: amount = flt(gle.debit) - flt(gle.credit) if filters.get("account") and (gle.posting_date < filters.from_date - or cstr(gle.is_advance) == "Yes"): + or cstr(gle.is_opening) == "Yes"): gle_map[gle.account].opening += amount opening += amount elif gle.posting_date <= filters.to_date: From f3aba2e536a58427b477c4064847ce38ea06a753 Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Tue, 21 Jan 2014 12:39:31 +0600 Subject: [PATCH 088/107] bumped to version 3.6.5 --- config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.json b/config.json index 5a916c569b..d45459417f 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,6 @@ { "app_name": "ERPNext", - "app_version": "3.6.4", + "app_version": "3.6.5", "base_template": "app/portal/templates/base.html", "modules": { "Accounts": { From 13a9e27320b18883e59f3a69175c064d69ad12ed Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 21 Jan 2014 20:57:39 +0530 Subject: [PATCH 089/107] Fixes in warehouse merge function --- stock/doctype/warehouse/warehouse.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/stock/doctype/warehouse/warehouse.py b/stock/doctype/warehouse/warehouse.py index e1b0ef3cc9..0b2fa840c5 100644 --- a/stock/doctype/warehouse/warehouse.py +++ b/stock/doctype/warehouse/warehouse.py @@ -92,23 +92,19 @@ class DocType: exists for this warehouse.""")) def before_rename(self, olddn, newdn, merge=False): - # Add company abbr if not provided - from setup.doctype.company.company import get_name_with_abbr - new_warehouse = get_name_with_abbr(newdn, self.doc.company) - if merge: if not webnotes.conn.exists("Warehouse", newdn): webnotes.throw(_("Warehouse ") + newdn +_(" does not exists")) - if self.doc.company != webnotes.conn.get_value("Warehouse", new_warehouse, "company"): + if self.doc.company != webnotes.conn.get_value("Warehouse", newdn, "company"): webnotes.throw(_("Both Warehouse must belong to same Company")) webnotes.conn.sql("delete from `tabBin` where warehouse=%s", olddn) from accounts.utils import rename_account_for - rename_account_for("Warehouse", olddn, new_warehouse, merge) + rename_account_for("Warehouse", olddn, newdn, merge) - return new_warehouse + return newdn def after_rename(self, olddn, newdn, merge=False): if merge: From 423932fab2f266efe7a5b443a39fed08289e0449 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 22 Jan 2014 11:52:54 +0530 Subject: [PATCH 090/107] Fixes in general ledger opening --- accounts/report/general_ledger/general_ledger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accounts/report/general_ledger/general_ledger.py b/accounts/report/general_ledger/general_ledger.py index 02e970b39c..af6a87ca97 100644 --- a/accounts/report/general_ledger/general_ledger.py +++ b/accounts/report/general_ledger/general_ledger.py @@ -51,7 +51,7 @@ def get_gl_entries(filters): gl_entries = webnotes.conn.sql("""select posting_date, account, sum(ifnull(debit, 0)) as debit, sum(ifnull(credit, 0)) as credit, - voucher_type, voucher_no, cost_center, remarks, is_advance, against + voucher_type, voucher_no, cost_center, remarks, is_opening, against from `tabGL Entry` where company=%(company)s {conditions} {group_by_condition} From 7460dcf4062b9fc01dd182013a40dcb8e7effcd0 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 22 Jan 2014 12:44:46 +0530 Subject: [PATCH 091/107] updated Bootstrap --- erpnext/public/js/startup.css | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/erpnext/public/js/startup.css b/erpnext/public/js/startup.css index 54c40d4cb0..3777f4c7b6 100644 --- a/erpnext/public/js/startup.css +++ b/erpnext/public/js/startup.css @@ -1,15 +1,3 @@ -h1, h2, h3, h4, h5 { - font-family: Arial, Helvetica, sans-serif; -} - -body { - font-family: Arial, Helvetica, sans-serif; -} - -span, div, td, input, textarea, button, select { - font-family: inherit; -} - .small { font-size: 11.5px; } From c7676797e1f6a847a69d05e5fec88b37c3dd5322 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 22 Jan 2014 15:36:44 +0530 Subject: [PATCH 092/107] Dont display old fraction outstanding in AR report --- .../report/accounts_receivable/accounts_receivable.py | 5 ++++- accounts/utils.py | 11 ++++++++++- stock/report/item_prices/item_prices.py | 9 +-------- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/accounts/report/accounts_receivable/accounts_receivable.py b/accounts/report/accounts_receivable/accounts_receivable.py index de96abb7d7..c826fcbd13 100644 --- a/accounts/report/accounts_receivable/accounts_receivable.py +++ b/accounts/report/accounts_receivable/accounts_receivable.py @@ -37,12 +37,15 @@ class AccountsReceivableReport(object): return columns def get_data(self, customer_naming_by): + from accounts.utils import get_currency_precision + currency_precision = get_currency_precision() or 2 + data = [] future_vouchers = self.get_entries_after(self.filters.report_date) for gle in self.get_entries_till(self.filters.report_date): if self.is_receivable(gle, future_vouchers): outstanding_amount = self.get_outstanding_amount(gle, self.filters.report_date) - if abs(outstanding_amount) > 0.0: + if abs(outstanding_amount) > 0.1/10**currency_precision: due_date = self.get_due_date(gle) invoiced_amount = gle.debit if (gle.debit > 0) else 0 payment_received = invoiced_amount - outstanding_amount diff --git a/accounts/utils.py b/accounts/utils.py index fdd57b35c2..a3557aed09 100644 --- a/accounts/utils.py +++ b/accounts/utils.py @@ -378,4 +378,13 @@ def get_account_for(account_for_doctype, account_for): account_for_field = "account_type" return webnotes.conn.get_value("Account", {account_for_field: account_for_doctype, - "master_name": account_for}) \ No newline at end of file + "master_name": account_for}) + +def get_currency_precision(currency=None): + if not currency: + currency = webnotes.conn.get_value("Company", + webnotes.conn.get_default("company"), "default_currency") + currency_format = webnotes.conn.get_value("Currency", currency, "number_format") + + from webnotes.utils import get_number_format_info + return get_number_format_info(currency_format)[2] \ No newline at end of file diff --git a/stock/report/item_prices/item_prices.py b/stock/report/item_prices/item_prices.py index c9efd69829..50c923bad4 100644 --- a/stock/report/item_prices/item_prices.py +++ b/stock/report/item_prices/item_prices.py @@ -15,6 +15,7 @@ def execute(filters=None): bom_rate = get_item_bom_rate() val_rate_map = get_valuation_rate() + from accounts.utils import get_currency_precision precision = get_currency_precision() or 2 data = [] for item in sorted(item_map): @@ -29,14 +30,6 @@ def execute(filters=None): ]) return columns, data - -def get_currency_precision(): - company_currency = webnotes.conn.get_value("Company", - webnotes.conn.get_default("company"), "default_currency") - currency_format = webnotes.conn.get_value("Currency", company_currency, "number_format") - - from webnotes.utils import get_number_format_info - return get_number_format_info(currency_format)[2] def get_columns(filters): """return columns based on filters""" From 7395dc996942a9da58660396ae4e85d75649ab5d Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Wed, 22 Jan 2014 16:33:07 +0600 Subject: [PATCH 093/107] bumped to version 3.6.6 --- config.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.json b/config.json index d45459417f..f71ed9b572 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,6 @@ { "app_name": "ERPNext", - "app_version": "3.6.5", + "app_version": "3.6.6", "base_template": "app/portal/templates/base.html", "modules": { "Accounts": { @@ -74,5 +74,5 @@ "type": "module" } }, - "requires_framework_version": "==3.7.4" + "requires_framework_version": "==3.7.5" } \ No newline at end of file From 82a21beba04bde8ec5b1ee6402c2812b7cef2ecf Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Wed, 22 Jan 2014 16:55:32 +0530 Subject: [PATCH 094/107] Item List refresh when price list changed in POS --- accounts/doctype/sales_invoice/pos.js | 52 +++++++++++++++------------ 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/accounts/doctype/sales_invoice/pos.js b/accounts/doctype/sales_invoice/pos.js index b71b45e55b..21ccd01eaa 100644 --- a/accounts/doctype/sales_invoice/pos.js +++ b/accounts/doctype/sales_invoice/pos.js @@ -109,6 +109,7 @@ erpnext.POS = Class.extend({ this.party = party; this.price_list = (party == "Customer" ? this.frm.doc.selling_price_list : this.frm.doc.buying_price_list); + this.price_list_field = (party == "Customer" ? "selling_price_list" : "buying_price_list"); this.sales_or_purchase = (party == "Customer" ? "Sales" : "Purchase"); this.net_total = "net_total_" + export_or_import; this.grand_total = "grand_total_" + export_or_import; @@ -324,10 +325,12 @@ erpnext.POS = Class.extend({ } } }); - me.refresh(); + this.refresh(); }, refresh: function() { var me = this; + + this.refresh_item_list(); this.party_field.set_input(this.frm.doc[this.party.toLowerCase()]); this.barcode.set_input(""); @@ -350,6 +353,14 @@ erpnext.POS = Class.extend({ this.make_party(); } }, + refresh_item_list: function() { + var me = this; + // refresh item list on change of price list + if (this.frm.doc[this.price_list_field] != this.price_list) { + this.price_list = this.frm.doc[this.price_list_field]; + this.make_item_list(); + } + }, show_items_in_item_cart: function() { var me = this; var $items = this.wrapper.find("#cart tbody").empty(); @@ -383,9 +394,8 @@ erpnext.POS = Class.extend({ )).appendTo($items); }); - this.wrapper.find(".increase-qty, .decrease-qty").on("click", function() { - var item_code = $(this).closest("tr").attr("id"); - me.selected_item_qty_operation(item_code, $(this).attr("class")); + this.wrapper.find("input.qty").on("focus", function() { + $(this).select(); }); }, show_taxes: function() { @@ -422,10 +432,16 @@ erpnext.POS = Class.extend({ // append quantity to the respective item after change from input box $(this.wrapper).find("input.qty").on("change", function() { - var item_code = $(this).closest("tr")[0].id; + var item_code = $(this).closest("tr").attr("id"); me.update_qty(item_code, $(this).val()); }); + // increase/decrease qty on plus/minus button + $(this.wrapper).find(".increase-qty, .decrease-qty").on("click", function() { + var tr = $(this).closest("tr"); + me.increase_decrease_qty(tr, $(this).attr("class")); + }); + // on td click toggle the highlighting of row $(this.wrapper).find("#cart tbody tr td").on("click", function() { var row = $(this).closest("tr"); @@ -443,6 +459,15 @@ erpnext.POS = Class.extend({ me.refresh_delete_btn(); this.barcode.$input.focus(); }, + increase_decrease_qty: function(tr, operation) { + var item_code = tr.attr("id"); + var item_qty = cint(tr.find("input.qty").val()); + + if (operation == "increase-qty") + this.update_qty(item_code, item_qty + 1); + else if (operation == "decrease-qty" && item_qty != 1) + this.update_qty(item_code, item_qty - 1); + }, disable_text_box_and_button: function() { var me = this; // if form is submitted & cancelled then disable all input box & buttons @@ -518,23 +543,6 @@ erpnext.POS = Class.extend({ this.frm.script_manager.trigger("calculate_taxes_and_totals"); this.refresh(); }, - selected_item_qty_operation: function(item_code, operation) { - var me = this; - var child = wn.model.get_children(this.frm.doctype + " Item", this.frm.doc.name, - this.frm.cscript.fname, this.frm.doctype); - - $.each(child, function(i, d) { - if (d.item_code == item_code) { - if (operation == "increase-qty") - d.qty += 1; - else if (operation == "decrease-qty") - d.qty != 1 ? d.qty -= 1 : d.qty = 1; - - me.frm.script_manager.trigger("qty", d.doctype, d.name); - me.refresh(); - } - }); - }, make_payment: function() { var me = this; var no_of_items = $(this.wrapper).find("#cart tbody tr").length; From 8589b1db2208ea0472480b41614a23066835d178 Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Wed, 22 Jan 2014 19:25:51 +0530 Subject: [PATCH 095/107] Use model set_value for updating values from POS --- accounts/doctype/sales_invoice/pos.js | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/accounts/doctype/sales_invoice/pos.js b/accounts/doctype/sales_invoice/pos.js index 21ccd01eaa..a594f7f941 100644 --- a/accounts/doctype/sales_invoice/pos.js +++ b/accounts/doctype/sales_invoice/pos.js @@ -270,22 +270,17 @@ erpnext.POS = Class.extend({ this.frm.cscript.fname, this.frm.doctype), function(i, d) { if (d.item_code == item_code) { caught = true; - if (serial_no) { - d.serial_no += '\n' + serial_no; - me.frm.script_manager.trigger("serial_no", d.doctype, d.name); - } - else { - d.qty += 1; - me.frm.script_manager.trigger("qty", d.doctype, d.name); - } + if (serial_no) + wn.model.set_value(d.doctype, d.name, "serial_no", d.serial_no + '\n' + serial_no); + else + wn.model.set_value(d.doctype, d.name, "qty", d.qty + 1); } }); } // if item not found then add new item - if (!caught) { + if (!caught) this.add_new_item_to_grid(item_code, serial_no); - } this.refresh(); this.refresh_search_box(); @@ -320,8 +315,7 @@ erpnext.POS = Class.extend({ wn.model.clear_doc(d.doctype, d.name); me.refresh_grid(); } else { - d.qty = qty; - me.frm.script_manager.trigger("qty", d.doctype, d.name); + wn.model.set_value(d.doctype, d.name, "qty", qty); } } }); @@ -539,6 +533,7 @@ erpnext.POS = Class.extend({ this.refresh_grid(); }, refresh_grid: function() { + this.frm.dirty(); this.frm.fields_dict[this.frm.cscript.fname].grid.refresh(); this.frm.script_manager.trigger("calculate_taxes_and_totals"); this.refresh(); From 557abdebe09af858b21d2473af51bf113b0876cd Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 23 Jan 2014 13:25:26 +0530 Subject: [PATCH 096/107] order preview through customer login --- portal/templates/sale.html | 4 ++-- portal/utils.py | 12 +++++++----- selling/doctype/sales_order/templates/pages/order.py | 11 ++++++----- selling/utils/cart.py | 5 +++-- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/portal/templates/sale.html b/portal/templates/sale.html index 5dc72c793b..c0996cc4f1 100644 --- a/portal/templates/sale.html +++ b/portal/templates/sale.html @@ -10,9 +10,9 @@
  • {{ doc.name }}
  • {{ doc.name }}

    - {% if doc.name == "Not Allowed" -%} + {% if session_user == "Guest" -%} - {% else %} + {% elif doc.name != "Not Allowed"%}
    diff --git a/portal/utils.py b/portal/utils.py index 89800f3e1d..e210f1a020 100644 --- a/portal/utils.py +++ b/portal/utils.py @@ -41,21 +41,23 @@ def get_currency_context(): } def get_transaction_context(doctype, name): + context = {"session_user": webnotes.session.user} + customer = webnotes.conn.get_value("Contact", {"email_id": webnotes.session.user}, "customer") bean = webnotes.bean(doctype, name) if bean.doc.customer != customer: - return { - "doc": {"name": "Not Allowed"} - } + context.update({"doc": {"name": "Not Allowed"}}) else: - return { + context.update({ "doc": bean.doc, "doclist": bean.doclist, "webnotes": webnotes, "utils": webnotes.utils - } + }) + + return context @webnotes.whitelist(allow_guest=True) def send_message(subject="Website Query", message="", sender="", status="Open"): diff --git a/selling/doctype/sales_order/templates/pages/order.py b/selling/doctype/sales_order/templates/pages/order.py index d53a8b0f6f..9b4a83ce21 100644 --- a/selling/doctype/sales_order/templates/pages/order.py +++ b/selling/doctype/sales_order/templates/pages/order.py @@ -10,11 +10,12 @@ no_cache = True def get_context(): from portal.utils import get_transaction_context context = get_transaction_context("Sales Order", webnotes.form_dict.name) - modify_status(context.get("doc")) - context.update({ - "parent_link": "orders", - "parent_title": "My Orders" - }) + if context.get("doc").get("name") != "Not Allowed": + modify_status(context.get("doc")) + context.update({ + "parent_link": "orders", + "parent_title": "My Orders" + }) return context def modify_status(doc): diff --git a/selling/utils/cart.py b/selling/utils/cart.py index 3cd7b3c9f1..79046270a9 100644 --- a/selling/utils/cart.py +++ b/selling/utils/cart.py @@ -282,7 +282,7 @@ def apply_cart_settings(party=None, quotation=None): party = get_lead_or_customer() if not quotation: quotation = _get_cart_quotation(party) - + cart_settings = webnotes.get_obj("Shopping Cart Settings") billing_territory = get_address_territory(quotation.doc.customer_address) or \ @@ -310,7 +310,8 @@ def set_price_list_and_rate(quotation, cart_settings, billing_territory): quotation.run_method("set_price_list_and_item_details") # set it in cookies for using in product page - webnotes.local._response.set_cookie("selling_price_list", quotation.doc.selling_price_list) + if quotation.doc.selling_price_list: + webnotes.local._response.set_cookie("selling_price_list", quotation.doc.selling_price_list) def set_taxes(quotation, cart_settings, billing_territory): """set taxes based on billing territory""" From 5ae6a61c4d1fcae9a129c36ae70528c938b543de Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 23 Jan 2014 15:33:30 +0530 Subject: [PATCH 097/107] Fixes related to appifing shopping cart --- .../accounts/doctype/account/test_account.py | 2 +- .../sales_invoice/test_sales_invoice.py | 2 +- erpnext/controllers/accounts_controller.py | 4 +-- .../setup/doctype/item_group/item_group.py | 27 +------------------ .../doctype/sales_partner/sales_partner.py | 8 +----- erpnext/stock/doctype/item/item.py | 20 +------------- 6 files changed, 7 insertions(+), 56 deletions(-) diff --git a/erpnext/accounts/doctype/account/test_account.py b/erpnext/accounts/doctype/account/test_account.py index 2d15b62604..3221901e24 100644 --- a/erpnext/accounts/doctype/account/test_account.py +++ b/erpnext/accounts/doctype/account/test_account.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals import webnotes -def make_test_records(verbose): +def _make_test_records(verbose): from webnotes.test_runner import make_test_objects accounts = [ diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index 02350c5abc..3092477e4f 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -668,7 +668,7 @@ class TestSalesInvoice(unittest.TestCase): def test_recurring_invoice(self): from webnotes.utils import get_first_day, get_last_day, add_to_date, nowdate, getdate - from accounts.utils import get_fiscal_year + from erpnext.accounts.utils import get_fiscal_year today = nowdate() base_si = webnotes.bean(copy=test_records[0]) base_si.doc.fields.update({ diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index ccfff8ad51..2615907474 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -48,7 +48,7 @@ class AccountsController(TransactionBase): {"master_type": fieldname.title(), "master_name": self.doc.fields[fieldname], "company": self.doc.company}, "name") if accounts: - from accounts.doctype.gl_entry.gl_entry import validate_frozen_account + from erpnext.accounts.doctype.gl_entry.gl_entry import validate_frozen_account for account in accounts: validate_frozen_account(account[0]) @@ -413,7 +413,7 @@ class AccountsController(TransactionBase): }) def validate_multiple_billing(self, ref_dt, item_ref_dn, based_on, parentfield): - from controllers.status_updater import get_tolerance_for + from erpnext.controllers.status_updater import get_tolerance_for item_tolerance = {} global_tolerance = None diff --git a/erpnext/setup/doctype/item_group/item_group.py b/erpnext/setup/doctype/item_group/item_group.py index 02fe374c13..7e79c95038 100644 --- a/erpnext/setup/doctype/item_group/item_group.py +++ b/erpnext/setup/doctype/item_group/item_group.py @@ -5,10 +5,8 @@ from __future__ import unicode_literals import webnotes from webnotes.utils.nestedset import DocTypeNestedSet -from webnotes.webutils import WebsiteGenerator -from webnotes.webutils import delete_page_cache -class DocType(DocTypeNestedSet, WebsiteGenerator): +class DocType(DocTypeNestedSet): def __init__(self, doc, doclist=[]): self.doc = doc self.doclist = doclist @@ -16,35 +14,12 @@ class DocType(DocTypeNestedSet, WebsiteGenerator): def on_update(self): DocTypeNestedSet.on_update(self) - WebsiteGenerator.on_update(self) self.validate_name_with_item() - invalidate_cache_for(self.doc.name) - self.validate_one_root() def validate_name_with_item(self): if webnotes.conn.exists("Item", self.doc.name): webnotes.msgprint("An item exists with same name (%s), please change the \ item group name or rename the item" % self.doc.name, raise_exception=1) - -def get_group_item_count(item_group): - child_groups = ", ".join(['"' + i[0] + '"' for i in get_child_groups(item_group)]) - return webnotes.conn.sql("""select count(*) from `tabItem` - where docstatus = 0 and show_in_website = 1 - and (item_group in (%s) - or name in (select parent from `tabWebsite Item Group` - where item_group in (%s))) """ % (child_groups, child_groups))[0][0] - -def get_parent_item_groups(item_group_name): - item_group = webnotes.doc("Item Group", item_group_name) - return webnotes.conn.sql("""select name, page_name from `tabItem Group` - where lft <= %s and rgt >= %s - and ifnull(show_in_website,0)=1 - order by lft asc""", (item_group.lft, item_group.rgt), as_dict=True) - -def invalidate_cache_for(item_group): - for i in get_parent_item_groups(item_group): - if i.page_name: - delete_page_cache(i.page_name) diff --git a/erpnext/setup/doctype/sales_partner/sales_partner.py b/erpnext/setup/doctype/sales_partner/sales_partner.py index c2309e8a55..cf9a863a86 100644 --- a/erpnext/setup/doctype/sales_partner/sales_partner.py +++ b/erpnext/setup/doctype/sales_partner/sales_partner.py @@ -4,9 +4,8 @@ from __future__ import unicode_literals import webnotes from webnotes.utils import cint, cstr, filter_strip_join -from webnotes.webutils import WebsiteGenerator, clear_cache -class DocType(WebsiteGenerator): +class DocType(): def __init__(self, doc, doclist=None): self.doc = doc self.doclist = doclist @@ -15,11 +14,6 @@ class DocType(WebsiteGenerator): if self.doc.partner_website and not self.doc.partner_website.startswith("http"): self.doc.partner_website = "http://" + self.doc.partner_website - def on_update(self): - WebsiteGenerator.on_update(self) - if self.doc.page_name: - clear_cache("partners") - def get_contacts(self,nm): if nm: contact_details =webnotes.conn.convert_to_lists(webnotes.conn.sql("select name, CONCAT(IFNULL(first_name,''),' ',IFNULL(last_name,'')),contact_no,email_id from `tabContact` where sales_partner = '%s'"%nm)) diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index fb6f73d335..16938b4027 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -8,13 +8,12 @@ from webnotes.utils import cstr, flt from webnotes.model.doc import addchild from webnotes.model.bean import getlist from webnotes import msgprint, _ -from webnotes.webutils import WebsiteGenerator from webnotes.model.controller import DocListController class WarehouseNotSet(Exception): pass -class DocType(DocListController, WebsiteGenerator): +class DocType(DocListController): def onload(self): self.doc.fields["__sle_exists"] = self.check_if_sle_exists() @@ -48,7 +47,6 @@ class DocType(DocListController, WebsiteGenerator): def on_update(self): self.validate_name_with_item_group() - self.update_website() self.update_item_price() def check_warehouse_is_set_for_stock_item(self): @@ -197,14 +195,6 @@ class DocType(DocListController, WebsiteGenerator): please change the item name or rename the item group" % self.doc.name, raise_exception=1) - def update_website(self): - from erpnext.setup.doctype.item_group.item_group import invalidate_cache_for - invalidate_cache_for(self.doc.item_group) - [invalidate_cache_for(d.item_group) for d in \ - self.doclist.get({"doctype":"Website Item Group"})] - - WebsiteGenerator.on_update(self) - def update_item_price(self): webnotes.conn.sql("""update `tabItem Price` set item_name=%s, item_description=%s, modified=NOW() where item_code=%s""", @@ -232,7 +222,6 @@ class DocType(DocListController, WebsiteGenerator): def on_trash(self): webnotes.conn.sql("""delete from tabBin where item_code=%s""", self.doc.item_code) - WebsiteGenerator.on_trash(self) def before_rename(self, olddn, newdn, merge=False): if merge: @@ -250,18 +239,11 @@ class DocType(DocListController, WebsiteGenerator): def after_rename(self, olddn, newdn, merge): webnotes.conn.set_value("Item", newdn, "item_code", newdn) - self.update_website_page_name() if merge: self.set_last_purchase_rate(newdn) self.recalculate_bin_qty(newdn) - def update_website_page_name(self): - if self.doc.page_name: - self.update_website() - from webnotes.webutils import clear_cache - clear_cache(self.doc.page_name) - def set_last_purchase_rate(self, newdn): from erpnext.buying.utils import get_last_purchase_details last_purchase_rate = get_last_purchase_details(newdn).get("purchase_rate", 0) From 4ba95d0b7a998374e26b647a0257170541852bcd Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 23 Jan 2014 16:45:22 +0530 Subject: [PATCH 098/107] Fix in testcases --- .../buying/doctype/purchase_order/test_purchase_order.py | 2 +- erpnext/controllers/accounts_controller.py | 3 ++- erpnext/stock/doctype/item/test_item.py | 8 ++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py index e151970b06..2aede0843c 100644 --- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py @@ -74,7 +74,7 @@ class TestPurchaseOrder(unittest.TestCase): self.assertEquals(flt(webnotes.conn.get_value("Bin", {"item_code": "_Test Item", "warehouse": "_Test Warehouse - _TC"}, "ordered_qty")), 0.0) - def test_make_purchase_invocie(self): + def test_make_purchase_invoice(self): from erpnext.buying.doctype.purchase_order.purchase_order import make_purchase_invoice po = webnotes.bean(copy=test_records[0]).insert() diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 2615907474..937449c6a2 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -134,7 +134,8 @@ class AccountsController(TransactionBase): def calculate_taxes_and_totals(self): self.discount_amount_applied = False self._calculate_taxes_and_totals() - if self.meta.get_field(self.doc.doctype, "discount_amount"): + + if self.meta.get_field("discount_amount"): self.apply_discount_amount() def _calculate_taxes_and_totals(self): diff --git a/erpnext/stock/doctype/item/test_item.py b/erpnext/stock/doctype/item/test_item.py index 3cf1d5ecf6..00ce548567 100644 --- a/erpnext/stock/doctype/item/test_item.py +++ b/erpnext/stock/doctype/item/test_item.py @@ -36,6 +36,7 @@ test_records = [ "stock_uom": "_Test UOM", "default_income_account": "Sales - _TC", "default_warehouse": "_Test Warehouse - _TC", + "purchase_account": "_Test Account Cost for Goods Sold - _TC" }, { "doctype": "Item Reorder", "parentfield": "item_reorder", @@ -64,6 +65,7 @@ test_records = [ "stock_uom": "_Test UOM", "default_income_account": "Sales - _TC", "default_warehouse": "_Test Warehouse - _TC", + "purchase_account": "_Test Account Cost for Goods Sold - _TC" }], [{ "doctype": "Item", @@ -73,6 +75,7 @@ test_records = [ "item_group": "_Test Item Group Desktops", "default_warehouse": "_Test Warehouse - _TC", "default_income_account": "Sales - _TC", + "purchase_account": "_Test Account Cost for Goods Sold - _TC", "is_stock_item": "Yes", "is_asset_item": "No", "has_batch_no": "No", @@ -99,6 +102,7 @@ test_records = [ "item_group": "_Test Item Group Desktops", "default_warehouse": "_Test Warehouse - _TC", "default_income_account": "Sales - _TC", + "purchase_account": "_Test Account Cost for Goods Sold - _TC", "is_stock_item": "Yes", "is_asset_item": "No", "has_batch_no": "No", @@ -119,6 +123,7 @@ test_records = [ "description": "_Test Sales BOM Item", "item_group": "_Test Item Group Desktops", "default_income_account": "Sales - _TC", + "purchase_account": "_Test Account Cost for Goods Sold - _TC", "is_stock_item": "No", "is_asset_item": "No", "has_batch_no": "No", @@ -140,6 +145,7 @@ test_records = [ "is_stock_item": "Yes", "default_warehouse": "_Test Warehouse - _TC", "default_income_account": "Sales - _TC", + "purchase_account": "_Test Account Cost for Goods Sold - _TC", "is_asset_item": "No", "has_batch_no": "No", "has_serial_no": "No", @@ -216,6 +222,7 @@ test_records = [ "item_group": "_Test Item Group Desktops", "default_warehouse": "_Test Warehouse - _TC", "default_income_account": "Sales - _TC", + "purchase_account": "_Test Account Cost for Goods Sold - _TC", "is_stock_item": "Yes", "is_asset_item": "No", "has_batch_no": "No", @@ -238,6 +245,7 @@ test_records = [ "is_stock_item": "Yes", "default_warehouse": "_Test Warehouse - _TC", "default_income_account": "Sales - _TC", + "purchase_account": "_Test Account Cost for Goods Sold - _TC", "is_asset_item": "No", "has_batch_no": "No", "has_serial_no": "No", From 93eab5521cbf7347e464cab7f3352efcea9a9f71 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 23 Jan 2014 17:58:03 +0530 Subject: [PATCH 099/107] Minor fix in path --- erpnext/accounts/doctype/sales_invoice/sales_invoice.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index 1a1fa9f66b..2362f3f202 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -241,8 +241,8 @@ cur_frm.cscript.hide_fields = function(doc) { cur_frm.cscript.mode_of_payment = function(doc) { return cur_frm.call({ - method: "get_bank_cash_account", - args: { mode_of_payment: doc.mode_of_payment } + method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.get_bank_cash_account", + args: { mode_of_payment: doc.mode_of_payment }, }); } @@ -255,9 +255,6 @@ cur_frm.cscript.is_opening = function(doc, dt, dn) { if (doc.is_opening == 'Yes') unhide_field('aging_date'); } -//Make Delivery Note Button -//----------------------------- - cur_frm.cscript['Make Delivery Note'] = function() { wn.model.open_mapped_doc({ method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.make_delivery_note", From 1cd96a136f203ea9b7de4d9eac4ed7df0527d62a Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 24 Jan 2014 11:10:01 +0530 Subject: [PATCH 100/107] updates for restriction --- erpnext/hr/doctype/appraisal/appraisal.txt | 4 ++-- erpnext/hr/doctype/expense_claim/expense_claim.txt | 4 ++-- erpnext/hr/doctype/leave_allocation/leave_allocation.txt | 4 ++-- erpnext/patches/4_0/update_user_properties.py | 6 +++++- erpnext/projects/doctype/time_log/time_log.txt | 4 ++-- erpnext/selling/page/sales_browser/sales_browser.py | 8 ++++---- erpnext/utilities/doctype/note/note.txt | 5 +++-- 7 files changed, 20 insertions(+), 15 deletions(-) diff --git a/erpnext/hr/doctype/appraisal/appraisal.txt b/erpnext/hr/doctype/appraisal/appraisal.txt index c82f8481bb..da57097b52 100644 --- a/erpnext/hr/doctype/appraisal/appraisal.txt +++ b/erpnext/hr/doctype/appraisal/appraisal.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:12", "docstatus": 0, - "modified": "2014-01-20 17:48:22", + "modified": "2014-01-22 16:05:34", "modified_by": "Administrator", "owner": "ashwini@webnotestech.com" }, @@ -233,7 +233,7 @@ "cancel": 0, "delete": 0, "doctype": "DocPerm", - "match": "owner", + "restricted": 1, "role": "Employee", "submit": 0 }, diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.txt b/erpnext/hr/doctype/expense_claim/expense_claim.txt index 98e1782697..ac7f78861d 100644 --- a/erpnext/hr/doctype/expense_claim/expense_claim.txt +++ b/erpnext/hr/doctype/expense_claim/expense_claim.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:14", "docstatus": 0, - "modified": "2014-01-20 17:48:44", + "modified": "2014-01-22 16:05:34", "modified_by": "Administrator", "owner": "harshada@webnotestech.com" }, @@ -223,7 +223,7 @@ { "delete": 0, "doctype": "DocPerm", - "match": "owner", + "restricted": 1, "role": "Employee" }, { diff --git a/erpnext/hr/doctype/leave_allocation/leave_allocation.txt b/erpnext/hr/doctype/leave_allocation/leave_allocation.txt index 41584c97be..60f2523941 100644 --- a/erpnext/hr/doctype/leave_allocation/leave_allocation.txt +++ b/erpnext/hr/doctype/leave_allocation/leave_allocation.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-20 19:10:38", "docstatus": 0, - "modified": "2014-01-20 17:48:54", + "modified": "2014-01-22 16:05:35", "modified_by": "Administrator", "owner": "Administrator" }, @@ -171,7 +171,7 @@ }, { "doctype": "DocPerm", - "match": "owner", + "restricted": 1, "role": "HR User" }, { diff --git a/erpnext/patches/4_0/update_user_properties.py b/erpnext/patches/4_0/update_user_properties.py index 085f2c1883..54aed648a8 100644 --- a/erpnext/patches/4_0/update_user_properties.py +++ b/erpnext/patches/4_0/update_user_properties.py @@ -45,7 +45,11 @@ def update_user_match(): for profile in webnotes.conn.sql_list("""select name from `tabProfile` where enabled=1 and user_type='System User'"""): - perms = webnotes.permissions.get_user_perms(meta, "read", profile) + user_roles = webnotes.get_roles(profile) + + perms = meta.get({"doctype": "DocPerm", "permlevel": 0, + "role": ["in", [["All"] + user_roles]], "read": 1}) + # user does not have required roles if not perms: continue diff --git a/erpnext/projects/doctype/time_log/time_log.txt b/erpnext/projects/doctype/time_log/time_log.txt index 556597a4a7..11fa7d6e6e 100644 --- a/erpnext/projects/doctype/time_log/time_log.txt +++ b/erpnext/projects/doctype/time_log/time_log.txt @@ -2,7 +2,7 @@ { "creation": "2013-04-03 16:38:41", "docstatus": 0, - "modified": "2014-01-20 17:49:34", + "modified": "2014-01-22 16:05:35", "modified_by": "Administrator", "owner": "Administrator" }, @@ -205,7 +205,7 @@ { "create": 1, "doctype": "DocPerm", - "match": "owner", + "restricted": 1, "role": "Projects User" }, { diff --git a/erpnext/selling/page/sales_browser/sales_browser.py b/erpnext/selling/page/sales_browser/sales_browser.py index 6791ecf751..bb1a094e76 100644 --- a/erpnext/selling/page/sales_browser/sales_browser.py +++ b/erpnext/selling/page/sales_browser/sales_browser.py @@ -7,17 +7,17 @@ import webnotes @webnotes.whitelist() def get_children(): - ctype = webnotes.form_dict.get('ctype') - webnotes.form_dict['parent_field'] = 'parent_' + ctype.lower().replace(' ', '_') + ctype = webnotes.local.form_dict.get('ctype') + webnotes.local.form_dict['parent_field'] = 'parent_' + ctype.lower().replace(' ', '_') if not webnotes.form_dict.get('parent'): - webnotes.form_dict['parent'] = '' + webnotes.local.form_dict['parent'] = '' return webnotes.conn.sql("""select name as value, if(is_group='Yes', 1, 0) as expandable from `tab%(ctype)s` where docstatus < 2 and ifnull(%(parent_field)s,'') = "%(parent)s" - order by name""" % webnotes.form_dict, as_dict=1) + order by name""" % webnotes.local.form_dict, as_dict=1) @webnotes.whitelist() def add_node(): diff --git a/erpnext/utilities/doctype/note/note.txt b/erpnext/utilities/doctype/note/note.txt index b7c4f8bab8..94e5a0fbb3 100644 --- a/erpnext/utilities/doctype/note/note.txt +++ b/erpnext/utilities/doctype/note/note.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 13:41:00", "docstatus": 0, - "modified": "2014-01-20 17:48:58", + "modified": "2014-01-22 16:05:35", "modified_by": "Administrator", "owner": "Administrator" }, @@ -25,7 +25,7 @@ "permlevel": 0 }, { - "cancel": 1, + "cancel": 0, "create": 1, "delete": 1, "doctype": "DocPerm", @@ -37,6 +37,7 @@ "permlevel": 0, "print": 1, "read": 1, + "restricted": 1, "role": "All", "write": 1 }, From 44edfb72312c380ad5ba868b03ea2d8ffb8e949a Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Fri, 24 Jan 2014 11:10:46 +0530 Subject: [PATCH 101/107] method name fixing --- erpnext/controllers/accounts_controller.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index ccfff8ad51..2615907474 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -48,7 +48,7 @@ class AccountsController(TransactionBase): {"master_type": fieldname.title(), "master_name": self.doc.fields[fieldname], "company": self.doc.company}, "name") if accounts: - from accounts.doctype.gl_entry.gl_entry import validate_frozen_account + from erpnext.accounts.doctype.gl_entry.gl_entry import validate_frozen_account for account in accounts: validate_frozen_account(account[0]) @@ -413,7 +413,7 @@ class AccountsController(TransactionBase): }) def validate_multiple_billing(self, ref_dt, item_ref_dn, based_on, parentfield): - from controllers.status_updater import get_tolerance_for + from erpnext.controllers.status_updater import get_tolerance_for item_tolerance = {} global_tolerance = None From e288e5238af724916fbc34e2a5353b4817a210b2 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 24 Jan 2014 15:33:42 +0530 Subject: [PATCH 102/107] added title_fields for Task, Newsletter --- erpnext/projects/doctype/task/task.txt | 6 ++++-- erpnext/support/doctype/newsletter/newsletter.txt | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/erpnext/projects/doctype/task/task.txt b/erpnext/projects/doctype/task/task.txt index 670eaa18c2..2dce94f921 100644 --- a/erpnext/projects/doctype/task/task.txt +++ b/erpnext/projects/doctype/task/task.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-29 19:25:50", "docstatus": 0, - "modified": "2014-01-20 17:49:32", + "modified": "2014-01-24 13:01:46", "modified_by": "Administrator", "owner": "Administrator" }, @@ -15,7 +15,9 @@ "icon": "icon-check", "max_attachments": 5, "module": "Projects", - "name": "__common__" + "name": "__common__", + "search_fields": "subject", + "title_field": "subject" }, { "doctype": "DocField", diff --git a/erpnext/support/doctype/newsletter/newsletter.txt b/erpnext/support/doctype/newsletter/newsletter.txt index 9482ed712e..0618394f28 100644 --- a/erpnext/support/doctype/newsletter/newsletter.txt +++ b/erpnext/support/doctype/newsletter/newsletter.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:31", "docstatus": 0, - "modified": "2013-12-20 19:24:14", + "modified": "2014-01-24 13:00:11", "modified_by": "Administrator", "owner": "Administrator" }, @@ -13,7 +13,8 @@ "document_type": "Other", "icon": "icon-envelope", "module": "Support", - "name": "__common__" + "name": "__common__", + "title_field": "subject" }, { "doctype": "DocField", @@ -26,6 +27,7 @@ { "cancel": 0, "create": 0, + "delete": 0, "doctype": "DocPerm", "email": 1, "name": "__common__", From d9ba544e09e6ed87216d7a0a3e585d1a31ec2cb0 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 24 Jan 2014 15:59:05 +0530 Subject: [PATCH 103/107] Fix in Item Test Case --- stock/doctype/item/test_item.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/stock/doctype/item/test_item.py b/stock/doctype/item/test_item.py index b8f6f9e246..47541749db 100644 --- a/stock/doctype/item/test_item.py +++ b/stock/doctype/item/test_item.py @@ -36,6 +36,7 @@ test_records = [ "stock_uom": "_Test UOM", "default_income_account": "Sales - _TC", "default_warehouse": "_Test Warehouse - _TC", + "purchase_account": "_Test Account Cost for Goods Sold - _TC" }, { "doctype": "Item Reorder", "parentfield": "item_reorder", @@ -64,6 +65,7 @@ test_records = [ "stock_uom": "_Test UOM", "default_income_account": "Sales - _TC", "default_warehouse": "_Test Warehouse - _TC", + "purchase_account": "_Test Account Cost for Goods Sold - _TC" }], [{ "doctype": "Item", @@ -73,6 +75,7 @@ test_records = [ "item_group": "_Test Item Group Desktops", "default_warehouse": "_Test Warehouse - _TC", "default_income_account": "Sales - _TC", + "purchase_account": "_Test Account Cost for Goods Sold - _TC", "is_stock_item": "Yes", "is_asset_item": "No", "has_batch_no": "No", @@ -99,6 +102,7 @@ test_records = [ "item_group": "_Test Item Group Desktops", "default_warehouse": "_Test Warehouse - _TC", "default_income_account": "Sales - _TC", + "purchase_account": "_Test Account Cost for Goods Sold - _TC", "is_stock_item": "Yes", "is_asset_item": "No", "has_batch_no": "No", @@ -119,6 +123,7 @@ test_records = [ "description": "_Test Sales BOM Item", "item_group": "_Test Item Group Desktops", "default_income_account": "Sales - _TC", + "purchase_account": "_Test Account Cost for Goods Sold - _TC", "is_stock_item": "No", "is_asset_item": "No", "has_batch_no": "No", @@ -140,6 +145,7 @@ test_records = [ "is_stock_item": "Yes", "default_warehouse": "_Test Warehouse - _TC", "default_income_account": "Sales - _TC", + "purchase_account": "_Test Account Cost for Goods Sold - _TC", "is_asset_item": "No", "has_batch_no": "No", "has_serial_no": "No", @@ -216,6 +222,7 @@ test_records = [ "item_group": "_Test Item Group Desktops", "default_warehouse": "_Test Warehouse - _TC", "default_income_account": "Sales - _TC", + "purchase_account": "_Test Account Cost for Goods Sold - _TC", "is_stock_item": "Yes", "is_asset_item": "No", "has_batch_no": "No", @@ -238,6 +245,7 @@ test_records = [ "is_stock_item": "Yes", "default_warehouse": "_Test Warehouse - _TC", "default_income_account": "Sales - _TC", + "purchase_account": "_Test Account Cost for Goods Sold - _TC", "is_asset_item": "No", "has_batch_no": "No", "has_serial_no": "No", From fc13b87fd56c6b9fa8ac8b8e9fcbf88f62c8749b Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 24 Jan 2014 18:54:50 +0530 Subject: [PATCH 104/107] Fixes in Make Demo --- accounts/doctype/sales_invoice/sales_invoice.py | 7 ++----- .../requested_items_to_be_ordered.txt | 4 ++-- utilities/demo/demo_docs/Fiscal_Year.csv | 3 ++- utilities/demo/make_demo.py | 15 +++++++++++---- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/accounts/doctype/sales_invoice/sales_invoice.py b/accounts/doctype/sales_invoice/sales_invoice.py index a39702b3fc..1768b9b02f 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.py +++ b/accounts/doctype/sales_invoice/sales_invoice.py @@ -320,12 +320,9 @@ class DocType(SellingController): item = webnotes.conn.sql("select name,is_asset_item,is_sales_item from `tabItem` where name = '%s' and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now())"% d.item_code) acc = webnotes.conn.sql("select account_type from `tabAccount` where name = '%s' and docstatus != 2" % d.income_account) if not acc: - msgprint("Account: "+d.income_account+" does not exist in the system") - raise Exception + msgprint("Account: "+d.income_account+" does not exist in the system", raise_exception=True) elif item and item[0][1] == 'Yes' and not acc[0][0] == 'Fixed Asset Account': - msgprint("Please select income head with account type 'Fixed Asset Account' as Item %s is an asset item" % d.item_code) - raise Exception - + msgprint("Please select income head with account type 'Fixed Asset Account' as Item %s is an asset item" % d.item_code, raise_exception=True) def validate_with_previous_doc(self): super(DocType, self).validate_with_previous_doc(self.tname, { diff --git a/buying/report/requested_items_to_be_ordered/requested_items_to_be_ordered.txt b/buying/report/requested_items_to_be_ordered/requested_items_to_be_ordered.txt index 49c747854a..4d3558ca68 100644 --- a/buying/report/requested_items_to_be_ordered/requested_items_to_be_ordered.txt +++ b/buying/report/requested_items_to_be_ordered/requested_items_to_be_ordered.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-13 16:10:02", "docstatus": 0, - "modified": "2013-05-13 16:21:07", + "modified": "2014-01-24 18:19:11", "modified_by": "Administrator", "owner": "Administrator" }, @@ -11,7 +11,7 @@ "doctype": "Report", "is_standard": "Yes", "name": "__common__", - "query": "select \n mr.name as \"Material Request:Link/Material Request:120\",\n\tmr.transaction_date as \"Date:Date:100\",\n\tmr_item.item_code as \"Item Code:Link/Item:120\",\n\tmr_item.qty as \"Qty:Float:100\",\n\tmr_item.ordered_qty as \"Ordered Qty:Float:100\", \n\t(mr_item.qty - ifnull(mr_item.ordered_qty, 0)) as \"Qty to Order:Float:100\",\n\tmr_item.item_name as \"Item Name::150\",\n\tmr_item.description as \"Description::200\"\nfrom\n\t`tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere\n\tmr_item.parent = mr.name\n\tand mr.material_request_type = \"Purchase\"\n\tand mr.docstatus = 1\n\tand mr.status != \"Stopped\"\n\tand ifnull(mr_item.ordered_qty, 0) < ifnull(mr_item.qty, 0)\norder by mr.transaction_date asc", + "query": "select \n mr.name as \"Material Request:Link/Material Request:120\",\n\tmr.transaction_date as \"Date:Date:100\",\n\tmr_item.item_code as \"Item Code:Link/Item:120\",\n\tsum(ifnull(mr_item.qty, 0)) as \"Qty:Float:100\",\n\tsum(ifnull(mr_item.ordered_qty, 0)) as \"Ordered Qty:Float:100\", \n\t(sum(mr_item.qty) - sum(ifnull(mr_item.ordered_qty, 0))) as \"Qty to Order:Float:100\",\n\tmr_item.item_name as \"Item Name::150\",\n\tmr_item.description as \"Description::200\"\nfrom\n\t`tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere\n\tmr_item.parent = mr.name\n\tand mr.material_request_type = \"Purchase\"\n\tand mr.docstatus = 1\n\tand mr.status != \"Stopped\"\ngroup by mr.name, mr_item.item_code\nhaving\n\tsum(ifnull(mr_item.ordered_qty, 0)) < sum(ifnull(mr_item.qty, 0))\norder by mr.transaction_date asc", "ref_doctype": "Purchase Order", "report_name": "Requested Items To Be Ordered", "report_type": "Query Report" diff --git a/utilities/demo/demo_docs/Fiscal_Year.csv b/utilities/demo/demo_docs/Fiscal_Year.csv index d56b1b9b94..1a06e872b8 100644 --- a/utilities/demo/demo_docs/Fiscal_Year.csv +++ b/utilities/demo/demo_docs/Fiscal_Year.csv @@ -20,4 +20,5 @@ Info:,,,,,"One of: No, Yes" Start entering data below this line,,,, ,,2009,01-01-2009,31-12-2009,No ,,2010,01-01-2010,31-12-2010,No -,,2011,01-01-2011,31-12-2011,No \ No newline at end of file +,,2011,01-01-2011,31-12-2011,No +,,2012,01-01-2012,31-12-2012,No \ No newline at end of file diff --git a/utilities/demo/make_demo.py b/utilities/demo/make_demo.py index b98fd7ac9c..99c3e8b7e8 100644 --- a/utilities/demo/make_demo.py +++ b/utilities/demo/make_demo.py @@ -19,7 +19,7 @@ company_abbr = "WP" country = "United States" currency = "USD" time_zone = "America/New_York" -start_date = '2013-01-01' +start_date = '2014-01-01' bank_name = "Citibank" runs_for = None prob = { @@ -105,6 +105,10 @@ def run_accounts(current_date): for so in list(set([r[0] for r in query_report.run(report)["result"] if r[0]!="Total"]))[:how_many("Sales Invoice")]: si = webnotes.bean(make_sales_invoice(so)) si.doc.posting_date = current_date + for d in si.doclist.get({"parentfield": "entries"}): + if not d.income_account: + d.income_account = "Sales - {}".format(company_abbr) + si.insert() si.submit() webnotes.conn.commit() @@ -170,6 +174,9 @@ def run_stock(current_date): dn = webnotes.bean(make_delivery_note(so)) dn.doc.posting_date = current_date dn.doc.fiscal_year = current_date.year + for d in dn.doclist.get({"parentfield": "delivery_note_details"}): + d.expense_account = "Cost of Goods Sold - {}".format(company_abbr) + dn.insert() try: dn.submit() @@ -236,7 +243,7 @@ def run_manufacturing(current_date): ppt = webnotes.bean("Production Planning Tool", "Production Planning Tool") ppt.doc.company = company ppt.doc.use_multi_level_bom = 1 - ppt.doc.purchase_request_for_warehouse = "Stores - WP" + ppt.doc.purchase_request_for_warehouse = "Stores - {}".format(company_abbr) ppt.run_method("get_open_sales_orders") ppt.run_method("get_items_from_so") ppt.run_method("raise_production_order") @@ -380,8 +387,8 @@ def complete_setup(): setup_account({ "first_name": "Test", "last_name": "User", - "fy_start_date": "2013-01-01", - "fy_end_date": "2013-12-31", + "fy_start_date": "2014-01-01", + "fy_end_date": "2014-12-31", "industry": "Manufacturing", "company_name": company, "company_abbr": company_abbr, From a4e0a1c061f79ea5ea6501d53930eb7d4bf3cdb2 Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Fri, 24 Jan 2014 19:57:52 +0530 Subject: [PATCH 105/107] minor changes --- .../selling/doctype/sms_center/sms_center.py | 87 +++++++++---------- .../stock/doctype/item_price/item_price.py | 4 +- .../doctype/sms_control/sms_control.py | 8 +- 3 files changed, 48 insertions(+), 51 deletions(-) diff --git a/erpnext/selling/doctype/sms_center/sms_center.py b/erpnext/selling/doctype/sms_center/sms_center.py index 8671210de5..6eaab482a4 100644 --- a/erpnext/selling/doctype/sms_center/sms_center.py +++ b/erpnext/selling/doctype/sms_center/sms_center.py @@ -10,52 +10,49 @@ from webnotes.model.bean import copy_doclist from webnotes.model.code import get_obj from webnotes import msgprint - -# ---------- - class DocType: - def __init__(self, doc, doclist=[]): - self.doc = doc - self.doclist = doclist - - def create_receiver_list(self): - rec, where_clause = '', '' - if self.doc.send_to == 'All Customer Contact': - where_clause = self.doc.customer and " and customer = '%s'" % self.doc.customer or " and ifnull(customer, '') != ''" - if self.doc.send_to == 'All Supplier Contact': - where_clause = self.doc.supplier and " and ifnull(is_supplier, 0) = 1 and supplier = '%s'" % self.doc.supplier or " and ifnull(supplier, '') != ''" - if self.doc.send_to == 'All Sales Partner Contact': - where_clause = self.doc.sales_partner and " and ifnull(is_sales_partner, 0) = 1 and sales_partner = '%s'" % self.doc.sales_partner or " and ifnull(sales_partner, '') != ''" + def __init__(self, doc, doclist=[]): + self.doc = doc + self.doclist = doclist - if self.doc.send_to in ['All Contact', 'All Customer Contact', 'All Supplier Contact', 'All Sales Partner Contact']: - rec = webnotes.conn.sql("select CONCAT(ifnull(first_name,''),'',ifnull(last_name,'')), mobile_no from `tabContact` where ifnull(mobile_no,'')!='' and docstatus != 2 %s" % where_clause) - elif self.doc.send_to == 'All Lead (Open)': - rec = webnotes.conn.sql("select lead_name, mobile_no from tabLead where ifnull(mobile_no,'')!='' and docstatus != 2 and status = 'Open'") - elif self.doc.send_to == 'All Employee (Active)': - where_clause = self.doc.department and " and department = '%s'" % self.doc.department or "" - where_clause += self.doc.branch and " and branch = '%s'" % self.doc.branch or "" - rec = webnotes.conn.sql("select employee_name, cell_number from `tabEmployee` where status = 'Active' and docstatus < 2 and ifnull(cell_number,'')!='' %s" % where_clause) - elif self.doc.send_to == 'All Sales Person': - rec = webnotes.conn.sql("select sales_person_name, mobile_no from `tabSales Person` where docstatus != 2 and ifnull(mobile_no,'')!=''") - rec_list = '' - for d in rec: - rec_list += d[0] + ' - ' + d[1] + '\n' - self.doc.receiver_list = rec_list + def create_receiver_list(self): + rec, where_clause = '', '' + if self.doc.send_to == 'All Customer Contact': + where_clause = self.doc.customer and " and customer = '%s'" % self.doc.customer or " and ifnull(customer, '') != ''" + if self.doc.send_to == 'All Supplier Contact': + where_clause = self.doc.supplier and " and ifnull(is_supplier, 0) = 1 and supplier = '%s'" % self.doc.supplier or " and ifnull(supplier, '') != ''" + if self.doc.send_to == 'All Sales Partner Contact': + where_clause = self.doc.sales_partner and " and ifnull(is_sales_partner, 0) = 1 and sales_partner = '%s'" % self.doc.sales_partner or " and ifnull(sales_partner, '') != ''" - def get_receiver_nos(self): - receiver_nos = [] - for d in self.doc.receiver_list.split('\n'): - receiver_no = d - if '-' in d: - receiver_no = receiver_no.split('-')[1] - if receiver_no.strip(): - receiver_nos.append(cstr(receiver_no).strip()) - return receiver_nos + if self.doc.send_to in ['All Contact', 'All Customer Contact', 'All Supplier Contact', 'All Sales Partner Contact']: + rec = webnotes.conn.sql("select CONCAT(ifnull(first_name,''),'',ifnull(last_name,'')), mobile_no from `tabContact` where ifnull(mobile_no,'')!='' and docstatus != 2 %s" % where_clause) + elif self.doc.send_to == 'All Lead (Open)': + rec = webnotes.conn.sql("select lead_name, mobile_no from tabLead where ifnull(mobile_no,'')!='' and docstatus != 2 and status = 'Open'") + elif self.doc.send_to == 'All Employee (Active)': + where_clause = self.doc.department and " and department = '%s'" % self.doc.department or "" + where_clause += self.doc.branch and " and branch = '%s'" % self.doc.branch or "" + rec = webnotes.conn.sql("select employee_name, cell_number from `tabEmployee` where status = 'Active' and docstatus < 2 and ifnull(cell_number,'')!='' %s" % where_clause) + elif self.doc.send_to == 'All Sales Person': + rec = webnotes.conn.sql("select sales_person_name, mobile_no from `tabSales Person` where docstatus != 2 and ifnull(mobile_no,'')!=''") + rec_list = '' + for d in rec: + rec_list += d[0] + ' - ' + d[1] + '\n' + self.doc.receiver_list = rec_list - def send_sms(self): - if not self.doc.message: - msgprint("Please enter message before sending") - else: - receiver_list = self.get_receiver_nos() - if receiver_list: - msgprint(get_obj('SMS Control', 'SMS Control').send_sms(receiver_list, cstr(self.doc.message))) + def get_receiver_nos(self): + receiver_nos = [] + for d in self.doc.receiver_list.split('\n'): + receiver_no = d + if '-' in d: + receiver_no = receiver_no.split('-')[1] + if receiver_no.strip(): + receiver_nos.append(cstr(receiver_no).strip()) + return receiver_nos + + def send_sms(self): + if not self.doc.message: + msgprint("Please enter message before sending") + else: + receiver_list = self.get_receiver_nos() + if receiver_list: + msgprint(get_obj('SMS Control', 'SMS Control').send_sms(receiver_list, cstr(self.doc.message))) \ No newline at end of file diff --git a/erpnext/stock/doctype/item_price/item_price.py b/erpnext/stock/doctype/item_price/item_price.py index e2c9f2fcb0..088641153c 100644 --- a/erpnext/stock/doctype/item_price/item_price.py +++ b/erpnext/stock/doctype/item_price/item_price.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals import webnotes -from webnotes import _ +from webnotes import throw, _ class ItemPriceDuplicateItem(webnotes.ValidationError): pass @@ -28,7 +28,7 @@ class DocType: if webnotes.conn.sql("""select name from `tabItem Price` where item_code=%s and price_list=%s and name!=%s""", (self.doc.item_code, self.doc.price_list, self.doc.name)): - webnotes.throw("{duplicate_item}: {item_code}, {already}: {price_list}".format(**{ + throw("{duplicate_item}: {item_code}, {already}: {price_list}".format(**{ "duplicate_item": _("Duplicate Item"), "item_code": self.doc.item_code, "already": _("already available in Price List"), diff --git a/erpnext/utilities/doctype/sms_control/sms_control.py b/erpnext/utilities/doctype/sms_control/sms_control.py index 8fbb8fe7dc..41ff2a1515 100644 --- a/erpnext/utilities/doctype/sms_control/sms_control.py +++ b/erpnext/utilities/doctype/sms_control/sms_control.py @@ -7,7 +7,7 @@ import webnotes, json from webnotes.utils import nowdate, cstr from webnotes.model.code import get_obj from webnotes.model.doc import Document -from webnotes import msgprint +from webnotes import msgprint, throw, _ from webnotes.model.bean import getlist, copy_doclist class DocType: @@ -26,7 +26,7 @@ class DocType: validated_receiver_list.append(d) if not validated_receiver_list: - msgprint("Please enter valid mobile nos", raise_exception=1) + throw(_("Please enter valid mobile nos")) return validated_receiver_list @@ -37,12 +37,12 @@ class DocType: 'ERPNXT' if len(sender_name) > 6 and \ webnotes.conn.get_value("Control Panel", None, "country") == "India": - msgprint(""" + throw(_(""" As per TRAI rule, sender name must be exactly 6 characters. Kindly change sender name in Setup --> Global Defaults. Note: Hyphen, space, numeric digit, special characters are not allowed. - """, raise_exception=1) + """)) return sender_name def get_contact_number(self, arg): From 3f8f4ff6cdd56d764522d953a4d5fbaf2953a178 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 24 Jan 2014 21:47:01 +0530 Subject: [PATCH 106/107] BugFix: Production Planning Tool - get_raw_materials --- .../production_planning_tool.py | 4 ++-- .../stock/doctype/material_request/material_request.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py index 3b529cbe10..ac4b0fab3f 100644 --- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py +++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py @@ -243,10 +243,10 @@ class DocType: "item_code": [qty_required, description, stock_uom, min_order_qty] } """ - bom_wise_item_details = {} item_list = [] - + for bom, so_wise_qty in bom_dict.items(): + bom_wise_item_details = {} if self.doc.use_multi_level_bom: # get all raw materials with sub assembly childs for d in webnotes.conn.sql("""select fb.item_code, diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py index 28ec5084e0..d3262c5888 100644 --- a/erpnext/stock/doctype/material_request/material_request.py +++ b/erpnext/stock/doctype/material_request/material_request.py @@ -37,16 +37,16 @@ class DocType(BuyingController): for so_no in so_items.keys(): for item in so_items[so_no].keys(): - already_indented = webnotes.conn.sql("""select sum(qty) from `tabMaterial Request Item` + already_indented = webnotes.conn.sql("""select sum(ifnull(qty, 0)) + from `tabMaterial Request Item` where item_code = %s and sales_order_no = %s and docstatus = 1 and parent != %s""", (item, so_no, self.doc.name)) already_indented = already_indented and flt(already_indented[0][0]) or 0 - actual_so_qty = webnotes.conn.sql("""select sum(qty) from `tabSales Order Item` - where parent = %s and item_code = %s and docstatus = 1 - group by parent""", (so_no, item)) + actual_so_qty = webnotes.conn.sql("""select sum(ifnull(qty, 0)) from `tabSales Order Item` + where parent = %s and item_code = %s and docstatus = 1""", (so_no, item)) actual_so_qty = actual_so_qty and flt(actual_so_qty[0][0]) or 0 - + if actual_so_qty and (flt(so_items[so_no][item]) + already_indented > actual_so_qty): webnotes.throw("You can raise indent of maximum qty: %s for item: %s against sales order: %s\ \n Anyway, you can add more qty in new row for the same item." From db4304914c2ca1d26a1e792bf19d111f687ea26f Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Mon, 27 Jan 2014 17:27:39 +0530 Subject: [PATCH 107/107] POS Invoice print format showing inclusive taxes and discount amount --- erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt b/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt index 980195642f..09caf556c0 100644 --- a/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt +++ b/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt @@ -2,14 +2,14 @@ { "creation": "2011-12-21 11:08:55", "docstatus": 0, - "modified": "2013-12-26 18:13:48", + "modified": "2014-01-27 17:26:10", "modified_by": "Administrator", "owner": "Administrator" }, { "doc_type": "Sales Invoice", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n
    ItemQtyItemQtyRate
    %(item_code)s%(item_name)s\ +
    \ + \ +
    \ +
    \ +
    \ + \ +
    \ +
    %(amount)s
    %(rate)s
    \n \n \n \n \n \n \n \n
    RECEIPT NO: DATE:
    M/s
    \n\n
    \n\n\n", + "html": "\n\t\n\n\t\t\n\t\t\n\n\t\t\n\t\t\n\t\n\n\t\n\t\t\n\t\t
    \n\t\t
    \n\t\t
    \n\t\t
    \n\t\t
    \n\t\n", "module": "Accounts", "name": "__common__", "print_format_type": "Client",