From c131bd1b257ddd13fef98ef0527da63ae86e1255 Mon Sep 17 00:00:00 2001 From: Mangesh-Khairnar Date: Mon, 2 Dec 2019 01:09:59 +0530 Subject: [PATCH 01/18] feat(marketplace): edit item dialog --- .../js/hub/components/edit_details_dialog.js | 45 +++++++++++++++++++ erpnext/public/js/hub/pages/Item.vue | 37 ++++++++++++++- 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 erpnext/public/js/hub/components/edit_details_dialog.js diff --git a/erpnext/public/js/hub/components/edit_details_dialog.js b/erpnext/public/js/hub/components/edit_details_dialog.js new file mode 100644 index 0000000000..b341901fec --- /dev/null +++ b/erpnext/public/js/hub/components/edit_details_dialog.js @@ -0,0 +1,45 @@ +function EditDetailsDialog(primary_action, defaults) { + let dialog = new frappe.ui.Dialog({ + title: __('Update Details'), + fields: [ + { + "label": "Item Name", + "fieldname": "item_name", + "fieldtype": "Data", + "default": defaults.item_name, + "reqd": 1 + }, + { + "label": "Hub Category", + "fieldname": "hub_category", + "fieldtype": "Autocomplete", + "default": defaults.hub_category, + "options": [], + "reqd": 1 + }, + { + "label": "Description", + "fieldname": "description", + "fieldtype": "Text", + "default": defaults.description, + "options": [], + "reqd": 1 + } + ], + primary_action_label: primary_action.label || __('Update Details'), + primary_action: primary_action.fn, + }); + + hub.call('get_categories') + .then(categories => { + categories = categories.map(d => d.name); + dialog.fields_dict.hub_category.df.options = categories; + dialog.fields_dict.hub_category.set_options(); + }); + + return dialog; +} + +export { + EditDetailsDialog +}; \ No newline at end of file diff --git a/erpnext/public/js/hub/pages/Item.vue b/erpnext/public/js/hub/pages/Item.vue index 841d0046db..b8399e30d6 100644 --- a/erpnext/public/js/hub/pages/Item.vue +++ b/erpnext/public/js/hub/pages/Item.vue @@ -35,6 +35,7 @@ From cc62aad503c8c9c453e545fb2213a7e0814e4191 Mon Sep 17 00:00:00 2001 From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Date: Tue, 24 Dec 2019 11:51:39 +0530 Subject: [PATCH 13/18] fix: Label for return amount --- erpnext/hr/doctype/employee_advance/employee_advance.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/hr/doctype/employee_advance/employee_advance.json b/erpnext/hr/doctype/employee_advance/employee_advance.json index a4e4676547..d233a2bb93 100644 --- a/erpnext/hr/doctype/employee_advance/employee_advance.json +++ b/erpnext/hr/doctype/employee_advance/employee_advance.json @@ -166,7 +166,7 @@ { "fieldname": "return_amount", "fieldtype": "Currency", - "label": "Return Amount", + "label": "Returned Amount", "options": "Company:company:default_currency", "read_only": 1 } @@ -210,4 +210,4 @@ "sort_field": "modified", "sort_order": "DESC", "track_changes": 1 -} \ No newline at end of file +} From 818c49279c5230770fdac5691f5bfb5e8ee5237b Mon Sep 17 00:00:00 2001 From: RJPvT <48353029+RJPvT@users.noreply.github.com> Date: Tue, 24 Dec 2019 07:54:58 +0100 Subject: [PATCH 14/18] Update supplier_scorecard.py (#20061) --- erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.py b/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.py index 9e201e3192..af109ba284 100644 --- a/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.py +++ b/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.py @@ -138,7 +138,7 @@ def refresh_scorecards(): # Check to see if any new scorecard periods are created if make_all_scorecards(sc.name) > 0: # Save the scorecard to update the score and standings - sc.save() + frappe.get_doc('Supplier Scorecard', sc.name).save() @frappe.whitelist() From 088be37e64be70b47db8e8f6ce962875d79956dc Mon Sep 17 00:00:00 2001 From: Sun Howwrongbum Date: Tue, 24 Dec 2019 12:29:25 +0530 Subject: [PATCH 15/18] feat: consider expiry_date during Batch queries (#20065) --- erpnext/controllers/queries.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py index 7b4a4c92ad..5c319008a8 100644 --- a/erpnext/controllers/queries.py +++ b/erpnext/controllers/queries.py @@ -311,6 +311,7 @@ def get_batch_no(doctype, txt, searchfield, start, page_len, filters): and sle.item_code = %(item_code)s and sle.warehouse = %(warehouse)s and (sle.batch_no like %(txt)s + or batch.expiry_date like %(txt)s or batch.manufacturing_date like %(txt)s) and batch.docstatus < 2 {cond} @@ -329,6 +330,7 @@ def get_batch_no(doctype, txt, searchfield, start, page_len, filters): where batch.disabled = 0 and item = %(item_code)s and (name like %(txt)s + or expiry_date like %(txt)s or manufacturing_date like %(txt)s) and docstatus < 2 {0} From 5af4c57ef7b1eee87dab16b39813e4d7f59f81a1 Mon Sep 17 00:00:00 2001 From: Himanshu Date: Tue, 24 Dec 2019 12:31:38 +0530 Subject: [PATCH 16/18] fix: ambihious error (#20068) --- erpnext/stock/doctype/batch/batch.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/erpnext/stock/doctype/batch/batch.py b/erpnext/stock/doctype/batch/batch.py index 3e890b4dd4..114925469b 100644 --- a/erpnext/stock/doctype/batch/batch.py +++ b/erpnext/stock/doctype/batch/batch.py @@ -261,15 +261,14 @@ def get_batch_no(item_code, warehouse, qty=1, throw=False): def get_batches(item_code, warehouse, qty=1, throw=False): - batches = frappe.db.sql( - 'select batch_id, sum(actual_qty) as qty from `tabBatch` join `tabStock Ledger Entry` ignore index (item_code, warehouse) ' - 'on (`tabBatch`.batch_id = `tabStock Ledger Entry`.batch_no )' - 'where `tabStock Ledger Entry`.item_code = %s and `tabStock Ledger Entry`.warehouse = %s ' - 'and (`tabBatch`.expiry_date >= CURDATE() or `tabBatch`.expiry_date IS NULL)' - 'group by batch_id ' - 'order by `tabBatch`.expiry_date ASC, `tabBatch`.creation ASC', - (item_code, warehouse), - as_dict=True - ) - return batches + return frappe.db.sql(""" + select batch_id, sum(`tabStock Ledger Entry`.actual_qty) as qty + from `tabBatch` + join `tabStock Ledger Entry` ignore index (item_code, warehouse) + on (`tabBatch`.batch_id = `tabStock Ledger Entry`.batch_no ) + where `tabStock Ledger Entry`.item_code = %s and `tabStock Ledger Entry`.warehouse = %s + and (`tabBatch`.expiry_date >= CURDATE() or `tabBatch`.expiry_date IS NULL) + group by batch_id + order by `tabBatch`.expiry_date ASC, `tabBatch`.creation ASC' + """, (item_code, warehouse), as_dict=True) \ No newline at end of file From 55bc26e300914954f16fd2fae76af038c10a8d34 Mon Sep 17 00:00:00 2001 From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Date: Tue, 24 Dec 2019 12:55:01 +0530 Subject: [PATCH 17/18] fix: Allow creation of multiple landed cost voucher against a Purchase Document (#20058) --- .../purchase_receipt/purchase_receipt.py | 47 +++++++++++-------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index 060175f904..691f92ffa7 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -88,7 +88,7 @@ class PurchaseReceipt(BuyingController): if getdate(self.posting_date) > getdate(nowdate()): throw(_("Posting Date cannot be future date")) - + def validate_cwip_accounts(self): for item in self.get('items'): if item.is_fixed_asset and is_cwip_accounting_enabled(item.asset_category): @@ -362,7 +362,7 @@ class PurchaseReceipt(BuyingController): # valuation rate is total of net rate, raw mat supp cost, tax amount, lcv amount per item self.update_assets(item, item.valuation_rate) return gl_entries - + def add_asset_gl_entries(self, item, gl_entries): arbnb_account = self.get_company_default("asset_received_but_not_billed") # This returns category's cwip account if not then fallback to company's default cwip account @@ -395,7 +395,7 @@ class PurchaseReceipt(BuyingController): "credit_in_account_currency": (base_asset_amount if asset_rbnb_currency == self.company_currency else asset_amount) }, item=item)) - + def add_lcv_gl_entries(self, item, gl_entries): expenses_included_in_asset_valuation = self.get_company_default("expenses_included_in_asset_valuation") if not is_cwip_accounting_enabled(item.asset_category): @@ -404,7 +404,7 @@ class PurchaseReceipt(BuyingController): else: # This returns company's default cwip account asset_account = get_asset_account("capital_work_in_progress_account", company=self.company) - + gl_entries.append(self.get_gl_dict({ "account": expenses_included_in_asset_valuation, "against": asset_account, @@ -424,7 +424,7 @@ class PurchaseReceipt(BuyingController): }, item=item)) def update_assets(self, item, valuation_rate): - assets = frappe.db.get_all('Asset', + assets = frappe.db.get_all('Asset', filters={ 'purchase_receipt': self.name, 'item_code': item.item_code } ) @@ -610,27 +610,36 @@ def make_stock_entry(source_name,target_doc=None): return doclist def get_item_account_wise_additional_cost(purchase_document): - landed_cost_voucher = frappe.get_value("Landed Cost Purchase Receipt", - {"receipt_document": purchase_document, "docstatus": 1}, "parent") + landed_cost_vouchers = frappe.get_all("Landed Cost Purchase Receipt", fields=["parent"], + filters = {"receipt_document": purchase_document, "docstatus": 1}) - if not landed_cost_voucher: + if not landed_cost_vouchers: return total_item_cost = 0 item_account_wise_cost = {} - landed_cost_voucher_doc = frappe.get_doc("Landed Cost Voucher", landed_cost_voucher) - based_on_field = frappe.scrub(landed_cost_voucher_doc.distribute_charges_based_on) + item_cost_allocated = [] - for item in landed_cost_voucher_doc.items: - total_item_cost += item.get(based_on_field) + for lcv in landed_cost_vouchers: + landed_cost_voucher_doc = frappe.get_cached_doc("Landed Cost Voucher", lcv.parent) + based_on_field = frappe.scrub(landed_cost_voucher_doc.distribute_charges_based_on) - for item in landed_cost_voucher_doc.items: - if item.receipt_document == purchase_document: - for account in landed_cost_voucher_doc.taxes: - item_account_wise_cost.setdefault((item.item_code, item.purchase_receipt_item), {}) - item_account_wise_cost[(item.item_code, item.purchase_receipt_item)].setdefault(account.expense_account, 0.0) - item_account_wise_cost[(item.item_code, item.purchase_receipt_item)][account.expense_account] += \ - account.amount * item.get(based_on_field) / total_item_cost + for item in landed_cost_voucher_doc.items: + if item.purchase_receipt_item not in item_cost_allocated: + total_item_cost += item.get(based_on_field) + item_cost_allocated.append(item.purchase_receipt_item) + + for lcv in landed_cost_vouchers: + landed_cost_voucher_doc = frappe.get_cached_doc("Landed Cost Voucher", lcv.parent) + based_on_field = frappe.scrub(landed_cost_voucher_doc.distribute_charges_based_on) + + for item in landed_cost_voucher_doc.items: + if item.receipt_document == purchase_document: + for account in landed_cost_voucher_doc.taxes: + item_account_wise_cost.setdefault((item.item_code, item.purchase_receipt_item), {}) + item_account_wise_cost[(item.item_code, item.purchase_receipt_item)].setdefault(account.expense_account, 0.0) + item_account_wise_cost[(item.item_code, item.purchase_receipt_item)][account.expense_account] += \ + account.amount * item.get(based_on_field) / total_item_cost return item_account_wise_cost From 08433c2919160e2b099ad191318f3c52e2d0d789 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Tue, 24 Dec 2019 13:03:47 +0530 Subject: [PATCH 18/18] fix: supplier email id field not showing in the notification for purchase cycle doctypes (#20071) --- .../accounts/doctype/purchase_invoice/purchase_invoice.json | 5 ++++- erpnext/buying/doctype/purchase_order/purchase_order.json | 3 ++- erpnext/stock/doctype/purchase_receipt/purchase_receipt.json | 5 ++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json index 6fe18115c0..3715d77413 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json @@ -1,4 +1,5 @@ { + "actions": [], "allow_import": 1, "autoname": "naming_series:", "creation": "2013-05-21 16:16:39", @@ -417,6 +418,7 @@ "fieldname": "contact_email", "fieldtype": "Small Text", "label": "Contact Email", + "options": "Email", "print_hide": 1, "read_only": 1 }, @@ -1287,7 +1289,8 @@ "icon": "fa fa-file-text", "idx": 204, "is_submittable": 1, - "modified": "2019-09-17 22:31:42.666601", + "links": [], + "modified": "2019-12-24 12:51:58.613538", "modified_by": "Administrator", "module": "Accounts", "name": "Purchase Invoice", diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index 8cd44c789d..d4c5acee90 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -342,6 +342,7 @@ "fieldname": "contact_email", "fieldtype": "Small Text", "label": "Contact Email", + "options": "Email", "print_hide": 1, "read_only": 1 }, @@ -1054,7 +1055,7 @@ "idx": 105, "is_submittable": 1, "links": [], - "modified": "2019-12-18 13:13:22.852412", + "modified": "2019-12-24 12:44:13.137194", "modified_by": "Administrator", "module": "Buying", "name": "Purchase Order", diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json index d6bc1a9b97..27cd997bcc 100755 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json @@ -1,4 +1,5 @@ { + "actions": [], "allow_import": 1, "autoname": "naming_series:", "creation": "2013-05-21 16:16:39", @@ -305,6 +306,7 @@ "fieldname": "contact_email", "fieldtype": "Small Text", "label": "Contact Email", + "options": "Email", "print_hide": 1, "read_only": 1 }, @@ -1056,7 +1058,8 @@ "icon": "fa fa-truck", "idx": 261, "is_submittable": 1, - "modified": "2019-09-27 14:24:49.044505", + "links": [], + "modified": "2019-12-24 12:52:17.216304", "modified_by": "Administrator", "module": "Stock", "name": "Purchase Receipt",