From 2b87d100fa9d71acece3cab5945869bd58314fed Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 28 Sep 2017 15:21:36 +0530 Subject: [PATCH 01/13] [fix] https://github.com/frappe/erpnext/issues/10956 --- .../monthly_attendance_sheet/monthly_attendance_sheet.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py b/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py index bb200a997e..698c4fbd7c 100644 --- a/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py +++ b/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py @@ -36,7 +36,7 @@ def execute(filters=None): status_map = {"Present": "P", "Absent": "A", "Half Day": "HD", "On Leave": "L", "None": "", "Holiday":"H"} if status == "None" and holiday_map: emp_holiday_list = emp_det.holiday_list if emp_det.holiday_list else default_holiday_list - if (day+1) in holiday_map[emp_holiday_list]: + if emp_holiday_list in holiday_map and (day+1) in holiday_map[emp_holiday_list]: status = "Holiday" row.append(status_map[status]) @@ -45,7 +45,7 @@ def execute(filters=None): elif status == "Absent": total_a += 1 elif status == "On Leave": - total_l += 1 + total_l += 1 elif status == "Half Day": total_p += 0.5 total_a += 0.5 From 3c14c5a16c060792f872ddd658245040c34efdfa Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 29 Sep 2017 13:21:22 +0530 Subject: [PATCH 02/13] [fix] tax_rule.py args --- erpnext/accounts/party.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index ba7ae323d4..69f40f8b25 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -320,11 +320,15 @@ def set_taxes(party, party_type, posting_date, company, customer_group=None, sup from erpnext.accounts.doctype.tax_rule.tax_rule import get_tax_template, get_party_details args = { party_type.lower(): party, - "customer_group": customer_group, - "supplier_type": supplier_type, "company": company } + if customer_group: + args['customer_group'] = customer_group + + if supplier_type: + args['supplier_type'] = supplier_type + if billing_address or shipping_address: args.update(get_party_details(party, party_type, {"billing_address": billing_address, \ "shipping_address": shipping_address })) From 367b90e3ae9162d9d06dfb90136c617ebc0ad6a6 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Fri, 29 Sep 2017 15:17:48 +0530 Subject: [PATCH 03/13] Add Data Import Tool desktop icon (#10916) fixes #8332 --- erpnext/config/desktop.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/erpnext/config/desktop.py b/erpnext/config/desktop.py index ef1ff103fa..8fb66b1b70 100644 --- a/erpnext/config/desktop.py +++ b/erpnext/config/desktop.py @@ -268,5 +268,13 @@ def get_data(): "icon": "octicon octicon-plus", "type": "module", "label": _("Healthcare") - } + }, + { + "module_name": "Data Import Tool", + "color": "#7f8c8d", + "icon": "octicon octicon-circuit-board", + "type": "page", + "link": "data-import-tool", + "label": _("Data Import Tool") + }, ] From 3f7d96ecba62b9f9d148a8f499f49e8b55beadfb Mon Sep 17 00:00:00 2001 From: Shridhar Patil Date: Fri, 29 Sep 2017 15:18:43 +0530 Subject: [PATCH 04/13] Unassign from todo. (#10896) Unassign from todo when the status is changed to Closed or Cancelled --- erpnext/projects/doctype/task/task.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/erpnext/projects/doctype/task/task.py b/erpnext/projects/doctype/task/task.py index 43240b20e7..52ae132078 100644 --- a/erpnext/projects/doctype/task/task.py +++ b/erpnext/projects/doctype/task/task.py @@ -47,7 +47,7 @@ class Task(Document): from frappe.desk.form.assign_to import clear clear(self.doctype, self.name) - + def validate_progress(self): if self.progress > 100: frappe.throw(_("Progress % for a task cannot be more than 100.")) @@ -63,6 +63,12 @@ class Task(Document): self.check_recursion() self.reschedule_dependent_tasks() self.update_project() + self.unassign_todo() + + def unassign_todo(self): + if self.status == "Closed" or self.status == "Cancelled": + from frappe.desk.form.assign_to import clear + clear(self.doctype, self.name) def update_total_expense_claim(self): self.total_expense_claim = frappe.db.sql("""select sum(total_sanctioned_amount) from `tabExpense Claim` @@ -120,7 +126,7 @@ class Task(Document): def has_webform_permission(doc): project_user = frappe.db.get_value("Project User", {"parent": doc.project, "user":frappe.session.user} , "user") if project_user: - return True + return True @frappe.whitelist() def get_events(start, end, filters=None): @@ -154,7 +160,7 @@ def get_project(doctype, txt, searchfield, start, page_len, filters): order by name limit %(start)s, %(page_len)s """ % {'key': searchfield, 'txt': "%%%s%%" % frappe.db.escape(txt), 'mcond':get_match_cond(doctype), - 'start': start, 'page_len': page_len}) + 'start': start, 'page_len': page_len}) @frappe.whitelist() @@ -170,4 +176,5 @@ def set_tasks_as_overdue(): where exp_end_date is not null and exp_end_date < CURDATE() and `status` not in ('Closed', 'Cancelled')""") - + + From 1b61dfd9eadc78fdfef9d60f2f6656ef099d8b2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Rold=C3=A1n?= Date: Fri, 29 Sep 2017 06:49:12 -0300 Subject: [PATCH 05/13] translated (#10886) --- .../emails/recurring_document_failed.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/erpnext/templates/emails/recurring_document_failed.html b/erpnext/templates/emails/recurring_document_failed.html index ea48034f41..27c43bc0fc 100644 --- a/erpnext/templates/emails/recurring_document_failed.html +++ b/erpnext/templates/emails/recurring_document_failed.html @@ -1,11 +1,11 @@

