From c28f84298ffb9a94f1f6f71d2f0fc30aad563d23 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 5 Sep 2013 13:31:20 +0530 Subject: [PATCH 1/4] [fix] [minor] opportunity to quotation - load price list values --- selling/doctype/opportunity/opportunity.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/selling/doctype/opportunity/opportunity.py b/selling/doctype/opportunity/opportunity.py index a3ef1976d9..b265356a4d 100644 --- a/selling/doctype/opportunity/opportunity.py +++ b/selling/doctype/opportunity/opportunity.py @@ -160,6 +160,11 @@ class DocType(TransactionBase): def make_quotation(source_name, target_doclist=None): from webnotes.model.mapper import get_mapped_doclist + def set_missing_values(source, target): + quotation = webnotes.bean(target) + quotation.run_method("onload_post_render") + quotation.run_method("calculate_taxes_and_totals") + doclist = get_mapped_doclist("Opportunity", source_name, { "Opportunity": { "doctype": "Quotation", @@ -181,6 +186,6 @@ def make_quotation(source_name, target_doclist=None): }, "add_if_empty": True } - }, target_doclist) + }, target_doclist, set_missing_values) return [d.fields for d in doclist] \ No newline at end of file From 2ea7a241a396767a4c56c4a797c3549b0eb7a5da Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Thu, 5 Sep 2013 16:28:45 +0530 Subject: [PATCH 2/4] [fix] purchase receipt test cases --- stock/doctype/purchase_receipt/test_purchase_receipt.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/stock/doctype/purchase_receipt/test_purchase_receipt.py b/stock/doctype/purchase_receipt/test_purchase_receipt.py index e303d7974b..af040231bb 100644 --- a/stock/doctype/purchase_receipt/test_purchase_receipt.py +++ b/stock/doctype/purchase_receipt/test_purchase_receipt.py @@ -95,9 +95,6 @@ class TestPurchaseReceipt(unittest.TestCase): self.assertFalse(webnotes.conn.get_value("Serial No", pr.doclist[1].serial_no, "warehouse")) - - self.assertEqual(webnotes.conn.get_value("Serial No", pr.doclist[1].serial_no, - "status"), "Not Available") From 179e3772c0c331cb6752bbd0f4911928518e2bc2 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 5 Sep 2013 16:53:57 +0530 Subject: [PATCH 3/4] [fix] [minor] item wise taxes --- controllers/accounts_controller.py | 7 ++++++- public/js/transaction.js | 13 ++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/controllers/accounts_controller.py b/controllers/accounts_controller.py index a3dae8e2e8..4ee7e53e15 100644 --- a/controllers/accounts_controller.py +++ b/controllers/accounts_controller.py @@ -291,7 +291,12 @@ class AccountsController(TransactionBase): current_tax_amount = flt(current_tax_amount, self.precision("tax_amount", tax)) # store tax breakup for each item - tax.item_wise_tax_detail[item.item_code or item.item_name] = [tax_rate, current_tax_amount] + key = item.item_code or item.item_name + if tax.item_wise_tax_detail.get(key): + item_wise_tax_amount = tax.item_wise_tax_detail[key][1] + current_tax_amount + tax.item_wise_tax_detail[key] = [tax_rate, item_wise_tax_amount] + else: + tax.item_wise_tax_detail[key] = [tax_rate, current_tax_amount] return current_tax_amount diff --git a/public/js/transaction.js b/public/js/transaction.js index 1d06a9f487..0ff957a820 100644 --- a/public/js/transaction.js +++ b/public/js/transaction.js @@ -338,8 +338,19 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ var headings = $.map([wn._("Item Name")].concat($.map(tax_accounts, function(head) { return head[1]; })), function(head) { return '' + (head || "") + "" }).join("\n"); + + var distinct_item_names = []; + var distinct_items = []; + $.each(this.get_item_doclist(), function(i, item) { + if(distinct_item_names.indexOf(item.item_code || item.item_name)===-1) { + distinct_item_names.push(item.item_code || item.item_name); + distinct_items.push(item); + } + }); - var rows = $.map(this.get_item_doclist(), function(item) { + console.log(distinct_items); + + var rows = $.map(distinct_items, function(item) { var item_tax_record = item_tax[item.item_code || item.item_name]; if(!item_tax_record) { return null; } return repl("%(item_name)s%(taxes)s", { From f6e62c94ffa1d4461581537fe3d10fd97fad87c8 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 5 Sep 2013 17:11:52 +0530 Subject: [PATCH 4/4] [fix] [minor] removed pos view check patch --- patches/patch_list.py | 2 +- .../p02_make_pos_view_checked_in_features_setup.py | 11 ----------- 2 files changed, 1 insertion(+), 12 deletions(-) delete mode 100644 patches/september_2013/p02_make_pos_view_checked_in_features_setup.py diff --git a/patches/patch_list.py b/patches/patch_list.py index f587563599..3c13e0eb47 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -261,6 +261,6 @@ patch_list = [ "execute:webnotes.reload_doc('accounts', 'Print Format', 'POS Invoice') # 2013-09-02", "patches.september_2013.p01_fix_buying_amount_gl_entries", "patches.september_2013.p01_update_communication", - "patches.september_2013.p02_make_pos_view_checked_in_features_setup", + "execute:webnotes.reload_doc('setup', 'doctype', 'features_setup') # 2013-09-05", "patches.september_2013.p02_fix_serial_no_status", ] \ No newline at end of file diff --git a/patches/september_2013/p02_make_pos_view_checked_in_features_setup.py b/patches/september_2013/p02_make_pos_view_checked_in_features_setup.py deleted file mode 100644 index c5e2c7bc60..0000000000 --- a/patches/september_2013/p02_make_pos_view_checked_in_features_setup.py +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -import webnotes - -def execute(): - webnotes.reload_doc("setup", "doctype", "features_setup") - fs = webnotes.bean("Features Setup") - fs.doc.fs_pos_view = 1 - fs.save() \ No newline at end of file