diff --git a/accounts/doctype/sales_invoice_item/sales_invoice_item.txt b/accounts/doctype/sales_invoice_item/sales_invoice_item.txt index ca5fae49c3a..dee0e85d6e8 100644 --- a/accounts/doctype/sales_invoice_item/sales_invoice_item.txt +++ b/accounts/doctype/sales_invoice_item/sales_invoice_item.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-03-25 15:35:04", + "creation": "2013-03-26 11:03:08", "docstatus": 0, - "modified": "2013-03-25 15:35:23", + "modified": "2013-03-28 15:42:14", "modified_by": "Administrator", "owner": "Administrator" }, @@ -210,7 +210,7 @@ "doctype": "DocField", "fieldname": "expense_account", "fieldtype": "Link", - "hidden": 1, + "hidden": 0, "in_filter": 1, "label": "Expense Account", "options": "Account", 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 b1cbbdcbfcc..1e72010f26f 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 @@ -53,16 +53,14 @@ cur_frm.pformat.other_charges= function(doc){ var new_val = flt(val)/flt(doc.conversion_rate); return new_val; } + + function print_hide(fieldname) { + var doc_field = wn.meta.get_docfield(doc.doctype, fieldname, doc.name); + return doc_field.print_hide; + } + out =''; if (!doc.print_without_amount) { - print_hide_dict = {}; - for(var i in locals['DocField']) { - var doc_field = locals['DocField'][i]; - if(doc_field.fieldname) { - print_hide_dict[doc_field.fieldname] = doc_field.print_hide; - } - } - var cl = getchildren('Sales Taxes and Charges',doc.name,'other_charges'); // outer table @@ -71,7 +69,7 @@ cur_frm.pformat.other_charges= function(doc){ // main table out +=''; - if(!print_hide_dict['net_total']) { + if(!print_hide('net_total')) { out +=make_row('Net Total',convert_rate(doc.net_total),1); } @@ -84,15 +82,15 @@ cur_frm.pformat.other_charges= function(doc){ } // grand total - if(!print_hide_dict['grand_total_export']) { + if(!print_hide('grand_total_export')) { out += make_row('Grand Total',doc.grand_total_export,1); } - if(!print_hide_dict['rounded_total_export']) { + if(!print_hide('rounded_total_export')) { out += make_row('Rounded Total',doc.rounded_total_export,1); } - if(doc.in_words_export && !print_hide_dict['in_words_export']){ + if(doc.in_words_export && !print_hide('in_words_export')){ out +='
'; out += ''; out += '' diff --git a/accounts/utils.py b/accounts/utils.py index 92173ab8ee7..d6b20431f87 100644 --- a/accounts/utils.py +++ b/accounts/utils.py @@ -294,18 +294,18 @@ def create_stock_in_hand_jv(reverse=False): jv.submit() def get_stock_rbnb_value(company): - total_received_amount = webnotes.conn.sql("""select sum(valuation_amount) + total_received_amount = webnotes.conn.sql("""select sum(valuation_rate*qty) from `tabPurchase Receipt Item` pr_item where docstatus=1 and exists(select name from `tabItem` where name = pr_item.item_code and is_stock_item='Yes') - and exist(select name from `tabPurchase Receipt` + and exists(select name from `tabPurchase Receipt` where name = pr_item.parent and company = %s)""", company) - total_billed_amount = webnotes.conn.sql("""select sum(valuation_amount) + total_billed_amount = webnotes.conn.sql("""select sum(valuation_rate*qty) from `tabPurchase Invoice Item` pi_item where docstatus=1 and exists(select name from `tabItem` where name = pi_item.item_code and is_stock_item='Yes') - and exist(select name from `tabPurchase Invoice` + and exists(select name from `tabPurchase Invoice` where name = pi_item.parent and company = %s)""", company) return flt(total_received_amount[0][0]) - flt(total_billed_amount[0][0]) diff --git a/patches/march_2013/p10_update_against_expense_account.py b/patches/march_2013/p10_update_against_expense_account.py new file mode 100644 index 00000000000..d1bad5cfeda --- /dev/null +++ b/patches/march_2013/p10_update_against_expense_account.py @@ -0,0 +1,11 @@ +def execute(): + import webnotes + from webnotes import get_obj + pi_list = webnotes.conn.sql("""select name from `tabPurchase Invoice` + where docstatus = 1 and ifnull(against_expense_account, '') = ''""") + + for pi in pi_list: + pi_obj = get_obj("Purchase Invoice", pi[0], with_children=1) + pi_obj.set_against_expense_account() + webnotes.conn.set_value("Purchase Invoice", pi[0], + "against_expense_account", pi_obj.doc.against_expense_account) \ No newline at end of file diff --git a/patches/march_2013/p12_set_item_tax_rate_in_json.py b/patches/march_2013/p12_set_item_tax_rate_in_json.py new file mode 100644 index 00000000000..de47c67d92f --- /dev/null +++ b/patches/march_2013/p12_set_item_tax_rate_in_json.py @@ -0,0 +1,19 @@ +import webnotes +import json + +def execute(): + """replace item_tax_rate stored as string with a json string""" + webnotes.conn.auto_commit_on_many_writes = 1 + for dt in ["Quotation Item", "Sales Order Item", "Sales Invoice Item", + "Delivery Note Item", "Supplier Quotation Item", "Purchase Order Item", + "Purchase Invoice Item", "Purchase Receipt Item"]: + for d in webnotes.conn.sql("""select name, item_tax_rate from `tab%s` + where ifnull(item_tax_rate, '')!=''""" % (dt,), as_dict=1): + try: + json.loads(d["item_tax_rate"]) + except ValueError, e: + webnotes.conn.sql("""update `tab%s` set item_tax_rate=%s + where name=%s""" % (dt, "%s", "%s"), + (json.dumps(eval(d["item_tax_rate"])), d["name"])) + + webnotes.conn.auto_commit_on_many_writes = 0 \ No newline at end of file diff --git a/patches/patch_list.py b/patches/patch_list.py index 5502385b2f3..905ea290c90 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -224,5 +224,7 @@ patch_list = [ "execute:webnotes.conn.set_value('Email Settings', None, 'send_print_in_body_and_attachment', 1)", "patches.march_2013.p09_unset_user_type_partner", "patches.march_2013.p10_set_fiscal_year_for_stock", + "patches.march_2013.p10_update_against_expense_account", "patches.march_2013.p11_update_attach_files", + "patches.march_2013.p12_set_item_tax_rate_in_json", ] \ No newline at end of file diff --git a/setup/doctype/global_defaults/global_defaults.py b/setup/doctype/global_defaults/global_defaults.py index 4b6707f5064..3f8de1de209 100644 --- a/setup/doctype/global_defaults/global_defaults.py +++ b/setup/doctype/global_defaults/global_defaults.py @@ -45,7 +45,7 @@ keydict = { 'session_expiry': 'session_expiry', 'disable_rounded_total': 'disable_rounded_total', "update_stock": "update_stock", - # "auto_inventory_accounting": "auto_inventory_accounting", + "auto_inventory_accounting": "auto_inventory_accounting", } class DocType: diff --git a/setup/doctype/global_defaults/global_defaults.txt b/setup/doctype/global_defaults/global_defaults.txt index ac1671e4028..7f816184691 100644 --- a/setup/doctype/global_defaults/global_defaults.txt +++ b/setup/doctype/global_defaults/global_defaults.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-02-21 12:28:24", + "creation": "2013-03-25 11:08:14", "docstatus": 0, - "modified": "2013-03-21 15:42:59", + "modified": "2013-03-28 15:41:03", "modified_by": "Administrator", "owner": "Administrator" }, @@ -27,6 +27,8 @@ "permlevel": 0 }, { + "amend": 0, + "cancel": 0, "create": 1, "doctype": "DocPerm", "name": "__common__", @@ -48,19 +50,22 @@ "doctype": "DocField", "fieldname": "general", "fieldtype": "Section Break", - "label": "General" + "label": "General", + "read_only": 0 }, { "description": "Session Expiry in Hours e.g. 06:00", "doctype": "DocField", "fieldname": "session_expiry", "fieldtype": "Data", - "label": "Session Expiry" + "label": "Session Expiry", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "column_break_3", - "fieldtype": "Column Break" + "fieldtype": "Column Break", + "read_only": 0 }, { "description": "For Server Side Print Formats", @@ -68,13 +73,15 @@ "fieldname": "print_style", "fieldtype": "Select", "label": "Print Format Style", - "options": "Standard\nClassic\nModern\nSpartan" + "options": "Standard\nClassic\nModern\nSpartan", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "company", "fieldtype": "Section Break", - "label": "Company" + "label": "Company", + "read_only": 0 }, { "doctype": "DocField", @@ -82,6 +89,7 @@ "fieldtype": "Link", "label": "Default Company", "options": "Company", + "read_only": 0, "reqd": 0 }, { @@ -90,6 +98,7 @@ "fieldtype": "Link", "label": "Current Fiscal Year", "options": "Fiscal Year", + "read_only": 0, "reqd": 1 }, { @@ -97,12 +106,14 @@ "fieldname": "date_format", "fieldtype": "Select", "label": "Date Format", - "options": "yyyy-mm-dd\ndd-mm-yyyy\ndd/mm/yyyy\nmm/dd/yyyy\nmm-dd-yyyy" + "options": "yyyy-mm-dd\ndd-mm-yyyy\ndd/mm/yyyy\nmm/dd/yyyy\nmm-dd-yyyy", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "column_break1", "fieldtype": "Column Break", + "read_only": 0, "width": "50%" }, { @@ -111,7 +122,8 @@ "fieldname": "hide_currency_symbol", "fieldtype": "Select", "label": "Hide Currency Symbol", - "options": "\nNo\nYes" + "options": "\nNo\nYes", + "read_only": 0 }, { "default": "INR", @@ -120,6 +132,7 @@ "fieldtype": "Link", "label": "Default Currency", "options": "Currency", + "read_only": 0, "reqd": 1 }, { @@ -128,7 +141,8 @@ "fieldname": "number_format", "fieldtype": "Select", "label": "Number Format", - "options": "\n#,###.##\n#.###,##\n# ###.##\n#,###.###\n#,##,###.##\n#.###\n#,###" + "options": "\n#,###.##\n#.###,##\n# ###.##\n#,###.###\n#,##,###.##\n#.###\n#,###", + "read_only": 0 }, { "description": "Precision for Float fields (quantities, discounts, percentages etc) only for display. Floats will still be calculated up to 6 decimals.", @@ -136,18 +150,21 @@ "fieldname": "float_precision", "fieldtype": "Select", "label": "Float Precision", - "options": "\n2\n3\n4\n5\n6" + "options": "\n2\n3\n4\n5\n6", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "stock", "fieldtype": "Section Break", - "label": "Stock" + "label": "Stock", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "column_break2", "fieldtype": "Column Break", + "read_only": 0, "width": "50%" }, { @@ -155,54 +172,62 @@ "fieldname": "default_item_group", "fieldtype": "Link", "label": "Default Item Group", - "options": "Item Group" + "options": "Item Group", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "ighelp", "fieldtype": "HTML", "label": "IGHelp", - "options": "To manage Item Groups, click here" + "options": "To manage Item Groups, click here", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "default_stock_uom", "fieldtype": "Link", "label": "Default Stock UOM", - "options": "UOM" + "options": "UOM", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "default_valuation_method", "fieldtype": "Select", "label": "Default Valuation Method", - "options": "FIFO\nMoving Average" + "options": "FIFO\nMoving Average", + "read_only": 0 }, { "description": "Applicable only if valuation method is moving average", "doctype": "DocField", "fieldname": "allow_negative_stock", "fieldtype": "Check", - "label": "Allow Negative Stock" + "label": "Allow Negative Stock", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "default_warehouse_type", "fieldtype": "Link", "label": "Default Warehouse Type", - "options": "Warehouse Type" + "options": "Warehouse Type", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "auto_indent", "fieldtype": "Check", - "label": "Raise Material Request when stock reaches re-order level" + "label": "Raise Material Request when stock reaches re-order level", + "read_only": 0 }, { "default": "1", "doctype": "DocField", "fieldname": "column_break3", "fieldtype": "Column Break", + "read_only": 0, "width": "50%" }, { @@ -210,14 +235,16 @@ "doctype": "DocField", "fieldname": "tolerance", "fieldtype": "Float", - "label": "Allowance Percent" + "label": "Allowance Percent", + "read_only": 0 }, { "description": "Stock level frozen up to this date, nobody can do / modify entry except authorized person", "doctype": "DocField", "fieldname": "stock_frozen_upto", "fieldtype": "Date", - "label": "Stock Frozen Upto" + "label": "Stock Frozen Upto", + "read_only": 0 }, { "description": "Users with this role are allowed to do / modify stock entry before frozen date", @@ -225,20 +252,32 @@ "fieldname": "stock_auth_role", "fieldtype": "Link", "label": "Authorized Role (Frozen Entry)", - "options": "Role" + "options": "Role", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "accounts", "fieldtype": "Section Break", - "label": "Accounts" + "label": "Accounts", + "read_only": 0 + }, + { + "description": "If enabled, the system will post accounting entries for inventory automatically", + "doctype": "DocField", + "fieldname": "auto_inventory_accounting", + "fieldtype": "Check", + "label": "Auto Inventory Accounting", + "no_copy": 0, + "print_hide": 1 }, { "description": "Accounting entry frozen up to this date, nobody can do / modify entry except authorized person", "doctype": "DocField", "fieldname": "acc_frozen_upto", "fieldtype": "Date", - "label": "Accounts Frozen Upto" + "label": "Accounts Frozen Upto", + "read_only": 0 }, { "description": "Users with this role are allowed to do / modify accounting entry before frozen date", @@ -246,39 +285,45 @@ "fieldname": "bde_auth_role", "fieldtype": "Link", "label": "Authourized Role (Frozen Entry)", - "options": "Role" + "options": "Role", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "credit_controller", "fieldtype": "Link", "label": "Credit Controller", - "options": "Role" + "options": "Role", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "column_break4", - "fieldtype": "Column Break" + "fieldtype": "Column Break", + "read_only": 0 }, { "description": "If checked, then in POS Sales Invoice, Update Stock gets checked by default", "doctype": "DocField", "fieldname": "update_stock", "fieldtype": "Check", - "label": "Update Stock when using POS Sales Invoice" + "label": "Update Stock when using POS Sales Invoice", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "account_info", "fieldtype": "HTML", "label": "Account Info", - "options": "
For more accounting defaults, Open Company
" + "options": "
For more accounting defaults, Open Company
", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "selling", "fieldtype": "Section Break", - "label": "Selling" + "label": "Selling", + "read_only": 0 }, { "default": "Customer Name", @@ -286,40 +331,46 @@ "fieldname": "cust_master_name", "fieldtype": "Select", "label": "Customer Master created by ", - "options": "Customer Name\nNaming Series" + "options": "Customer Name\nNaming Series", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "default_customer_group", "fieldtype": "Link", "label": "Default Customer Group", - "options": "Customer Group" + "options": "Customer Group", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "cghelp", "fieldtype": "HTML", "label": "CGHelp", - "options": "To manage Customer Groups, click here" + "options": "To manage Customer Groups, click here", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "default_territory", "fieldtype": "Link", "label": "Default Territory", - "options": "Territory" + "options": "Territory", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "territoryhelp", "fieldtype": "HTML", "label": "TerritoryHelp", - "options": "To manage Territory, click here" + "options": "To manage Territory, click here", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "column_break5", "fieldtype": "Column Break", + "read_only": 0, "width": "50%" }, { @@ -327,14 +378,16 @@ "fieldname": "default_price_list", "fieldtype": "Link", "label": "Default Price List", - "options": "Price List" + "options": "Price List", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "default_price_list_currency", "fieldtype": "Link", "label": "Default Price List Currency", - "options": "Currency" + "options": "Currency", + "read_only": 0 }, { "default": "No", @@ -342,7 +395,8 @@ "fieldname": "so_required", "fieldtype": "Select", "label": "Sales Order Required", - "options": "No\nYes" + "options": "No\nYes", + "read_only": 0 }, { "default": "No", @@ -350,27 +404,31 @@ "fieldname": "dn_required", "fieldtype": "Select", "label": "Delivery Note Required", - "options": "No\nYes" + "options": "No\nYes", + "read_only": 0 }, { "description": "If disable, 'Rounded Total' field will not be visible in any transaction", "doctype": "DocField", "fieldname": "disable_rounded_total", "fieldtype": "Check", - "label": "Disable Rounded Total" + "label": "Disable Rounded Total", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "buying", "fieldtype": "Section Break", - "label": "Buying" + "label": "Buying", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "default_supplier_type", "fieldtype": "Link", "label": "Default Supplier Type", - "options": "Supplier Type" + "options": "Supplier Type", + "read_only": 0 }, { "default": "Supplier Name", @@ -378,12 +436,14 @@ "fieldname": "supp_master_name", "fieldtype": "Select", "label": "Supplier Master created by ", - "options": "Supplier Name\nNaming Series" + "options": "Supplier Name\nNaming Series", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "column_break6", "fieldtype": "Column Break", + "read_only": 0, "width": "50%" }, { @@ -392,7 +452,8 @@ "fieldname": "po_required", "fieldtype": "Select", "label": "Purchase Order Required", - "options": "No\nYes" + "options": "No\nYes", + "read_only": 0 }, { "default": "No", @@ -400,20 +461,23 @@ "fieldname": "pr_required", "fieldtype": "Select", "label": "Purchase Receipt Required", - "options": "No\nYes" + "options": "No\nYes", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "maintain_same_rate", "fieldtype": "Check", - "label": "Maintain same rate throughout purchase cycle" + "label": "Maintain same rate throughout purchase cycle", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "hr", "fieldtype": "Section Break", "label": "HR", - "options": "
HR
" + "options": "
HR
", + "read_only": 0 }, { "description": "Employee record is created using selected field. ", @@ -421,24 +485,22 @@ "fieldname": "emp_created_by", "fieldtype": "Select", "label": "Employee Records to be created by ", - "options": "Naming Series\nEmployee Number" + "options": "Naming Series\nEmployee Number", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "system", "fieldtype": "Section Break", - "label": "System" + "label": "System", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "sms_sender_name", "fieldtype": "Data", - "label": "SMS Sender Name" - }, - { - "amend": 0, - "cancel": 0, - "doctype": "DocPerm" + "label": "SMS Sender Name", + "read_only": 0 }, { "doctype": "DocPerm" diff --git a/stock/doctype/delivery_note_item/delivery_note_item.txt b/stock/doctype/delivery_note_item/delivery_note_item.txt index 1961e6cfa82..fb3dd413efd 100644 --- a/stock/doctype/delivery_note_item/delivery_note_item.txt +++ b/stock/doctype/delivery_note_item/delivery_note_item.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-03-25 11:55:16", + "creation": "2013-03-26 11:03:09", "docstatus": 0, - "modified": "2013-03-25 15:43:04", + "modified": "2013-03-28 15:42:41", "modified_by": "Administrator", "owner": "Administrator" }, @@ -248,7 +248,7 @@ "doctype": "DocField", "fieldname": "expense_account", "fieldtype": "Link", - "hidden": 1, + "hidden": 0, "label": "Expense Account", "no_copy": 1, "options": "Account", @@ -260,11 +260,12 @@ "doctype": "DocField", "fieldname": "cost_center", "fieldtype": "Link", - "hidden": 1, + "hidden": 0, "label": "Cost Center", "no_copy": 1, "options": "Cost Center", "print_hide": 1, + "read_only": 0, "width": "120px" }, { diff --git a/stock/doctype/stock_entry/stock_entry.js b/stock/doctype/stock_entry/stock_entry.js index c54f619735c..3e21207eaa1 100644 --- a/stock/doctype/stock_entry/stock_entry.js +++ b/stock/doctype/stock_entry/stock_entry.js @@ -360,7 +360,8 @@ cur_frm.cscript.uom = function(doc, cdt, cdn) { cur_frm.cscript.validate = function(doc, cdt, cdn) { cur_frm.cscript.validate_items(doc); - validated = cur_frm.cscript.get_doctype_docname() ? true : false; + if($.inArray(cur_frm.doc.purpose, ["Purchase Return", "Sales Return"])!==-1) + validated = cur_frm.cscript.get_doctype_docname() ? true : false; } cur_frm.cscript.validate_items = function(doc) {
In Words