{{_("Recurring")}} {{ type }} {{ _("Failed")}}

-

An error occured while creating recurring {{ type }} {{ name }} for {{ party }}.

-

This could be because of some invalid Email Addresses in the {{ type }}.

-

To stop sending repetitive error notifications from the system, we have checked "Disabled" field in the subscription {{ subscription}} for the {{ type }} {{ name }}.

-

Please correct the {{ type }} and unchcked "Disabled" in the {{ subscription }} for making recurring again.

+

{{_("An error occured while creating recurring")}} {{ type }} {{ name }} {{_("for")}} {{ party }}.

+

{{_("This could be because of some invalid Email Addresses in the")}} {{ type }}.

+

{{_("To stop sending repetitive error notifications from the system, we have checked "Disabled" field in the subscription")}} {{ subscription}} {{_("for the")}} {{ type }} {{ name }}.

+

{{_("Please correct the")}} {{ type }} {{_('and unchcked "Disabled" in the')}} {{ subscription }} {{_("for making recurring again.")}}


-

It is necessary to take this action today itself for the above mentioned recurring {{ type }} -to be generated. If delayed, you will have to manually change the "Repeat on Day of Month" field -of this {{ type }} for generating the recurring {{ type }} in the subscription {{ subscription }}.

-

[This email is autogenerated]

+

{{_("It is necessary to take this action today itself for the above mentioned recurring")}} {{ type }} +{{_('to be generated. If delayed, you will have to manually change the "Repeat on Day of Month" field +of this')}} {{ type }} {{_("for generating the recurring")}} {{ type }} {{_("in the subscription")}} {{ subscription }}.

+

[{{_("This email is autogenerated")}}]

