From c6285069dcc9a2c4c5f932af14b30e4c4007fcef Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 30 Mar 2016 13:10:25 +0530 Subject: [PATCH 1/9] [fix] Item query in bom --- erpnext/controllers/queries.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py index eff5f53e18c..91cd0da725f 100644 --- a/erpnext/controllers/queries.py +++ b/erpnext/controllers/queries.py @@ -184,8 +184,8 @@ def item_query(doctype, txt, searchfield, start, page_len, filters): idx desc, name, item_name limit %(start)s, %(page_len)s """.format(key=searchfield, - fcond=get_filters_cond(doctype, filters, conditions), - mcond=get_match_cond(doctype)), + fcond=get_filters_cond(doctype, filters, conditions).replace('%', '%%'), + mcond=get_match_cond(doctype).replace('%', '%%')), { "today": nowdate(), "txt": "%%%s%%" % txt, From 83e61bf368465565fd15fca8023d9db2e0bf7e10 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 1 Apr 2016 11:10:27 +0530 Subject: [PATCH 2/9] [fix] Get query for item in warranty claim --- erpnext/support/doctype/warranty_claim/warranty_claim.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/erpnext/support/doctype/warranty_claim/warranty_claim.js b/erpnext/support/doctype/warranty_claim/warranty_claim.js index 25d65e34a9a..39285779d70 100644 --- a/erpnext/support/doctype/warranty_claim/warranty_claim.js +++ b/erpnext/support/doctype/warranty_claim/warranty_claim.js @@ -85,13 +85,18 @@ cur_frm.add_fetch('item_code', 'description', 'description'); cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) { if(doc.serial_no) { return{ - filters:{ 'serial_no': doc.serial_no} + doctype: "Serial No", + fields: "item_code", + filters:{ + name: doc.serial_no + } } } else{ return{ filters:[ - ['Item', 'docstatus', '!=', 2] + ['Item', 'docstatus', '!=', 2], + ['Item', 'disabled', '=', 0] ] } } From 4f10f156868ca1aff528acddf1cd19e7697cbe2b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 1 Apr 2016 17:59:06 +0530 Subject: [PATCH 3/9] [fix] Modified date changed in query report due to project field renaming --- .../delivered_items_to_be_billed.json | 2 +- .../ordered_items_to_be_billed.json | 2 +- .../purchase_order_items_to_be_billed.json | 2 +- .../received_items_to_be_billed.json | 2 +- .../item_wise_purchase_history.json | 2 +- .../item_wise_sales_history.json | 4 +-- .../items_to_be_requested.json | 30 ++++++++++--------- .../ordered_items_to_be_delivered.json | 2 +- .../purchase_order_items_to_be_received.json | 2 +- 9 files changed, 25 insertions(+), 23 deletions(-) diff --git a/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.json b/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.json index 41b7dd15440..897dec5c800 100644 --- a/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.json +++ b/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.json @@ -7,7 +7,7 @@ "doctype": "Report", "idx": 1, "is_standard": "Yes", - "modified": "2015-11-02 12:32:02.048551", + "modified": "2016-04-01 08:27:10.765516", "modified_by": "Administrator", "module": "Accounts", "name": "Delivered Items To Be Billed", diff --git a/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.json b/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.json index 8f41ac45f01..47b62a84992 100644 --- a/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.json +++ b/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.json @@ -7,7 +7,7 @@ "doctype": "Report", "idx": 1, "is_standard": "Yes", - "modified": "2016-02-23 18:48:42.372321", + "modified": "2016-04-01 08:26:43.868609", "modified_by": "Administrator", "module": "Accounts", "name": "Ordered Items To Be Billed", diff --git a/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.json b/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.json index c5314e60a8e..72e9396d588 100644 --- a/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.json +++ b/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.json @@ -7,7 +7,7 @@ "doctype": "Report", "idx": 1, "is_standard": "Yes", - "modified": "2016-02-23 18:51:21.968327", + "modified": "2016-04-01 08:27:32.122070", "modified_by": "Administrator", "module": "Accounts", "name": "Purchase Order Items To Be Billed", diff --git a/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.json b/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.json index 0b8597d204d..e803a910ecf 100644 --- a/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.json +++ b/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.json @@ -7,7 +7,7 @@ "doctype": "Report", "idx": 1, "is_standard": "Yes", - "modified": "2015-11-02 12:33:11.681513", + "modified": "2016-04-01 08:27:07.033939", "modified_by": "Administrator", "module": "Accounts", "name": "Received Items To Be Billed", diff --git a/erpnext/buying/report/item_wise_purchase_history/item_wise_purchase_history.json b/erpnext/buying/report/item_wise_purchase_history/item_wise_purchase_history.json index c06d33d0b82..4a8d608c99b 100644 --- a/erpnext/buying/report/item_wise_purchase_history/item_wise_purchase_history.json +++ b/erpnext/buying/report/item_wise_purchase_history/item_wise_purchase_history.json @@ -7,7 +7,7 @@ "doctype": "Report", "idx": 1, "is_standard": "Yes", - "modified": "2016-02-22 11:27:39.445257", + "modified": "2016-04-01 08:26:52.361800", "modified_by": "Administrator", "module": "Buying", "name": "Item-wise Purchase History", diff --git a/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.json b/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.json index 4116568ef6b..bd49d0bc939 100644 --- a/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.json +++ b/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.json @@ -7,7 +7,7 @@ "doctype": "Report", "idx": 1, "is_standard": "Yes", - "modified": "2016-01-28 14:59:04.611174", + "modified": "2016-04-01 08:26:55.705992", "modified_by": "Administrator", "module": "Selling", "name": "Item-wise Sales History", @@ -16,4 +16,4 @@ "ref_doctype": "Sales Order", "report_name": "Item-wise Sales History", "report_type": "Query Report" -} +} \ No newline at end of file diff --git a/erpnext/stock/report/items_to_be_requested/items_to_be_requested.json b/erpnext/stock/report/items_to_be_requested/items_to_be_requested.json index 340577beef6..92072a894b7 100644 --- a/erpnext/stock/report/items_to_be_requested/items_to_be_requested.json +++ b/erpnext/stock/report/items_to_be_requested/items_to_be_requested.json @@ -1,17 +1,19 @@ { - "apply_user_permissions": 1, - "creation": "2013-08-20 15:08:10", - "docstatus": 0, - "doctype": "Report", - "idx": 1, - "is_standard": "Yes", - "modified": "2014-06-03 07:18:17.128918", - "modified_by": "Administrator", - "module": "Stock", - "name": "Items To Be Requested", - "owner": "Administrator", + "add_total_row": 0, + "apply_user_permissions": 1, + "creation": "2013-08-20 15:08:10", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 1, + "is_standard": "Yes", + "modified": "2016-04-01 08:27:14.436178", + "modified_by": "Administrator", + "module": "Stock", + "name": "Items To Be Requested", + "owner": "Administrator", "query": "SELECT\n tabBin.item_code as \"Item:Link/Item:120\",\n tabBin.warehouse as \"Warehouse:Link/Warehouse:120\",\n tabBin.actual_qty as \"Actual:Float:90\",\n tabBin.indented_qty as \"Requested:Float:90\",\n tabBin.reserved_qty as \"Reserved:Float:90\",\n tabBin.ordered_qty as \"Ordered:Float:90\",\n tabBin.projected_qty as \"Projected:Float:90\"\nFROM\n tabBin, tabItem\nWHERE\n tabBin.item_code = tabItem.name\n AND tabItem.is_purchase_item = 1\n AND tabBin.projected_qty < 0\nORDER BY\n tabBin.projected_qty ASC", - "ref_doctype": "Item", - "report_name": "Items To Be Requested", + "ref_doctype": "Item", + "report_name": "Items To Be Requested", "report_type": "Query Report" -} +} \ No newline at end of file diff --git a/erpnext/stock/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.json b/erpnext/stock/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.json index 6f857a0b837..4d565193d97 100644 --- a/erpnext/stock/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.json +++ b/erpnext/stock/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.json @@ -7,7 +7,7 @@ "doctype": "Report", "idx": 1, "is_standard": "Yes", - "modified": "2015-11-04 12:00:40.085130", + "modified": "2016-04-01 08:27:03.318987", "modified_by": "Administrator", "module": "Stock", "name": "Ordered Items To Be Delivered", diff --git a/erpnext/stock/report/purchase_order_items_to_be_received/purchase_order_items_to_be_received.json b/erpnext/stock/report/purchase_order_items_to_be_received/purchase_order_items_to_be_received.json index d62bf76a577..fd78f28bb1b 100644 --- a/erpnext/stock/report/purchase_order_items_to_be_received/purchase_order_items_to_be_received.json +++ b/erpnext/stock/report/purchase_order_items_to_be_received/purchase_order_items_to_be_received.json @@ -7,7 +7,7 @@ "doctype": "Report", "idx": 1, "is_standard": "Yes", - "modified": "2015-11-04 12:01:22.108641", + "modified": "2016-04-01 08:26:59.904034", "modified_by": "Administrator", "module": "Stock", "name": "Purchase Order Items To Be Received", From da7d1667d5ebffff364268ef95e3cffe8341906d Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 4 Apr 2016 12:36:52 +0530 Subject: [PATCH 4/9] [travis] --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index cb3dd5e4b2c..12a73c9b855 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,9 +23,6 @@ script: - cd ~/frappe-bench - bench get-app erpnext $TRAVIS_BUILD_DIR - bench use test_site - - bench setup redis-cache - - bench setup redis-async-broker - - bench setup procfile --with-celery-broker - bench reinstall - bench build - bench build-website From 08b39b1ff8219bf36a28110be7d04c088d6d9c54 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 4 Apr 2016 13:16:56 +0530 Subject: [PATCH 5/9] [fix] escape fg_item in production planning's get_so_items --- .../production_planning_tool.py | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py index b79b136f8c8..e4246957467 100644 --- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py +++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py @@ -71,7 +71,7 @@ class ProductionPlanningTool(Document): pp_so.sales_order_date = cstr(r['transaction_date']) pp_so.customer = cstr(r['customer']) pp_so.grand_total = flt(r['base_grand_total']) - + def get_pending_material_requests(self): """ Pull Material Requests that are pending based on criteria selected""" mr_filter = item_filter = "" @@ -81,7 +81,7 @@ class ProductionPlanningTool(Document): mr_filter += " and mr.transaction_date <= %(to_date)s" if self.warehouse: mr_filter += " and mr_item.warehouse = %(warehouse)s" - + if self.fg_item: item_filter += " and item.name = %(item)s" @@ -102,7 +102,7 @@ class ProductionPlanningTool(Document): }, as_dict=1) self.add_mr_in_table(pending_mr) - + def add_mr_in_table(self, pending_mr): """ Add Material Requests in the table""" self.clear_table("material_requests") @@ -119,7 +119,7 @@ class ProductionPlanningTool(Document): self.get_so_items() elif self.get_items_from == "Material Request": self.get_mr_items() - + def get_so_items(self): so_list = [d.sales_order for d in self.get('sales_orders') if d.sales_order] if not so_list: @@ -128,7 +128,7 @@ class ProductionPlanningTool(Document): item_condition = "" if self.fg_item: - item_condition = ' and so_item.item_code = "' + self.fg_item + '"' + item_condition = ' and so_item.item_code = "{0}"'.format(frappe.db.escape(self.fg_item)) items = frappe.db.sql("""select distinct parent, item_code, warehouse, (qty - delivered_qty) as pending_qty @@ -139,7 +139,7 @@ class ProductionPlanningTool(Document): (", ".join(["%s"] * len(so_list)), item_condition), tuple(so_list), as_dict=1) if self.fg_item: - item_condition = ' and pi.item_code = "' + self.fg_item + '"' + item_condition = ' and pi.item_code = "{0}"'.format(frappe.db.escape(self.fg_item)) packed_items = frappe.db.sql("""select distinct pi.parent, pi.item_code, pi.warehouse as warehouse, (((so_item.qty - so_item.delivered_qty) * pi.qty) / so_item.qty) @@ -153,7 +153,7 @@ class ProductionPlanningTool(Document): (", ".join(["%s"] * len(so_list)), item_condition), tuple(so_list), as_dict=1) self.add_items(items + packed_items) - + def get_mr_items(self): mr_list = [d.material_request for d in self.get('material_requests') if d.material_request] if not mr_list: @@ -173,7 +173,7 @@ class ProductionPlanningTool(Document): (", ".join(["%s"] * len(mr_list)), item_condition), tuple(mr_list), as_dict=1) self.add_items(items) - + def add_items(self, items): self.clear_table("items") @@ -187,13 +187,13 @@ class ProductionPlanningTool(Document): pi.bom_no = item_details and item_details.bom_no or '' pi.planned_qty = flt(p['pending_qty']) pi.pending_qty = flt(p['pending_qty']) - + if self.get_items_from == "Sales Order": pi.sales_order = p['parent'] elif self.get_items_from == "Material Request": pi.material_request = p['parent'] pi.material_request_item = p['name'] - + def validate_data(self): self.validate_company() for d in self.get('items'): @@ -201,7 +201,7 @@ class ProductionPlanningTool(Document): frappe.throw(_("Please select BOM for Item in Row {0}".format(d.idx))) else: validate_bom_no(d.item_code, d.bom_no) - + if not flt(d.planned_qty): frappe.throw(_("Please enter Planned Qty for Item {0} at row {1}").format(d.item_code, d.idx)) @@ -213,17 +213,17 @@ class ProductionPlanningTool(Document): validate_uom_is_integer(self, "stock_uom", "planned_qty") items = self.get_production_items() - + pro_list = [] frappe.flags.mute_messages = True - + for key in items: production_order = self.create_production_order(items[key]) if production_order: pro_list.append(production_order) - + frappe.flags.mute_messages = False - + if pro_list: pro_list = ["""%s""" % \ (p, p) for p in pro_list] @@ -247,14 +247,14 @@ class ProductionPlanningTool(Document): "fg_warehouse" : d.warehouse, "status" : "Draft", } - + """ Club similar BOM and item for processing in case of Sales Orders """ if self.get_items_from == "Material Request": item_details.update({ "qty": d.planned_qty }) item_dict[(d.item_code, d.material_request_item, d.warehouse)] = item_details - + else: item_details.update({ "qty":flt(item_dict.get((d.item_code, d.sales_order, d.warehouse),{}) @@ -275,7 +275,7 @@ class ProductionPlanningTool(Document): pro.wip_warehouse = warehouse.get('wip_warehouse') if not pro.fg_warehouse: pro.fg_warehouse = warehouse.get('fg_warehouse') - + try: pro.insert() return pro.name @@ -283,7 +283,7 @@ class ProductionPlanningTool(Document): pass def get_so_wise_planned_qty(self): - """ + """ bom_dict { bom_no: ['sales_order', 'qty'] } @@ -295,7 +295,7 @@ class ProductionPlanningTool(Document): else: bom_dict.setdefault(d.bom_no, []).append([d.sales_order, flt(d.planned_qty)]) return bom_dict - + def download_raw_materials(self): """ Create csv data for required raw material to produce finished goods""" self.validate_data() From 15f7b1ee1a4eb7965731d338817e387a7f4d80e2 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 4 Apr 2016 15:03:28 +0530 Subject: [PATCH 6/9] [fix] POS paid amount validation using grand total --- .../doctype/sales_invoice/sales_invoice.py | 4 +-- erpnext/controllers/taxes_and_totals.py | 34 ++++++++++--------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 2d45abefda0..a1144f26f2e 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -375,7 +375,7 @@ class SalesInvoice(SellingController): frappe.throw(_("Cash or Bank Account is mandatory for making payment entry")) if flt(self.paid_amount) + flt(self.write_off_amount) \ - - flt(self.base_grand_total) > 1/(10**(self.precision("base_grand_total") + 1)): + - flt(self.grand_total) > 1/(10**(self.precision("grand_total") + 1)): frappe.throw(_("""Paid amount + Write Off Amount can not be greater than Grand Total""")) @@ -471,7 +471,7 @@ class SalesInvoice(SellingController): frappe.db.set(self,'paid_amount',0) frappe.db.set(self, 'base_paid_amount', - flt(self.paid_amount*self.conversion_rate, self.precision("base_paid_amount"))) + flt(self.paid_amount*self.conversion_rate, self.precision("base_paid_amount"))) def check_prev_docstatus(self): for d in self.get('items'): diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py index d4a64f2e7f0..49e0bd37087 100644 --- a/erpnext/controllers/taxes_and_totals.py +++ b/erpnext/controllers/taxes_and_totals.py @@ -283,8 +283,8 @@ class calculate_taxes_and_totals(object): last_tax.tax_amount += diff last_tax.tax_amount_after_discount_amount += diff last_tax.total += diff - - self._set_in_company_currency(last_tax, + + self._set_in_company_currency(last_tax, ["total", "tax_amount", "tax_amount_after_discount_amount"]) def calculate_totals(self): @@ -319,22 +319,22 @@ class calculate_taxes_and_totals(object): self.doc.round_floats_in(self.doc, ["grand_total", "base_grand_total"]) if self.doc.meta.get_field("rounded_total"): - self.doc.rounded_total = round_based_on_smallest_currency_fraction(self.doc.grand_total, + self.doc.rounded_total = round_based_on_smallest_currency_fraction(self.doc.grand_total, self.doc.currency, self.doc.precision("rounded_total")) if self.doc.meta.get_field("base_rounded_total"): company_currency = get_company_currency(self.doc.company) - + self.doc.base_rounded_total = \ - round_based_on_smallest_currency_fraction(self.doc.base_grand_total, + round_based_on_smallest_currency_fraction(self.doc.base_grand_total, company_currency, self.doc.precision("base_rounded_total")) def _cleanup(self): for tax in self.doc.get("taxes"): tax.item_wise_tax_detail = json.dumps(tax.item_wise_tax_detail, separators=(',', ':')) - + def set_discount_amount(self): if not self.doc.discount_amount and self.doc.additional_discount_percentage: - self.doc.discount_amount = flt(flt(self.doc.get(scrub(self.doc.apply_discount_on))) + self.doc.discount_amount = flt(flt(self.doc.get(scrub(self.doc.apply_discount_on))) * self.doc.additional_discount_percentage / 100, self.doc.precision("discount_amount")) def apply_discount_amount(self): @@ -397,13 +397,13 @@ class calculate_taxes_and_totals(object): for adv in self.doc.get("advances")]) self.doc.total_advance = flt(total_allocated_amount, self.doc.precision("total_advance")) - + if self.doc.party_account_currency == self.doc.currency: invoice_total = self.doc.grand_total else: - invoice_total = flt(self.doc.grand_total * self.doc.conversion_rate, + invoice_total = flt(self.doc.grand_total * self.doc.conversion_rate, self.doc.precision("grand_total")) - + if invoice_total > 0 and self.doc.total_advance > invoice_total: frappe.throw(_("Advance amount cannot be greater than {0} {1}") .format(self.doc.party_account_currency, invoice_total)) @@ -417,21 +417,23 @@ class calculate_taxes_and_totals(object): # total_advance is only for non POS Invoice if self.doc.is_return: return - + self.doc.round_floats_in(self.doc, ["grand_total", "total_advance", "write_off_amount"]) + self._set_in_company_currency(self.doc, ['write_off_amount']) + if self.doc.party_account_currency == self.doc.currency: - total_amount_to_pay = flt(self.doc.grand_total - self.doc.total_advance + total_amount_to_pay = flt(self.doc.grand_total - self.doc.total_advance - flt(self.doc.write_off_amount), self.doc.precision("grand_total")) else: total_amount_to_pay = flt(flt(self.doc.grand_total * - self.doc.conversion_rate, self.doc.precision("grand_total")) - self.doc.total_advance + self.doc.conversion_rate, self.doc.precision("grand_total")) - self.doc.total_advance - flt(self.doc.base_write_off_amount), self.doc.precision("grand_total")) - + if self.doc.doctype == "Sales Invoice": self.doc.round_floats_in(self.doc, ["paid_amount"]) paid_amount = self.doc.paid_amount \ if self.doc.party_account_currency == self.doc.currency else self.doc.base_paid_amount - self.doc.outstanding_amount = flt(total_amount_to_pay - flt(paid_amount), + self.doc.outstanding_amount = flt(total_amount_to_pay - flt(paid_amount), self.doc.precision("outstanding_amount")) elif self.doc.doctype == "Purchase Invoice": - self.doc.outstanding_amount = flt(total_amount_to_pay, self.doc.precision("outstanding_amount")) \ No newline at end of file + self.doc.outstanding_amount = flt(total_amount_to_pay, self.doc.precision("outstanding_amount")) From c6b47bcdda493e666ac170e0b487673eed16b878 Mon Sep 17 00:00:00 2001 From: shreyas Date: Mon, 4 Apr 2016 15:13:03 +0530 Subject: [PATCH 7/9] [Fix] Show amount in credit note print format --- .../doctype/journal_entry/journal_entry.py | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 74b749a0179..aaf3318f86a 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -353,25 +353,31 @@ class JournalEntry(AccountsController): self.remark = ("\n").join(r) #User Remarks is not mandatory def set_print_format_fields(self): - total_amount = 0.0 - bank_account_currency = None - pay_to_recd_from = None + bank_amount = party_amount = total_amount = 0.0 + currency = bank_account_currency = party_account_currency = pay_to_recd_from= None for d in self.get('accounts'): if d.party_type and d.party: if not pay_to_recd_from: pay_to_recd_from = frappe.db.get_value(d.party_type, d.party, "customer_name" if d.party_type=="Customer" else "supplier_name") + party_amount += (d.debit_in_account_currency or d.credit_in_account_currency) + party_account_currency = d.account_currency + elif frappe.db.get_value("Account", d.account, "account_type") in ["Bank", "Cash"]: - total_amount += (d.debit_in_account_currency or d.credit_in_account_currency) + bank_amount += (d.debit_in_account_currency or d.credit_in_account_currency) bank_account_currency = d.account_currency if pay_to_recd_from: self.pay_to_recd_from = pay_to_recd_from - else: - total_amount = 0 + if bank_amount: + total_amount = bank_amount + currency = bank_account_currency + else: + total_amount = party_amount + currency = party_account_currency - self.set_total_amount(total_amount, bank_account_currency) + self.set_total_amount(total_amount, currency) def set_total_amount(self, amt, currency): self.total_amount = amt @@ -664,7 +670,7 @@ def get_payment_entry(ref_doc, args): bank_row.cost_center = cost_center amount = args.get("debit_in_account_currency") or args.get("amount") - + if bank_row.account_currency == args.get("party_account_currency"): bank_row.set(args.get("amount_field_bank"), amount) else: From 94360cca20047da1c725670b1d6a6b663ae3e364 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 1 Apr 2016 19:08:47 +0530 Subject: [PATCH 8/9] [fix] received and delivered items to be billed report based on percentage billed --- .../delivered_items_to_be_billed.json | 4 ++-- .../received_items_to_be_billed.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.json b/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.json index 897dec5c800..691a5c30cc6 100644 --- a/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.json +++ b/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.json @@ -7,12 +7,12 @@ "doctype": "Report", "idx": 1, "is_standard": "Yes", - "modified": "2016-04-01 08:27:10.765516", + "modified": "2016-04-04 17:27:19.104519", "modified_by": "Administrator", "module": "Accounts", "name": "Delivered Items To Be Billed", "owner": "Administrator", - "query": "select\n `tabDelivery Note`.`name` as \"Delivery Note:Link/Delivery Note:120\",\n\t`tabDelivery Note`.`customer` as \"Customer:Link/Customer:120\",\n\t`tabDelivery Note`.`posting_date` as \"Date:Date\",\n\t`tabDelivery Note`.`project` as \"Project\",\n\t`tabDelivery Note Item`.`item_code` as \"Item:Link/Item:120\",\n\t(`tabDelivery Note Item`.`qty` - ifnull((select sum(qty) from `tabSales Invoice Item` \n\t where `tabSales Invoice Item`.docstatus=1 and \n `tabSales Invoice Item`.delivery_note = `tabDelivery Note`.name and\n\t `tabSales Invoice Item`.dn_detail = `tabDelivery Note Item`.name), 0))\n\t\tas \"Qty:Float:110\",\n\t(`tabDelivery Note Item`.`base_amount` - ifnull((select sum(base_amount) from `tabSales Invoice Item` \n where `tabSales Invoice Item`.docstatus=1 and \n `tabSales Invoice Item`.delivery_note = `tabDelivery Note`.name and\n `tabSales Invoice Item`.dn_detail = `tabDelivery Note Item`.name), 0))\n\t\tas \"Amount:Currency:110\",\n\t`tabDelivery Note Item`.`item_name` as \"Item Name::150\",\n\t`tabDelivery Note Item`.`description` as \"Description::200\",\n\t`tabDelivery Note`.`company` as \"Company:Link/Company:\"\nfrom `tabDelivery Note`, `tabDelivery Note Item`\nwhere\n `tabDelivery Note`.docstatus = 1 and\n\t`tabDelivery Note`.`status` not in (\"Stopped\", \"Closed\") and\n `tabDelivery Note`.name = `tabDelivery Note Item`.parent and\n (`tabDelivery Note Item`.qty > ifnull((select sum(qty) from `tabSales Invoice Item` \n where `tabSales Invoice Item`.docstatus=1 and \n `tabSales Invoice Item`.delivery_note = `tabDelivery Note`.name and\n `tabSales Invoice Item`.dn_detail = `tabDelivery Note Item`.name), 0))\norder by `tabDelivery Note`.`name` desc", + "query": "select\n `tabDelivery Note`.`name` as \"Delivery Note:Link/Delivery Note:120\",\n\t`tabDelivery Note`.`customer` as \"Customer:Link/Customer:120\",\n\t`tabDelivery Note`.`posting_date` as \"Date:Date\",\n\t`tabDelivery Note`.`project` as \"Project\",\n\t`tabDelivery Note Item`.`item_code` as \"Item:Link/Item:120\",\n\t`tabDelivery Note Item`.`billed_amt` as \"Pending Amount:Currency:110\",\n\t`tabDelivery Note Item`.`item_name` as \"Item Name::150\",\n\t`tabDelivery Note Item`.`description` as \"Description::200\",\n\t`tabDelivery Note`.`company` as \"Company:Link/Company:\"\nfrom `tabDelivery Note`, `tabDelivery Note Item`\nwhere\n `tabDelivery Note`.docstatus = 1 and\n\t`tabDelivery Note`.`status` not in (\"Stopped\", \"Closed\") and\n `tabDelivery Note`.name = `tabDelivery Note Item`.parent and\n `tabDelivery Note`.per_billed < 100\norder by `tabDelivery Note`.`name` desc", "ref_doctype": "Sales Invoice", "report_name": "Delivered Items To Be Billed", "report_type": "Query Report" diff --git a/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.json b/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.json index e803a910ecf..c38a7bb5955 100644 --- a/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.json +++ b/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.json @@ -7,12 +7,12 @@ "doctype": "Report", "idx": 1, "is_standard": "Yes", - "modified": "2016-04-01 08:27:07.033939", + "modified": "2016-04-04 17:27:29.449124", "modified_by": "Administrator", "module": "Accounts", "name": "Received Items To Be Billed", "owner": "Administrator", - "query": "select\n `tabPurchase Receipt`.`name` as \"Purchase Receipt:Link/Purchase Receipt:120\",\n `tabPurchase Receipt`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Receipt`.`posting_date` as \"Date:Date\",\n\t`tabPurchase Receipt Item`.`project` as \"Project\",\n\t`tabPurchase Receipt Item`.`item_code` as \"Item:Link/Item:120\",\n\t(`tabPurchase Receipt Item`.`qty` - ifnull((select sum(qty) from `tabPurchase Invoice Item` \n\t where `tabPurchase Invoice Item`.purchase_receipt = `tabPurchase Receipt`.name and\n `tabPurchase Invoice Item`.docstatus = 1 and\n\t `tabPurchase Invoice Item`.pr_detail = `tabPurchase Receipt Item`.name), 0))\n\t as \"Qty:Float:110\",\n\t(`tabPurchase Receipt Item`.`base_amount` - ifnull((select sum(base_amount) \n from `tabPurchase Invoice Item` \n where `tabPurchase Invoice Item`.purchase_receipt = `tabPurchase Receipt`.name and\n `tabPurchase Invoice Item`.docstatus = 1 and\n `tabPurchase Invoice Item`.pr_detail = `tabPurchase Receipt Item`.name), 0))\n\t as \"Amount:Currency:110\",\n\t`tabPurchase Receipt Item`.`item_name` as \"Item Name::150\",\n\t`tabPurchase Receipt Item`.`description` as \"Description::200\",\n\t`tabPurchase Receipt`.`company` as \"Company:Link/Company:\"\nfrom `tabPurchase Receipt`, `tabPurchase Receipt Item`\nwhere\n `tabPurchase Receipt`.docstatus = 1 and `tabPurchase Receipt`.status != \"Closed\" and \n `tabPurchase Receipt`.name = `tabPurchase Receipt Item`.parent and\n (`tabPurchase Receipt Item`.qty > ifnull((select sum(qty) from `tabPurchase Invoice Item` \n where `tabPurchase Invoice Item`.purchase_receipt = `tabPurchase Receipt`.name and\n `tabPurchase Invoice Item`.docstatus=1 and \n `tabPurchase Invoice Item`.pr_detail = `tabPurchase Receipt Item`.name), 0))\norder by `tabPurchase Receipt`.`name` desc", + "query": "select\n `tabPurchase Receipt`.`name` as \"Purchase Receipt:Link/Purchase Receipt:120\",\n `tabPurchase Receipt`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Receipt`.`posting_date` as \"Date:Date\",\n\t`tabPurchase Receipt Item`.`project` as \"Project\",\n\t`tabPurchase Receipt Item`.`item_code` as \"Item:Link/Item:120\",\n\t`tabPurchase Receipt Item`.`billed_amt` as \"Pending Amount:Currency:110\",\n\t`tabPurchase Receipt Item`.`item_name` as \"Item Name::150\",\n\t`tabPurchase Receipt Item`.`description` as \"Description::200\",\n\t`tabPurchase Receipt`.`company` as \"Company:Link/Company:\"\nfrom `tabPurchase Receipt`, `tabPurchase Receipt Item`\nwhere\n `tabPurchase Receipt`.docstatus = 1 and `tabPurchase Receipt`.status != \"Closed\" and \n `tabPurchase Receipt`.name = `tabPurchase Receipt Item`.parent and\n `tabPurchase Receipt`.per_billed < 100\norder by `tabPurchase Receipt`.`name` desc", "ref_doctype": "Purchase Invoice", "report_name": "Received Items To Be Billed", "report_type": "Query Report" From bcbfeb0d53a85b285588444376a5410864d0f377 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 4 Apr 2016 18:24:48 +0600 Subject: [PATCH 9/9] bumped to version 6.27.6 --- erpnext/__version__.py | 2 +- erpnext/hooks.py | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/__version__.py b/erpnext/__version__.py index 9ebc832a59c..8bad8a4ec4b 100644 --- a/erpnext/__version__.py +++ b/erpnext/__version__.py @@ -1,2 +1,2 @@ from __future__ import unicode_literals -__version__ = '6.27.5' +__version__ = '6.27.6' diff --git a/erpnext/hooks.py b/erpnext/hooks.py index fd54dd72840..b25566a06f7 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -7,7 +7,7 @@ app_publisher = "Frappe Technologies Pvt. Ltd." app_description = """ERP made simple""" app_icon = "icon-th" app_color = "#e74c3c" -app_version = "6.27.5" +app_version = "6.27.6" app_email = "info@erpnext.com" app_license = "GNU General Public License (v3)" source_link = "https://github.com/frappe/erpnext" diff --git a/setup.py b/setup.py index 581e0655652..21398ccff40 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages from pip.req import parse_requirements -version = "6.27.5" +version = "6.27.6" requirements = parse_requirements("requirements.txt", session="") setup(