Skip to content

Commit 91dcd8d

Browse files
committed
Merge branch 'hotfix'
2 parents 8c72fa2 + 4d2d996 commit 91dcd8d

File tree

7 files changed

+9
-45
lines changed

7 files changed

+9
-45
lines changed

erpnext/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from __future__ import unicode_literals
33
import frappe
44

5-
__version__ = '8.0.30'
5+
__version__ = '8.0.31'
66

77

88
def get_default_company(user=None):

erpnext/controllers/accounts_controller.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def validate(self):
5454
self.validate_currency()
5555

5656
if self.meta.get_field("is_recurring"):
57-
if self.amended_from and self.recurring_id:
57+
if self.amended_from and self.recurring_id == self.amended_from:
5858
self.recurring_id = None
5959
if not self.get("__islocal"):
6060
validate_recurring_document(self)

erpnext/controllers/item_variant.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def create_variant(item, args):
165165

166166
variant.set("attributes", variant_attributes)
167167
copy_attributes_to_variant(template, variant)
168-
make_variant_item_code(template.item_code, variant)
168+
make_variant_item_code(template.item_code, template.item_name, variant)
169169

170170
return variant
171171

@@ -194,7 +194,7 @@ def copy_attributes_to_variant(item, variant):
194194
for d in variant.attributes:
195195
variant.description += "<p>" + d.attribute + ": " + cstr(d.attribute_value) + "</p>"
196196

197-
def make_variant_item_code(template_item_code, variant):
197+
def make_variant_item_code(template_item_code, template_item_name, variant):
198198
"""Uses template's item code and abbreviations to make variant's item code"""
199199
if variant.item_code:
200200
return
@@ -220,6 +220,4 @@ def make_variant_item_code(template_item_code, variant):
220220

221221
if abbreviations:
222222
variant.item_code = "{0}-{1}".format(template_item_code, "-".join(abbreviations))
223-
224-
if variant.item_code:
225-
variant.item_name = variant.item_code
223+
variant.item_name = "{0}-{1}".format(template_item_name, "-".join(abbreviations))

erpnext/public/js/pos/pos_item.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="pos-item-wrapper image-view-item" data-item-code="{{item_code}}">
22
<div class="image-view-header doclist-row">
33
<div class="list-value">
4-
<a class="grey list-id" data-name="{{item_code}}" title="{{ item_name || item_code}}">{{item_name || item_code}}<br>({{ _(item_stock) }})</a>
4+
<a class="grey list-id" data-name="{{item_code}}" title="{{ item_name || item_code}}">{{item_name || item_code}}<br>({{ __(item_stock) }})</a>
55
</div>
66
</div>
77
<div class="image-view-body">

erpnext/setup/doctype/company/company.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ def _set_default_account(self, fieldname, account_type):
170170

171171
def set_mode_of_payment_account(self):
172172
cash = frappe.db.get_value('Mode of Payment', {'type': 'Cash'}, 'name')
173-
if cash and not frappe.db.get_value('Mode of Payment Account', {'company': self.name}):
173+
if cash and self.default_cash_account \
174+
and not frappe.db.get_value('Mode of Payment Account', {'company': self.name}):
174175
mode_of_payment = frappe.get_doc('Mode of Payment', cash)
175176
mode_of_payment.append('accounts', {
176177
'company': self.name,

erpnext/stock/doctype/item/item.js

+1-13
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ frappe.ui.form.on("Item", {
6565
frm.page.set_inner_btn_group_as_primary(__("Make"));
6666
}
6767
if (frm.doc.variant_of) {
68-
frm.set_intro(__("This Item is a Variant of {0} (Template). Attributes will be copied over from the template unless 'No Copy' is set",
68+
frm.set_intro(__("This Item is a Variant of {0} (Template).",
6969
[frm.doc.variant_of]), true);
7070
}
7171

@@ -97,8 +97,6 @@ frappe.ui.form.on("Item", {
9797
}
9898
frappe.set_route('Form', 'Item', new_item.name);
9999
});
100-
101-
frm.trigger('make_variant_fields_read_only');
102100
},
103101

104102
validate: function(frm){
@@ -109,16 +107,6 @@ frappe.ui.form.on("Item", {
109107
refresh_field("image_view");
110108
},
111109

112-
make_variant_fields_read_only: function(frm) {
113-
if(frm.doc.variant_of) {
114-
frm.meta.fields.forEach(function(df) {
115-
if (!df.no_copy) {
116-
frm.toggle_enable(df.fieldname, false);
117-
}
118-
});
119-
}
120-
},
121-
122110
is_fixed_asset: function(frm) {
123111
if (frm.doc.is_fixed_asset) {
124112
frm.set_value("is_stock_item", 0);

erpnext/stock/doctype/item/item.py

-23
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ def validate(self):
8686
self.validate_has_variants()
8787
self.validate_attributes()
8888
self.validate_variant_attributes()
89-
self.copy_variant_attributes()
9089
self.validate_website_image()
9190
self.make_thumbnail()
9291
self.validate_fixed_asset()
@@ -101,7 +100,6 @@ def on_update(self):
101100
invalidate_cache_for_item(self)
102101
self.validate_name_with_item_group()
103102
self.update_item_price()
104-
self.update_variants()
105103
self.update_template_item()
106104

107105
def add_price(self, price_list=None):
@@ -613,23 +611,8 @@ def update_template_item(self):
613611
if not template_item.show_in_website:
614612
template_item.show_in_website = 1
615613
template_item.flags.ignore_permissions = True
616-
template_item.flags.dont_update_variants = True
617614
template_item.save()
618615

619-
def update_variants(self):
620-
if self.flags.dont_update_variants:
621-
return
622-
if self.has_variants:
623-
updated = []
624-
variants = frappe.db.get_all("Item", fields=["item_code"], filters={"variant_of": self.name })
625-
for d in variants:
626-
variant = frappe.get_doc("Item", d)
627-
copy_attributes_to_variant(self, variant)
628-
variant.save()
629-
updated.append(d.item_code)
630-
if updated:
631-
frappe.msgprint(_("Item Variants {0} updated").format(", ".join(updated)))
632-
633616
def validate_has_variants(self):
634617
if not self.has_variants and frappe.db.get_value("Item", self.name, "has_variants"):
635618
if frappe.db.exists("Item", {"variant_of": self.name}):
@@ -673,12 +656,6 @@ def validate_variant_attributes(self):
673656

674657
validate_item_variant_attributes(self, args)
675658

676-
def copy_variant_attributes(self):
677-
'''Copy attributes from template (if they have been changed before saving)'''
678-
if self.variant_of:
679-
template = frappe.get_doc('Item', self.variant_of)
680-
copy_attributes_to_variant(template, self)
681-
682659
def get_timeline_data(doctype, name):
683660
'''returns timeline data based on stock ledger entry'''
684661
out = {}

0 commit comments

Comments
 (0)