From b79c4a9ff639e5ec6001bb87c84c8256e8902bb3 Mon Sep 17 00:00:00 2001 From: Shreya Shah Date: Fri, 29 Sep 2017 15:20:48 +0530 Subject: [PATCH 06/13] Getting last purchase price of an item (#10897) * Added a column last purchase rate * Removed button last purchase rate * Get last purchase rate on adding an item * Added test case for last purchase rate * Replaced cur_frm with frm * Update purchase_order.js --- .../doctype/purchase_order/purchase_order.js | 24 ++--- .../purchase_order/purchase_order.json | 33 +------ .../doctype/purchase_order/purchase_order.py | 5 +- ..._purchase_order_with_last_purchase_rate.js | 99 +++++++++++++++++++ .../purchase_order_item.json | 33 ++++++- erpnext/tests/ui/tests.txt | 1 + 6 files changed, 148 insertions(+), 47 deletions(-) create mode 100644 erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_last_purchase_rate.js diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js index a51246bcb8..8134e7e701 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order.js @@ -1,3 +1,4 @@ + // Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors // License: GNU General Public License v3. See license.txt @@ -24,6 +25,18 @@ frappe.ui.form.on("Purchase Order", { }, }); +frappe.ui.form.on("Purchase Order Item", { + item_code: function(frm) { + frappe.call({ + method: "get_last_purchase_rate", + doc: frm.doc, + callback: function(r, rt) { + frm.trigger('calculate_taxes_and_totals'); + } + }) + } +}); + erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend({ refresh: function(doc, cdt, cdn) { var me = this; @@ -214,17 +227,6 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( delivered_by_supplier: function(){ cur_frm.cscript.update_status('Deliver', 'Delivered') - }, - - get_last_purchase_rate: function() { - frappe.call({ - "method": "get_last_purchase_rate", - "doc": cur_frm.doc, - callback: function(r, rt) { - cur_frm.dirty(); - cur_frm.cscript.calculate_taxes_and_totals(); - } - }) } }); diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index 919707c08d..07a80b87bd 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -1206,37 +1206,6 @@ "set_only_once": 0, "unique": 0 }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:doc.docstatus===0 && (doc.items && doc.items.length)", - "fieldname": "get_last_purchase_rate", - "fieldtype": "Button", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Get last purchase rate", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -3458,7 +3427,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-09-19 11:22:30.190589", + "modified": "2017-09-22 16:11:49.856808", "modified_by": "Administrator", "module": "Buying", "name": "Purchase Order", diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py index 56f3059f2e..e2f5a9dca8 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/purchase_order.py @@ -116,14 +116,13 @@ class PurchaseOrder(BuyingController): d.discount_percentage = last_purchase_details['discount_percentage'] d.base_rate = last_purchase_details['base_rate'] * (flt(d.conversion_factor) or 1.0) d.price_list_rate = d.base_price_list_rate / conversion_rate - d.rate = d.base_rate / conversion_rate + d.last_purchase_rate = d.base_rate / conversion_rate else: - msgprint(_("Last purchase rate not found")) item_last_purchase_rate = frappe.db.get_value("Item", d.item_code, "last_purchase_rate") if item_last_purchase_rate: d.base_price_list_rate = d.base_rate = d.price_list_rate \ - = d.rate = item_last_purchase_rate + = d.last_purchase_rate = item_last_purchase_rate # Check for Closed status def check_for_closed_status(self): diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_last_purchase_rate.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_last_purchase_rate.js new file mode 100644 index 0000000000..d19f017425 --- /dev/null +++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_last_purchase_rate.js @@ -0,0 +1,99 @@ +QUnit.module('Buying'); + +QUnit.test("test: purchase order with last purchase rate", function(assert) { + assert.expect(5); + let done = assert.async(); + + frappe.run_serially([ + () => { + return frappe.tests.make('Purchase Order', [ + {supplier: 'Test Supplier'}, + {is_subcontracted: 'No'}, + {currency: 'INR'}, + {items: [ + [ + {"item_code": 'Test Product 4'}, + {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, + {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, + {"qty": 1}, + {"rate": 800}, + {"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default("Company"))} + ], + [ + {"item_code": 'Test Product 1'}, + {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, + {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, + {"qty": 1}, + {"rate": 400}, + {"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default("Company"))} + ] + ]} + ]); + }, + + () => { + // Get item details + assert.ok(cur_frm.doc.items[0].item_name == 'Test Product 4', "Item 1 name correct"); + assert.ok(cur_frm.doc.items[1].item_name == 'Test Product 1', "Item 2 name correct"); + }, + + () => frappe.timeout(1), + + () => frappe.tests.click_button('Submit'), + () => frappe.tests.click_button('Yes'), + () => frappe.timeout(3), + + () => frappe.tests.click_button('Close'), + () => frappe.timeout(1), + + () => { + return frappe.tests.make('Purchase Order', [ + {supplier: 'Test Supplier'}, + {is_subcontracted: 'No'}, + {currency: 'INR'}, + {items: [ + [ + {"item_code": 'Test Product 4'}, + {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, + {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, + {"qty": 1}, + {"rate": 600}, + {"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default("Company"))} + ], + [ + {"item_code": 'Test Product 1'}, + {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, + {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, + {"qty": 1}, + {"rate": 200}, + {"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default("Company"))} + ] + ]} + ]); + }, + + () => frappe.timeout(2), + + // Get the last purchase rate of items + () => { + assert.ok(cur_frm.doc.items[0].last_purchase_rate == 800, "Last purchase rate of item 1 correct"); + }, + () => { + assert.ok(cur_frm.doc.items[1].last_purchase_rate == 400, "Last purchase rate of item 2 correct"); + }, + + () => frappe.tests.click_button('Submit'), + () => frappe.tests.click_button('Yes'), + () => frappe.timeout(3), + + () => frappe.tests.click_button('Close'), + + () => frappe.timeout(1), + + () => { + assert.ok(cur_frm.doc.status == 'To Receive and Bill', "Submitted successfully"); + }, + + () => done() + ]); +}); \ No newline at end of file diff --git a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json index 2dd7b6c0ed..1ddce628a2 100755 --- a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json +++ b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json @@ -655,6 +655,37 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "last_purchase_rate", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Last Purchase Rate", + "length": 0, + "no_copy": 0, + "options": "currency", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -1714,7 +1745,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2017-08-02 22:15:47.411235", + "modified": "2017-09-22 16:47:08.783546", "modified_by": "Administrator", "module": "Buying", "name": "Purchase Order Item", diff --git a/erpnext/tests/ui/tests.txt b/erpnext/tests/ui/tests.txt index 909216b92e..199d886deb 100644 --- a/erpnext/tests/ui/tests.txt +++ b/erpnext/tests/ui/tests.txt @@ -128,3 +128,4 @@ erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_material_issue_with erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_repack.js erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_serialize_item.js erpnext/accounts/doctype/payment_entry/tests/test_payment_against_invoice.js +erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_last_purchase_rate.js \ No newline at end of file From 5510d0751d23371895795bff307e024a0e326624 Mon Sep 17 00:00:00 2001 From: tundebabzy Date: Fri, 29 Sep 2017 10:51:59 +0100 Subject: [PATCH 07/13] correctly set frm company currency (#10944) --- erpnext/public/js/controllers/transaction.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 5f35ea44de..908d591e70 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -378,7 +378,8 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ if(me.frm.doc.company && me.frm.fields_dict.currency) { var company_currency = me.get_company_currency(); var company_doc = frappe.get_doc(":Company", me.frm.doc.company); - if (!me.frm.doc.currency) { + + if (!me.frm.doc.currency || me.frm.doc.currency != company_currency) { me.frm.set_value("currency", company_currency); } From bf379957456dac594de19fbf1c2b3ae229aa980e Mon Sep 17 00:00:00 2001 From: Javier Wong Date: Fri, 29 Sep 2017 17:53:08 +0800 Subject: [PATCH 08/13] [Enhancement] Sales and Purchase Default UOM (#10929) Option for specifying an optional default Sales and Purchase UOM at the item master level. --- erpnext/stock/doctype/item/item.json | 64 +++++++++++++++++++++++++++- erpnext/stock/get_item_details.py | 12 +++++- 2 files changed, 74 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json index b168631970..525321c5a9 100644 --- a/erpnext/stock/doctype/item/item.json +++ b/erpnext/stock/doctype/item/item.json @@ -1473,6 +1473,37 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "purchase_uom", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Default Purchase Unit of Measure", + "length": 0, + "no_copy": 0, + "options": "UOM", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -2069,6 +2100,37 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "sales_uom", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Default Sales Unit of Measure", + "length": 0, + "no_copy": 0, + "options": "UOM", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -3143,7 +3205,7 @@ "issingle": 0, "istable": 0, "max_attachments": 1, - "modified": "2017-07-06 18:28:36.645217", + "modified": "2017-09-27 14:08:02.948326", "modified_by": "Administrator", "module": "Stock", "name": "Item", diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 72a83c6c1b..0b92c250aa 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -164,6 +164,16 @@ def get_basic_details(args, item): warehouse = user_default_warehouse or item.default_warehouse or args.warehouse + #Set the UOM to the Default Sales UOM or Default Purchase UOM if configured in the Item Master + if args.get('doctype') in ['Quotation', 'Sales Order', 'Delivery Note', 'Sales Invoice']: + uom = item.sales_uom if item.sales_uom else item.stock_uom + elif args.get('doctype') in ['Purchase Order', 'Purchase Receipt', 'Purchase Invoice']: + uom = item.purchase_uom if item.purchase_uom else item.stock_uom + else: + uom = item.stock_uom + + args.uom = uom + out = frappe._dict({ "item_code": item.name, "item_name": item.item_name, @@ -178,7 +188,7 @@ def get_basic_details(args, item): "batch_no": None, "item_tax_rate": json.dumps(dict(([d.tax_type, d.tax_rate] for d in item.get("taxes")))), - "uom": item.stock_uom, + "uom": uom, "min_order_qty": flt(item.min_order_qty) if args.doctype == "Material Request" else "", "qty": args.qty or 1.0, "stock_qty": args.qty or 1.0, From 5d8fd477bdc9df5e07634a962ce345125b1b8463 Mon Sep 17 00:00:00 2001 From: Pawan Mehta Date: Fri, 29 Sep 2017 15:23:54 +0530 Subject: [PATCH 09/13] [fix] #10840 (#10844) --- .../doctype/sales_invoice/sales_invoice.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index 11d1825388..be01184882 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -520,6 +520,24 @@ frappe.ui.form.on('Sales Invoice', { }; }); }, + //When multiple companies are set up. in case company name is changed set default company address + company:function(frm){ + if (frm.doc.company) + { + frappe.call({ + method:"frappe.contacts.doctype.address.address.get_default_address", + args:{ doctype:'Company',name:frm.doc.company}, + callback: function(r){ + if (r.message){ + frm.set_value("company_address",r.message) + } + else { + frm.set_value("company_address","") + } + } + }) + } + }, project: function(frm){ frm.call({ From 80d24f83f86ceabc565477d3e10401c159f76ff3 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 29 Sep 2017 15:39:03 +0530 Subject: [PATCH 10/13] [fix] item variant description --- erpnext/controllers/item_variant.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/controllers/item_variant.py b/erpnext/controllers/item_variant.py index 967c1339f1..ca3ddfdfa5 100644 --- a/erpnext/controllers/item_variant.py +++ b/erpnext/controllers/item_variant.py @@ -195,7 +195,7 @@ def copy_attributes_to_variant(item, variant): if variant.attributes: variant.description += "\n" for d in variant.attributes: - variant.description += "

" + d.attribute + ": " + cstr(d.attribute_value) + "

" + variant.description += "
" + d.attribute + ": " + cstr(d.attribute_value) + "
" def make_variant_item_code(template_item_code, template_item_name, variant): """Uses template's item code and abbreviations to make variant's item code""" From d3a48a83fd9fde70c4610ae48889806965216310 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 29 Sep 2017 15:50:17 +0530 Subject: [PATCH 11/13] [fix] bom.py, dont use keyword --- erpnext/manufacturing/doctype/bom/bom.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index b308e097ea..93a41f34e7 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -95,8 +95,8 @@ class BOM(WebsiteGenerator): self.validate_bom_currecny(item) ret = self.get_bom_material_detail({ - "item_code": item.item_code, - "item_name": item.item_name, + "item_code": item.item_code, + "item_name": item.item_name, "bom_no": item.bom_no, "stock_qty": item.stock_qty }) @@ -312,7 +312,7 @@ class BOM(WebsiteGenerator): li.append("{0} on row {1}".format(i.item_code, i.idx)) duplicate_list = '
' + '
'.join(li) - frappe.throw(_("Same item has been entered multiple times. {list}").format(list=duplicate_list)) + frappe.throw(_("Same item has been entered multiple times. {0}").format(duplicate_list)) def check_recursion(self): """ Check whether recursion occurs in any bom""" @@ -346,7 +346,7 @@ class BOM(WebsiteGenerator): count = 0 if not bom_list: bom_list = [] - + if self.name not in bom_list: bom_list.append(self.name) From e1a4b3e4bc8bb6a33fb1ea2579343564ae860743 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 29 Sep 2017 16:52:01 +0600 Subject: [PATCH 12/13] bumped to version 9.0.4 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index ce16a6e7db..fa3fcc2cce 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from erpnext.hooks import regional_overrides -__version__ = '9.0.3' +__version__ = '9.0.4' def get_default_company(user=None): '''Get default company for user''' From 6488645d426b96f2b4b1a4bbac52e254d51ea1c7 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 29 Sep 2017 16:38:17 +0530 Subject: [PATCH 13/13] Fixed ui tests for production order --- .../doctype/production_order/test_production_order.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/erpnext/manufacturing/doctype/production_order/test_production_order.js b/erpnext/manufacturing/doctype/production_order/test_production_order.js index 7ce67ba430..32cc3efd97 100644 --- a/erpnext/manufacturing/doctype/production_order/test_production_order.js +++ b/erpnext/manufacturing/doctype/production_order/test_production_order.js @@ -59,8 +59,6 @@ QUnit.test("test: production order", function (assert) { // Confirm the production order timesheet, save and submit it () => frappe.click_link("TS-00"), () => frappe.timeout(1), - () => frappe.click_button("Save"), - () => frappe.timeout(1), () => frappe.click_button("Submit"), () => frappe.timeout(1), () => frappe.click_button("Yes"),