From e1f499ae1b7bc421f54c0bc0fdda6a31943bfe94 Mon Sep 17 00:00:00 2001 From: marination Date: Tue, 17 Mar 2020 11:47:11 +0530 Subject: [PATCH 01/20] fix: Pick List Enhancements --- .../v12_0/set_updated_purpose_in_pick_list.py | 10 ++++ .../doctype/sales_order/sales_order.py | 2 +- erpnext/stock/doctype/pick_list/pick_list.js | 49 ++++++++++----- .../stock/doctype/pick_list/pick_list.json | 9 ++- erpnext/stock/doctype/pick_list/pick_list.py | 59 ++++++++++++++----- .../pick_list_item/pick_list_item.json | 15 ++++- 6 files changed, 108 insertions(+), 36 deletions(-) create mode 100644 erpnext/patches/v12_0/set_updated_purpose_in_pick_list.py diff --git a/erpnext/patches/v12_0/set_updated_purpose_in_pick_list.py b/erpnext/patches/v12_0/set_updated_purpose_in_pick_list.py new file mode 100644 index 0000000000..42491882c4 --- /dev/null +++ b/erpnext/patches/v12_0/set_updated_purpose_in_pick_list.py @@ -0,0 +1,10 @@ +# Copyright (c) 2019, Frappe and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals + +import frappe + +def execute(): + frappe.db.sql("""UPDATE `tabPick List` set purpose = 'Delivery' + WHERE docstatus = 1 and purpose = 'Delivery against Sales Order' """) \ No newline at end of file diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index e7cbf405e1..6ccbd512fe 100755 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -1043,7 +1043,7 @@ def create_pick_list(source_name, target_doc=None): }, }, target_doc) - doc.purpose = 'Delivery against Sales Order' + doc.purpose = 'Delivery' doc.set_item_locations() diff --git a/erpnext/stock/doctype/pick_list/pick_list.js b/erpnext/stock/doctype/pick_list/pick_list.js index 278971125f..f4fd0a202f 100644 --- a/erpnext/stock/doctype/pick_list/pick_list.js +++ b/erpnext/stock/doctype/pick_list/pick_list.js @@ -38,11 +38,11 @@ frappe.ui.form.on('Pick List', { }; }); }, - get_item_locations: (frm) => { - if (!frm.doc.locations || !frm.doc.locations.length) { - frappe.msgprint(__('First add items in the Item Locations table')); + get_item_locations: (frm, save=false) => { + if (!(frm.doc.locations && frm.doc.locations.length)) { + frappe.msgprint(__('Add items in the Item Locations table')); } else { - frm.call('set_item_locations'); + frm.call('set_item_locations', {save: save}); } }, refresh: (frm) => { @@ -52,8 +52,13 @@ frappe.ui.form.on('Pick List', { 'pick_list_name': frm.doc.name, 'purpose': frm.doc.purpose }).then(target_document_exists => { + frm.set_df_property("locations", "allow_on_submit", target_document_exists ? 0 : 1); + if (target_document_exists) return; - if (frm.doc.purpose === 'Delivery against Sales Order') { + + frm.add_custom_button(__('Update Current Stock'), () => frm.trigger('update_pick_list_stock')); + + if (frm.doc.purpose === 'Delivery') { frm.add_custom_button(__('Delivery Note'), () => frm.trigger('create_delivery_note'), __('Create')); } else { frm.add_custom_button(__('Stock Entry'), () => frm.trigger('create_stock_entry'), __('Create')); @@ -101,22 +106,34 @@ frappe.ui.form.on('Pick List', { frm.trigger('add_get_items_button'); }, create_delivery_note: (frm) => { - frappe.model.open_mapped_doc({ - method: 'erpnext.stock.doctype.pick_list.pick_list.create_delivery_note', - frm: frm - }); + if (!(frm.doc.locations && frm.doc.locations.length)) { + frappe.msgprint(__('Add items in the Item Locations table')); + } else { + frappe.model.open_mapped_doc({ + method: 'erpnext.stock.doctype.pick_list.pick_list.create_delivery_note', + frm: frm + }); + } + }, create_stock_entry: (frm) => { - frappe.xcall('erpnext.stock.doctype.pick_list.pick_list.create_stock_entry', { - 'pick_list': frm.doc, - }).then(stock_entry => { - frappe.model.sync(stock_entry); - frappe.set_route("Form", 'Stock Entry', stock_entry.name); - }); + if (!(frm.doc.locations && frm.doc.locations.length)) { + frappe.msgprint(__('Add items in the Item Locations table')); + } else { + frappe.xcall('erpnext.stock.doctype.pick_list.pick_list.create_stock_entry', { + 'pick_list': frm.doc, + }).then(stock_entry => { + frappe.model.sync(stock_entry); + frappe.set_route("Form", 'Stock Entry', stock_entry.name); + }); + } + }, + update_pick_list_stock: (frm) => { + frm.events.get_item_locations(frm, true); }, add_get_items_button: (frm) => { let purpose = frm.doc.purpose; - if (purpose != 'Delivery against Sales Order' || frm.doc.docstatus !== 0) return; + if (purpose != 'Delivery' || frm.doc.docstatus !== 0) return; let get_query_filters = { docstatus: 1, per_delivered: ['<', 100], diff --git a/erpnext/stock/doctype/pick_list/pick_list.json b/erpnext/stock/doctype/pick_list/pick_list.json index 8d5ef3d12a..c01388dcd2 100644 --- a/erpnext/stock/doctype/pick_list/pick_list.json +++ b/erpnext/stock/doctype/pick_list/pick_list.json @@ -1,4 +1,5 @@ { + "actions": [], "autoname": "naming_series:", "creation": "2019-07-11 16:03:13.681045", "doctype": "DocType", @@ -44,7 +45,7 @@ "options": "Warehouse" }, { - "depends_on": "eval:doc.purpose==='Delivery against Sales Order'", + "depends_on": "eval:doc.purpose==='Delivery'", "fieldname": "customer", "fieldtype": "Link", "in_list_view": 1, @@ -59,6 +60,7 @@ "options": "Work Order" }, { + "allow_on_submit": 1, "fieldname": "locations", "fieldtype": "Table", "label": "Item Locations", @@ -86,7 +88,7 @@ "fieldname": "purpose", "fieldtype": "Select", "label": "Purpose", - "options": "Material Transfer for Manufacture\nMaterial Transfer\nDelivery against Sales Order" + "options": "Material Transfer for Manufacture\nMaterial Transfer\nDelivery" }, { "depends_on": "eval:['Material Transfer', 'Material Issue'].includes(doc.purpose)", @@ -111,7 +113,8 @@ } ], "is_submittable": 1, - "modified": "2019-08-29 21:10:11.572387", + "links": [], + "modified": "2020-03-17 11:38:41.932875", "modified_by": "Administrator", "module": "Stock", "name": "Pick List", diff --git a/erpnext/stock/doctype/pick_list/pick_list.py b/erpnext/stock/doctype/pick_list/pick_list.py index c4d8c41ebb..d7afaf3d68 100644 --- a/erpnext/stock/doctype/pick_list/pick_list.py +++ b/erpnext/stock/doctype/pick_list/pick_list.py @@ -29,7 +29,7 @@ class PickList(Document): frappe.throw(_('For item {0} at row {1}, count of serial numbers does not match with the picked quantity') .format(frappe.bold(item.item_code), frappe.bold(item.idx))) - def set_item_locations(self): + def set_item_locations(self, save=False): items = self.aggregate_item_qty() self.item_location_map = frappe._dict() @@ -43,7 +43,7 @@ class PickList(Document): item_code = item_doc.item_code self.item_location_map.setdefault(item_code, - get_available_item_locations(item_code, from_warehouses, self.item_count_map.get(item_code))) + get_available_item_locations(item_code, from_warehouses, self.item_count_map.get(item_code), self.company)) locations = get_items_with_location_and_quantity(item_doc, self.item_location_map) @@ -59,12 +59,17 @@ class PickList(Document): location.update(row) self.append('locations', location) + if save: + self.save() + def aggregate_item_qty(self): locations = self.get('locations') self.item_count_map = {} # aggregate qty for same item item_map = OrderedDict() for item in locations: + if not item.item_code: + frappe.throw("Row #{0}: Item Code is Mandatory".format(item.idx)) item_code = item.item_code reference = item.sales_order_item or item.material_request_item key = (item_code, item.uom, reference) @@ -130,14 +135,14 @@ def get_items_with_location_and_quantity(item_doc, item_location_map): item_location_map[item_doc.item_code] = available_locations return locations -def get_available_item_locations(item_code, from_warehouses, required_qty): +def get_available_item_locations(item_code, from_warehouses, required_qty, company): locations = [] if frappe.get_cached_value('Item', item_code, 'has_serial_no'): - locations = get_available_item_locations_for_serialized_item(item_code, from_warehouses, required_qty) + locations = get_available_item_locations_for_serialized_item(item_code, from_warehouses, required_qty, company) elif frappe.get_cached_value('Item', item_code, 'has_batch_no'): - locations = get_available_item_locations_for_batched_item(item_code, from_warehouses, required_qty) + locations = get_available_item_locations_for_batched_item(item_code, from_warehouses, required_qty, company) else: - locations = get_available_item_locations_for_other_item(item_code, from_warehouses, required_qty) + locations = get_available_item_locations_for_other_item(item_code, from_warehouses, required_qty, company) total_qty_available = sum(location.get('qty') for location in locations) @@ -150,9 +155,10 @@ def get_available_item_locations(item_code, from_warehouses, required_qty): return locations -def get_available_item_locations_for_serialized_item(item_code, from_warehouses, required_qty): +def get_available_item_locations_for_serialized_item(item_code, from_warehouses, required_qty, company): filters = frappe._dict({ 'item_code': item_code, + 'company': company, 'warehouse': ['!=', ''] }) @@ -180,7 +186,7 @@ def get_available_item_locations_for_serialized_item(item_code, from_warehouses, return locations -def get_available_item_locations_for_batched_item(item_code, from_warehouses, required_qty): +def get_available_item_locations_for_batched_item(item_code, from_warehouses, required_qty, company): warehouse_condition = 'and warehouse in %(warehouses)s' if from_warehouses else '' batch_locations = frappe.db.sql(""" SELECT @@ -192,6 +198,7 @@ def get_available_item_locations_for_batched_item(item_code, from_warehouses, re WHERE sle.batch_no = batch.name and sle.`item_code`=%(item_code)s + and sle.`company` = %(company)s and IFNULL(batch.`expiry_date`, '2200-01-01') > %(today)s {warehouse_condition} GROUP BY @@ -202,16 +209,20 @@ def get_available_item_locations_for_batched_item(item_code, from_warehouses, re ORDER BY IFNULL(batch.`expiry_date`, '2200-01-01'), batch.`creation` """.format(warehouse_condition=warehouse_condition), { #nosec 'item_code': item_code, + 'company': company, 'today': today(), 'warehouses': from_warehouses }, as_dict=1) return batch_locations -def get_available_item_locations_for_other_item(item_code, from_warehouses, required_qty): +def get_available_item_locations_for_other_item(item_code, from_warehouses, required_qty, company): # gets all items available in different warehouses + warehouses = [x.get('name') for x in frappe.get_list("Warehouse", {'company': company}, "name")] + filters = frappe._dict({ 'item_code': item_code, + 'warehouse': ['in', warehouses], 'actual_qty': ['>', 0] }) @@ -230,7 +241,7 @@ def get_available_item_locations_for_other_item(item_code, from_warehouses, requ @frappe.whitelist() def create_delivery_note(source_name, target_doc=None): pick_list = frappe.get_doc('Pick List', source_name) - sales_orders = [d.sales_order for d in pick_list.locations] + sales_orders = [d.sales_order for d in pick_list.locations if d.sales_order] sales_orders = set(sales_orders) delivery_note = None @@ -238,6 +249,10 @@ def create_delivery_note(source_name, target_doc=None): delivery_note = create_delivery_note_from_sales_order(sales_order, delivery_note, skip_item_mapping=True) + # map rows without sales orders as well + if not delivery_note: + delivery_note = frappe.new_doc("Delivery Note") + item_table_mapper = { 'doctype': 'Delivery Note Item', 'field_map': { @@ -248,9 +263,25 @@ def create_delivery_note(source_name, target_doc=None): 'condition': lambda doc: abs(doc.delivered_qty) < abs(doc.qty) and doc.delivered_by_supplier!=1 } + item_table_mapper_without_so = { + 'doctype': 'Delivery Note Item', + 'field_map': { + 'rate': 'rate', + 'name': 'name', + 'parent': '', + } + } + for location in pick_list.locations: - sales_order_item = frappe.get_cached_doc('Sales Order Item', location.sales_order_item) - dn_item = map_child_doc(sales_order_item, delivery_note, item_table_mapper) + if location.sales_order_item: + sales_order_item = frappe.get_cached_doc('Sales Order Item', {'name':location.sales_order_item}) + else: + sales_order_item = None + + source_doc, table_mapper = [sales_order_item, item_table_mapper] if sales_order_item \ + else [location, item_table_mapper_without_so] + + dn_item = map_child_doc(source_doc, delivery_note, table_mapper) if dn_item: dn_item.warehouse = location.warehouse @@ -258,7 +289,7 @@ def create_delivery_note(source_name, target_doc=None): dn_item.batch_no = location.batch_no dn_item.serial_no = location.serial_no - update_delivery_note_item(sales_order_item, dn_item, delivery_note) + update_delivery_note_item(source_doc, dn_item, delivery_note) set_delivery_note_missing_values(delivery_note) @@ -318,7 +349,7 @@ def get_pending_work_orders(doctype, txt, searchfield, start, page_length, filte @frappe.whitelist() def target_document_exists(pick_list_name, purpose): - if purpose == 'Delivery against Sales Order': + if purpose == 'Delivery': return frappe.db.exists('Delivery Note', { 'pick_list': pick_list_name }) diff --git a/erpnext/stock/doctype/pick_list_item/pick_list_item.json b/erpnext/stock/doctype/pick_list_item/pick_list_item.json index c7a35df51f..71fbf9a866 100644 --- a/erpnext/stock/doctype/pick_list_item/pick_list_item.json +++ b/erpnext/stock/doctype/pick_list_item/pick_list_item.json @@ -1,4 +1,5 @@ { + "actions": [], "creation": "2019-07-11 16:01:22.832885", "doctype": "DocType", "editable_grid": 1, @@ -8,6 +9,7 @@ "item_name", "column_break_2", "description", + "item_group", "section_break_5", "warehouse", "quantity_section", @@ -120,7 +122,8 @@ "fieldtype": "Link", "in_list_view": 1, "label": "Item", - "options": "Item" + "options": "Item", + "reqd": 1 }, { "fieldname": "quantity_section", @@ -166,10 +169,18 @@ "fieldtype": "Data", "label": "Material Request Item", "read_only": 1 + }, + { + "fetch_from": "item_code.item_group", + "fieldname": "item_group", + "fieldtype": "Data", + "label": "Item Group", + "read_only": 1 } ], "istable": 1, - "modified": "2019-08-29 21:28:39.539007", + "links": [], + "modified": "2020-03-13 19:08:21.995986", "modified_by": "Administrator", "module": "Stock", "name": "Pick List Item", From 3251dcf672cc4f36904ae2962c542c2b58a279f4 Mon Sep 17 00:00:00 2001 From: marination Date: Wed, 18 Mar 2020 10:11:23 +0530 Subject: [PATCH 02/20] fix: Added patch to patches.txt --- erpnext/patches.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index b0fc7ea59c..ef69591091 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -659,3 +659,4 @@ erpnext.patches.v12_0.set_published_in_hub_tracked_item erpnext.patches.v12_0.set_job_offer_applicant_email erpnext.patches.v12_0.create_irs_1099_field_united_states erpnext.patches.v12_0.rename_bank_reconciliation_fields # 2020-01-22 +erpnext.patches.v12_0.set_updated_purpose_in_pick_list \ No newline at end of file From 686a09620db6874729fcc59dbfea749398d290e6 Mon Sep 17 00:00:00 2001 From: marination Date: Thu, 2 Apr 2020 13:51:25 +0530 Subject: [PATCH 03/20] fix: Commonified code and added server side validation --- erpnext/stock/doctype/pick_list/pick_list.js | 36 +++++++++----------- erpnext/stock/doctype/pick_list/pick_list.py | 7 ++++ 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/erpnext/stock/doctype/pick_list/pick_list.js b/erpnext/stock/doctype/pick_list/pick_list.js index f4fd0a202f..d46b98b461 100644 --- a/erpnext/stock/doctype/pick_list/pick_list.js +++ b/erpnext/stock/doctype/pick_list/pick_list.js @@ -38,13 +38,17 @@ frappe.ui.form.on('Pick List', { }; }); }, - get_item_locations: (frm, save=false) => { + set_item_locations:(frm, save) => { if (!(frm.doc.locations && frm.doc.locations.length)) { frappe.msgprint(__('Add items in the Item Locations table')); } else { frm.call('set_item_locations', {save: save}); } }, + get_item_locations: (frm) => { + // Button on the form + frm.events.set_item_locations(frm, false); + }, refresh: (frm) => { frm.trigger('add_get_items_button'); if (frm.doc.docstatus === 1) { @@ -106,30 +110,22 @@ frappe.ui.form.on('Pick List', { frm.trigger('add_get_items_button'); }, create_delivery_note: (frm) => { - if (!(frm.doc.locations && frm.doc.locations.length)) { - frappe.msgprint(__('Add items in the Item Locations table')); - } else { - frappe.model.open_mapped_doc({ - method: 'erpnext.stock.doctype.pick_list.pick_list.create_delivery_note', - frm: frm - }); - } + frappe.model.open_mapped_doc({ + method: 'erpnext.stock.doctype.pick_list.pick_list.create_delivery_note', + frm: frm + }); }, create_stock_entry: (frm) => { - if (!(frm.doc.locations && frm.doc.locations.length)) { - frappe.msgprint(__('Add items in the Item Locations table')); - } else { - frappe.xcall('erpnext.stock.doctype.pick_list.pick_list.create_stock_entry', { - 'pick_list': frm.doc, - }).then(stock_entry => { - frappe.model.sync(stock_entry); - frappe.set_route("Form", 'Stock Entry', stock_entry.name); - }); - } + frappe.xcall('erpnext.stock.doctype.pick_list.pick_list.create_stock_entry', { + 'pick_list': frm.doc, + }).then(stock_entry => { + frappe.model.sync(stock_entry); + frappe.set_route("Form", 'Stock Entry', stock_entry.name); + }); }, update_pick_list_stock: (frm) => { - frm.events.get_item_locations(frm, true); + frm.events.set_item_locations(frm, true); }, add_get_items_button: (frm) => { let purpose = frm.doc.purpose; diff --git a/erpnext/stock/doctype/pick_list/pick_list.py b/erpnext/stock/doctype/pick_list/pick_list.py index d7afaf3d68..616de5e00a 100644 --- a/erpnext/stock/doctype/pick_list/pick_list.py +++ b/erpnext/stock/doctype/pick_list/pick_list.py @@ -90,6 +90,10 @@ class PickList(Document): return item_map.values() +def validate_item_locations(pick_list): + if not pick_list.locations: + frappe.throw(_("Add items in the Item Locations table")) + def get_items_with_location_and_quantity(item_doc, item_location_map): available_locations = item_location_map.get(item_doc.item_code) locations = [] @@ -241,6 +245,8 @@ def get_available_item_locations_for_other_item(item_code, from_warehouses, requ @frappe.whitelist() def create_delivery_note(source_name, target_doc=None): pick_list = frappe.get_doc('Pick List', source_name) + validate_item_locations(pick_list) + sales_orders = [d.sales_order for d in pick_list.locations if d.sales_order] sales_orders = set(sales_orders) @@ -300,6 +306,7 @@ def create_delivery_note(source_name, target_doc=None): @frappe.whitelist() def create_stock_entry(pick_list): pick_list = frappe.get_doc(json.loads(pick_list)) + validate_item_locations(pick_list) if stock_entry_exists(pick_list.get('name')): return frappe.msgprint(_('Stock Entry has been already created against this Pick List')) From fd04e96bddadc31eda684b24e456ee1096963499 Mon Sep 17 00:00:00 2001 From: marination Date: Fri, 3 Apr 2020 15:46:48 +0530 Subject: [PATCH 04/20] fix: Mapping Customer Provided Material Request to Stock Entry - Fixed inability to map Material Request to Stock Entry - Commonified Customer Provided Item validation --- erpnext/controllers/stock_controller.py | 7 +++++++ erpnext/stock/doctype/delivery_note/delivery_note.py | 7 ------- erpnext/stock/doctype/material_request/material_request.py | 5 ++++- erpnext/stock/doctype/purchase_receipt/purchase_receipt.py | 4 ++-- erpnext/stock/doctype/stock_entry/stock_entry.py | 5 +---- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py index f6908c06bd..55a2c435a1 100644 --- a/erpnext/controllers/stock_controller.py +++ b/erpnext/controllers/stock_controller.py @@ -21,6 +21,7 @@ class StockController(AccountsController): super(StockController, self).validate() self.validate_inspection() self.validate_serialized_batch() + self.validate_customer_provided_item() def make_gl_entries(self, gl_entries=None, repost_future_gle=True, from_repost=False): if self.docstatus == 2: @@ -377,6 +378,12 @@ class StockController(AccountsController): for blanket_order in blanket_orders: frappe.get_doc("Blanket Order", blanket_order).update_ordered_qty() + def validate_customer_provided_item(self): + for d in self.get('items'): + # Customer Provided parts will have zero valuation rate + if frappe.db.get_value('Item', d.item_code, 'is_customer_provided_item'): + d.allow_zero_valuation_rate = 1 + def update_gl_entries_after(posting_date, posting_time, for_warehouses=None, for_items=None, warehouse_account=None, company=None): def _delete_gl_entries(voucher_type, voucher_no): diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py index 30d82ca415..dc96e7bd49 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -112,7 +112,6 @@ class DeliveryNote(SellingController): self.so_required() self.validate_proj_cust() self.check_sales_order_on_hold_or_close("against_sales_order") - self.validate_for_items() self.validate_warehouse() self.validate_uom_is_integer("stock_uom", "stock_qty") self.validate_uom_is_integer("uom", "qty") @@ -166,12 +165,6 @@ class DeliveryNote(SellingController): if not res: frappe.throw(_("Customer {0} does not belong to project {1}").format(self.customer, self.project)) - def validate_for_items(self): - for d in self.get('items'): - #Customer Provided parts will have zero valuation rate - if frappe.db.get_value('Item', d.item_code, 'is_customer_provided_item'): - d.allow_zero_valuation_rate = 1 - def validate_warehouse(self): super(DeliveryNote, self).validate_warehouse() diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py index 285643d712..5b242a51bc 100644 --- a/erpnext/stock/doctype/material_request/material_request.py +++ b/erpnext/stock/doctype/material_request/material_request.py @@ -454,6 +454,9 @@ def make_stock_entry(source_name, target_doc=None): else: target.s_warehouse = obj.warehouse + if source_parent.material_request_type == "Customer Provided": + target.allow_zero_valuation_rate = 1 + def set_missing_values(source, target): target.purpose = source.material_request_type if source.job_card: @@ -471,7 +474,7 @@ def make_stock_entry(source_name, target_doc=None): "doctype": "Stock Entry", "validation": { "docstatus": ["=", 1], - "material_request_type": ["in", ["Material Transfer", "Material Issue"]] + "material_request_type": ["in", ["Material Transfer", "Material Issue", "Customer Provided"]] } }, "Material Request Item": { diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index 3b43690658..afd2abda34 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -357,7 +357,7 @@ class PurchaseReceipt(BuyingController): if warehouse_with_no_account: frappe.msgprint(_("No accounting entries for the following warehouses") + ": \n" + "\n".join(warehouse_with_no_account)) - + return process_gl_map(gl_entries) def get_asset_gl_entry(self, gl_entries): @@ -628,7 +628,7 @@ def get_item_account_wise_additional_cost(purchase_document): if not landed_cost_vouchers: return - + item_account_wise_cost = {} for lcv in landed_cost_vouchers: diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index be4c78b1eb..7cf822bf49 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -50,6 +50,7 @@ class StockEntry(StockController): self.validate_posting_time() self.validate_purpose() self.validate_item() + self.validate_customer_provided_item() self.validate_qty() self.set_transfer_qty() self.validate_uom_is_integer("uom", "qty") @@ -203,10 +204,6 @@ class StockEntry(StockController): frappe.throw(_("Row #{0}: Please specify Serial No for Item {1}").format(item.idx, item.item_code), frappe.MandatoryError) - #Customer Provided parts will have zero valuation rate - if frappe.db.get_value('Item', item.item_code, 'is_customer_provided_item'): - item.allow_zero_valuation_rate = 1 - def validate_qty(self): manufacture_purpose = ["Manufacture", "Material Consumption for Manufacture"] From 2a9a5352bb0f05102a990d127c6184947c7bac4e Mon Sep 17 00:00:00 2001 From: marination Date: Fri, 3 Apr 2020 18:25:21 +0530 Subject: [PATCH 05/20] fix: Test Cases and block expense on outward entry - Throw error if rate present against Customer Provided Item in DN and SI - Added test cases for Sales Invoice and Delivery Note - Allow SI and DN with 0 rate in Test --- .../doctype/sales_invoice/test_sales_invoice.py | 12 +++++++++++- erpnext/controllers/stock_controller.py | 3 +++ .../doctype/delivery_note/test_delivery_note.py | 12 +++++++++++- .../stock/doctype/stock_entry/test_stock_entry.py | 2 +- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index 3d5ce8ac40..0e54b62caa 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -1926,6 +1926,16 @@ class TestSalesInvoice(unittest.TestCase): item.taxes = [] item.save() + def test_customer_provided_parts_si(self): + create_item('CUST-0987', is_customer_provided_item = 1, customer = '_Test Customer', is_purchase_item = 0) + si = create_sales_invoice(item_code='CUST-0987', rate=0) + self.assertEqual(si.get("items")[0].allow_zero_valuation_rate, 1) + self.assertEqual(si.get("items")[0].amount, 0) + + # test if Sales Invoice with rate is allowed + si2 = create_sales_invoice(item_code='CUST-0987', do_not_save=True) + self.assertRaises(frappe.ValidationError, si2.save) + def create_sales_invoice(**args): si = frappe.new_doc("Sales Invoice") args = frappe._dict(args) @@ -1948,7 +1958,7 @@ def create_sales_invoice(**args): "gst_hsn_code": "999800", "warehouse": args.warehouse or "_Test Warehouse - _TC", "qty": args.qty or 1, - "rate": args.rate or 100, + "rate": args.rate if args.get("rate") is not None else 100, "income_account": args.income_account or "Sales - _TC", "expense_account": args.expense_account or "Cost of Goods Sold - _TC", "cost_center": args.cost_center or "_Test Cost Center - _TC", diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py index 55a2c435a1..4037f2f60f 100644 --- a/erpnext/controllers/stock_controller.py +++ b/erpnext/controllers/stock_controller.py @@ -383,6 +383,9 @@ class StockController(AccountsController): # Customer Provided parts will have zero valuation rate if frappe.db.get_value('Item', d.item_code, 'is_customer_provided_item'): d.allow_zero_valuation_rate = 1 + if d.parenttype in ["Delivery Note", "Sales Invoice"] and d.rate: + frappe.throw(_("Row #{0}: {1} cannot have {2} as it is a Customer Provided Item") + .format(d.idx, frappe.bold(d.item_code), frappe.bold("Rate"))) def update_gl_entries_after(posting_date, posting_time, for_warehouses=None, for_items=None, warehouse_account=None, company=None): diff --git a/erpnext/stock/doctype/delivery_note/test_delivery_note.py b/erpnext/stock/doctype/delivery_note/test_delivery_note.py index dc92c5c9ff..47a72b21a6 100644 --- a/erpnext/stock/doctype/delivery_note/test_delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/test_delivery_note.py @@ -21,6 +21,7 @@ from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation \ from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order, create_dn_against_so from erpnext.accounts.doctype.account.test_account import get_inventory_account, create_account from erpnext.stock.doctype.warehouse.test_warehouse import get_warehouse +from erpnext.stock.doctype.item.test_item import create_item class TestDeliveryNote(unittest.TestCase): def setUp(self): @@ -433,6 +434,15 @@ class TestDeliveryNote(unittest.TestCase): update_delivery_note_status(dn.name, "Closed") self.assertEqual(frappe.db.get_value("Delivery Note", dn.name, "Status"), "Closed") + def test_customer_provided_parts_dn(self): + create_item('CUST-0987', is_customer_provided_item = 1, customer = '_Test Customer', is_purchase_item = 0) + dn = create_delivery_note(item_code='CUST-0987', rate=0) + self.assertEqual(dn.get("items")[0].allow_zero_valuation_rate, 1) + + # test if Delivery Note with rate is allowed against Customer Provided Item + dn2 = create_delivery_note(item_code='CUST-0987', do_not_save=True) + self.assertRaises(frappe.ValidationError, dn2.save) + def test_dn_billing_status_case1(self): # SO -> DN -> SI so = make_sales_order() @@ -671,7 +681,7 @@ def create_delivery_note(**args): "item_code": args.item or args.item_code or "_Test Item", "warehouse": args.warehouse or "_Test Warehouse - _TC", "qty": args.qty or 1, - "rate": args.rate or 100, + "rate": args.rate if args.get("rate") is not None else 100, "conversion_factor": 1.0, "allow_zero_valuation_rate": args.allow_zero_valuation_rate or 1, "expense_account": args.expense_account or "Cost of Goods Sold - _TC", diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py index ee5f237098..2afabe1480 100644 --- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py @@ -744,7 +744,7 @@ class TestStockEntry(unittest.TestCase): def test_customer_provided_parts_se(self): create_item('CUST-0987', is_customer_provided_item = 1, customer = '_Test Customer', is_purchase_item = 0) - se = make_stock_entry(item_code='CUST-0987', purporse = 'Material Receipt', qty=4, to_warehouse = "_Test Warehouse - _TC") + se = make_stock_entry(item_code='CUST-0987', purpose = 'Material Receipt', qty=4, to_warehouse = "_Test Warehouse - _TC") self.assertEqual(se.get("items")[0].allow_zero_valuation_rate, 1) self.assertEqual(se.get("items")[0].amount, 0) From 642f19d704471b9ad0370c3f5304eb69e9cab11d Mon Sep 17 00:00:00 2001 From: marination Date: Mon, 6 Apr 2020 16:01:50 +0530 Subject: [PATCH 06/20] fix: Patch fix --- erpnext/patches/v12_0/set_updated_purpose_in_pick_list.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/patches/v12_0/set_updated_purpose_in_pick_list.py b/erpnext/patches/v12_0/set_updated_purpose_in_pick_list.py index 42491882c4..03a74cff6c 100644 --- a/erpnext/patches/v12_0/set_updated_purpose_in_pick_list.py +++ b/erpnext/patches/v12_0/set_updated_purpose_in_pick_list.py @@ -6,5 +6,6 @@ from __future__ import unicode_literals import frappe def execute(): + frappe.reload_doctype("Pick List") frappe.db.sql("""UPDATE `tabPick List` set purpose = 'Delivery' WHERE docstatus = 1 and purpose = 'Delivery against Sales Order' """) \ No newline at end of file From 39f9dd03a7c43edb03ba8695f22b22da8828b2fa Mon Sep 17 00:00:00 2001 From: marination Date: Tue, 7 Apr 2020 14:03:50 +0530 Subject: [PATCH 07/20] fix: Use reload_doc in patch --- erpnext/patches/v12_0/set_updated_purpose_in_pick_list.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/patches/v12_0/set_updated_purpose_in_pick_list.py b/erpnext/patches/v12_0/set_updated_purpose_in_pick_list.py index 03a74cff6c..63ca540a8e 100644 --- a/erpnext/patches/v12_0/set_updated_purpose_in_pick_list.py +++ b/erpnext/patches/v12_0/set_updated_purpose_in_pick_list.py @@ -6,6 +6,6 @@ from __future__ import unicode_literals import frappe def execute(): - frappe.reload_doctype("Pick List") + frappe.reload_doc("stock", "doctype", "pick_list") frappe.db.sql("""UPDATE `tabPick List` set purpose = 'Delivery' WHERE docstatus = 1 and purpose = 'Delivery against Sales Order' """) \ No newline at end of file From f93dc8dd883d66431bdf54d8f7d56c6dd2decb43 Mon Sep 17 00:00:00 2001 From: Saqib Date: Wed, 8 Apr 2020 09:20:17 +0530 Subject: [PATCH 08/20] fix: [ux] enforce 'get references from' in payment order (#21175) --- erpnext/accounts/doctype/payment_order/payment_order.js | 4 ++-- erpnext/accounts/doctype/payment_order/payment_order.json | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/payment_order/payment_order.js b/erpnext/accounts/doctype/payment_order/payment_order.js index d6d494668a..d12e474c5b 100644 --- a/erpnext/accounts/doctype/payment_order/payment_order.js +++ b/erpnext/accounts/doctype/payment_order/payment_order.js @@ -15,11 +15,11 @@ frappe.ui.form.on('Payment Order', { if (frm.doc.docstatus == 0) { frm.add_custom_button(__('Payment Request'), function() { frm.trigger("get_from_payment_request"); - }, __("Get from")); + }, __("Get Payments from")); frm.add_custom_button(__('Payment Entry'), function() { frm.trigger("get_from_payment_entry"); - }, __("Get from")); + }, __("Get Payments from")); frm.trigger('remove_button'); } diff --git a/erpnext/accounts/doctype/payment_order/payment_order.json b/erpnext/accounts/doctype/payment_order/payment_order.json index 2e12ad3523..2ed0a4a22f 100644 --- a/erpnext/accounts/doctype/payment_order/payment_order.json +++ b/erpnext/accounts/doctype/payment_order/payment_order.json @@ -59,7 +59,6 @@ "fieldtype": "Section Break" }, { - "allow_bulk_edit": 1, "fieldname": "references", "fieldtype": "Table", "label": "Payment Order Reference", @@ -108,7 +107,7 @@ } ], "is_submittable": 1, - "modified": "2019-05-14 17:12:24.912666", + "modified": "2020-04-06 18:00:56.022642", "modified_by": "Administrator", "module": "Accounts", "name": "Payment Order", From 385a92d3f247434de669489581b19ff294989e3f Mon Sep 17 00:00:00 2001 From: Raffael Meyer Date: Wed, 8 Apr 2020 05:54:34 +0200 Subject: [PATCH 09/20] fix(patch): set_task_status (#21130) * fix(patch): set_task_status * remove unnecessary loop, use tabs Co-authored-by: Nabin Hait --- erpnext/patches/v12_0/set_task_status.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/erpnext/patches/v12_0/set_task_status.py b/erpnext/patches/v12_0/set_task_status.py index 70f65097dc..dbd7e5a818 100644 --- a/erpnext/patches/v12_0/set_task_status.py +++ b/erpnext/patches/v12_0/set_task_status.py @@ -1,16 +1,15 @@ import frappe def execute(): - frappe.reload_doctype('Task') + frappe.reload_doctype('Task') - # add "Completed" if customized - for doctype in ('Task'): - property_setter_name = frappe.db.exists('Property Setter', dict(doc_type = doctype, field_name = 'status', property = 'options')) - if property_setter_name: - property_setter = frappe.get_doc('Property Setter', property_setter_name) - if not "Completed" in property_setter.value: - property_setter.value = property_setter.value + '\nCompleted' - property_setter.save() + # add "Completed" if customized + property_setter_name = frappe.db.exists('Property Setter', dict(doc_type='Task', field_name = 'status', property = 'options')) + if property_setter_name: + property_setter = frappe.get_doc('Property Setter', property_setter_name) + if not "Completed" in property_setter.value: + property_setter.value = property_setter.value + '\nCompleted' + property_setter.save() - # renamed default status to Completed as status "Closed" is ambiguous - frappe.db.sql('update tabTask set status = "Completed" where status = "Closed"') \ No newline at end of file + # renamed default status to Completed as status "Closed" is ambiguous + frappe.db.sql('update tabTask set status = "Completed" where status = "Closed"') From 28753268e60a30bcd99bd59bb91434752c0c3767 Mon Sep 17 00:00:00 2001 From: Raffael Meyer Date: Wed, 8 Apr 2020 05:56:18 +0200 Subject: [PATCH 10/20] fix(regional): DATEV report: description in header, quote nonnumeric values (#21126) * fix description in header, quote nonnumeric values * fix: truncate 'Buchungstext' to 60 chars --- erpnext/regional/report/datev/datev.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/erpnext/regional/report/datev/datev.py b/erpnext/regional/report/datev/datev.py index a6579121cb..a8e40cc493 100644 --- a/erpnext/regional/report/datev/datev.py +++ b/erpnext/regional/report/datev/datev.py @@ -13,6 +13,7 @@ import json import zlib import zipfile import six +from csv import QUOTE_NONNUMERIC from six import BytesIO from six import string_types import frappe @@ -80,7 +81,7 @@ def get_transactions(filters, as_dict=1): gl.posting_date as 'Belegdatum', gl.voucher_no as 'Belegfeld 1', - gl.remarks as 'Buchungstext', + LEFT(gl.remarks, 60) as 'Buchungstext', gl.voucher_type as 'Beleginfo - Art 1', gl.voucher_no as 'Beleginfo - Inhalt 1', gl.against_voucher_type as 'Beleginfo - Art 2', @@ -268,7 +269,9 @@ def get_datev_csv(data, filters, csv_class): # Do not number rows index=False, # Use all columns defined above - columns=csv_class.COLUMNS + columns=csv_class.COLUMNS, + # Quote most fields, even currency values with "," separator + quoting=QUOTE_NONNUMERIC ) if not six.PY2: @@ -285,6 +288,7 @@ def get_datev_csv(data, filters, csv_class): def get_header(filters, csv_class): coa = frappe.get_value("Company", filters.get("company"), "chart_of_accounts") + description = filters.get("voucher_type", csv_class.FORMAT_NAME) coa_used = "04" if "SKR04" in coa else ("03" if "SKR03" in coa else "") header = [ @@ -323,12 +327,8 @@ def get_header(filters, csv_class): frappe.utils.formatdate(filters.get('from_date'), "yyyyMMdd"), # P = Transaction batch end date (YYYYMMDD) frappe.utils.formatdate(filters.get('to_date'), "yyyyMMdd"), - # Q = Description (for example, "January - February 2019 Transactions") - '"{} - {} {}"'.format( - frappe.utils.formatdate(filters.get('from_date'), "MMMM yyyy"), - frappe.utils.formatdate(filters.get('to_date'), "MMMM yyyy"), - csv_class.FORMAT_NAME - ), + # Q = Description (for example, "Sales Invoice") Max. 30 chars + '"{}"'.format(_(description)), # R = Diktatkürzel '', # S = Buchungstyp From da6806e6bc061dceac44c88ebd18108f09d5f427 Mon Sep 17 00:00:00 2001 From: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com> Date: Wed, 8 Apr 2020 09:32:41 +0530 Subject: [PATCH 11/20] fix: Translation strings with trailing spaces (#21192) --- erpnext/controllers/accounts_controller.py | 2 +- .../student_and_guardian_contact_details.py | 12 ++++++------ .../doctype/leave_application/leave_application.py | 3 +-- erpnext/projects/report/billing_summary.py | 2 +- erpnext/stock/dashboard/item_dashboard.js | 4 ++-- erpnext/stock/doctype/item/item.py | 2 +- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 76eb56f523..5a3ec4ef61 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -439,7 +439,7 @@ class AccountsController(TransactionBase): if account_currency not in valid_currency: frappe.throw(_("Account {0} is invalid. Account Currency must be {1}") - .format(account, _(" or ").join(valid_currency))) + .format(account, (' ' + _("or") + ' ').join(valid_currency))) def clear_unallocated_advances(self, childtype, parentfield): self.set(parentfield, self.get(parentfield, {"allocated_amount": ["not in", [0, None, ""]]})) diff --git a/erpnext/education/report/student_and_guardian_contact_details/student_and_guardian_contact_details.py b/erpnext/education/report/student_and_guardian_contact_details/student_and_guardian_contact_details.py index c2ac0d7d7b..5bebd4385c 100644 --- a/erpnext/education/report/student_and_guardian_contact_details/student_and_guardian_contact_details.py +++ b/erpnext/education/report/student_and_guardian_contact_details/student_and_guardian_contact_details.py @@ -14,7 +14,7 @@ def execute(filters=None): student_batch_name = filters.get("student_batch_name") columns = get_columns() - + program_enrollments = frappe.get_list("Program Enrollment", fields=["student", "student_name"], filters={"academic_year": academic_year, "program": program, "student_batch_name": student_batch_name}) @@ -46,9 +46,9 @@ def execute(filters=None): def get_columns(): columns = [ - _(" Group Roll No") + "::60", - _("Student ID") + ":Link/Student:90", - _("Student Name") + "::150", + _("Group Roll No") + "::60", + _("Student ID") + ":Link/Student:90", + _("Student Name") + "::150", _("Student Mobile No.") + "::110", _("Student Email ID") + "::125", _("Student Address") + "::175", @@ -84,10 +84,10 @@ def get_guardian_map(student_list): guardian_list = list(set([g.guardian for g in guardian_details])) or [''] - guardian_mobile_no = dict(frappe.db.sql("""select name, mobile_number from `tabGuardian` + guardian_mobile_no = dict(frappe.db.sql("""select name, mobile_number from `tabGuardian` where name in (%s)""" % ", ".join(['%s']*len(guardian_list)), tuple(guardian_list))) - guardian_email_id = dict(frappe.db.sql("""select name, email_address from `tabGuardian` + guardian_email_id = dict(frappe.db.sql("""select name, email_address from `tabGuardian` where name in (%s)""" % ", ".join(['%s']*len(guardian_list)), tuple(guardian_list))) for guardian in guardian_details: diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py index f78e17fb18..afd52de397 100755 --- a/erpnext/hr/doctype/leave_application/leave_application.py +++ b/erpnext/hr/doctype/leave_application/leave_application.py @@ -687,8 +687,7 @@ def add_leaves(events, start, end, filter_conditions=None): "to_date": d.to_date, "docstatus": d.docstatus, "color": d.color, - "title": cstr(d.employee_name) + \ - (d.half_day and _(" (Half Day)") or ""), + "title": cstr(d.employee_name) + (' ' + _('(Half Day)') if d.half_day else ''), } if e not in events: events.append(e) diff --git a/erpnext/projects/report/billing_summary.py b/erpnext/projects/report/billing_summary.py index 76379f1de2..b808268d1b 100644 --- a/erpnext/projects/report/billing_summary.py +++ b/erpnext/projects/report/billing_summary.py @@ -53,7 +53,7 @@ def get_columns(): def get_data(filters): data = [] if(filters.from_date > filters.to_date): - frappe.msgprint(_(" From Date can not be greater than To Date")) + frappe.msgprint(_("From Date can not be greater than To Date")) return data timesheets = get_timesheets(filters) diff --git a/erpnext/stock/dashboard/item_dashboard.js b/erpnext/stock/dashboard/item_dashboard.js index 1bfa2cf56c..9bd03d45cb 100644 --- a/erpnext/stock/dashboard/item_dashboard.js +++ b/erpnext/stock/dashboard/item_dashboard.js @@ -108,8 +108,8 @@ erpnext.stock.ItemDashboard = Class.extend({ if (context.data.length > 0) { $(frappe.render_template('item_dashboard_list', context)).appendTo(this.result); } else { - var message = __(" Currently no stock available in any warehouse") - $(""+message+"").appendTo(this.result); + var message = __("Currently no stock available in any warehouse"); + $(` ${message} `).appendTo(this.result); } }, get_item_dashboard_data: function(data, max_count, show_item) { diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index 7d31942f7f..c62b3ab583 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -308,7 +308,7 @@ class Item(WebsiteGenerator): if self.retain_sample and not frappe.db.get_single_value('Stock Settings', 'sample_retention_warehouse'): frappe.throw(_("Please select Sample Retention Warehouse in Stock Settings first")) if self.retain_sample and not self.has_batch_no: - frappe.throw(_(" {0} Retain Sample is based on batch, please check Has Batch No to retain sample of item").format( + frappe.throw(_("{0} Retain Sample is based on batch, please check Has Batch No to retain sample of item").format( self.item_code)) def get_context(self, context): From 04870ae23a5471cc1de9c6626ccd84704c87fd33 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 8 Apr 2020 09:34:46 +0530 Subject: [PATCH 12/20] fix: Replace newlines with spaces before evaluation of condition and formula (#21165) --- erpnext/hr/doctype/salary_slip/salary_slip.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py index d03a3dd9a3..c637215e96 100644 --- a/erpnext/hr/doctype/salary_slip/salary_slip.py +++ b/erpnext/hr/doctype/salary_slip/salary_slip.py @@ -356,13 +356,13 @@ class SalarySlip(TransactionBase): def eval_condition_and_formula(self, d, data): try: - condition = d.condition.strip() if d.condition else None + condition = d.condition.strip().replace("\n", " ") if d.condition else None if condition: if not frappe.safe_eval(condition, self.whitelisted_globals, data): return None amount = d.amount if d.amount_based_on_formula: - formula = d.formula.strip() if d.formula else None + formula = d.formula.strip().replace("\n", " ") if d.formula else None if formula: amount = flt(frappe.safe_eval(formula, self.whitelisted_globals, data), d.precision("amount")) if amount: From 683581edef98d35932a4852605fb8260705aee09 Mon Sep 17 00:00:00 2001 From: Saqib Date: Wed, 8 Apr 2020 11:49:06 +0530 Subject: [PATCH 13/20] fix: cannot find accounting module while rendering breadcrumb (#21190) --- erpnext/accounts/doctype/account/account_tree.js | 2 +- erpnext/accounts/doctype/cost_center/cost_center_tree.js | 2 +- erpnext/public/js/conf.js | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/account/account_tree.js b/erpnext/accounts/doctype/account/account_tree.js index efac1af551..f62d07668d 100644 --- a/erpnext/accounts/doctype/account/account_tree.js +++ b/erpnext/accounts/doctype/account/account_tree.js @@ -1,7 +1,7 @@ frappe.provide("frappe.treeview_settings") frappe.treeview_settings["Account"] = { - breadcrumbs: "Accounts", + breadcrumb: "Accounts", title: __("Chart Of Accounts"), get_tree_root: false, filters: [ diff --git a/erpnext/accounts/doctype/cost_center/cost_center_tree.js b/erpnext/accounts/doctype/cost_center/cost_center_tree.js index 16d9734432..fde41233c4 100644 --- a/erpnext/accounts/doctype/cost_center/cost_center_tree.js +++ b/erpnext/accounts/doctype/cost_center/cost_center_tree.js @@ -1,5 +1,5 @@ frappe.treeview_settings["Cost Center"] = { - breadcrumbs: "Accounts", + breadcrumb: "Accounts", get_tree_root: false, filters: [{ fieldname: "company", diff --git a/erpnext/public/js/conf.js b/erpnext/public/js/conf.js index 615f6a43f9..9870f81910 100644 --- a/erpnext/public/js/conf.js +++ b/erpnext/public/js/conf.js @@ -43,7 +43,6 @@ $.extend(frappe.breadcrumbs.preferred, { $.extend(frappe.breadcrumbs.module_map, { 'ERPNext Integrations': 'Integrations', 'Geo': 'Settings', - 'Accounts': 'Accounting', 'Portal': 'Website', 'Utilities': 'Settings', 'Shopping Cart': 'Website', From 562fd0eab0d7434bb8ab7d61767074b0097af457 Mon Sep 17 00:00:00 2001 From: Saqib Date: Wed, 8 Apr 2020 12:11:40 +0530 Subject: [PATCH 14/20] fix: purchase return are allowed even when assets are not cancelled (#20797) * fix: purchase return are allowed even when assets are not cancelled * chore: test case * fix: error message Co-authored-by: Nabin Hait --- erpnext/controllers/buying_controller.py | 14 ++++++++++ .../purchase_receipt/test_purchase_receipt.py | 27 +++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index fcc9098ba1..0e72ec2853 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -45,6 +45,7 @@ class BuyingController(StockController): self.validate_warehouse() self.validate_from_warehouse() self.set_supplier_address() + self.validate_asset_return() if self.doctype=="Purchase Invoice": self.validate_purchase_receipt_if_update_stock() @@ -100,6 +101,19 @@ class BuyingController(StockController): for d in tax_for_valuation: d.category = 'Total' msgprint(_('Tax Category has been changed to "Total" because all the Items are non-stock items')) + + def validate_asset_return(self): + if self.doctype not in ['Purchase Receipt', 'Purchase Invoice'] or not self.is_return: + return + + purchase_doc_field = 'purchase_receipt' if self.doctype == 'Purchase Receipt' else 'purchase_invoice' + not_cancelled_asset = [d.name for d in frappe.db.get_all("Asset", { + purchase_doc_field: self.return_against, + "docstatus": 1 + })] + if self.is_return and len(not_cancelled_asset): + frappe.throw(_("{} has submitted assets linked to it. You need to cancel the assets to create purchase return.".format(self.return_against)), + title=_("Not Allowed")) def get_asset_items(self): if self.doctype not in ['Purchase Order', 'Purchase Invoice', 'Purchase Receipt']: diff --git a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py index cba7f20153..113da9f421 100644 --- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py @@ -375,6 +375,33 @@ class TestPurchaseReceipt(unittest.TestCase): location = frappe.db.get_value('Asset', assets[0].name, 'location') self.assertEquals(location, "Test Location") + + def test_purchase_return_with_submitted_asset(self): + from erpnext.stock.doctype.purchase_receipt.purchase_receipt import make_purchase_return + + pr = make_purchase_receipt(item_code="Test Asset Item", qty=1) + + asset = frappe.get_doc("Asset", { + 'purchase_receipt': pr.name + }) + asset.available_for_use_date = frappe.utils.nowdate() + asset.gross_purchase_amount = 50.0 + asset.append("finance_books", { + "expected_value_after_useful_life": 10, + "depreciation_method": "Straight Line", + "total_number_of_depreciations": 3, + "frequency_of_depreciation": 1, + "depreciation_start_date": frappe.utils.nowdate() + }) + asset.submit() + + pr_return = make_purchase_return(pr.name) + self.assertRaises(frappe.exceptions.ValidationError, pr_return.submit) + + asset.load_from_db() + asset.cancel() + + pr_return.submit() def test_purchase_receipt_for_enable_allow_cost_center_in_entry_of_bs_account(self): from erpnext.accounts.doctype.cost_center.test_cost_center import create_cost_center From 49816b0c5f1139273b45ecf07b1c712d7d0857fe Mon Sep 17 00:00:00 2001 From: Mangesh-Khairnar Date: Wed, 8 Apr 2020 12:57:14 +0530 Subject: [PATCH 15/20] fix(MWS): add new regions to marketplace (#21196) * fix(MWS): add marketplace region for uae * fix: rename the fields for mws integrations Co-authored-by: Nabin Hait --- .../amazon_mws_settings/amazon_methods.py | 2 +- .../amazon_mws_settings/amazon_mws_api.py | 23 +- .../amazon_mws_settings.json | 1139 +++-------------- .../amazon_mws_settings.py | 7 +- erpnext/patches.txt | 1 + .../v12_0/rename_mws_settings_fields.py | 11 + 6 files changed, 231 insertions(+), 952 deletions(-) create mode 100644 erpnext/patches/v12_0/rename_mws_settings_fields.py diff --git a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_methods.py b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_methods.py index 3bc8db5e78..cc75a0afbe 100644 --- a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_methods.py +++ b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_methods.py @@ -121,7 +121,7 @@ def call_mws_method(mws_method, *args, **kwargs): time.sleep(delay) continue - mws_settings.enable_synch = 0 + mws_settings.enable_sync = 0 mws_settings.save() frappe.throw(_("Sync has been temporarily disabled because maximum retries have been exceeded")) diff --git a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_api.py b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_api.py index 9925dc4a08..f713684d37 100755 --- a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_api.py +++ b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_api.py @@ -39,16 +39,19 @@ __all__ = [ # for a list of the end points and marketplace IDs MARKETPLACES = { - "CA" : "https://mws.amazonservices.ca", #A2EUQ1WTGCTBG2 - "US" : "https://mws.amazonservices.com", #ATVPDKIKX0DER", - "DE" : "https://mws-eu.amazonservices.com", #A1PA6795UKMFR9 - "ES" : "https://mws-eu.amazonservices.com", #A1RKKUPIHCS9HS - "FR" : "https://mws-eu.amazonservices.com", #A13V1IB3VIYZZH - "IN" : "https://mws.amazonservices.in", #A21TJRUUN4KGV - "IT" : "https://mws-eu.amazonservices.com", #APJ6JRA9NG5V4 - "UK" : "https://mws-eu.amazonservices.com", #A1F83G8C2ARO7P - "JP" : "https://mws.amazonservices.jp", #A1VC38T7YXB528 - "CN" : "https://mws.amazonservices.com.cn", #AAHKV2X7AFYLW + "CA": "https://mws.amazonservices.ca", #A2EUQ1WTGCTBG2 + "US": "https://mws.amazonservices.com", #ATVPDKIKX0DER", + "DE": "https://mws-eu.amazonservices.com", #A1PA6795UKMFR9 + "ES": "https://mws-eu.amazonservices.com", #A1RKKUPIHCS9HS + "FR": "https://mws-eu.amazonservices.com", #A13V1IB3VIYZZH + "IN": "https://mws.amazonservices.in", #A21TJRUUN4KGV + "IT": "https://mws-eu.amazonservices.com", #APJ6JRA9NG5V4 + "UK": "https://mws-eu.amazonservices.com", #A1F83G8C2ARO7P + "JP": "https://mws.amazonservices.jp", #A1VC38T7YXB528 + "CN": "https://mws.amazonservices.com.cn", #AAHKV2X7AFYLW + "AE": " https://mws.amazonservices.ae", #A2VIGQ35RCS4UG + "MX": "https://mws.amazonservices.com.mx", #A1AM78C64UM0Y8 + "BR": "https://mws.amazonservices.com", #A2Q3Y263D00KWC } diff --git a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_settings.json b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_settings.json index 607ca4fe1d..5a678e77d1 100644 --- a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_settings.json +++ b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_settings.json @@ -1,974 +1,237 @@ { - "allow_copy": 0, - "allow_guest_to_view": 0, - "allow_import": 0, - "allow_rename": 0, - "autoname": "", - "beta": 0, - "creation": "2018-07-31 05:51:41.357047", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "", - "editable_grid": 1, - "engine": "InnoDB", + "actions": [], + "creation": "2018-07-31 05:51:41.357047", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "enable_amazon", + "mws_credentials", + "seller_id", + "aws_access_key_id", + "mws_auth_token", + "secret_key", + "column_break_4", + "market_place_id", + "region", + "domain", + "section_break_13", + "company", + "warehouse", + "item_group", + "price_list", + "column_break_17", + "customer_group", + "territory", + "customer_type", + "market_place_account_group", + "section_break_12", + "after_date", + "taxes_charges", + "sync_products", + "sync_orders", + "column_break_10", + "enable_sync", + "max_retry_limit" + ], "fields": [ { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "enable_amazon", - "fieldtype": "Check", - "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": "Enable Amazon", - "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, - "translatable": 0, - "unique": 0 - }, + "default": "0", + "fieldname": "enable_amazon", + "fieldtype": "Check", + "label": "Enable Amazon" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": "", - "columns": 0, - "fieldname": "mws_credentials", - "fieldtype": "Section Break", - "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": "MWS Credentials", - "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, - "translatable": 0, - "unique": 0 - }, + "fieldname": "mws_credentials", + "fieldtype": "Section Break", + "label": "MWS Credentials" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "seller_id", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Seller ID", - "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": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "seller_id", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Seller ID", + "reqd": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "aws_access_key_id", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "AWS Access Key ID", - "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": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "aws_access_key_id", + "fieldtype": "Data", + "in_list_view": 1, + "label": "AWS Access Key ID", + "reqd": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "mws_auth_token", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "MWS Auth Token", - "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": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "mws_auth_token", + "fieldtype": "Data", + "in_list_view": 1, + "label": "MWS Auth Token", + "reqd": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "secret_key", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Secret Key", - "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": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "secret_key", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Secret Key", + "reqd": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_4", - "fieldtype": "Column Break", - "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, - "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, - "translatable": 0, - "unique": 0 - }, + "fieldname": "column_break_4", + "fieldtype": "Column Break" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "market_place_id", - "fieldtype": "Data", - "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": "Market Place ID", - "length": 0, - "no_copy": 0, - "options": "", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "market_place_id", + "fieldtype": "Data", + "label": "Market Place ID", + "reqd": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "region", - "fieldtype": "Select", - "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": "Region", - "length": 0, - "no_copy": 0, - "options": "\nIN\nCN\nJP\nBR\nAU\nES\nUK\nFR\nDE\nIT\nCA\nUS\nMX", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "region", + "fieldtype": "Select", + "label": "Region", + "options": "\nAE\nAU\nBR\nCA\nCN\nDE\nES\nFR\nIN\nJP\nIT\nMX\nUK\nUS", + "reqd": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "domain", - "fieldtype": "Data", - "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": "Domain", - "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": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "domain", + "fieldtype": "Data", + "label": "Domain", + "reqd": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "section_break_13", - "fieldtype": "Section Break", - "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, - "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, - "translatable": 0, - "unique": 0 - }, + "fieldname": "section_break_13", + "fieldtype": "Section Break" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "company", - "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": "Company", - "length": 0, - "no_copy": 0, - "options": "Company", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "company", + "fieldtype": "Link", + "label": "Company", + "options": "Company", + "reqd": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "warehouse", - "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": "Warehouse", - "length": 0, - "no_copy": 0, - "options": "Warehouse", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "warehouse", + "fieldtype": "Link", + "label": "Warehouse", + "options": "Warehouse", + "reqd": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "item_group", - "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": "Item Group", - "length": 0, - "no_copy": 0, - "options": "Item Group", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "item_group", + "fieldtype": "Link", + "label": "Item Group", + "options": "Item Group", + "reqd": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "price_list", - "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": "Price List", - "length": 0, - "no_copy": 0, - "options": "Price List", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "price_list", + "fieldtype": "Link", + "label": "Price List", + "options": "Price List", + "reqd": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_17", - "fieldtype": "Column Break", - "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, - "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, - "translatable": 0, - "unique": 0 - }, + "fieldname": "column_break_17", + "fieldtype": "Column Break" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "customer_group", - "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": "Customer Group", - "length": 0, - "no_copy": 0, - "options": "Customer Group", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "customer_group", + "fieldtype": "Link", + "label": "Customer Group", + "options": "Customer Group", + "reqd": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "territory", - "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": "Territory", - "length": 0, - "no_copy": 0, - "options": "Territory", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "territory", + "fieldtype": "Link", + "label": "Territory", + "options": "Territory", + "reqd": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "customer_type", - "fieldtype": "Select", - "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": "Customer Type", - "length": 0, - "no_copy": 0, - "options": "Individual\nCompany", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "customer_type", + "fieldtype": "Select", + "label": "Customer Type", + "options": "Individual\nCompany", + "reqd": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "market_place_account_group", - "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": "Market Place Account Group", - "length": 0, - "no_copy": 0, - "options": "Account", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "fieldname": "market_place_account_group", + "fieldtype": "Link", + "label": "Market Place Account Group", + "options": "Account", + "reqd": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "section_break_12", - "fieldtype": "Section Break", - "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, - "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, - "translatable": 0, - "unique": 0 - }, + "fieldname": "section_break_12", + "fieldtype": "Section Break" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "description": "Amazon will synch data updated after this date", - "fieldname": "after_date", - "fieldtype": "Datetime", - "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": "After Date", - "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": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, + "description": "Amazon will synch data updated after this date", + "fieldname": "after_date", + "fieldtype": "Datetime", + "label": "After Date", + "reqd": 1 + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "description": "Get financial breakup of Taxes and charges data by Amazon ", - "fieldname": "taxes_charges", - "fieldtype": "Check", - "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": "Synch Taxes and Charges", - "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, - "translatable": 0, - "unique": 0 - }, + "default": "0", + "description": "Get financial breakup of Taxes and charges data by Amazon ", + "fieldname": "taxes_charges", + "fieldtype": "Check", + "label": "Sync Taxes and Charges" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "description": "Always synch your products from Amazon MWS before synching the Orders details", - "fieldname": "synch_products", - "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": "Synch Products", - "length": 0, - "no_copy": 0, - "options": "get_products_details", - "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, - "translatable": 0, - "unique": 0 - }, + "fieldname": "column_break_10", + "fieldtype": "Column Break" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "description": "Click this button to pull your Sales Order data from Amazon MWS.", - "fieldname": "synch_orders", - "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": "Synch Orders", - "length": 0, - "no_copy": 0, - "options": "get_order_details", - "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, - "translatable": 0, - "unique": 0 - }, + "default": "3", + "fieldname": "max_retry_limit", + "fieldtype": "Int", + "label": "Max Retry Limit" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_10", - "fieldtype": "Column Break", - "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, - "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, - "translatable": 0, - "unique": 0 - }, + "description": "Always sync your products from Amazon MWS before synching the Orders details", + "fieldname": "sync_products", + "fieldtype": "Button", + "label": "Sync Products", + "options": "get_products_details" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "", - "description": "Check this to enable a scheduled Daily synchronization routine via scheduler", - "fieldname": "enable_synch", - "fieldtype": "Check", - "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": "Enable Scheduled Synch", - "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, - "translatable": 0, - "unique": 0 - }, + "description": "Click this button to pull your Sales Order data from Amazon MWS.", + "fieldname": "sync_orders", + "fieldtype": "Button", + "label": "Sync Orders", + "options": "get_order_details" + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "3", - "fieldname": "max_retry_limit", - "fieldtype": "Int", - "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": "Max Retry Limit", - "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, - "translatable": 0, - "unique": 0 + "default": "0", + "description": "Check this to enable a scheduled Daily synchronization routine via scheduler", + "fieldname": "enable_sync", + "fieldtype": "Check", + "label": "Enable Scheduled Sync" } - ], - "has_web_view": 0, - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 0, - "image_view": 0, - "in_create": 0, - "is_submittable": 0, - "issingle": 1, - "istable": 0, - "max_attachments": 0, - "modified": "2018-09-07 16:45:44.439834", - "modified_by": "Administrator", - "module": "ERPNext Integrations", - "name": "Amazon MWS Settings", - "name_case": "", - "owner": "Administrator", + ], + "issingle": 1, + "links": [], + "modified": "2020-04-07 14:26:20.174848", + "modified_by": "Administrator", + "module": "ERPNext Integrations", + "name": "Amazon MWS Settings", + "owner": "Administrator", "permissions": [ { - "amend": 0, - "cancel": 0, - "create": 1, - "delete": 1, - "email": 1, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 0, - "role": "System Manager", - "set_user_permissions": 0, - "share": 1, - "submit": 0, + "create": 1, + "delete": 1, + "email": 1, + "print": 1, + "read": 1, + "role": "System Manager", + "share": 1, "write": 1 } - ], - "quick_entry": 1, - "read_only": 0, - "read_only_onload": 0, - "show_name_in_global_search": 0, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1, - "track_seen": 0, - "track_views": 0 + ], + "quick_entry": 1, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 } \ No newline at end of file diff --git a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_settings.py b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_settings.py index c222afbb6c..899b7ffe13 100644 --- a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_settings.py +++ b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_settings.py @@ -7,14 +7,15 @@ import frappe from frappe.model.document import Document import dateutil from frappe.custom.doctype.custom_field.custom_field import create_custom_fields +from erpnext.erpnext_integrations.doctype.amazon_mws_settings.amazon_methods import get_orders class AmazonMWSSettings(Document): def validate(self): if self.enable_amazon == 1: - self.enable_synch = 1 + self.enable_sync = 1 setup_custom_fields() else: - self.enable_synch = 0 + self.enable_sync = 0 def get_products_details(self): if self.enable_amazon == 1: @@ -27,7 +28,7 @@ class AmazonMWSSettings(Document): def schedule_get_order_details(): mws_settings = frappe.get_doc("Amazon MWS Settings") - if mws_settings.enable_synch and mws_settings.enable_amazon: + if mws_settings.enable_sync and mws_settings.enable_amazon: after_date = dateutil.parser.parse(mws_settings.after_date).strftime("%Y-%m-%d") get_orders(after_date = after_date) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 031d41cc9b..9b5e5d02fb 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -664,4 +664,5 @@ erpnext.patches.v12_0.rename_bank_reconciliation_fields # 2020-01-22 erpnext.patches.v12_0.set_received_qty_in_material_request_as_per_stock_uom erpnext.patches.v12_0.recalculate_requested_qty_in_bin erpnext.patches.v12_0.set_total_batch_quantity +erpnext.patches.v12_0.rename_mws_settings_fields erpnext.patches.v12_0.set_updated_purpose_in_pick_list diff --git a/erpnext/patches/v12_0/rename_mws_settings_fields.py b/erpnext/patches/v12_0/rename_mws_settings_fields.py new file mode 100644 index 0000000000..e08e376915 --- /dev/null +++ b/erpnext/patches/v12_0/rename_mws_settings_fields.py @@ -0,0 +1,11 @@ +# Copyright (c) 2020, Frappe and Contributors +# License: GNU General Public License v3. See license.txt + +import frappe + +def execute(): + count = frappe.db.sql("SELECT COUNT(*) FROM `tabSingles` WHERE doctype='Amazon MWS Settings' AND field='enable_sync';")[0][0] + if count == 0: + frappe.db.sql("UPDATE `tabSingles` SET field='enable_sync' WHERE doctype='Amazon MWS Settings' AND field='enable_synch';") + + frappe.reload_doc("ERPNext Integrations", "doctype", "Amazon MWS Settings") From 74dd0e12e70273557e4655db02321d3f47c4e64f Mon Sep 17 00:00:00 2001 From: gavin Date: Wed, 8 Apr 2020 12:59:15 +0530 Subject: [PATCH 16/20] fix: enable validations for email and phone data fields (#21199) --- erpnext/crm/doctype/lead/lead.json | 12 +++++++----- erpnext/hr/doctype/employee/employee.json | 13 +++++++------ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/erpnext/crm/doctype/lead/lead.json b/erpnext/crm/doctype/lead/lead.json index 514f878c9c..20ab51d44b 100644 --- a/erpnext/crm/doctype/lead/lead.json +++ b/erpnext/crm/doctype/lead/lead.json @@ -284,8 +284,7 @@ "depends_on": "eval: doc.__islocal", "fieldname": "pincode", "fieldtype": "Data", - "label": "Postal Code", - "options": "Country" + "label": "Postal Code" }, { "fieldname": "column_break2", @@ -303,7 +302,8 @@ "fieldtype": "Data", "label": "Phone", "oldfieldname": "contact_no", - "oldfieldtype": "Data" + "oldfieldtype": "Data", + "options": "Phone" }, { "depends_on": "eval: doc.__islocal", @@ -311,7 +311,8 @@ "fieldtype": "Data", "label": "Mobile No.", "oldfieldname": "mobile_no", - "oldfieldtype": "Data" + "oldfieldtype": "Data", + "options": "Phone" }, { "depends_on": "eval: doc.__islocal", @@ -445,7 +446,8 @@ "icon": "fa fa-user", "idx": 5, "image_field": "image", - "modified": "2020-04-06 20:26:11.687110", + "links": [], + "modified": "2020-04-08 22:26:11.687110", "modified_by": "Administrator", "module": "CRM", "name": "Lead", diff --git a/erpnext/hr/doctype/employee/employee.json b/erpnext/hr/doctype/employee/employee.json index 3f0b9c49ac..13c202c775 100644 --- a/erpnext/hr/doctype/employee/employee.json +++ b/erpnext/hr/doctype/employee/employee.json @@ -259,7 +259,8 @@ "bold": 1, "fieldname": "emergency_phone_number", "fieldtype": "Data", - "label": "Emergency Phone" + "label": "Emergency Phone", + "options": "Phone" }, { "bold": 1, @@ -480,7 +481,8 @@ { "fieldname": "cell_number", "fieldtype": "Data", - "label": "Mobile" + "label": "Mobile", + "options": "Phone" }, { "fieldname": "prefered_contact_email", @@ -787,7 +789,7 @@ "idx": 24, "image_field": "image", "links": [], - "modified": "2020-01-09 04:23:55.611366", + "modified": "2020-04-08 12:25:34.306695", "modified_by": "Administrator", "module": "HR", "name": "Employee", @@ -834,6 +836,5 @@ "show_name_in_global_search": 1, "sort_field": "modified", "sort_order": "DESC", - "title_field": "employee_name", - "track_changes": 1 -} + "title_field": "employee_name" +} \ No newline at end of file From 3e84ab1349cd798608145bc0f81db00081266239 Mon Sep 17 00:00:00 2001 From: Marica Date: Thu, 9 Apr 2020 12:01:10 +0530 Subject: [PATCH 17/20] fix: Error on any new doc from Shipping Rule. (#21206) --- erpnext/accounts/doctype/shipping_rule/shipping_rule.py | 2 +- erpnext/public/js/controllers/transaction.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/shipping_rule/shipping_rule.py b/erpnext/accounts/doctype/shipping_rule/shipping_rule.py index 1fd340c731..b2638c7827 100644 --- a/erpnext/accounts/doctype/shipping_rule/shipping_rule.py +++ b/erpnext/accounts/doctype/shipping_rule/shipping_rule.py @@ -82,7 +82,7 @@ class ShippingRule(Document): if not shipping_country: frappe.throw(_('Shipping Address does not have country, which is required for this Shipping Rule')) if shipping_country not in [d.country for d in self.countries]: - frappe.throw(_('Shipping rule not applicable for country {0}').format(shipping_country)) + frappe.throw(_('Shipping rule not applicable for country {0} in Shipping Address').format(shipping_country)) def add_shipping_rule_to_tax_table(self, doc, shipping_amount): shipping_charge = { diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 2c436b2bde..0c63c33f7a 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -894,7 +894,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ shipping_rule: function() { var me = this; - if(this.frm.doc.shipping_rule) { + if(this.frm.doc.shipping_rule && this.frm.doc.shipping_address) { return this.frm.call({ doc: this.frm.doc, method: "apply_shipping_rule", From 2f5431378e6452f6c4f4a2ca7e08f9925239d903 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 9 Apr 2020 12:48:30 +0530 Subject: [PATCH 18/20] core: Added codeowners --- CODEOWNERS | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 CODEOWNERS diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000000..e8d61cc9fb --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,19 @@ +# Each line is a file pattern followed by one or more owners. + +# These owners will be the default owners for everything in +# the repo. Unless a later match takes precedence, + +* @nabinhait +manufacturing/ @rohitwaghchaure +accounts/ @deepeshgarg007 @nextchamp-saqib +loan_management/ @deepeshgarg007 +pos* @nextchamp-saqib +assets/ @nextchamp-saqib +stock/ @marination @rohitwaghchaure +buying/ @marination @rohitwaghchaure +hr/ @Anurag810 +projects/ @hrwX +support/ @hrwX +healthcare/ @ruchamahabal +erpnext_integrations/ @Mangesh-Khairnar +requirements.txt @gavindsouza From bd063c3fefedeeb980cd9199c165f64c0bec73e0 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 9 Apr 2020 12:49:15 +0530 Subject: [PATCH 19/20] Update CODEOWNERS --- CODEOWNERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index e8d61cc9fb..5e1113d34f 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -3,7 +3,7 @@ # These owners will be the default owners for everything in # the repo. Unless a later match takes precedence, -* @nabinhait +* @nabinhait manufacturing/ @rohitwaghchaure accounts/ @deepeshgarg007 @nextchamp-saqib loan_management/ @deepeshgarg007 @@ -16,4 +16,4 @@ projects/ @hrwX support/ @hrwX healthcare/ @ruchamahabal erpnext_integrations/ @Mangesh-Khairnar -requirements.txt @gavindsouza +requirements.txt @gavindsouza From 7f2477b72cbda18236a3e020ca929dd760dc24ae Mon Sep 17 00:00:00 2001 From: Michelle Alva <50285544+michellealva@users.noreply.github.com> Date: Thu, 9 Apr 2020 17:23:23 +0530 Subject: [PATCH 20/20] fix: better error message due date show better error message payment schedule due date --- erpnext/controllers/accounts_controller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 5a3ec4ef61..d95753df90 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -834,7 +834,7 @@ class AccountsController(TransactionBase): for d in self.get("payment_schedule"): if self.doctype == "Sales Order" and getdate(d.due_date) < getdate(self.transaction_date): - frappe.throw(_("Row {0}: Due Date cannot be before posting date").format(d.idx)) + frappe.throw(_("Row {0}: Due Date in the Payment Terms table cannot be before Posting Date").format(d.idx)) elif d.due_date in dates: li.append(_("{0} in row {1}").format(d.due_date, d.idx)) dates.append(d.due_date)