diff --git a/erpnext/__init__.py b/erpnext/__init__.py index b77047d741d..97a2c73ded7 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): diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 742e59b4d69..3a3e873eae8 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) diff --git a/erpnext/controllers/item_variant.py b/erpnext/controllers/item_variant.py index 53421b71bc5..334930314ba 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)) diff --git a/erpnext/public/js/pos/pos_item.html b/erpnext/public/js/pos/pos_item.html index 816dc3ac2f4..f6ef5a42d2d 100644 --- a/erpnext/public/js/pos/pos_item.html +++ b/erpnext/public/js/pos/pos_item.html @@ -1,7 +1,7 @@
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index 9f355f7ee9e..39ad556227e 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, diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js index 460f1c3debc..057c78a81f1 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 ef85dd9a680..f2780bf67c5 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() @@ -101,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): @@ -613,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}): @@ -673,12 +656,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 = {}