From c9b6a07732a8f514c7ba050391534741f179a86a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 16 Nov 2016 18:43:44 +0530 Subject: [PATCH 1/7] [fix] Remove recurring id on amendment only if it is same as amended_from --- 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 b436670141..e85e88eeb9 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -54,7 +54,7 @@ class AccountsController(TransactionBase): self.validate_currency() if self.meta.get_field("is_recurring"): - if self.amended_from and self.recurring_id: + if self.amended_from and self.recurring_id == self.amended_from: self.recurring_id = None if not self.get("__islocal"): validate_recurring_document(self) From c6d75eb94201cbbcba439ccf4d93c44cc50ec95c Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 18 May 2017 16:21:01 +0530 Subject: [PATCH 2/7] [fix] allow editing of variant properties, reverting earlier fix (#8905) --- erpnext/stock/doctype/item/item.js | 14 +------------- erpnext/stock/doctype/item/item.py | 7 ------- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js index 460f1c3deb..057c78a81f 100644 --- a/erpnext/stock/doctype/item/item.js +++ b/erpnext/stock/doctype/item/item.js @@ -65,7 +65,7 @@ frappe.ui.form.on("Item", { frm.page.set_inner_btn_group_as_primary(__("Make")); } if (frm.doc.variant_of) { - frm.set_intro(__("This Item is a Variant of {0} (Template). Attributes will be copied over from the template unless 'No Copy' is set", + frm.set_intro(__("This Item is a Variant of {0} (Template).", [frm.doc.variant_of]), true); } @@ -97,8 +97,6 @@ frappe.ui.form.on("Item", { } frappe.set_route('Form', 'Item', new_item.name); }); - - frm.trigger('make_variant_fields_read_only'); }, validate: function(frm){ @@ -109,16 +107,6 @@ frappe.ui.form.on("Item", { refresh_field("image_view"); }, - make_variant_fields_read_only: function(frm) { - if(frm.doc.variant_of) { - frm.meta.fields.forEach(function(df) { - if (!df.no_copy) { - frm.toggle_enable(df.fieldname, false); - } - }); - } - }, - is_fixed_asset: function(frm) { if (frm.doc.is_fixed_asset) { frm.set_value("is_stock_item", 0); diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index ef85dd9a68..3b8f6e4ac7 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -86,7 +86,6 @@ class Item(WebsiteGenerator): self.validate_has_variants() self.validate_attributes() self.validate_variant_attributes() - self.copy_variant_attributes() self.validate_website_image() self.make_thumbnail() self.validate_fixed_asset() @@ -673,12 +672,6 @@ class Item(WebsiteGenerator): validate_item_variant_attributes(self, args) - def copy_variant_attributes(self): - '''Copy attributes from template (if they have been changed before saving)''' - if self.variant_of: - template = frappe.get_doc('Item', self.variant_of) - copy_attributes_to_variant(template, self) - def get_timeline_data(doctype, name): '''returns timeline data based on stock ledger entry''' out = {} From 012c9a09168c849e4e2282094d56bf3a57deaf1c Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 19 May 2017 12:30:58 +0530 Subject: [PATCH 3/7] Set default account in mode-of-payment Cash, only if default cash account exists (#8909) --- erpnext/setup/doctype/company/company.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index 9f355f7ee9..39ad556227 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -170,7 +170,8 @@ class Company(Document): def set_mode_of_payment_account(self): cash = frappe.db.get_value('Mode of Payment', {'type': 'Cash'}, 'name') - if cash and not frappe.db.get_value('Mode of Payment Account', {'company': self.name}): + if cash and self.default_cash_account \ + and not frappe.db.get_value('Mode of Payment Account', {'company': self.name}): mode_of_payment = frappe.get_doc('Mode of Payment', cash) mode_of_payment.append('accounts', { 'company': self.name, From 4bcc2316a93ec68b330569a2aedacc95cad9b39f Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 19 May 2017 12:33:00 +0530 Subject: [PATCH 4/7] Don't update variant when template is updated (#8922) * [fix] allow editing of variant properties, reverting earlier fix * [minor] dont automatically update variants when the template is saved --- erpnext/stock/doctype/item/item.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index 3b8f6e4ac7..f2780bf67c 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -100,7 +100,6 @@ class Item(WebsiteGenerator): invalidate_cache_for_item(self) self.validate_name_with_item_group() self.update_item_price() - self.update_variants() self.update_template_item() def add_price(self, price_list=None): @@ -612,23 +611,8 @@ class Item(WebsiteGenerator): if not template_item.show_in_website: template_item.show_in_website = 1 template_item.flags.ignore_permissions = True - template_item.flags.dont_update_variants = True template_item.save() - def update_variants(self): - if self.flags.dont_update_variants: - return - if self.has_variants: - updated = [] - variants = frappe.db.get_all("Item", fields=["item_code"], filters={"variant_of": self.name }) - for d in variants: - variant = frappe.get_doc("Item", d) - copy_attributes_to_variant(self, variant) - variant.save() - updated.append(d.item_code) - if updated: - frappe.msgprint(_("Item Variants {0} updated").format(", ".join(updated))) - def validate_has_variants(self): if not self.has_variants and frappe.db.get_value("Item", self.name, "has_variants"): if frappe.db.exists("Item", {"variant_of": self.name}): From 89cec1846773f6aa055023077401e3196d2373a0 Mon Sep 17 00:00:00 2001 From: Prateeksha Singh Date: Fri, 19 May 2017 12:35:36 +0530 Subject: [PATCH 5/7] set variant name based on template name (frappe/erpnext#6367) (#8920) --- erpnext/controllers/item_variant.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/erpnext/controllers/item_variant.py b/erpnext/controllers/item_variant.py index 53421b71bc..334930314b 100644 --- a/erpnext/controllers/item_variant.py +++ b/erpnext/controllers/item_variant.py @@ -165,7 +165,7 @@ def create_variant(item, args): variant.set("attributes", variant_attributes) copy_attributes_to_variant(template, variant) - make_variant_item_code(template.item_code, variant) + make_variant_item_code(template.item_code, template.item_name, variant) return variant @@ -194,7 +194,7 @@ def copy_attributes_to_variant(item, variant): for d in variant.attributes: variant.description += "

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

" -def make_variant_item_code(template_item_code, variant): +def make_variant_item_code(template_item_code, template_item_name, variant): """Uses template's item code and abbreviations to make variant's item code""" if variant.item_code: return @@ -220,6 +220,4 @@ def make_variant_item_code(template_item_code, variant): if abbreviations: variant.item_code = "{0}-{1}".format(template_item_code, "-".join(abbreviations)) - - if variant.item_code: - variant.item_name = variant.item_code + variant.item_name = "{0}-{1}".format(template_item_name, "-".join(abbreviations)) From 8a1c58c3c390a74c541ca0ccc0862adbd046fe2f Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Fri, 19 May 2017 13:01:32 +0530 Subject: [PATCH 6/7] [fix] _ is not defined while accessing the POS --- erpnext/public/js/pos/pos_item.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/public/js/pos/pos_item.html b/erpnext/public/js/pos/pos_item.html index 816dc3ac2f..f6ef5a42d2 100644 --- a/erpnext/public/js/pos/pos_item.html +++ b/erpnext/public/js/pos/pos_item.html @@ -1,7 +1,7 @@
From 4d2d9967822bb9245303e713cdb4248ad749666e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 19 May 2017 14:42:28 +0600 Subject: [PATCH 7/7] bumped to version 8.0.31 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index b77047d741..97a2c73ded 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals import frappe -__version__ = '8.0.30' +__version__ = '8.0.31' def get_default_company(user=None):