From d8b85073cde5581cffead3c1d92e0b02f4dfe056 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 30 Nov 2012 19:45:39 +0530 Subject: [PATCH 1/4] removed old tests.py --- stock/tests.py | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 stock/tests.py diff --git a/stock/tests.py b/stock/tests.py deleted file mode 100644 index 92378dca06..0000000000 --- a/stock/tests.py +++ /dev/null @@ -1,27 +0,0 @@ -# ERPNext - web based ERP (http://erpnext.com) -# Copyright (C) 2012 Web Notes Technologies Pvt Ltd -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -from __future__ import unicode_literals -import unittest - -import sys -sys.path.append('/Users/rushabh/Workbench/www/wnframework/cgi-bin/') -sys.path.append('/Users/rushabh/Workbench/www/erpnext/') - -from material_management.doctype.delivery_note.tests import * - -if __name__ == '__main__': - unittest.main() \ No newline at end of file From 9021ef75d1d8c496777eb452d043639f9b8247e4 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 30 Nov 2012 19:45:51 +0530 Subject: [PATCH 2/4] minor fixes --- buying/doctype/supplier/supplier.py | 3 +-- production/doctype/bom/bom.py | 4 +--- stock/doctype/item/item.py | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/buying/doctype/supplier/supplier.py b/buying/doctype/supplier/supplier.py index 0e28f1fbff..63106539e5 100644 --- a/buying/doctype/supplier/supplier.py +++ b/buying/doctype/supplier/supplier.py @@ -107,8 +107,7 @@ class DocType(TransactionBase): #validation for Naming Series mandatory field... if get_defaults()['supp_master_name'] == 'Naming Series': if not self.doc.naming_series: - msgprint("Series is Mandatory.") - raise Exception + msgprint("Series is Mandatory.", raise_exception=1) def create_account_head(self): if self.doc.company : diff --git a/production/doctype/bom/bom.py b/production/doctype/bom/bom.py index a413f6a6b8..68e1c3c1b6 100644 --- a/production/doctype/bom/bom.py +++ b/production/doctype/bom/bom.py @@ -240,14 +240,12 @@ class DocType: # add operation in op list self.op.append(cstr(d.operation_no)) - - def validate_materials(self): """ Validate raw material entries """ check_list = [] for m in getlist(self.doclist, 'bom_materials'): # check if operation no not in op table - if m.operation_no not in self.op: + if cstr(m.operation_no) not in self.op: msgprint("""Operation no: %s against item: %s at row no: %s is not present at Operations table"""% (m.operation_no, m.item_code, m.idx), raise_exception = 1) diff --git a/stock/doctype/item/item.py b/stock/doctype/item/item.py index 92dc82b9f8..41ae423b8f 100644 --- a/stock/doctype/item/item.py +++ b/stock/doctype/item/item.py @@ -141,7 +141,7 @@ class DocType: 'is_purchase_item' :'Is Purchase Item', 'is_pro_applicable' :'Is Pro Applicable'} for d in fl: - if cstr(self.doc.fields[d]) != 'Yes': + if cstr(self.doc.fields.get(d)) != 'Yes': self.check_for_active_boms(check = fl[d]) self.check_ref_rate_detail() self.fill_customer_code() From 9760aebdf9ab7a1d0db5556642313853c23336a9 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 30 Nov 2012 19:46:11 +0530 Subject: [PATCH 3/4] ported test data and test purchase receipt from aii --- .../purchase_receipt/test_purchase_receipt.py | 192 ++++++++++++++++++ tests/data/item/android_jack_d.txt | 37 ++++ tests/data/item/android_jack_s.txt | 37 ++++ tests/data/item/home_desktop_100.txt | 37 ++++ tests/data/item/home_desktop_200.txt | 37 ++++ tests/data/item/home_desktop_300.txt | 37 ++++ tests/data/item/nebula_7.txt | 38 ++++ tests/data/item_group/accessories.txt | 27 +++ tests/data/item_group/android.txt | 27 +++ tests/data/item_group/desktops.txt | 27 +++ tests/data/item_group/full_size_tablets.txt | 27 +++ tests/data/item_group/gamer.txt | 27 +++ tests/data/item_group/home_series.txt | 27 +++ tests/data/item_group/laptops.txt | 27 +++ tests/data/item_group/lightweight.txt | 27 +++ tests/data/item_group/medium_tablets.txt | 27 +++ tests/data/item_group/pro_series.txt | 27 +++ tests/data/item_group/small_tablets.txt | 27 +++ tests/data/item_group/smartphones.txt | 27 +++ tests/data/item_group/tablets.txt | 27 +++ tests/data/item_group/tough.txt | 27 +++ tests/data/item_group/ultrabook.txt | 27 +++ 22 files changed, 820 insertions(+) create mode 100644 stock/doctype/purchase_receipt/test_purchase_receipt.py create mode 100644 tests/data/item/android_jack_d.txt create mode 100644 tests/data/item/android_jack_s.txt create mode 100644 tests/data/item/home_desktop_100.txt create mode 100644 tests/data/item/home_desktop_200.txt create mode 100644 tests/data/item/home_desktop_300.txt create mode 100644 tests/data/item/nebula_7.txt create mode 100644 tests/data/item_group/accessories.txt create mode 100644 tests/data/item_group/android.txt create mode 100644 tests/data/item_group/desktops.txt create mode 100644 tests/data/item_group/full_size_tablets.txt create mode 100644 tests/data/item_group/gamer.txt create mode 100644 tests/data/item_group/home_series.txt create mode 100644 tests/data/item_group/laptops.txt create mode 100644 tests/data/item_group/lightweight.txt create mode 100644 tests/data/item_group/medium_tablets.txt create mode 100644 tests/data/item_group/pro_series.txt create mode 100644 tests/data/item_group/small_tablets.txt create mode 100644 tests/data/item_group/smartphones.txt create mode 100644 tests/data/item_group/tablets.txt create mode 100644 tests/data/item_group/tough.txt create mode 100644 tests/data/item_group/ultrabook.txt diff --git a/stock/doctype/purchase_receipt/test_purchase_receipt.py b/stock/doctype/purchase_receipt/test_purchase_receipt.py new file mode 100644 index 0000000000..98418d0755 --- /dev/null +++ b/stock/doctype/purchase_receipt/test_purchase_receipt.py @@ -0,0 +1,192 @@ +# ERPNext - web based ERP (http://erpnext.com) +# Copyright (C) 2012 Web Notes Technologies Pvt Ltd +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +from __future__ import unicode_literals +import unittest +import webnotes +import webnotes.model +from webnotes.utils import nowdate +from accounts.utils import get_fiscal_year + +company = webnotes.conn.get_default("company") +abbr = webnotes.conn.get_value("Company", company, "abbr") + +def load_data(): + insert_accounts() + + # create default warehouse + if not webnotes.conn.exists("Warehouse", "Default Warehouse"): + webnotes.insert({"doctype": "Warehouse", + "warehouse_name": "Default Warehouse", + "warehouse_type": "Stores"}) + + # create UOM: Nos. + if not webnotes.conn.exists("UOM", "Nos"): + webnotes.insert({"doctype": "UOM", "uom_name": "Nos"}) + + from webnotes.tests import insert_test_data + # create item groups and items + insert_test_data("Item Group", + sort_fn=lambda ig: (ig[0].get('parent_item_group'), ig[0].get('name'))) + insert_test_data("Item") + + # create supplier type + webnotes.insert({"doctype": "Supplier Type", "supplier_type": "Manufacturing"}) + + # create supplier + webnotes.insert({"doctype": "Supplier", "supplier_name": "East Wind Inc.", + "supplier_type": "Manufacturing", "company": company}) + + # create default cost center if not exists + if not webnotes.conn.exists("Cost Center", "Default Cost Center - %s" % abbr): + dl = webnotes.insert({"doctype": "Cost Center", "group_or_ledger": "Ledger", + "cost_center_name": "Default Cost Center", + "parent_cost_center": "Root - %s" % abbr, + "company_name": company, "company_abbr": abbr}) + + # create account heads for taxes + + webnotes.insert({"doctype": "Account", "account_name": "Shipping Charges", + "parent_account": "Stock Expenses - %s" % abbr, "company": company, + "group_or_ledger": "Ledger"}) + + webnotes.insert({"doctype": "Account", "account_name": "Customs Duty", + "parent_account": "Stock Expenses - %s" % abbr, "company": company, + "group_or_ledger": "Ledger"}) + webnotes.insert({"doctype": "Account", "account_name": "Tax Assets", + "parent_account": "Current Assets - %s" % abbr, "company": company, + "group_or_ledger": "Group"}) + webnotes.insert({"doctype": "Account", "account_name": "VAT - Test", + "parent_account": "Tax Assets - %s" % abbr, "company": company, + "group_or_ledger": "Ledger"}) + + # create BOM + webnotes.insert([ + {"doctype": "BOM", "item": "Nebula 7", "quantity": 1, + "is_active": "Yes", "is_default": 1, "uom": "Nos"}, + {"doctype": "BOM Operation", "operation_no": 1, "parentfield": "bom_operations", + "opn_description": "Development"}, + {"doctype": "BOM Item", "item_code": "Android Jack D", "operation_no": 1, + "qty": 5, "rate": 20, "amount": 100, "stock_uom": "Nos", + "parentfield": "bom_materials"} + ]) + + +base_purchase_receipt = [ + { + "doctype": "Purchase Receipt", "supplier": "East Wind Inc.", + "naming_series": "PR", "posting_date": nowdate(), "posting_time": "12:05", + "company": company, "fiscal_year": webnotes.conn.get_default("fiscal_year"), + "currency": webnotes.conn.get_default("currency"), "conversion_rate": 1 + }, + { + "doctype": "Purchase Receipt Item", + "item_code": "Home Desktop 100", + "qty": 10, "received_qty": 10, "rejected_qty": 0, "purchase_rate": 50, + "amount": 500, "warehouse": "Default Warehouse", "valuation_tax_amount": 250, + "parentfield": "purchase_receipt_details", + "conversion_factor": 1, "uom": "Nos", "stock_uom": "Nos" + }, + { + "doctype": "Purchase Taxes and Charges", "charge_type": "Actual", + "account_head": "Shipping Charges - %s" % abbr, "purchase_rate": 100, "tax_amount": 100, + "category": "Valuation and Total", "parentfield": "purchase_tax_details", + "cost_center": "Default Cost Center - %s" % abbr + }, + { + "doctype": "Purchase Taxes and Charges", "charge_type": "Actual", + "account_head": "VAT - Test - %s" % abbr, "purchase_rate": 120, "tax_amount": 120, + "category": "Total", "parentfield": "purchase_tax_details" + }, + { + "doctype": "Purchase Taxes and Charges", "charge_type": "Actual", + "account_head": "Customs Duty - %s" % abbr, "purchase_rate": 150, "tax_amount": 150, + "category": "Valuation", "parentfield": "purchase_tax_details", + "cost_center": "Default Cost Center - %s" % abbr + } +] + +def insert_accounts(): + for d in webnotes.conn.sql("""select name, abbr from tabCompany""", as_dict=1): + acc_list = [ + make_account_dict('Stock Assets', 'Current Assets', d, 'Group'), + make_account_dict('Stock In Hand', 'Stock Assets', d, 'Ledger'), + make_account_dict('Stock Delivered But Not Billed', 'Stock Assets', + d, 'Ledger'), + make_account_dict('Stock Liabilities', 'Current Liabilities', d, 'Group'), + make_account_dict('Stock Received But Not Billed', 'Stock Liabilities', + d, 'Ledger'), + make_account_dict('Stock Expenses', 'Direct Expenses', d, 'Group'), + make_account_dict('Stock Variance', 'Stock Expenses', d, 'Ledger'), + make_account_dict('Expenses Included In Valuation', 'Stock Expenses', + d, 'Ledger'), + ] + for acc in acc_list: + acc_name = "%s - %s" % (acc['account_name'], d['abbr']) + if not webnotes.conn.exists('Account', acc_name): + webnotes.insert(acc) + else: + print "Account %s already exists" % acc_name + +def make_account_dict(account, parent, company_detail, group_or_ledger): + return { + "doctype": "Account", + "account_name": account, + "parent_account": "%s - %s" % (parent, company_detail['abbr']), + "company": company_detail['name'], + "group_or_ledger": group_or_ledger + } + + +class TestPurchaseReceipt(unittest.TestCase): + def setUp(self): + webnotes.conn.begin() + load_data() + webnotes.conn.set_value("Global Defaults", None, "automatic_inventory_accounting", 1) + + + def test_purchase_receipt(self): + # warehouse does not have stock in hand specified + self.run_purchase_receipt_test(base_purchase_receipt, + "Stock In Hand - %s" % (abbr,), + "Stock Received But Not Billed - %s" % (abbr,), 750.0) + + def run_purchase_receipt_test(self, purchase_receipt, debit_account, + credit_account, stock_value): + from webnotes.model.doclist import DocList + dl = webnotes.insert(DocList(purchase_receipt)) + dl.submit() + dl.load_from_db() + + gle = webnotes.conn.sql("""select account, ifnull(debit, 0), ifnull(credit, 0) + from `tabGL Entry` where voucher_no = %s""", dl.doclist[0].name) + + gle_map = dict(((entry[0], entry) for entry in gle)) + + self.assertEquals(gle_map[debit_account], (debit_account, stock_value, 0.0)) + self.assertEquals(gle_map[credit_account], (credit_account, 0.0, stock_value)) + + def atest_subcontracting(self): + pr = base_purchase_receipt.copy() + pr[1].update({"item_code": "Nebula 7"}) + + self.run_purchase_receipt_test(pr, + "Stock In Hand - %s" % (abbr,), + "Stock Received But Not Billed - %s" % (abbr,), 1750.0) + + def tearDown(self): + webnotes.conn.rollback() \ No newline at end of file diff --git a/tests/data/item/android_jack_d.txt b/tests/data/item/android_jack_d.txt new file mode 100644 index 0000000000..24944e3bae --- /dev/null +++ b/tests/data/item/android_jack_d.txt @@ -0,0 +1,37 @@ +# Item, Android Jack D +[ + + # These values are common in all dictionaries + { + u'creation': '2012-08-26 11:30:44', + u'docstatus': 0, + u'modified': '2012-08-26 11:30:44', + u'modified_by': u'Administrator', + u'owner': u'Administrator' + }, + + # These values are common for all Item + { + 'description': u'Android Jack D', + 'doctype': 'Item', + 'has_batch_no': u'No', + 'has_serial_no': u'No', + 'inspection_required': u'No', + 'is_purchase_item': u'Yes', + 'is_sales_item': u'Yes', + 'is_service_item': u'No', + 'is_stock_item': u'Yes', + 'item_code': u'Android Jack D', + 'item_group': u'Android', + 'item_name': u'Android Jack D', + u'name': u'__common__', + 'stock_uom': u'Nos', + 'default_warehouse': u'Default Warehouse' + }, + + # Item, Android Jack D + { + u'doctype': 'Item', + 'name': u'Android Jack D' + } +] \ No newline at end of file diff --git a/tests/data/item/android_jack_s.txt b/tests/data/item/android_jack_s.txt new file mode 100644 index 0000000000..feaceef368 --- /dev/null +++ b/tests/data/item/android_jack_s.txt @@ -0,0 +1,37 @@ +# Item, Android Jack S +[ + + # These values are common in all dictionaries + { + u'creation': '2012-08-26 11:29:22', + u'docstatus': 0, + u'modified': '2012-08-26 11:29:22', + u'modified_by': u'Administrator', + u'owner': u'Administrator' + }, + + # These values are common for all Item + { + 'description': u'Android Jack S', + 'doctype': 'Item', + 'has_batch_no': u'No', + 'has_serial_no': u'No', + 'inspection_required': u'No', + 'is_purchase_item': u'Yes', + 'is_sales_item': u'Yes', + 'is_service_item': u'No', + 'is_stock_item': u'Yes', + 'item_code': u'Android Jack S', + 'item_group': u'Android', + 'item_name': u'Android Jack S', + u'name': u'__common__', + 'stock_uom': u'Nos', + 'default_warehouse': u'Default Warehouse' + }, + + # Item, Android Jack S + { + u'doctype': 'Item', + 'name': u'Android Jack S' + } +] \ No newline at end of file diff --git a/tests/data/item/home_desktop_100.txt b/tests/data/item/home_desktop_100.txt new file mode 100644 index 0000000000..19ef01d341 --- /dev/null +++ b/tests/data/item/home_desktop_100.txt @@ -0,0 +1,37 @@ +# Item, Home Desktop 100 +[ + + # These values are common in all dictionaries + { + u'creation': '2012-08-26 11:25:28', + u'docstatus': 0, + u'modified': '2012-08-26 11:25:28', + u'modified_by': u'Administrator', + u'owner': u'Administrator' + }, + + # These values are common for all Item + { + 'description': u'Home Desktop 100', + 'doctype': 'Item', + 'has_batch_no': u'No', + 'has_serial_no': u'No', + 'inspection_required': u'No', + 'is_purchase_item': u'Yes', + 'is_sales_item': u'Yes', + 'is_service_item': u'No', + 'is_stock_item': u'Yes', + 'item_code': u'Home Desktop 100', + 'item_group': u'Home Series', + 'item_name': u'Home Desktop 100', + u'name': u'__common__', + 'stock_uom': u'Nos', + 'default_warehouse': u'Default Warehouse' + }, + + # Item, Home Desktop 100 + { + u'doctype': 'Item', + 'name': u'Home Desktop 100' + } +] \ No newline at end of file diff --git a/tests/data/item/home_desktop_200.txt b/tests/data/item/home_desktop_200.txt new file mode 100644 index 0000000000..053e37c637 --- /dev/null +++ b/tests/data/item/home_desktop_200.txt @@ -0,0 +1,37 @@ +# Item, Home Desktop 200 +[ + + # These values are common in all dictionaries + { + u'creation': '2012-08-26 11:25:54', + u'docstatus': 0, + u'modified': '2012-08-26 11:25:54', + u'modified_by': u'Administrator', + u'owner': u'Administrator' + }, + + # These values are common for all Item + { + 'description': u'Home Desktop 200', + 'doctype': 'Item', + 'has_batch_no': u'No', + 'has_serial_no': u'No', + 'inspection_required': u'No', + 'is_purchase_item': u'Yes', + 'is_sales_item': u'Yes', + 'is_service_item': u'No', + 'is_stock_item': u'Yes', + 'item_code': u'Home Desktop 200', + 'item_group': u'Home Series', + 'item_name': u'Home Desktop 200', + u'name': u'__common__', + 'stock_uom': u'Nos', + 'default_warehouse': u'Default Warehouse' + }, + + # Item, Home Desktop 200 + { + u'doctype': 'Item', + 'name': u'Home Desktop 200' + } +] \ No newline at end of file diff --git a/tests/data/item/home_desktop_300.txt b/tests/data/item/home_desktop_300.txt new file mode 100644 index 0000000000..304b2eff99 --- /dev/null +++ b/tests/data/item/home_desktop_300.txt @@ -0,0 +1,37 @@ +# Item, Home Desktop 300 +[ + + # These values are common in all dictionaries + { + u'creation': '2012-08-26 11:26:37', + u'docstatus': 0, + u'modified': '2012-08-26 11:26:37', + u'modified_by': u'Administrator', + u'owner': u'Administrator' + }, + + # These values are common for all Item + { + 'description': u'Home Desktop 300', + 'doctype': 'Item', + 'has_batch_no': u'No', + 'has_serial_no': u'No', + 'inspection_required': u'No', + 'is_purchase_item': u'Yes', + 'is_sales_item': u'Yes', + 'is_service_item': u'No', + 'is_stock_item': u'Yes', + 'item_code': u'Home Desktop 300', + 'item_group': u'Home Series', + 'item_name': u'Home Desktop 300', + u'name': u'__common__', + 'stock_uom': u'Nos', + 'default_warehouse': u'Default Warehouse' + }, + + # Item, Home Desktop 300 + { + u'doctype': 'Item', + 'name': u'Home Desktop 300' + } +] \ No newline at end of file diff --git a/tests/data/item/nebula_7.txt b/tests/data/item/nebula_7.txt new file mode 100644 index 0000000000..9f61d7a227 --- /dev/null +++ b/tests/data/item/nebula_7.txt @@ -0,0 +1,38 @@ +# Item, Nebula 7 +[ + + # These values are common in all dictionaries + { + u'creation': '2012-08-26 11:32:02', + u'docstatus': 0, + u'modified': '2012-08-26 11:32:02', + u'modified_by': u'Administrator', + u'owner': u'Administrator' + }, + + # These values are common for all Item + { + 'description': u'Nebula 7', + 'doctype': 'Item', + 'has_batch_no': u'No', + 'has_serial_no': u'No', + 'inspection_required': u'No', + 'is_sub_contracted_item': 'Yes', + 'is_purchase_item': u'No', + 'is_sales_item': u'Yes', + 'is_service_item': u'No', + 'is_stock_item': u'Yes', + 'item_code': u'Nebula 7', + 'item_group': u'Small Tablets', + 'item_name': u'Nebula 7', + u'name': u'__common__', + 'stock_uom': u'Nos', + 'default_warehouse': u'Default Warehouse' + }, + + # Item, Nebula 7 + { + u'doctype': 'Item', + 'name': u'Nebula 7' + } +] \ No newline at end of file diff --git a/tests/data/item_group/accessories.txt b/tests/data/item_group/accessories.txt new file mode 100644 index 0000000000..c4d3b1a3c6 --- /dev/null +++ b/tests/data/item_group/accessories.txt @@ -0,0 +1,27 @@ +# Item Group, Accessories +[ + + # These values are common in all dictionaries + { + u'creation': '2012-08-07 09:55:59', + u'docstatus': 0, + u'modified': '2012-08-07 09:55:59', + u'modified_by': u'Administrator', + u'owner': u'Administrator' + }, + + # These values are common for all Item Group + { + u'doctype': 'Item Group', + 'is_group': u'Yes', + 'item_group_name': u'Accessories', + u'name': u'__common__', + 'parent_item_group': u'All Item Groups' + }, + + # Item Group, Accessories + { + u'doctype': 'Item Group', + u'name': u'Accessories' + } +] \ No newline at end of file diff --git a/tests/data/item_group/android.txt b/tests/data/item_group/android.txt new file mode 100644 index 0000000000..9d66be55aa --- /dev/null +++ b/tests/data/item_group/android.txt @@ -0,0 +1,27 @@ +# Item Group, Android +[ + + # These values are common in all dictionaries + { + u'creation': '2012-08-07 09:57:11', + u'docstatus': 0, + u'modified': '2012-08-07 09:57:11', + u'modified_by': u'Administrator', + u'owner': u'Administrator' + }, + + # These values are common for all Item Group + { + u'doctype': 'Item Group', + 'is_group': u'No', + 'item_group_name': u'Android', + u'name': u'__common__', + 'parent_item_group': u'Smartphones' + }, + + # Item Group, Android + { + u'doctype': 'Item Group', + u'name': u'Android' + } +] \ No newline at end of file diff --git a/tests/data/item_group/desktops.txt b/tests/data/item_group/desktops.txt new file mode 100644 index 0000000000..7c093d51da --- /dev/null +++ b/tests/data/item_group/desktops.txt @@ -0,0 +1,27 @@ +# Item Group, Desktops +[ + + # These values are common in all dictionaries + { + u'creation': '2012-08-07 09:55:28', + u'docstatus': 0, + u'modified': '2012-08-07 09:55:28', + u'modified_by': u'Administrator', + u'owner': u'Administrator' + }, + + # These values are common for all Item Group + { + u'doctype': 'Item Group', + 'is_group': u'Yes', + 'item_group_name': u'Desktops', + u'name': u'__common__', + 'parent_item_group': u'All Item Groups' + }, + + # Item Group, Desktops + { + u'doctype': 'Item Group', + u'name': u'Desktops' + } +] \ No newline at end of file diff --git a/tests/data/item_group/full_size_tablets.txt b/tests/data/item_group/full_size_tablets.txt new file mode 100644 index 0000000000..158547c9a8 --- /dev/null +++ b/tests/data/item_group/full_size_tablets.txt @@ -0,0 +1,27 @@ +# Item Group, Full Size Tablets +[ + + # These values are common in all dictionaries + { + u'creation': '2012-08-07 09:58:20', + u'docstatus': 0, + u'modified': '2012-08-07 09:58:20', + u'modified_by': u'Administrator', + u'owner': u'Administrator' + }, + + # These values are common for all Item Group + { + u'doctype': 'Item Group', + 'is_group': u'No', + 'item_group_name': u'Full Size Tablets', + u'name': u'__common__', + 'parent_item_group': u'Tablets' + }, + + # Item Group, Full Size Tablets + { + u'doctype': 'Item Group', + u'name': u'Full Size Tablets' + } +] \ No newline at end of file diff --git a/tests/data/item_group/gamer.txt b/tests/data/item_group/gamer.txt new file mode 100644 index 0000000000..bce38c75ea --- /dev/null +++ b/tests/data/item_group/gamer.txt @@ -0,0 +1,27 @@ +# Item Group, Gamer +[ + + # These values are common in all dictionaries + { + u'creation': '2012-08-07 09:56:27', + u'docstatus': 0, + u'modified': '2012-08-07 09:56:27', + u'modified_by': u'Administrator', + u'owner': u'Administrator' + }, + + # These values are common for all Item Group + { + u'doctype': 'Item Group', + 'is_group': u'No', + 'item_group_name': u'Gamer', + u'name': u'__common__', + 'parent_item_group': u'Desktops' + }, + + # Item Group, Gamer + { + u'doctype': 'Item Group', + u'name': u'Gamer' + } +] \ No newline at end of file diff --git a/tests/data/item_group/home_series.txt b/tests/data/item_group/home_series.txt new file mode 100644 index 0000000000..27eeec31d1 --- /dev/null +++ b/tests/data/item_group/home_series.txt @@ -0,0 +1,27 @@ +# Item Group, Home Series +[ + + # These values are common in all dictionaries + { + u'creation': '2012-08-07 09:56:15', + u'docstatus': 0, + u'modified': '2012-08-07 09:56:15', + u'modified_by': u'Administrator', + u'owner': u'Administrator' + }, + + # These values are common for all Item Group + { + u'doctype': 'Item Group', + 'is_group': u'No', + 'item_group_name': u'Home Series', + u'name': u'__common__', + 'parent_item_group': u'Desktops' + }, + + # Item Group, Home Series + { + u'doctype': 'Item Group', + u'name': u'Home Series' + } +] \ No newline at end of file diff --git a/tests/data/item_group/laptops.txt b/tests/data/item_group/laptops.txt new file mode 100644 index 0000000000..2ac14d1391 --- /dev/null +++ b/tests/data/item_group/laptops.txt @@ -0,0 +1,27 @@ +# Item Group, Laptops +[ + + # These values are common in all dictionaries + { + u'creation': '2012-08-07 09:55:36', + u'docstatus': 0, + u'modified': '2012-08-07 09:55:36', + u'modified_by': u'Administrator', + u'owner': u'Administrator' + }, + + # These values are common for all Item Group + { + u'doctype': 'Item Group', + 'is_group': u'Yes', + 'item_group_name': u'Laptops', + u'name': u'__common__', + 'parent_item_group': u'All Item Groups' + }, + + # Item Group, Laptops + { + u'doctype': 'Item Group', + u'name': u'Laptops' + } +] \ No newline at end of file diff --git a/tests/data/item_group/lightweight.txt b/tests/data/item_group/lightweight.txt new file mode 100644 index 0000000000..b3e01e5c27 --- /dev/null +++ b/tests/data/item_group/lightweight.txt @@ -0,0 +1,27 @@ +# Item Group, Lightweight +[ + + # These values are common in all dictionaries + { + u'creation': '2012-08-07 09:56:57', + u'docstatus': 0, + u'modified': '2012-08-07 09:56:58', + u'modified_by': u'Administrator', + u'owner': u'Administrator' + }, + + # These values are common for all Item Group + { + u'doctype': 'Item Group', + 'is_group': u'No', + 'item_group_name': u'Lightweight', + u'name': u'__common__', + 'parent_item_group': u'Laptops' + }, + + # Item Group, Lightweight + { + u'doctype': 'Item Group', + u'name': u'Lightweight' + } +] \ No newline at end of file diff --git a/tests/data/item_group/medium_tablets.txt b/tests/data/item_group/medium_tablets.txt new file mode 100644 index 0000000000..87bda5dc25 --- /dev/null +++ b/tests/data/item_group/medium_tablets.txt @@ -0,0 +1,27 @@ +# Item Group, Medium Tablets +[ + + # These values are common in all dictionaries + { + u'creation': '2012-08-07 09:57:51', + u'docstatus': 0, + u'modified': '2012-08-07 09:57:51', + u'modified_by': u'Administrator', + u'owner': u'Administrator' + }, + + # These values are common for all Item Group + { + u'doctype': 'Item Group', + 'is_group': u'No', + 'item_group_name': u'Medium Tablets', + u'name': u'__common__', + 'parent_item_group': u'Tablets' + }, + + # Item Group, Medium Tablets + { + u'doctype': 'Item Group', + u'name': u'Medium Tablets' + } +] \ No newline at end of file diff --git a/tests/data/item_group/pro_series.txt b/tests/data/item_group/pro_series.txt new file mode 100644 index 0000000000..e66f91ad19 --- /dev/null +++ b/tests/data/item_group/pro_series.txt @@ -0,0 +1,27 @@ +# Item Group, Pro Series +[ + + # These values are common in all dictionaries + { + u'creation': '2012-08-07 09:56:20', + u'docstatus': 0, + u'modified': '2012-08-07 09:56:20', + u'modified_by': u'Administrator', + u'owner': u'Administrator' + }, + + # These values are common for all Item Group + { + u'doctype': 'Item Group', + 'is_group': u'No', + 'item_group_name': u'Pro Series', + u'name': u'__common__', + 'parent_item_group': u'Desktops' + }, + + # Item Group, Pro Series + { + u'doctype': 'Item Group', + u'name': u'Pro Series' + } +] \ No newline at end of file diff --git a/tests/data/item_group/small_tablets.txt b/tests/data/item_group/small_tablets.txt new file mode 100644 index 0000000000..cbf4399ee0 --- /dev/null +++ b/tests/data/item_group/small_tablets.txt @@ -0,0 +1,27 @@ +# Item Group, Small Tablets +[ + + # These values are common in all dictionaries + { + u'creation': '2012-08-07 09:57:44', + u'docstatus': 0, + u'modified': '2012-08-07 09:57:44', + u'modified_by': u'Administrator', + u'owner': u'Administrator' + }, + + # These values are common for all Item Group + { + u'doctype': 'Item Group', + 'is_group': u'No', + 'item_group_name': u'Small Tablets', + u'name': u'__common__', + 'parent_item_group': u'Tablets' + }, + + # Item Group, Small Tablets + { + u'doctype': 'Item Group', + u'name': u'Small Tablets' + } +] \ No newline at end of file diff --git a/tests/data/item_group/smartphones.txt b/tests/data/item_group/smartphones.txt new file mode 100644 index 0000000000..ee7dfb92bf --- /dev/null +++ b/tests/data/item_group/smartphones.txt @@ -0,0 +1,27 @@ +# Item Group, Smartphones +[ + + # These values are common in all dictionaries + { + u'creation': '2012-08-07 09:55:49', + u'docstatus': 0, + u'modified': '2012-08-07 09:55:49', + u'modified_by': u'Administrator', + u'owner': u'Administrator' + }, + + # These values are common for all Item Group + { + u'doctype': 'Item Group', + 'is_group': u'Yes', + 'item_group_name': u'Smartphones', + u'name': u'__common__', + 'parent_item_group': u'All Item Groups' + }, + + # Item Group, Smartphones + { + u'doctype': 'Item Group', + u'name': u'Smartphones' + } +] \ No newline at end of file diff --git a/tests/data/item_group/tablets.txt b/tests/data/item_group/tablets.txt new file mode 100644 index 0000000000..cc44bae913 --- /dev/null +++ b/tests/data/item_group/tablets.txt @@ -0,0 +1,27 @@ +# Item Group, Tablets +[ + + # These values are common in all dictionaries + { + u'creation': '2012-08-07 09:55:42', + u'docstatus': 0, + u'modified': '2012-08-07 09:55:42', + u'modified_by': u'Administrator', + u'owner': u'Administrator' + }, + + # These values are common for all Item Group + { + u'doctype': 'Item Group', + 'is_group': u'Yes', + 'item_group_name': u'Tablets', + u'name': u'__common__', + 'parent_item_group': u'All Item Groups' + }, + + # Item Group, Tablets + { + u'doctype': 'Item Group', + u'name': u'Tablets' + } +] \ No newline at end of file diff --git a/tests/data/item_group/tough.txt b/tests/data/item_group/tough.txt new file mode 100644 index 0000000000..0d3badddfe --- /dev/null +++ b/tests/data/item_group/tough.txt @@ -0,0 +1,27 @@ +# Item Group, Tough +[ + + # These values are common in all dictionaries + { + u'creation': '2012-08-07 09:56:41', + u'docstatus': 0, + u'modified': '2012-08-07 09:56:41', + u'modified_by': u'Administrator', + u'owner': u'Administrator' + }, + + # These values are common for all Item Group + { + u'doctype': 'Item Group', + 'is_group': u'No', + 'item_group_name': u'Tough', + u'name': u'__common__', + 'parent_item_group': u'Laptops' + }, + + # Item Group, Tough + { + u'doctype': 'Item Group', + u'name': u'Tough' + } +] \ No newline at end of file diff --git a/tests/data/item_group/ultrabook.txt b/tests/data/item_group/ultrabook.txt new file mode 100644 index 0000000000..4bb19d7cd2 --- /dev/null +++ b/tests/data/item_group/ultrabook.txt @@ -0,0 +1,27 @@ +# Item Group, Ultrabook +[ + + # These values are common in all dictionaries + { + u'creation': '2012-08-07 09:56:50', + u'docstatus': 0, + u'modified': '2012-08-07 09:56:50', + u'modified_by': u'Administrator', + u'owner': u'Administrator' + }, + + # These values are common for all Item Group + { + u'doctype': 'Item Group', + 'is_group': u'No', + 'item_group_name': u'Ultrabook', + u'name': u'__common__', + 'parent_item_group': u'Laptops' + }, + + # Item Group, Ultrabook + { + u'doctype': 'Item Group', + u'name': u'Ultrabook' + } +] \ No newline at end of file From 88be29e43ba6833986ec7c9983650c287c81b384 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Sat, 1 Dec 2012 18:03:05 +0530 Subject: [PATCH 4/4] flt before round in gl control --- accounts/doctype/gl_control/gl_control.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accounts/doctype/gl_control/gl_control.py b/accounts/doctype/gl_control/gl_control.py index deb88f7d2f..0eebf48cb5 100644 --- a/accounts/doctype/gl_control/gl_control.py +++ b/accounts/doctype/gl_control/gl_control.py @@ -142,7 +142,7 @@ class DocType: def save_entries(self, cancel, adv_adj, update_outstanding): for le in self.entries: # round off upto 2 decimal - le.debit, le.credit = round(le.debit, 2), round(le.credit, 2) + le.debit, le.credit = round(flt(le.debit), 2), round(flt(le.credit), 2) #toggle debit, credit if negative entry if flt(le.debit) < 0 or flt(le.credit) < 0: