From 72a178a37e5ca8ad9ede5c72128a9a0fb58d5289 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 18 Jun 2014 12:14:17 +0530 Subject: [PATCH 01/17] Fixed Currency Exchange error --- erpnext/setup/doctype/currency/currency.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/erpnext/setup/doctype/currency/currency.py b/erpnext/setup/doctype/currency/currency.py index 5be618b80e..abfbe1930c 100644 --- a/erpnext/setup/doctype/currency/currency.py +++ b/erpnext/setup/doctype/currency/currency.py @@ -17,8 +17,5 @@ def validate_conversion_rate(currency, conversion_rate, conversion_rate_label, c company_currency = frappe.db.get_value("Company", company, "default_currency") if not conversion_rate: - throw(_('%(conversion_rate_label)s is mandatory. Maybe Currency Exchange record is not created for %(from_currency)s to %(to_currency)s') % { - "conversion_rate_label": conversion_rate_label, - "from_currency": currency, - "to_currency": company_currency - }) + throw(_("{0} is mandatory. Maybe Currency Exchange record is not created for {1} to {2}.").format( + conversion_rate_label, currency, company_currency)) From 2f800521cb9db1aa3d96e240d1a0f22b7a529994 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 18 Jun 2014 12:48:46 +0530 Subject: [PATCH 02/17] Don't set default for warehouse when creating serial no --- erpnext/stock/doctype/serial_no/serial_no.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/serial_no/serial_no.py b/erpnext/stock/doctype/serial_no/serial_no.py index ff4d519cf9..fe4af21d78 100644 --- a/erpnext/stock/doctype/serial_no/serial_no.py +++ b/erpnext/stock/doctype/serial_no/serial_no.py @@ -278,13 +278,16 @@ def get_serial_nos(serial_no): def make_serial_no(serial_no, sle): sr = frappe.new_doc("Serial No") + sr.warehouse = None + sr.dont_update_if_missing.append("warehouse") sr.ignore_permissions = True + sr.serial_no = serial_no sr.item_code = sle.item_code - sr.warehouse = None sr.company = sle.company sr.via_stock_ledger = True sr.insert() + sr.warehouse = sle.warehouse sr.status = "Available" sr.save() From 297939325a49f51140971f99c5f240162b656f36 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 18 Jun 2014 13:10:10 +0530 Subject: [PATCH 03/17] Stock Entry: get fg item incoming rate if bom is mentioned --- .../stock/doctype/stock_entry/stock_entry.py | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 3df78c8def..1dc624f21e 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -217,8 +217,8 @@ class StockEntry(StockController): Available Qty: {4}, Transfer Qty: {5}""").format(d.idx, d.s_warehouse, self.posting_date, self.posting_time, d.actual_qty, d.transfer_qty)) - # get incoming rate if not d.bom_no: + # set incoming rate if not flt(d.incoming_rate) or d.s_warehouse or self.purpose == "Sales Return": incoming_rate = self.get_incoming_rate(args) if flt(incoming_rate) > 0: @@ -227,15 +227,16 @@ class StockEntry(StockController): d.amount = flt(d.transfer_qty) * flt(d.incoming_rate) raw_material_cost += flt(d.amount) - # set incoming rate for fg item - if self.production_order and self.purpose == "Manufacture/Repack": - for d in self.get("mtn_details"): - if d.bom_no: - if not flt(d.incoming_rate): - bom = frappe.db.get_value("BOM", d.bom_no, ["operating_cost", "quantity"], as_dict=1) - operation_cost_per_unit = flt(bom.operating_cost) / flt(bom.quantity) - d.incoming_rate = operation_cost_per_unit + (raw_material_cost / flt(d.transfer_qty)) - d.amount = flt(d.transfer_qty) * flt(d.incoming_rate) + # bom no exists and purpose is Manufacture/Repack + elif self.purpose == "Manufacture/Repack": + + # set incoming rate for fg item + if not flt(d.incoming_rate): + bom = frappe.db.get_value("BOM", d.bom_no, ["operating_cost", "quantity"], as_dict=1) + operation_cost_per_unit = flt(bom.operating_cost) / flt(bom.quantity) + d.incoming_rate = operation_cost_per_unit + (raw_material_cost / flt(d.transfer_qty)) + + d.amount = flt(d.transfer_qty) * flt(d.incoming_rate) def get_incoming_rate(self, args): incoming_rate = 0 From c5dbf0f8ad5a926cffa75206899b531379573e46 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 18 Jun 2014 13:35:37 +0530 Subject: [PATCH 04/17] Travis: Install frappe of targetted branch For example: If pull request is for wip-4.1 branch of erpnext, install frappe with branch as wip-4.1 --- .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 59acb5c0e4..dba0dab6ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,9 +14,13 @@ install: - sudo apt-get update - sudo apt-get purge -y mysql-common - sudo apt-get install mariadb-server mariadb-common libmariadbclient-dev - - CFLAGS=-O0 pip install git+https://github.com/frappe/frappe.git@develop && + - CFLAGS=-O0 pip install git+https://github.com/frappe/frappe.git@$TRAVIS_BRANCH && - pip install --editable . +before_script: + - mysql -e 'create database test_frappe' + - echo "USE mysql;\nCREATE USER 'test_frappe'@'localhost' IDENTIFIED BY 'test_frappe';\nFLUSH PRIVILEGES;\n" | mysql -u root + script: - cd ./test_sites/ - frappe --use test_site @@ -25,7 +29,3 @@ script: - frappe -b - frappe --serve_test & - frappe --verbose --run_tests --app erpnext - -before_script: - - mysql -e 'create database test_frappe' - - echo "USE mysql;\nCREATE USER 'test_frappe'@'localhost' IDENTIFIED BY 'test_frappe';\nFLUSH PRIVILEGES;\n" | mysql -u root From 987a28fc6aeb24eebe94f321d94aaf7cfc303cf5 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 18 Jun 2014 14:05:08 +0530 Subject: [PATCH 05/17] Revert "Stock Entry: get fg item incoming rate if bom is mentioned" This reverts commit 297939325a49f51140971f99c5f240162b656f36. --- .../stock/doctype/stock_entry/stock_entry.py | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 1dc624f21e..3df78c8def 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -217,8 +217,8 @@ class StockEntry(StockController): Available Qty: {4}, Transfer Qty: {5}""").format(d.idx, d.s_warehouse, self.posting_date, self.posting_time, d.actual_qty, d.transfer_qty)) + # get incoming rate if not d.bom_no: - # set incoming rate if not flt(d.incoming_rate) or d.s_warehouse or self.purpose == "Sales Return": incoming_rate = self.get_incoming_rate(args) if flt(incoming_rate) > 0: @@ -227,16 +227,15 @@ class StockEntry(StockController): d.amount = flt(d.transfer_qty) * flt(d.incoming_rate) raw_material_cost += flt(d.amount) - # bom no exists and purpose is Manufacture/Repack - elif self.purpose == "Manufacture/Repack": - - # set incoming rate for fg item - if not flt(d.incoming_rate): - bom = frappe.db.get_value("BOM", d.bom_no, ["operating_cost", "quantity"], as_dict=1) - operation_cost_per_unit = flt(bom.operating_cost) / flt(bom.quantity) - d.incoming_rate = operation_cost_per_unit + (raw_material_cost / flt(d.transfer_qty)) - - d.amount = flt(d.transfer_qty) * flt(d.incoming_rate) + # set incoming rate for fg item + if self.production_order and self.purpose == "Manufacture/Repack": + for d in self.get("mtn_details"): + if d.bom_no: + if not flt(d.incoming_rate): + bom = frappe.db.get_value("BOM", d.bom_no, ["operating_cost", "quantity"], as_dict=1) + operation_cost_per_unit = flt(bom.operating_cost) / flt(bom.quantity) + d.incoming_rate = operation_cost_per_unit + (raw_material_cost / flt(d.transfer_qty)) + d.amount = flt(d.transfer_qty) * flt(d.incoming_rate) def get_incoming_rate(self, args): incoming_rate = 0 From de12a0941fd36362d6cd5ae5bda82a9c6e1d71e4 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 18 Jun 2014 14:05:29 +0530 Subject: [PATCH 06/17] Stock Entry: get fg item incoming rate if bom is mentioned --- erpnext/stock/doctype/stock_entry/stock_entry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 3df78c8def..38c7521e36 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -228,7 +228,7 @@ class StockEntry(StockController): raw_material_cost += flt(d.amount) # set incoming rate for fg item - if self.production_order and self.purpose == "Manufacture/Repack": + if self.purpose == "Manufacture/Repack": for d in self.get("mtn_details"): if d.bom_no: if not flt(d.incoming_rate): From d768afb80b6544db64625b95034ba10eda8add96 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 18 Jun 2014 15:23:25 +0530 Subject: [PATCH 07/17] Fixed Sales Order -> Delivery Note mapping of address fields --- erpnext/selling/doctype/sales_order/sales_order.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index 1b66c65dac..24da5773a3 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -279,13 +279,9 @@ def make_delivery_note(source_name, target_doc=None): target.amount = (flt(source.qty) - flt(source.delivered_qty)) * flt(source.rate) target.qty = flt(source.qty) - flt(source.delivered_qty) - doclist = get_mapped_doc("Sales Order", source_name, { + target_doc = get_mapped_doc("Sales Order", source_name, { "Sales Order": { "doctype": "Delivery Note", - "field_map": { - "shipping_address": "address_display", - "shipping_address_name": "customer_address", - }, "validation": { "docstatus": ["=", 1] } @@ -310,7 +306,7 @@ def make_delivery_note(source_name, target_doc=None): } }, target_doc, set_missing_values) - return doclist + return target_doc @frappe.whitelist() def make_sales_invoice(source_name, target_doc=None): From 31c977b906bce8508a306f0fac53bbe55368b03e Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 18 Jun 2014 16:26:45 +0530 Subject: [PATCH 08/17] Fixed Employee Leave Balance Report --- .../report/employee_leave_balance/employee_leave_balance.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py index c1d8bcfba4..99b235e91a 100644 --- a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py +++ b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py @@ -24,17 +24,19 @@ def execute(filters=None): else: fiscal_years = frappe.db.sql_list("select name from `tabFiscal Year` order by name desc") + employee_names = [d.name for d in employees] + allocations = frappe.db.sql("""select employee, fiscal_year, leave_type, total_leaves_allocated from `tabLeave Allocation` where docstatus=1 and employee in (%s)""" % - ','.join(['%s']*len(employees)), employees, as_dict=True) + ','.join(['%s']*len(employee_names)), employee_names, as_dict=True) applications = frappe.db.sql("""select employee, fiscal_year, leave_type, SUM(total_leave_days) as leaves from `tabLeave Application` where status="Approved" and docstatus = 1 and employee in (%s) group by employee, fiscal_year, leave_type""" % - ','.join(['%s']*len(employees)), employees, as_dict=True) + ','.join(['%s']*len(employee_names)), employee_names, as_dict=True) columns = [ "Fiscal Year", "Employee:Link/Employee:150", "Employee Name::200", "Department::150" From ae0d753cade7b5c2c771b5529617600ea9fa0ef9 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 18 Jun 2014 14:42:22 +0530 Subject: [PATCH 09/17] Valuation rate and amount for fg item --- .../stock/doctype/stock_entry/stock_entry.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index a42a865cbb..510b395ae4 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -359,16 +359,17 @@ cur_frm.cscript.item_code = function(doc, cdt, cdn) { cur_frm.cscript.s_warehouse = function(doc, cdt, cdn) { var d = locals[cdt][cdn]; - args = { - 'item_code' : d.item_code, - 'warehouse' : cstr(d.s_warehouse) || cstr(d.t_warehouse), - 'transfer_qty' : d.transfer_qty, - 'serial_no' : d.serial_no, - 'bom_no' : d.bom_no, - 'qty' : d.s_warehouse ? -1* d.qty : d.qty + if(!d.bom_no) { + args = { + 'item_code' : d.item_code, + 'warehouse' : cstr(d.s_warehouse) || cstr(d.t_warehouse), + 'transfer_qty' : d.transfer_qty, + 'serial_no' : d.serial_no, + 'qty' : d.s_warehouse ? -1* d.qty : d.qty + } + return get_server_fields('get_warehouse_details', JSON.stringify(args), + 'mtn_details', doc, cdt, cdn, 1); } - return get_server_fields('get_warehouse_details', JSON.stringify(args), - 'mtn_details', doc, cdt, cdn, 1); } cur_frm.cscript.t_warehouse = cur_frm.cscript.s_warehouse; From a7da6e148018aeaf0e3e29055745040382fb087a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 18 Jun 2014 15:12:03 +0530 Subject: [PATCH 10/17] Incoming rate for sales return --- .../stock/doctype/stock_entry/stock_entry.py | 31 ++++++++----------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 38c7521e36..0321dcfeb7 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -239,29 +239,24 @@ class StockEntry(StockController): def get_incoming_rate(self, args): incoming_rate = 0 - if self.purpose == "Sales Return" and \ - (self.delivery_note_no or self.sales_invoice_no): - sle = frappe.db.sql("""select name, posting_date, posting_time, - actual_qty, stock_value, warehouse from `tabStock Ledger Entry` - where voucher_type = %s and voucher_no = %s and - item_code = %s limit 1""", - ((self.delivery_note_no and "Delivery Note" or "Sales Invoice"), - self.delivery_note_no or self.sales_invoice_no, args.item_code), as_dict=1) - if sle: - args.update({ - "posting_date": sle[0].posting_date, - "posting_time": sle[0].posting_time, - "sle": sle[0].name, - "warehouse": sle[0].warehouse, - }) - previous_sle = get_previous_sle(args) - incoming_rate = (flt(sle[0].stock_value) - flt(previous_sle.get("stock_value"))) / \ - flt(sle[0].actual_qty) + if self.purpose == "Sales Return": + incoming_rate = self.get_incoming_rate_for_sales_return(args) else: incoming_rate = get_incoming_rate(args) return incoming_rate + def get_incoming_rate_for_sales_return(self, args): + incoming_rate = 0.0 + if self.delivery_note_no or self.sales_invoice_no: + incoming_rate = frappe.db.sql("""select abs(ifnull(stock_value_difference, 0) / actual_qty) + from `tabStock Ledger Entry` + where voucher_type = %s and voucher_no = %s and item_code = %s limit 1""", + ((self.delivery_note_no and "Delivery Note" or "Sales Invoice"), + self.delivery_note_no or self.sales_invoice_no, args.item_code))[0][0] + + return incoming_rate + def validate_incoming_rate(self): for d in self.get('mtn_details'): if d.t_warehouse: From e7c2f74a078980fc7be5fedb82279d74ca541714 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 18 Jun 2014 16:40:08 +0530 Subject: [PATCH 11/17] Stocvk entry incoming rate for sales return --- erpnext/stock/doctype/stock_entry/stock_entry.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 0321dcfeb7..297542b50f 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -248,12 +248,13 @@ class StockEntry(StockController): def get_incoming_rate_for_sales_return(self, args): incoming_rate = 0.0 - if self.delivery_note_no or self.sales_invoice_no: + if (self.delivery_note_no or self.sales_invoice_no) and args.get("item_code"): incoming_rate = frappe.db.sql("""select abs(ifnull(stock_value_difference, 0) / actual_qty) from `tabStock Ledger Entry` where voucher_type = %s and voucher_no = %s and item_code = %s limit 1""", ((self.delivery_note_no and "Delivery Note" or "Sales Invoice"), - self.delivery_note_no or self.sales_invoice_no, args.item_code))[0][0] + self.delivery_note_no or self.sales_invoice_no, args.item_code)) + incoming_rate = incoming_rate[0][0] if incoming_rate else 0.0 return incoming_rate From 4d7c4fc0f40d5ff745cf1a3f6fead56e9680f702 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 18 Jun 2014 16:40:27 +0530 Subject: [PATCH 12/17] Get party details fixes --- erpnext/accounts/party.py | 13 +++++++------ erpnext/public/js/utils/party.js | 1 + erpnext/stock/doctype/stock_entry/stock_entry.js | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index 9792da1b26..cd172f1902 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -12,13 +12,14 @@ from erpnext.utilities.doctype.contact.contact import get_contact_details @frappe.whitelist() def get_party_details(party=None, account=None, party_type="Customer", company=None, - posting_date=None, price_list=None, currency=None): + posting_date=None, price_list=None, currency=None, doctype=None): - return _get_party_details(party, account, party_type, company, posting_date, price_list, currency) + return _get_party_details(party, account, party_type, + company, posting_date, price_list, currency, doctype) def _get_party_details(party=None, account=None, party_type="Customer", company=None, - posting_date=None, price_list=None, currency=None, ignore_permissions=False): - out = frappe._dict(set_account_and_due_date(party, account, party_type, company, posting_date)) + posting_date=None, price_list=None, currency=None, doctype=None, ignore_permissions=False): + out = frappe._dict(set_account_and_due_date(party, account, party_type, company, posting_date, doctype)) party = out[party_type.lower()] @@ -106,8 +107,8 @@ def set_price_list(out, party, party_type, given_price_list): out["selling_price_list" if party.doctype=="Customer" else "buying_price_list"] = price_list -def set_account_and_due_date(party, account, party_type, company, posting_date): - if not posting_date: +def set_account_and_due_date(party, account, party_type, company, posting_date, doctype): + if doctype not in ["Sales Invoice", "Purchase Invoice"]: # not an invoice return { party_type.lower(): party diff --git a/erpnext/public/js/utils/party.js b/erpnext/public/js/utils/party.js index 40db97feb8..c9b1206cc1 100644 --- a/erpnext/public/js/utils/party.js +++ b/erpnext/public/js/utils/party.js @@ -25,6 +25,7 @@ erpnext.utils.get_party_details = function(frm, method, args, callback) { args.currency = frm.doc.currency; args.company = frm.doc.company; + args.doctype = frm.doc.doctype; frappe.call({ method: method, args: args, diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index 510b395ae4..959739225e 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -241,14 +241,14 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({ customer: function() { return this.frm.call({ method: "erpnext.accounts.party.get_party_details", - args: { party: this.frm.doc.customer, party_type:"Customer" } + args: { party: this.frm.doc.customer, party_type:"Customer", doctype: this.frm.doc.doctype } }); }, supplier: function() { return this.frm.call({ method: "erpnext.accounts.party.get_party_details", - args: { party: this.frm.doc.supplier, party_type:"Supplier" } + args: { party: this.frm.doc.supplier, party_type:"Supplier", doctype: this.frm.doc.doctype } }); }, From faf176d78c08dacce2aa30a2169c73309e450997 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 18 Jun 2014 19:51:38 +0530 Subject: [PATCH 13/17] Overwrite from POS Settings if value exists --- erpnext/stock/get_item_details.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index cdf5aa1f3d..c5c1280fdb 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -229,7 +229,7 @@ def get_pos_settings_item_details(company, args, pos_settings=None): if pos_settings: for fieldname in ("income_account", "cost_center", "warehouse", "expense_account"): - if not args.get(fieldname): + if not args.get(fieldname) and pos_settings.get(fieldname): res[fieldname] = pos_settings.get(fieldname) if res.get("warehouse"): From fd05f458e1dc4f125328b9352c3c4f615a267965 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 18 Jun 2014 20:55:18 +0530 Subject: [PATCH 14/17] Minor fix in Journal Voucher --- .../accounts/doctype/journal_voucher/journal_voucher.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/journal_voucher/journal_voucher.py b/erpnext/accounts/doctype/journal_voucher/journal_voucher.py index d75101d0e1..fc1916b5bc 100644 --- a/erpnext/accounts/doctype/journal_voucher/journal_voucher.py +++ b/erpnext/accounts/doctype/journal_voucher/journal_voucher.py @@ -186,9 +186,14 @@ class JournalVoucher(AccountsController): def set_print_format_fields(self): for d in self.get('entries'): - account_type, master_type = frappe.db.get_value("Account", d.account, + result = frappe.db.get_value("Account", d.account, ["account_type", "master_type"]) + if not result: + continue + + account_type, master_type = result + if master_type in ['Supplier', 'Customer']: if not self.pay_to_recd_from: self.pay_to_recd_from = frappe.db.get_value(master_type, From aecddefbc8c037960cbbf6bd8543ff5bd1e5edc1 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 18 Jun 2014 20:55:39 +0530 Subject: [PATCH 15/17] Fixed number format in currency --- erpnext/setup/doctype/currency/currency.json | 182 +++++++++---------- 1 file changed, 91 insertions(+), 91 deletions(-) diff --git a/erpnext/setup/doctype/currency/currency.json b/erpnext/setup/doctype/currency/currency.json index 26fd14e5f9..ee7be19a53 100644 --- a/erpnext/setup/doctype/currency/currency.json +++ b/erpnext/setup/doctype/currency/currency.json @@ -1,117 +1,117 @@ { - "autoname": "field:currency_name", - "creation": "2013-01-28 10:06:02", - "description": "**Currency** Master", - "docstatus": 0, - "doctype": "DocType", + "autoname": "field:currency_name", + "creation": "2013-01-28 10:06:02", + "description": "**Currency** Master", + "docstatus": 0, + "doctype": "DocType", "fields": [ { - "fieldname": "currency_name", - "fieldtype": "Data", - "label": "Currency Name", - "oldfieldname": "currency_name", - "oldfieldtype": "Data", - "permlevel": 0, + "fieldname": "currency_name", + "fieldtype": "Data", + "label": "Currency Name", + "oldfieldname": "currency_name", + "oldfieldtype": "Data", + "permlevel": 0, "reqd": 1 - }, + }, { - "fieldname": "enabled", - "fieldtype": "Check", - "in_list_view": 1, - "label": "Enabled", + "fieldname": "enabled", + "fieldtype": "Check", + "in_list_view": 1, + "label": "Enabled", "permlevel": 0 - }, + }, { - "description": "Sub-currency. For e.g. \"Cent\"", - "fieldname": "fraction", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Fraction", + "description": "Sub-currency. For e.g. \"Cent\"", + "fieldname": "fraction", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Fraction", "permlevel": 0 - }, + }, { - "description": "1 Currency = [?] Fraction\nFor e.g. 1 USD = 100 Cent", - "fieldname": "fraction_units", - "fieldtype": "Int", - "in_list_view": 1, - "label": "Fraction Units", + "description": "1 Currency = [?] Fraction\nFor e.g. 1 USD = 100 Cent", + "fieldname": "fraction_units", + "fieldtype": "Int", + "in_list_view": 1, + "label": "Fraction Units", "permlevel": 0 - }, + }, { - "description": "A symbol for this currency. For e.g. $", - "fieldname": "symbol", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Symbol", + "description": "A symbol for this currency. For e.g. $", + "fieldname": "symbol", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Symbol", "permlevel": 0 - }, + }, { - "description": "How should this currency be formatted? If not set, will use system defaults", - "fieldname": "number_format", - "fieldtype": "Select", - "in_list_view": 1, - "label": "Number Format", - "options": "\n#,###.##\n#.###,##\n# ###.##\n#,###.###\n#,##,###.##\n#.###\n#,###", + "description": "How should this currency be formatted? If not set, will use system defaults", + "fieldname": "number_format", + "fieldtype": "Select", + "in_list_view": 1, + "label": "Number Format", + "options": "\n#,###.##\n#.###,##\n# ###.##\n# ###,##\n#'###.##\n#, ###.##\n#,##,###.##\n#,###.###\n#.###\n#,###", "permlevel": 0 } - ], - "icon": "icon-bitcoin", - "idx": 1, - "in_create": 0, - "modified": "2014-05-27 03:49:09.038451", - "modified_by": "Administrator", - "module": "Setup", - "name": "Currency", - "owner": "Administrator", + ], + "icon": "icon-bitcoin", + "idx": 1, + "in_create": 0, + "modified": "2014-06-18 03:49:09.038451", + "modified_by": "Administrator", + "module": "Setup", + "name": "Currency", + "owner": "Administrator", "permissions": [ { - "create": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Accounts Manager", - "submit": 0, + "create": 1, + "delete": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts Manager", + "submit": 0, "write": 1 - }, + }, { - "amend": 0, - "create": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Sales Master Manager", - "submit": 0, + "amend": 0, + "create": 1, + "delete": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Sales Master Manager", + "submit": 0, "write": 1 - }, + }, { - "amend": 0, - "create": 1, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Purchase Master Manager", - "submit": 0, + "amend": 0, + "create": 1, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Purchase Master Manager", + "submit": 0, "write": 1 - }, + }, { - "apply_user_permissions": 1, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, + "apply_user_permissions": 1, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, "role": "All" } - ], + ], "read_only": 0 -} \ No newline at end of file +} From da342c7855876d4246dae09b94395f644c9e6950 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 18 Jun 2014 21:09:19 +0530 Subject: [PATCH 16/17] Fixed feed type options --- erpnext/home/doctype/feed/feed.json | 101 ++++++++++++++-------------- 1 file changed, 51 insertions(+), 50 deletions(-) diff --git a/erpnext/home/doctype/feed/feed.json b/erpnext/home/doctype/feed/feed.json index a4018703c2..bef8aacfc0 100644 --- a/erpnext/home/doctype/feed/feed.json +++ b/erpnext/home/doctype/feed/feed.json @@ -1,72 +1,73 @@ { - "autoname": "hash", - "creation": "2012-07-03 13:29:42", - "docstatus": 0, - "doctype": "DocType", + "autoname": "hash", + "creation": "2012-07-03 13:29:42", + "docstatus": 0, + "doctype": "DocType", "fields": [ { - "fieldname": "feed_type", - "fieldtype": "Select", - "in_list_view": 1, - "label": "Feed Type", + "fieldname": "feed_type", + "fieldtype": "Select", + "in_list_view": 1, + "label": "Feed Type", + "options": "\nComment\nLogin", "permlevel": 0 - }, + }, { - "fieldname": "doc_type", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Doc Type", + "fieldname": "doc_type", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Doc Type", "permlevel": 0 - }, + }, { - "fieldname": "doc_name", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Doc Name", + "fieldname": "doc_name", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Doc Name", "permlevel": 0 - }, + }, { - "fieldname": "subject", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Subject", + "fieldname": "subject", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Subject", "permlevel": 0 - }, + }, { - "fieldname": "color", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Color", + "fieldname": "color", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Color", "permlevel": 0 - }, + }, { - "fieldname": "full_name", - "fieldtype": "Data", - "label": "Full Name", + "fieldname": "full_name", + "fieldtype": "Data", + "label": "Full Name", "permlevel": 0 } - ], - "icon": "icon-rss", - "idx": 1, - "modified": "2014-05-27 03:49:10.882587", - "modified_by": "Administrator", - "module": "Home", - "name": "Feed", - "owner": "Administrator", + ], + "icon": "icon-rss", + "idx": 1, + "modified": "2014-06-18 03:49:10.882587", + "modified_by": "Administrator", + "module": "Home", + "name": "Feed", + "owner": "Administrator", "permissions": [ { - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, "role": "System Manager" - }, + }, { - "apply_user_permissions": 1, - "permlevel": 0, - "read": 1, + "apply_user_permissions": 1, + "permlevel": 0, + "read": 1, "role": "All" } ] -} \ No newline at end of file +} From a5cfc59d811718814efd6641becb2765fcfc153f Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 19 Jun 2014 15:52:19 +0530 Subject: [PATCH 17/17] Validate Select field values --- erpnext/accounts/doctype/account/account.json | 4 +- .../accounts/doctype/gl_entry/gl_entry.json | 364 ++++++++-------- .../purchase_invoice/test_records.json | 328 +++++++------- .../production_order/production_order.json | 404 +++++++++--------- .../selling/doctype/lead/test_records.json | 2 +- .../support/doctype/newsletter/newsletter.py | 2 +- 6 files changed, 552 insertions(+), 552 deletions(-) diff --git a/erpnext/accounts/doctype/account/account.json b/erpnext/accounts/doctype/account/account.json index ab8830543d..4c24199cc8 100644 --- a/erpnext/accounts/doctype/account/account.json +++ b/erpnext/accounts/doctype/account/account.json @@ -91,7 +91,7 @@ "label": "Account Type", "oldfieldname": "account_type", "oldfieldtype": "Select", - "options": "\nBank\nCash\nTax\nChargeable\nWarehouse\nReceivable\nPayable\nEquity\nFixed Asset\nCost of Goods Sold\nExpense Account\nIncome Account\nStock Received But Not Billed\nExpenses Included In Valuation\nStock Adjustment", + "options": "\nBank\nCash\nTax\nChargeable\nWarehouse\nReceivable\nPayable\nEquity\nFixed Asset\nCost of Goods Sold\nExpense Account\nIncome Account\nStock Received But Not Billed\nExpenses Included In Valuation\nStock Adjustment\nStock", "permlevel": 0, "search_index": 0 }, @@ -210,7 +210,7 @@ "icon": "icon-money", "idx": 1, "in_create": 1, - "modified": "2014-06-03 18:27:58.109303", + "modified": "2014-06-19 18:27:58.109303", "modified_by": "Administrator", "module": "Accounts", "name": "Account", diff --git a/erpnext/accounts/doctype/gl_entry/gl_entry.json b/erpnext/accounts/doctype/gl_entry/gl_entry.json index 1856386237..ce17278d82 100644 --- a/erpnext/accounts/doctype/gl_entry/gl_entry.json +++ b/erpnext/accounts/doctype/gl_entry/gl_entry.json @@ -1,226 +1,226 @@ { - "autoname": "GL.#######", - "creation": "2013-01-10 16:34:06", - "docstatus": 0, - "doctype": "DocType", + "autoname": "GL.#######", + "creation": "2013-01-10 16:34:06", + "docstatus": 0, + "doctype": "DocType", "fields": [ { - "fieldname": "posting_date", - "fieldtype": "Date", - "in_filter": 1, - "in_list_view": 1, - "label": "Posting Date", - "oldfieldname": "posting_date", - "oldfieldtype": "Date", - "permlevel": 0, + "fieldname": "posting_date", + "fieldtype": "Date", + "in_filter": 1, + "in_list_view": 1, + "label": "Posting Date", + "oldfieldname": "posting_date", + "oldfieldtype": "Date", + "permlevel": 0, "search_index": 1 - }, + }, { - "fieldname": "transaction_date", - "fieldtype": "Date", - "in_list_view": 1, - "label": "Transaction Date", - "oldfieldname": "transaction_date", - "oldfieldtype": "Date", + "fieldname": "transaction_date", + "fieldtype": "Date", + "in_list_view": 1, + "label": "Transaction Date", + "oldfieldname": "transaction_date", + "oldfieldtype": "Date", "permlevel": 0 - }, + }, { - "fieldname": "aging_date", - "fieldtype": "Date", - "in_filter": 1, - "in_list_view": 1, - "label": "Aging Date", - "oldfieldname": "aging_date", - "oldfieldtype": "Date", - "permlevel": 0, + "fieldname": "aging_date", + "fieldtype": "Date", + "in_filter": 1, + "in_list_view": 1, + "label": "Aging Date", + "oldfieldname": "aging_date", + "oldfieldtype": "Date", + "permlevel": 0, "search_index": 0 - }, + }, { - "fieldname": "account", - "fieldtype": "Link", - "in_filter": 1, - "in_list_view": 1, - "label": "Account", - "oldfieldname": "account", - "oldfieldtype": "Link", - "options": "Account", - "permlevel": 0, + "fieldname": "account", + "fieldtype": "Link", + "in_filter": 1, + "in_list_view": 1, + "label": "Account", + "oldfieldname": "account", + "oldfieldtype": "Link", + "options": "Account", + "permlevel": 0, "search_index": 1 - }, + }, { - "fieldname": "cost_center", - "fieldtype": "Link", - "in_filter": 1, - "in_list_view": 1, - "label": "Cost Center", - "oldfieldname": "cost_center", - "oldfieldtype": "Link", - "options": "Cost Center", - "permlevel": 0, + "fieldname": "cost_center", + "fieldtype": "Link", + "in_filter": 1, + "in_list_view": 1, + "label": "Cost Center", + "oldfieldname": "cost_center", + "oldfieldtype": "Link", + "options": "Cost Center", + "permlevel": 0, "search_index": 0 - }, + }, { - "fieldname": "debit", - "fieldtype": "Currency", - "label": "Debit Amt", - "oldfieldname": "debit", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", + "fieldname": "debit", + "fieldtype": "Currency", + "label": "Debit Amt", + "oldfieldname": "debit", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", "permlevel": 0 - }, + }, { - "fieldname": "credit", - "fieldtype": "Currency", - "label": "Credit Amt", - "oldfieldname": "credit", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", + "fieldname": "credit", + "fieldtype": "Currency", + "label": "Credit Amt", + "oldfieldname": "credit", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", "permlevel": 0 - }, + }, { - "fieldname": "against", - "fieldtype": "Text", - "in_filter": 1, - "label": "Against", - "oldfieldname": "against", - "oldfieldtype": "Text", + "fieldname": "against", + "fieldtype": "Text", + "in_filter": 1, + "label": "Against", + "oldfieldname": "against", + "oldfieldtype": "Text", "permlevel": 0 - }, + }, { - "fieldname": "against_voucher", - "fieldtype": "Data", - "in_filter": 1, - "label": "Against Voucher", - "oldfieldname": "against_voucher", - "oldfieldtype": "Data", - "permlevel": 0, + "fieldname": "against_voucher", + "fieldtype": "Data", + "in_filter": 1, + "label": "Against Voucher", + "oldfieldname": "against_voucher", + "oldfieldtype": "Data", + "permlevel": 0, "search_index": 0 - }, + }, { - "fieldname": "against_voucher_type", - "fieldtype": "Data", - "in_filter": 0, - "label": "Against Voucher Type", - "oldfieldname": "against_voucher_type", - "oldfieldtype": "Data", - "permlevel": 0, + "fieldname": "against_voucher_type", + "fieldtype": "Data", + "in_filter": 0, + "label": "Against Voucher Type", + "oldfieldname": "against_voucher_type", + "oldfieldtype": "Data", + "permlevel": 0, "search_index": 0 - }, + }, { - "fieldname": "voucher_type", - "fieldtype": "Select", - "in_filter": 1, - "label": "Voucher Type", - "oldfieldname": "voucher_type", - "oldfieldtype": "Select", - "options": "Journal Voucher\nSales Invoice\nPurchase Invoice", - "permlevel": 0, + "fieldname": "voucher_type", + "fieldtype": "Select", + "in_filter": 1, + "label": "Voucher Type", + "oldfieldname": "voucher_type", + "oldfieldtype": "Select", + "options": "Journal Voucher\nSales Invoice\nPurchase Invoice\nPeriod Closing Voucher\nPurchase Receipt\nDelivery Note\nStock Entry\nStock Reconciliation", + "permlevel": 0, "search_index": 0 - }, + }, { - "fieldname": "voucher_no", - "fieldtype": "Data", - "in_filter": 1, - "label": "Voucher No", - "oldfieldname": "voucher_no", - "oldfieldtype": "Data", - "permlevel": 0, + "fieldname": "voucher_no", + "fieldtype": "Data", + "in_filter": 1, + "label": "Voucher No", + "oldfieldname": "voucher_no", + "oldfieldtype": "Data", + "permlevel": 0, "search_index": 1 - }, + }, { - "fieldname": "remarks", - "fieldtype": "Text", - "in_filter": 1, - "label": "Remarks", - "no_copy": 1, - "oldfieldname": "remarks", - "oldfieldtype": "Text", - "permlevel": 0, + "fieldname": "remarks", + "fieldtype": "Text", + "in_filter": 1, + "label": "Remarks", + "no_copy": 1, + "oldfieldname": "remarks", + "oldfieldtype": "Text", + "permlevel": 0, "search_index": 0 - }, + }, { - "fieldname": "is_opening", - "fieldtype": "Select", - "in_filter": 1, - "label": "Is Opening", - "oldfieldname": "is_opening", - "oldfieldtype": "Select", - "options": "No\nYes", - "permlevel": 0, + "fieldname": "is_opening", + "fieldtype": "Select", + "in_filter": 1, + "label": "Is Opening", + "oldfieldname": "is_opening", + "oldfieldtype": "Select", + "options": "No\nYes", + "permlevel": 0, "search_index": 0 - }, + }, { - "fieldname": "is_advance", - "fieldtype": "Select", - "in_filter": 0, - "label": "Is Advance", - "oldfieldname": "is_advance", - "oldfieldtype": "Select", - "options": "No\nYes", - "permlevel": 0, + "fieldname": "is_advance", + "fieldtype": "Select", + "in_filter": 0, + "label": "Is Advance", + "oldfieldname": "is_advance", + "oldfieldtype": "Select", + "options": "No\nYes", + "permlevel": 0, "search_index": 0 - }, + }, { - "fieldname": "fiscal_year", - "fieldtype": "Link", - "in_filter": 1, - "label": "Fiscal Year", - "oldfieldname": "fiscal_year", - "oldfieldtype": "Select", - "options": "Fiscal Year", - "permlevel": 0, + "fieldname": "fiscal_year", + "fieldtype": "Link", + "in_filter": 1, + "label": "Fiscal Year", + "oldfieldname": "fiscal_year", + "oldfieldtype": "Select", + "options": "Fiscal Year", + "permlevel": 0, "search_index": 0 - }, + }, { - "fieldname": "company", - "fieldtype": "Link", - "in_filter": 1, - "label": "Company", - "oldfieldname": "company", - "oldfieldtype": "Link", - "options": "Company", - "permlevel": 0, + "fieldname": "company", + "fieldtype": "Link", + "in_filter": 1, + "label": "Company", + "oldfieldname": "company", + "oldfieldtype": "Link", + "options": "Company", + "permlevel": 0, "search_index": 0 } - ], - "icon": "icon-list", - "idx": 1, - "in_create": 1, - "modified": "2014-06-09 01:51:29.340077", - "modified_by": "Administrator", - "module": "Accounts", - "name": "GL Entry", - "owner": "Administrator", + ], + "icon": "icon-list", + "idx": 1, + "in_create": 1, + "modified": "2014-06-19 01:51:29.340077", + "modified_by": "Administrator", + "module": "Accounts", + "name": "GL Entry", + "owner": "Administrator", "permissions": [ { - "amend": 0, - "apply_user_permissions": 1, - "create": 0, - "email": 1, - "export": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Accounts User", - "submit": 0, + "amend": 0, + "apply_user_permissions": 1, + "create": 0, + "email": 1, + "export": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts User", + "submit": 0, "write": 0 - }, + }, { - "amend": 0, - "create": 0, - "email": 1, - "export": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Accounts Manager", - "submit": 0, + "amend": 0, + "create": 0, + "email": 1, + "export": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts Manager", + "submit": 0, "write": 0 } - ], - "search_fields": "voucher_no,account,posting_date,against_voucher", - "sort_field": "modified", + ], + "search_fields": "voucher_no,account,posting_date,against_voucher", + "sort_field": "modified", "sort_order": "DESC" -} \ No newline at end of file +} diff --git a/erpnext/accounts/doctype/purchase_invoice/test_records.json b/erpnext/accounts/doctype/purchase_invoice/test_records.json index 67a705cc4a..48fb45d4d0 100644 --- a/erpnext/accounts/doctype/purchase_invoice/test_records.json +++ b/erpnext/accounts/doctype/purchase_invoice/test_records.json @@ -1,206 +1,206 @@ [ { - "bill_no": "NA", - "buying_price_list": "_Test Price List", - "company": "_Test Company", - "conversion_rate": 1, - "credit_to": "_Test Supplier - _TC", - "currency": "INR", - "doctype": "Purchase Invoice", + "bill_no": "NA", + "buying_price_list": "_Test Price List", + "company": "_Test Company", + "conversion_rate": 1, + "credit_to": "_Test Supplier - _TC", + "currency": "INR", + "doctype": "Purchase Invoice", "entries": [ { - "amount": 500, - "base_amount": 500, - "base_rate": 50, - "conversion_factor": 1.0, - "cost_center": "_Test Cost Center - _TC", - "doctype": "Purchase Invoice Item", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "item_code": "_Test Item Home Desktop 100", - "item_name": "_Test Item Home Desktop 100", - "item_tax_rate": "{\"_Test Account Excise Duty - _TC\": 10}", - "parentfield": "entries", - "qty": 10, - "rate": 50, + "amount": 500, + "base_amount": 500, + "base_rate": 50, + "conversion_factor": 1.0, + "cost_center": "_Test Cost Center - _TC", + "doctype": "Purchase Invoice Item", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "item_code": "_Test Item Home Desktop 100", + "item_name": "_Test Item Home Desktop 100", + "item_tax_rate": "{\"_Test Account Excise Duty - _TC\": 10}", + "parentfield": "entries", + "qty": 10, + "rate": 50, "uom": "_Test UOM" - }, + }, { - "amount": 750, - "base_amount": 750, - "base_rate": 150, - "conversion_factor": 1.0, - "cost_center": "_Test Cost Center - _TC", - "doctype": "Purchase Invoice Item", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "item_code": "_Test Item Home Desktop 200", - "item_name": "_Test Item Home Desktop 200", - "parentfield": "entries", - "qty": 5, - "rate": 150, + "amount": 750, + "base_amount": 750, + "base_rate": 150, + "conversion_factor": 1.0, + "cost_center": "_Test Cost Center - _TC", + "doctype": "Purchase Invoice Item", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "item_code": "_Test Item Home Desktop 200", + "item_name": "_Test Item Home Desktop 200", + "parentfield": "entries", + "qty": 5, + "rate": 150, "uom": "_Test UOM" } - ], - "fiscal_year": "_Test Fiscal Year 2013", - "grand_total_import": 0, - "naming_series": "BILL", + ], + "fiscal_year": "_Test Fiscal Year 2013", + "grand_total_import": 0, + "naming_series": "_T-BILL", "other_charges": [ { - "account_head": "_Test Account Shipping Charges - _TC", - "add_deduct_tax": "Add", - "category": "Valuation and Total", - "charge_type": "Actual", - "cost_center": "_Test Cost Center - _TC", - "description": "Shipping Charges", - "doctype": "Purchase Taxes and Charges", - "parentfield": "other_charges", + "account_head": "_Test Account Shipping Charges - _TC", + "add_deduct_tax": "Add", + "category": "Valuation and Total", + "charge_type": "Actual", + "cost_center": "_Test Cost Center - _TC", + "description": "Shipping Charges", + "doctype": "Purchase Taxes and Charges", + "parentfield": "other_charges", "rate": 100 - }, + }, { - "account_head": "_Test Account Customs Duty - _TC", - "add_deduct_tax": "Add", - "category": "Valuation", - "charge_type": "On Net Total", - "cost_center": "_Test Cost Center - _TC", - "description": "Customs Duty", - "doctype": "Purchase Taxes and Charges", - "parentfield": "other_charges", + "account_head": "_Test Account Customs Duty - _TC", + "add_deduct_tax": "Add", + "category": "Valuation", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Customs Duty", + "doctype": "Purchase Taxes and Charges", + "parentfield": "other_charges", "rate": 10 - }, + }, { - "account_head": "_Test Account Excise Duty - _TC", - "add_deduct_tax": "Add", - "category": "Total", - "charge_type": "On Net Total", - "cost_center": "_Test Cost Center - _TC", - "description": "Excise Duty", - "doctype": "Purchase Taxes and Charges", - "parentfield": "other_charges", + "account_head": "_Test Account Excise Duty - _TC", + "add_deduct_tax": "Add", + "category": "Total", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Excise Duty", + "doctype": "Purchase Taxes and Charges", + "parentfield": "other_charges", "rate": 12 - }, + }, { - "account_head": "_Test Account Education Cess - _TC", - "add_deduct_tax": "Add", - "category": "Total", - "charge_type": "On Previous Row Amount", - "cost_center": "_Test Cost Center - _TC", - "description": "Education Cess", - "doctype": "Purchase Taxes and Charges", - "parentfield": "other_charges", - "rate": 2, + "account_head": "_Test Account Education Cess - _TC", + "add_deduct_tax": "Add", + "category": "Total", + "charge_type": "On Previous Row Amount", + "cost_center": "_Test Cost Center - _TC", + "description": "Education Cess", + "doctype": "Purchase Taxes and Charges", + "parentfield": "other_charges", + "rate": 2, "row_id": 3 - }, + }, { - "account_head": "_Test Account S&H Education Cess - _TC", - "add_deduct_tax": "Add", - "category": "Total", - "charge_type": "On Previous Row Amount", - "cost_center": "_Test Cost Center - _TC", - "description": "S&H Education Cess", - "doctype": "Purchase Taxes and Charges", - "parentfield": "other_charges", - "rate": 1, + "account_head": "_Test Account S&H Education Cess - _TC", + "add_deduct_tax": "Add", + "category": "Total", + "charge_type": "On Previous Row Amount", + "cost_center": "_Test Cost Center - _TC", + "description": "S&H Education Cess", + "doctype": "Purchase Taxes and Charges", + "parentfield": "other_charges", + "rate": 1, "row_id": 3 - }, + }, { - "account_head": "_Test Account CST - _TC", - "add_deduct_tax": "Add", - "category": "Total", - "charge_type": "On Previous Row Total", - "cost_center": "_Test Cost Center - _TC", - "description": "CST", - "doctype": "Purchase Taxes and Charges", - "parentfield": "other_charges", - "rate": 2, + "account_head": "_Test Account CST - _TC", + "add_deduct_tax": "Add", + "category": "Total", + "charge_type": "On Previous Row Total", + "cost_center": "_Test Cost Center - _TC", + "description": "CST", + "doctype": "Purchase Taxes and Charges", + "parentfield": "other_charges", + "rate": 2, "row_id": 5 - }, + }, { - "account_head": "_Test Account VAT - _TC", - "add_deduct_tax": "Add", - "category": "Total", - "charge_type": "On Net Total", - "cost_center": "_Test Cost Center - _TC", - "description": "VAT", - "doctype": "Purchase Taxes and Charges", - "parentfield": "other_charges", + "account_head": "_Test Account VAT - _TC", + "add_deduct_tax": "Add", + "category": "Total", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "VAT", + "doctype": "Purchase Taxes and Charges", + "parentfield": "other_charges", "rate": 12.5 - }, + }, { - "account_head": "_Test Account Discount - _TC", - "add_deduct_tax": "Deduct", - "category": "Total", - "charge_type": "On Previous Row Total", - "cost_center": "_Test Cost Center - _TC", - "description": "Discount", - "doctype": "Purchase Taxes and Charges", - "parentfield": "other_charges", - "rate": 10, + "account_head": "_Test Account Discount - _TC", + "add_deduct_tax": "Deduct", + "category": "Total", + "charge_type": "On Previous Row Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Discount", + "doctype": "Purchase Taxes and Charges", + "parentfield": "other_charges", + "rate": 10, "row_id": 7 } - ], - "posting_date": "2013-02-03", + ], + "posting_date": "2013-02-03", "supplier_name": "_Test Supplier" - }, + }, { - "bill_no": "NA", - "buying_price_list": "_Test Price List", - "company": "_Test Company", - "conversion_rate": 1.0, - "credit_to": "_Test Supplier - _TC", - "currency": "INR", - "doctype": "Purchase Invoice", + "bill_no": "NA", + "buying_price_list": "_Test Price List", + "company": "_Test Company", + "conversion_rate": 1.0, + "credit_to": "_Test Supplier - _TC", + "currency": "INR", + "doctype": "Purchase Invoice", "entries": [ { - "conversion_factor": 1.0, - "cost_center": "_Test Cost Center - _TC", - "doctype": "Purchase Invoice Item", - "expense_account": "_Test Account Cost for Goods Sold - _TC", - "item_code": "_Test Item", - "item_name": "_Test Item", - "parentfield": "entries", - "qty": 10.0, - "rate": 50.0, + "conversion_factor": 1.0, + "cost_center": "_Test Cost Center - _TC", + "doctype": "Purchase Invoice Item", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "item_code": "_Test Item", + "item_name": "_Test Item", + "parentfield": "entries", + "qty": 10.0, + "rate": 50.0, "uom": "_Test UOM" } - ], - "fiscal_year": "_Test Fiscal Year 2013", - "grand_total_import": 0, - "naming_series": "_T-Purchase Invoice-", + ], + "fiscal_year": "_Test Fiscal Year 2013", + "grand_total_import": 0, + "naming_series": "_T-Purchase Invoice-", "other_charges": [ { - "account_head": "_Test Account Shipping Charges - _TC", - "add_deduct_tax": "Add", - "category": "Valuation and Total", - "charge_type": "Actual", - "cost_center": "_Test Cost Center - _TC", - "description": "Shipping Charges", - "doctype": "Purchase Taxes and Charges", - "parentfield": "other_charges", + "account_head": "_Test Account Shipping Charges - _TC", + "add_deduct_tax": "Add", + "category": "Valuation and Total", + "charge_type": "Actual", + "cost_center": "_Test Cost Center - _TC", + "description": "Shipping Charges", + "doctype": "Purchase Taxes and Charges", + "parentfield": "other_charges", "rate": 100.0 - }, + }, { - "account_head": "_Test Account VAT - _TC", - "add_deduct_tax": "Add", - "category": "Total", - "charge_type": "Actual", - "cost_center": "_Test Cost Center - _TC", - "description": "VAT", - "doctype": "Purchase Taxes and Charges", - "parentfield": "other_charges", + "account_head": "_Test Account VAT - _TC", + "add_deduct_tax": "Add", + "category": "Total", + "charge_type": "Actual", + "cost_center": "_Test Cost Center - _TC", + "description": "VAT", + "doctype": "Purchase Taxes and Charges", + "parentfield": "other_charges", "rate": 120.0 - }, + }, { - "account_head": "_Test Account Customs Duty - _TC", - "add_deduct_tax": "Add", - "category": "Valuation", - "charge_type": "Actual", - "cost_center": "_Test Cost Center - _TC", - "description": "Customs Duty", - "doctype": "Purchase Taxes and Charges", - "parentfield": "other_charges", + "account_head": "_Test Account Customs Duty - _TC", + "add_deduct_tax": "Add", + "category": "Valuation", + "charge_type": "Actual", + "cost_center": "_Test Cost Center - _TC", + "description": "Customs Duty", + "doctype": "Purchase Taxes and Charges", + "parentfield": "other_charges", "rate": 150.0 } - ], - "posting_date": "2013-02-03", + ], + "posting_date": "2013-02-03", "supplier_name": "_Test Supplier" } -] \ No newline at end of file +] diff --git a/erpnext/manufacturing/doctype/production_order/production_order.json b/erpnext/manufacturing/doctype/production_order/production_order.json index b1b19e41c9..7e068cff74 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.json +++ b/erpnext/manufacturing/doctype/production_order/production_order.json @@ -1,256 +1,256 @@ { - "allow_import": 1, - "autoname": "naming_series:", - "creation": "2013-01-10 16:34:16", - "docstatus": 0, - "doctype": "DocType", + "allow_import": 1, + "autoname": "naming_series:", + "creation": "2013-01-10 16:34:16", + "docstatus": 0, + "doctype": "DocType", "fields": [ { - "fieldname": "item", - "fieldtype": "Section Break", - "label": "Item", - "options": "icon-gift", + "fieldname": "item", + "fieldtype": "Section Break", + "label": "Item", + "options": "icon-gift", "permlevel": 0 - }, + }, { - "default": "PRO", - "fieldname": "naming_series", - "fieldtype": "Select", - "label": "Series", - "options": "PRO-", - "permlevel": 0, + "default": "PRO-", + "fieldname": "naming_series", + "fieldtype": "Select", + "label": "Series", + "options": "PRO-", + "permlevel": 0, "reqd": 1 - }, + }, { - "depends_on": "eval:!doc.__islocal", - "fieldname": "status", - "fieldtype": "Select", - "in_filter": 1, - "in_list_view": 1, - "label": "Status", - "no_copy": 1, - "oldfieldname": "status", - "oldfieldtype": "Select", - "options": "\nDraft\nSubmitted\nStopped\nIn Process\nCompleted\nCancelled", - "permlevel": 0, - "read_only": 1, - "reqd": 1, + "depends_on": "eval:!doc.__islocal", + "fieldname": "status", + "fieldtype": "Select", + "in_filter": 1, + "in_list_view": 1, + "label": "Status", + "no_copy": 1, + "oldfieldname": "status", + "oldfieldtype": "Select", + "options": "\nDraft\nSubmitted\nStopped\nIn Process\nCompleted\nCancelled", + "permlevel": 0, + "read_only": 1, + "reqd": 1, "search_index": 1 - }, + }, { - "fieldname": "production_item", - "fieldtype": "Link", - "in_filter": 1, - "in_list_view": 1, - "label": "Item To Manufacture", - "oldfieldname": "production_item", - "oldfieldtype": "Link", - "options": "Item", - "permlevel": 0, - "read_only": 0, + "fieldname": "production_item", + "fieldtype": "Link", + "in_filter": 1, + "in_list_view": 1, + "label": "Item To Manufacture", + "oldfieldname": "production_item", + "oldfieldtype": "Link", + "options": "Item", + "permlevel": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "depends_on": "production_item", - "description": "Bill of Material to be considered for manufacturing", - "fieldname": "bom_no", - "fieldtype": "Link", - "in_list_view": 1, - "label": "BOM No", - "oldfieldname": "bom_no", - "oldfieldtype": "Link", - "options": "BOM", - "permlevel": 0, - "read_only": 0, + "depends_on": "production_item", + "description": "Bill of Material to be considered for manufacturing", + "fieldname": "bom_no", + "fieldtype": "Link", + "in_list_view": 1, + "label": "BOM No", + "oldfieldname": "bom_no", + "oldfieldtype": "Link", + "options": "BOM", + "permlevel": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "default": "1", - "description": "If checked, BOM for sub-assembly items will be considered for getting raw materials. Otherwise, all sub-assembly items will be treated as a raw material.", - "fieldname": "use_multi_level_bom", - "fieldtype": "Check", - "label": "Use Multi-Level BOM", + "default": "1", + "description": "If checked, BOM for sub-assembly items will be considered for getting raw materials. Otherwise, all sub-assembly items will be treated as a raw material.", + "fieldname": "use_multi_level_bom", + "fieldtype": "Check", + "label": "Use Multi-Level BOM", "permlevel": 0 - }, + }, { - "fieldname": "column_break1", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, - "read_only": 0, + "fieldname": "column_break1", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, + "read_only": 0, "width": "50%" - }, + }, { - "description": "Manufacture against Sales Order", - "fieldname": "sales_order", - "fieldtype": "Link", - "label": "Sales Order", - "options": "Sales Order", - "permlevel": 0, + "description": "Manufacture against Sales Order", + "fieldname": "sales_order", + "fieldtype": "Link", + "label": "Sales Order", + "options": "Sales Order", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "production_item", - "fieldname": "qty", - "fieldtype": "Float", - "in_list_view": 1, - "label": "Qty To Manufacture", - "oldfieldname": "qty", - "oldfieldtype": "Currency", - "permlevel": 0, - "read_only": 0, + "depends_on": "production_item", + "fieldname": "qty", + "fieldtype": "Float", + "in_list_view": 1, + "label": "Qty To Manufacture", + "oldfieldname": "qty", + "oldfieldtype": "Currency", + "permlevel": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "depends_on": "eval:doc.docstatus==1", - "description": "Automatically updated via Stock Entry of type Manufacture/Repack", - "fieldname": "produced_qty", - "fieldtype": "Float", - "label": "Manufactured Qty", - "no_copy": 1, - "oldfieldname": "produced_qty", - "oldfieldtype": "Currency", - "permlevel": 0, + "depends_on": "eval:doc.docstatus==1", + "description": "Automatically updated via Stock Entry of type Manufacture/Repack", + "fieldname": "produced_qty", + "fieldtype": "Float", + "label": "Manufactured Qty", + "no_copy": 1, + "oldfieldname": "produced_qty", + "oldfieldtype": "Currency", + "permlevel": 0, "read_only": 1 - }, + }, { - "depends_on": "sales_order", - "fieldname": "expected_delivery_date", - "fieldtype": "Date", - "label": "Expected Delivery Date", - "permlevel": 0, + "depends_on": "sales_order", + "fieldname": "expected_delivery_date", + "fieldtype": "Date", + "label": "Expected Delivery Date", + "permlevel": 0, "read_only": 1 - }, + }, { - "fieldname": "warehouses", - "fieldtype": "Section Break", - "label": "Warehouses", - "options": "icon-building", + "fieldname": "warehouses", + "fieldtype": "Section Break", + "label": "Warehouses", + "options": "icon-building", "permlevel": 0 - }, + }, { - "depends_on": "production_item", - "description": "Manufactured quantity will be updated in this warehouse", - "fieldname": "fg_warehouse", - "fieldtype": "Link", - "in_list_view": 0, - "label": "For Warehouse", - "options": "Warehouse", - "permlevel": 0, - "read_only": 0, + "depends_on": "production_item", + "description": "Manufactured quantity will be updated in this warehouse", + "fieldname": "fg_warehouse", + "fieldtype": "Link", + "in_list_view": 0, + "label": "For Warehouse", + "options": "Warehouse", + "permlevel": 0, + "read_only": 0, "reqd": 0 - }, + }, { - "fieldname": "column_break_12", - "fieldtype": "Column Break", + "fieldname": "column_break_12", + "fieldtype": "Column Break", "permlevel": 0 - }, + }, { - "fieldname": "wip_warehouse", - "fieldtype": "Link", - "label": "Work-in-Progress Warehouse", - "options": "Warehouse", - "permlevel": 0, + "fieldname": "wip_warehouse", + "fieldtype": "Link", + "label": "Work-in-Progress Warehouse", + "options": "Warehouse", + "permlevel": 0, "reqd": 0 - }, + }, { - "fieldname": "more_info", - "fieldtype": "Section Break", - "label": "More Info", - "options": "icon-file-text", - "permlevel": 0, + "fieldname": "more_info", + "fieldtype": "Section Break", + "label": "More Info", + "options": "icon-file-text", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "description", - "fieldtype": "Small Text", - "label": "Item Description", - "permlevel": 0, + "fieldname": "description", + "fieldtype": "Small Text", + "label": "Item Description", + "permlevel": 0, "read_only": 1 - }, + }, { - "fieldname": "project_name", - "fieldtype": "Link", - "in_filter": 1, - "label": "Project Name", - "oldfieldname": "project_name", - "oldfieldtype": "Link", - "options": "Project", - "permlevel": 0, + "fieldname": "project_name", + "fieldtype": "Link", + "in_filter": 1, + "label": "Project Name", + "oldfieldname": "project_name", + "oldfieldtype": "Link", + "options": "Project", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "column_break2", - "fieldtype": "Column Break", - "permlevel": 0, - "read_only": 0, + "fieldname": "column_break2", + "fieldtype": "Column Break", + "permlevel": 0, + "read_only": 0, "width": "50%" - }, + }, { - "depends_on": "production_item", - "fieldname": "stock_uom", - "fieldtype": "Link", - "label": "Stock UOM", - "oldfieldname": "stock_uom", - "oldfieldtype": "Data", - "options": "UOM", - "permlevel": 0, + "depends_on": "production_item", + "fieldname": "stock_uom", + "fieldtype": "Link", + "label": "Stock UOM", + "oldfieldname": "stock_uom", + "oldfieldtype": "Data", + "options": "UOM", + "permlevel": 0, "read_only": 1 - }, + }, { - "fieldname": "company", - "fieldtype": "Link", - "label": "Company", - "oldfieldname": "company", - "oldfieldtype": "Link", - "options": "Company", - "permlevel": 0, - "read_only": 0, + "fieldname": "company", + "fieldtype": "Link", + "label": "Company", + "oldfieldname": "company", + "oldfieldtype": "Link", + "options": "Company", + "permlevel": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "fieldname": "amended_from", - "fieldtype": "Data", - "ignore_user_permissions": 1, - "label": "Amended From", - "no_copy": 1, - "oldfieldname": "amended_from", - "oldfieldtype": "Data", - "permlevel": 0, + "fieldname": "amended_from", + "fieldtype": "Data", + "ignore_user_permissions": 1, + "label": "Amended From", + "no_copy": 1, + "oldfieldname": "amended_from", + "oldfieldtype": "Data", + "permlevel": 0, "read_only": 1 } - ], - "icon": "icon-cogs", - "idx": 1, - "in_create": 0, - "is_submittable": 1, - "modified": "2014-05-27 03:49:15.008942", - "modified_by": "Administrator", - "module": "Manufacturing", - "name": "Production Order", - "owner": "Administrator", + ], + "icon": "icon-cogs", + "idx": 1, + "in_create": 0, + "is_submittable": 1, + "modified": "2014-05-27 03:49:15.008942", + "modified_by": "Administrator", + "module": "Manufacturing", + "name": "Production Order", + "owner": "Administrator", "permissions": [ { - "amend": 1, - "apply_user_permissions": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Manufacturing User", - "submit": 1, + "amend": 1, + "apply_user_permissions": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Manufacturing User", + "submit": 1, "write": 1 - }, + }, { - "apply_user_permissions": 1, - "permlevel": 0, - "read": 1, - "report": 1, + "apply_user_permissions": 1, + "permlevel": 0, + "read": 1, + "report": 1, "role": "Material User" } ] -} \ No newline at end of file +} diff --git a/erpnext/selling/doctype/lead/test_records.json b/erpnext/selling/doctype/lead/test_records.json index ce9460489c..01b0a992d2 100644 --- a/erpnext/selling/doctype/lead/test_records.json +++ b/erpnext/selling/doctype/lead/test_records.json @@ -16,7 +16,7 @@ "doctype": "Lead", "email_id": "test_lead2@example.com", "lead_name": "_Test Lead 2", - "status": "Contacted" + "status": "Lead" }, { "doctype": "Lead", diff --git a/erpnext/support/doctype/newsletter/newsletter.py b/erpnext/support/doctype/newsletter/newsletter.py index 9072700fb6..88040e21b4 100644 --- a/erpnext/support/doctype/newsletter/newsletter.py +++ b/erpnext/support/doctype/newsletter/newsletter.py @@ -125,7 +125,7 @@ def create_lead(email_id): "doctype": "Lead", "email_id": email_id, "lead_name": real_name or email_id, - "status": "Contacted", + "status": "Lead", "naming_series": get_default_naming_series("Lead"), "company": frappe.db.get_default("company"), "source": "Email"