Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f8b412ba98 | ||
|
|
c8a25b6dac | ||
|
|
724cc35421 | ||
|
|
67ae3a7f22 | ||
|
|
8854f8bd50 | ||
|
|
fe05645051 | ||
|
|
29d64cae34 | ||
|
|
84e50fe371 | ||
|
|
2ef20a968c | ||
|
|
fdc7d7f3de | ||
|
|
a68fff470c | ||
|
|
552f7ab678 | ||
|
|
2424aa73d7 | ||
|
|
50835cbaa0 | ||
|
|
f3a318921f | ||
|
|
529f5ce503 | ||
|
|
177a26849d | ||
|
|
d144a4c621 | ||
|
|
d2484ece24 | ||
|
|
04ea4910f0 | ||
|
|
65a27395fe | ||
|
|
91dcd8d952 | ||
|
|
4d2d996782 | ||
|
|
47afc55939 | ||
|
|
81fcbbefe5 | ||
|
|
8a1c58c3c3 | ||
|
|
89cec18467 | ||
|
|
4bcc2316a9 | ||
|
|
012c9a0916 | ||
|
|
c6d75eb942 | ||
|
|
83f8344e62 | ||
|
|
ee59ecd396 | ||
|
|
c9b6a07732 |
@@ -2,7 +2,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
__version__ = '8.0.30'
|
||||
__version__ = '8.0.36'
|
||||
|
||||
|
||||
def get_default_company(user=None):
|
||||
|
||||
@@ -355,8 +355,14 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
|
||||
this.print_template_data = frappe.render_template("print_template", {
|
||||
content: this.print_template,
|
||||
title: "POS", base_url: frappe.urllib.get_base_url(), print_css: frappe.boot.print_css,
|
||||
print_settings: this.print_settings, header: this.letter_head.header, footer: this.letter_head.footer
|
||||
title: "POS",
|
||||
base_url: frappe.urllib.get_base_url(),
|
||||
print_css: frappe.boot.print_css,
|
||||
print_settings: this.print_settings,
|
||||
header: this.letter_head.header,
|
||||
footer: this.letter_head.footer,
|
||||
landscape: false,
|
||||
columns: []
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
@@ -278,7 +278,7 @@ def sort_root_accounts(roots):
|
||||
"""Sort root types as Asset, Liability, Equity, Income, Expense"""
|
||||
|
||||
def compare_roots(a, b):
|
||||
if re.split('\W+', a.value)[0].isdigit():
|
||||
if a.value and re.split('\W+', a.value)[0].isdigit():
|
||||
# if chart of accounts is numbered, then sort by number
|
||||
return cmp(a.value, b.value)
|
||||
if a.report_type != b.report_type and a.report_type == "Balance Sheet":
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -43,7 +43,8 @@ class Lead(SellingController):
|
||||
if self.email_id == self.contact_by:
|
||||
frappe.throw(_("Next Contact By cannot be same as the Lead Email Address"))
|
||||
|
||||
self.image = has_gravatar(self.email_id)
|
||||
if self.is_new() or not self.image:
|
||||
self.image = has_gravatar(self.email_id)
|
||||
|
||||
if self.contact_date and self.contact_date < now():
|
||||
frappe.throw(_("Next Contact Date cannot be in the past"))
|
||||
|
||||
@@ -75,7 +75,7 @@ class Opportunity(TransactionBase):
|
||||
self.lead = lead_name
|
||||
|
||||
def declare_enquiry_lost(self,arg):
|
||||
if not self.has_quotation():
|
||||
if not self.has_active_quotation():
|
||||
frappe.db.set(self, 'status', 'Lost')
|
||||
frappe.db.set(self, 'order_lost_reason', arg)
|
||||
else:
|
||||
|
||||
@@ -11,43 +11,55 @@ def execute():
|
||||
|
||||
# for converting student batch into student group
|
||||
frappe.reload_doctype("Student Group")
|
||||
student_batches = frappe.db.sql('''select name as student_group_name, student_batch_name as batch,
|
||||
program, academic_year, academic_term from `tabStudent Batch`''', as_dict=1)
|
||||
|
||||
for student_batch in student_batches:
|
||||
# create student batch name if does not exists !!
|
||||
if student_batch.get("batch") and not frappe.db.exists("Student Batch Name", student_batch.get("batch")):
|
||||
frappe.get_doc({
|
||||
"doctype": "Student Batch Name",
|
||||
"batch_name": student_batch.get("batch")
|
||||
}).insert(ignore_permissions=True)
|
||||
if frappe.db.table_exists("Student Batch"):
|
||||
student_batches = frappe.db.sql('''select name as student_group_name, student_batch_name as batch,
|
||||
program, academic_year, academic_term from `tabStudent Batch`''', as_dict=1)
|
||||
|
||||
student_batch.update({"doctype":"Student Group", "group_based_on": "Batch"})
|
||||
doc = frappe.get_doc(student_batch)
|
||||
student_list = frappe.db.sql('''select student, student_name, active from `tabStudent Batch Student`
|
||||
where parent=%s''', (doc.name), as_dict=1)
|
||||
for i, student in enumerate(student_list):
|
||||
student.update({"group_roll_number": i+1})
|
||||
for student_batch in student_batches:
|
||||
# create student batch name if does not exists !!
|
||||
if student_batch.get("batch") and not frappe.db.exists("Student Batch Name", student_batch.get("batch")):
|
||||
frappe.get_doc({
|
||||
"doctype": "Student Batch Name",
|
||||
"batch_name": student_batch.get("batch")
|
||||
}).insert(ignore_permissions=True)
|
||||
|
||||
if student_list:
|
||||
doc.extend("students", student_list)
|
||||
student_batch.update({"doctype":"Student Group", "group_based_on": "Batch"})
|
||||
doc = frappe.get_doc(student_batch)
|
||||
|
||||
instructor_list = frappe.db.sql('''select instructor, instructor_name from `tabStudent Batch Instructor`
|
||||
where parent=%s''', (doc.name), as_dict=1)
|
||||
if instructor_list:
|
||||
doc.extend("instructors", instructor_list)
|
||||
doc.save()
|
||||
if frappe.db.sql("SHOW COLUMNS FROM `tabStudent Batch Student` LIKE 'active'"):
|
||||
cond = ", active"
|
||||
else:
|
||||
cond = " "
|
||||
student_list = frappe.db.sql('''select student, student_name {cond} from `tabStudent Batch Student`
|
||||
where parent=%s'''.format(cond=cond), (doc.name), as_dict=1)
|
||||
|
||||
if student_list:
|
||||
for i, student in enumerate(student_list):
|
||||
student.update({"group_roll_number": i+1})
|
||||
doc.extend("students", student_list)
|
||||
|
||||
instructor_list = frappe.db.sql('''select instructor, instructor_name from `tabStudent Batch Instructor`
|
||||
where parent=%s''', (doc.name), as_dict=1)
|
||||
if instructor_list:
|
||||
doc.extend("instructors", instructor_list)
|
||||
doc.save()
|
||||
|
||||
# delete the student batch and child-table
|
||||
frappe.delete_doc("DocType", "Student Batch", force=1)
|
||||
frappe.delete_doc("DocType", "Student Batch Student", force=1)
|
||||
frappe.delete_doc("DocType", "Student Batch Instructor", force=1)
|
||||
if frappe.db.table_exists("Student Batch"):
|
||||
frappe.delete_doc("DocType", "Student Batch", force=1)
|
||||
if frappe.db.table_exists("Student Batch Student"):
|
||||
frappe.delete_doc("DocType", "Student Batch Student", force=1)
|
||||
if frappe.db.table_exists("Student Batch Instructor"):
|
||||
frappe.delete_doc("DocType", "Student Batch Instructor", force=1)
|
||||
|
||||
# delete the student batch creation tool
|
||||
frappe.delete_doc("DocType", "Student Batch Creation Tool", force=1)
|
||||
if frappe.db.table_exists("Student Batch Creation Tool"):
|
||||
frappe.delete_doc("DocType", "Student Batch Creation Tool", force=1)
|
||||
|
||||
# delete the student batch creation tool
|
||||
frappe.delete_doc("DocType", "Attendance Tool Student", force=1)
|
||||
if frappe.db.table_exists("Attendance Tool Student"):
|
||||
frappe.delete_doc("DocType", "Attendance Tool Student", force=1)
|
||||
|
||||
# change the student batch to student group in the student attendance
|
||||
frappe.reload_doctype("Student Attendance")
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -33,7 +33,7 @@ class StudentGroup(Document):
|
||||
program_enrollment = get_program_enrollment(self.academic_year, self.academic_term, self.program, self.batch, self.course)
|
||||
students = [d.student for d in program_enrollment] if program_enrollment else None
|
||||
for d in self.students:
|
||||
if self.group_based_on != "Activity" and d.student not in students and d.active == 1:
|
||||
if self.group_based_on != "Activity" and students and d.student not in students and d.active == 1:
|
||||
frappe.throw(_("{0} - {1} is not enrolled in the given {2}".format(d.group_roll_number, d.student_name, self.group_based_on)))
|
||||
if not frappe.db.get_value("Student", d.student, "enabled") and d.active:
|
||||
frappe.throw(_("{0} - {1} is inactive student".format(d.group_roll_number, d.student_name)))
|
||||
|
||||
@@ -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 = {}
|
||||
|
||||
@@ -33,14 +33,14 @@
|
||||
</div>
|
||||
<div class="text-center item-group-nav-buttons">
|
||||
{% if frappe.form_dict.start|int > 0 %}
|
||||
<a class="btn btn-default" href="/{{ pathname }}?start={{ frappe.form_dict.start|int - page_length }}">{{ __("Prev") }}</a>
|
||||
<a class="btn btn-default" href="/{{ pathname }}?start={{ frappe.form_dict.start|int - page_length }}">{{ _("Prev") }}</a>
|
||||
{% endif %}
|
||||
{% if items|length > page_length %}
|
||||
<a class="btn btn-default" href="/{{ pathname }}?start={{ frappe.form_dict.start|int + page_length }}">{{ __("Next") }}</a>
|
||||
<a class="btn btn-default" href="/{{ pathname }}?start={{ frappe.form_dict.start|int + page_length }}">{{ _("Next") }}</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="text-muted">{{ __("No items listed") }}.</div>
|
||||
<div class="text-muted">{{ _("No items listed") }}.</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -37,9 +37,6 @@ def get_level():
|
||||
if frappe.db.count('Student') > 5:
|
||||
activation_level += 1
|
||||
|
||||
if frappe.db.count('Student Batch Name') > 5:
|
||||
activation_level += 1
|
||||
|
||||
if frappe.db.count('Instructor') > 5:
|
||||
activation_level += 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user