From 8c9fd62775769d726d139464746e88cc647892a7 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Fri, 6 Sep 2019 12:14:45 +0530 Subject: [PATCH 01/12] fix: ImponibileImporto for On Previous Row Total (#18947) --- erpnext/regional/italy/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/regional/italy/utils.py b/erpnext/regional/italy/utils.py index c8b90ec9ca8..caaf80129b9 100644 --- a/erpnext/regional/italy/utils.py +++ b/erpnext/regional/italy/utils.py @@ -153,7 +153,8 @@ def get_invoice_summary(items, taxes): tax_rate=tax.rate, tax_amount=(reference_row.tax_amount * tax.rate) / 100, net_amount=reference_row.tax_amount, - taxable_amount=reference_row.tax_amount, + taxable_amount=(reference_row.tax_amount if tax.charge_type == 'On Previous Row Amount' + else reference_row.total), item_tax_rate={tax.account_head: tax.rate}, charges=True, type="Actual", From c0a21ad96a939193fcd58678e423740bb69720d5 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Fri, 6 Sep 2019 16:20:01 +0530 Subject: [PATCH 02/12] fix: PrezzoUnitario decimal issue --- erpnext/regional/italy/e-invoice.xml | 14 +++++++------- erpnext/regional/italy/utils.py | 6 +++++- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/erpnext/regional/italy/e-invoice.xml b/erpnext/regional/italy/e-invoice.xml index 9a588d1666b..9978dc0da2e 100644 --- a/erpnext/regional/italy/e-invoice.xml +++ b/erpnext/regional/italy/e-invoice.xml @@ -1,5 +1,5 @@ -{%- macro format_float(value) -%} -{{ "%.2f" % value|abs }} +{%- macro format_float(value, precision=2) -%} +{{ value|round(frappe.utils.cint(precision)) }} {%- endmacro -%} {%- macro render_address(address) %} @@ -182,10 +182,10 @@ {{ html2text(item.description or '') or item.item_name }} {{ format_float(item.qty) }} {{ item.stock_uom }} - {{ format_float(item.price_list_rate or item.rate) }} + {{ format_float(item.price_list_rate or item.rate, item_meta.get_field("rate").precision) }} {{ render_discount_or_margin(item) }} - {{ format_float(item.amount) }} - {{ format_float(item.tax_rate) }} + {{ format_float(item.amount, item_meta.get_field("amount").precision) }} + {{ format_float(item.tax_rate, item_meta.get_field("tax_rate").precision) }} {%- if item.tax_exemption_reason %} {{ item.tax_exemption_reason.split("-")[0] }} {%- endif %} @@ -197,8 +197,8 @@ {%- if data.tax_exemption_reason %} {{ data.tax_exemption_reason.split("-")[0] }} {%- endif %} - {{ format_float(data.taxable_amount) }} - {{ format_float(data.tax_amount) }} + {{ format_float(data.taxable_amount, item_meta.get_field("tax_amount").precision) }} + {{ format_float(data.tax_amount, item_meta.get_field("tax_amount").precision) }} {{ doc.vat_collectability.split("-")[0] }} {%- if data.tax_exemption_law %} {{ data.tax_exemption_law }} diff --git a/erpnext/regional/italy/utils.py b/erpnext/regional/italy/utils.py index caaf80129b9..9a14a35dbab 100644 --- a/erpnext/regional/italy/utils.py +++ b/erpnext/regional/italy/utils.py @@ -291,7 +291,11 @@ def prepare_and_attach_invoice(doc, replace=False): progressive_name, progressive_number = get_progressive_name_and_number(doc, replace) invoice = prepare_invoice(doc, progressive_number) - invoice_xml = frappe.render_template('erpnext/regional/italy/e-invoice.xml', context={"doc": invoice}, is_path=True) + item_meta = frappe.get_meta("Sales Invoice Item") + + invoice_xml = frappe.render_template('erpnext/regional/italy/e-invoice.xml', + context={"doc": invoice, "item_meta": item_meta}, is_path=True) + invoice_xml = invoice_xml.replace("&", "&") xml_filename = progressive_name + ".xml" From 690139ca1105ca2201c8cde500ad4ed53f514a17 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Fri, 6 Sep 2019 18:39:25 +0530 Subject: [PATCH 03/12] fix: circular dependency during asset cancellation (#18952) --- erpnext/assets/doctype/asset/asset.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/erpnext/assets/doctype/asset/asset.py b/erpnext/assets/doctype/asset/asset.py index 45d2ec2c516..f1f46525bbd 100644 --- a/erpnext/assets/doctype/asset/asset.py +++ b/erpnext/assets/doctype/asset/asset.py @@ -286,12 +286,6 @@ class Asset(AccountsController): if self.status not in ("Submitted", "Partially Depreciated", "Fully Depreciated"): frappe.throw(_("Asset cannot be cancelled, as it is already {0}").format(self.status)) - if self.purchase_invoice: - frappe.throw(_("Please cancel Purchase Invoice {0} first").format(self.purchase_invoice)) - - if self.purchase_receipt: - frappe.throw(_("Please cancel Purchase Receipt {0} first").format(self.purchase_receipt)) - def delete_depreciation_entries(self): for d in self.get("schedules"): if d.journal_entry: From b53e4404dc67dac39f43d3c4649c5d1c498dea92 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Mon, 9 Sep 2019 13:19:22 +0530 Subject: [PATCH 04/12] fix: '>' not supported between instances of 'int' and 'str' (#18966) --- erpnext/stock/doctype/packing_slip/packing_slip.json | 6 +++--- erpnext/stock/doctype/packing_slip/packing_slip.py | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/erpnext/stock/doctype/packing_slip/packing_slip.json b/erpnext/stock/doctype/packing_slip/packing_slip.json index 4e944039132..a860c72faf3 100644 --- a/erpnext/stock/doctype/packing_slip/packing_slip.json +++ b/erpnext/stock/doctype/packing_slip/packing_slip.json @@ -248,7 +248,7 @@ "description": "Identification of the package for the delivery (for print)", "fetch_if_empty": 0, "fieldname": "from_case_no", - "fieldtype": "Data", + "fieldtype": "Int", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -313,7 +313,7 @@ "description": "If more than one package of the same type (for print)", "fetch_if_empty": 0, "fieldname": "to_case_no", - "fieldtype": "Data", + "fieldtype": "Int", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -773,7 +773,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2019-05-30 21:50:38.260908", + "modified": "2019-09-09 12:40:22.497613", "modified_by": "Administrator", "module": "Stock", "name": "Packing Slip", diff --git a/erpnext/stock/doctype/packing_slip/packing_slip.py b/erpnext/stock/doctype/packing_slip/packing_slip.py index b99215c426a..7a5ae317c2b 100644 --- a/erpnext/stock/doctype/packing_slip/packing_slip.py +++ b/erpnext/stock/doctype/packing_slip/packing_slip.py @@ -49,11 +49,10 @@ class PackingSlip(Document): frappe.msgprint(_("Please specify a valid 'From Case No.'"), raise_exception=1) elif not self.to_case_no: self.to_case_no = self.from_case_no - elif self.from_case_no > self.to_case_no: + elif cint(self.from_case_no) > cint(self.to_case_no): frappe.msgprint(_("'To Case No.' cannot be less than 'From Case No.'"), raise_exception=1) - res = frappe.db.sql("""SELECT name FROM `tabPacking Slip` WHERE delivery_note = %(delivery_note)s AND docstatus = 1 AND ((from_case_no BETWEEN %(from_case_no)s AND %(to_case_no)s) From 9c428ebfba7063abd3c48a34b9c1bcdbcbc51fa6 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Mon, 9 Sep 2019 13:20:15 +0530 Subject: [PATCH 05/12] fix: not able to save item because price list has disabled (#18965) --- erpnext/stock/doctype/item_price/item_price.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/erpnext/stock/doctype/item_price/item_price.py b/erpnext/stock/doctype/item_price/item_price.py index 30675b54b3e..4c496cb59a7 100644 --- a/erpnext/stock/doctype/item_price/item_price.py +++ b/erpnext/stock/doctype/item_price/item_price.py @@ -32,10 +32,16 @@ class ItemPrice(Document): def update_price_list_details(self): if self.price_list: - self.buying, self.selling, self.currency = \ - frappe.db.get_value("Price List", - {"name": self.price_list, "enabled": 1}, - ["buying", "selling", "currency"]) + price_list_details = frappe.db.get_value("Price List", + {"name": self.price_list, "enabled": 1}, + ["buying", "selling", "currency"]) + + if not price_list_details: + link = frappe.utils.get_link_to_form('Price List', self.price_list) + frappe.throw("The price list {0} does not exists or disabled". + format(link)) + + self.buying, self.selling, self.currency = price_list_details def update_item_details(self): if self.item_code: From ad2365502fc2353b71dd4094397e0efd18d604a5 Mon Sep 17 00:00:00 2001 From: Rohan Date: Mon, 9 Sep 2019 13:49:02 +0530 Subject: [PATCH 06/12] fix: only select serial no that are present in the selected batch (#18726) --- erpnext/public/js/utils.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js index 2dd65fec170..4134904d74d 100755 --- a/erpnext/public/js/utils.js +++ b/erpnext/public/js/utils.js @@ -70,8 +70,9 @@ $.extend(erpnext, { "get_query": function () { return { filters: { - item_code:grid_row.doc.item_code, - warehouse:cur_frm.doc.is_return ? null : grid_row.doc.warehouse + item_code: grid_row.doc.item_code, + warehouse: cur_frm.doc.is_return ? null : grid_row.doc.warehouse, + batch_no: grid_row.doc.batch_no || null } } } From 6efe4acb1ddef9b7d8f7f96dc1b1df0841e8d402 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Mon, 9 Sep 2019 14:28:12 +0530 Subject: [PATCH 07/12] fix: Set Price List in case of User Permissions (#18968) - Pick Price List if there is one User Permission record --- erpnext/accounts/party.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index 80274e0c395..061b6006b1d 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -155,7 +155,7 @@ def set_price_list(out, party, party_type, given_price_list, pos=None): # price list price_list = get_permitted_documents('Price List') - if price_list: + if price_list and len(price_list) == 1: price_list = price_list[0] elif pos and party_type == 'Customer': customer_price_list = frappe.get_value('Customer', party.name, 'default_price_list') @@ -588,4 +588,4 @@ def get_partywise_advanced_payment_amount(party_type, posting_date = None): .format(("credit") if party_type == "Customer" else "debit", cond) , party_type) if data: - return frappe._dict(data) \ No newline at end of file + return frappe._dict(data) From ea6d90988f7756fe62149f4ea12b64862b522e85 Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Mon, 9 Sep 2019 16:05:23 +0530 Subject: [PATCH 08/12] fix: sales invoice return print format overideing the meta default print format --- erpnext/accounts/doctype/sales_invoice/sales_invoice.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index 8914afcba9f..d7576183906 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -141,7 +141,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte cur_frm.meta._default_print_format = cur_frm.meta.default_print_format; cur_frm.meta.default_print_format = cur_frm.pos_print_format; } - } else if(cur_frm.doc.is_return) { + } else if(cur_frm.doc.is_return && !cur_frm.meta.default_print_format) { if(cur_frm.return_print_format) { cur_frm.meta._default_print_format = cur_frm.meta.default_print_format; cur_frm.meta.default_print_format = cur_frm.return_print_format; From ed1e28b8fa09df3cb87df41428d6291adc10b62c Mon Sep 17 00:00:00 2001 From: Mangesh-Khairnar Date: Tue, 10 Sep 2019 13:21:19 +0530 Subject: [PATCH 09/12] fix(packing-slip): add a more descriptive message (#18982) --- erpnext/stock/doctype/packing_slip/packing_slip.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/packing_slip/packing_slip.js b/erpnext/stock/doctype/packing_slip/packing_slip.js index 9f6b9ff1914..bd14e5f6161 100644 --- a/erpnext/stock/doctype/packing_slip/packing_slip.js +++ b/erpnext/stock/doctype/packing_slip/packing_slip.js @@ -10,7 +10,7 @@ cur_frm.fields_dict['delivery_note'].get_query = function(doc, cdt, cdn) { cur_frm.fields_dict['items'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) { if(!doc.delivery_note) { - frappe.throw(__("Please Delivery Note first")) + frappe.throw(__("Please select a Delivery Note")); } else { return { query: "erpnext.stock.doctype.packing_slip.packing_slip.item_details", @@ -125,4 +125,4 @@ cur_frm.pformat.gross_weight_pkg= function(doc){ return '' + make_row('Gross Weight', doc.gross_weight_pkg) + '
' } -// TODO: validate gross weight field \ No newline at end of file +// TODO: validate gross weight field From 3fc10a8da114a316054e67a874311df54638f4d9 Mon Sep 17 00:00:00 2001 From: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com> Date: Tue, 10 Sep 2019 14:07:01 +0530 Subject: [PATCH 10/12] fix: Make address fields mandatory (#18980) --- erpnext/public/js/utils/customer_quick_entry.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/erpnext/public/js/utils/customer_quick_entry.js b/erpnext/public/js/utils/customer_quick_entry.js index f454ba057b4..ac9a7828cbb 100644 --- a/erpnext/public/js/utils/customer_quick_entry.js +++ b/erpnext/public/js/utils/customer_quick_entry.js @@ -37,7 +37,8 @@ frappe.ui.form.CustomerQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ { label: __("Address Line 1"), fieldname: "address_line1", - fieldtype: "Data" + fieldtype: "Data", + reqd: 1 }, { label: __("Address Line 2"), @@ -55,7 +56,8 @@ frappe.ui.form.CustomerQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ { label: __("City"), fieldname: "city", - fieldtype: "Data" + fieldtype: "Data", + reqd: 1, }, { label: __("State"), @@ -66,7 +68,8 @@ frappe.ui.form.CustomerQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ label: __("Country"), fieldname: "country", fieldtype: "Link", - options: "Country" + options: "Country", + reqd: 1 }, { label: __("Customer POS Id"), From 143f007272fd8adfc29866de954ee617cd613284 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 10 Sep 2019 14:07:37 +0530 Subject: [PATCH 11/12] fix: set raw material's batch based on main item's batch only if RM has batch no (#18978) --- erpnext/controllers/buying_controller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index 14fe35e7821..73b158d14be 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -337,7 +337,7 @@ class BuyingController(StockController): if self.doctype in ["Purchase Receipt", "Purchase Invoice"]: rm.consumed_qty = required_qty rm.description = bom_item.description - if item.batch_no and not rm.batch_no: + if item.batch_no and frappe.db.get_value("Item", rm.rm_item_code, "has_batch_no") and not rm.batch_no: rm.batch_no = item.batch_no # get raw materials rate From 3ac54a0ba6c7dd4f77925dde1e4c25574cf99772 Mon Sep 17 00:00:00 2001 From: Sahil Khan Date: Tue, 10 Sep 2019 14:52:29 +0550 Subject: [PATCH 12/12] bumped to version 11.1.61 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 425a9b07114..b69bb4ebdc8 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -5,7 +5,7 @@ import frappe from erpnext.hooks import regional_overrides from frappe.utils import getdate -__version__ = '11.1.60' +__version__ = '11.1.61' def get_default_company(user=None): '''Get default company for user'''