Merge branch 'hotfix'
This commit is contained in:
commit
91dcd8d952
@ -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):
|
||||
|
@ -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)
|
||||
|
@ -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 += "<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 @@ 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))
|
||||
|
@ -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">
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -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 = {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user