Merge branch 'hotfix'
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index b77047d..97a2c73 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 742e59b..3a3e873 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -54,7 +54,7 @@
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 53421b7..3349303 100644
--- a/erpnext/controllers/item_variant.py
+++ b/erpnext/controllers/item_variant.py
@@ -165,7 +165,7 @@
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 @@
for d in variant.attributes:
variant.description += "<p>" + d.attribute + ": " + cstr(d.attribute_value) + "</p>"
-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 @@
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 816dc3a..f6ef5a4 100644
--- a/erpnext/public/js/pos/pos_item.html
+++ b/erpnext/public/js/pos/pos_item.html
@@ -1,7 +1,7 @@
<div class="pos-item-wrapper image-view-item" data-item-code="{{item_code}}">
<div class="image-view-header doclist-row">
<div class="list-value">
- <a class="grey list-id" data-name="{{item_code}}" title="{{ item_name || item_code}}">{{item_name || item_code}}<br>({{ _(item_stock) }})</a>
+ <a class="grey list-id" data-name="{{item_code}}" title="{{ item_name || item_code}}">{{item_name || item_code}}<br>({{ __(item_stock) }})</a>
</div>
</div>
<div class="image-view-body">
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index 9f355f7..39ad556 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -170,7 +170,8 @@
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 460f1c3..057c78a 100644
--- a/erpnext/stock/doctype/item/item.js
+++ b/erpnext/stock/doctype/item/item.js
@@ -65,7 +65,7 @@
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.set_route('Form', 'Item', new_item.name);
});
-
- frm.trigger('make_variant_fields_read_only');
},
validate: function(frm){
@@ -109,16 +107,6 @@
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 ef85dd9..f2780bf 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -86,7 +86,6 @@
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 @@
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 @@
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 @@
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 = {}