Merge branch 'develop' into missing_pos_invoice_json
This commit is contained in:
commit
6a4975f9f1
@ -3,6 +3,10 @@
|
||||
frappe.provide("education");
|
||||
|
||||
frappe.ui.form.on('Student Attendance Tool', {
|
||||
setup: (frm) => {
|
||||
frm.students_area = $('<div>')
|
||||
.appendTo(frm.fields_dict.students_html.wrapper);
|
||||
},
|
||||
onload: function(frm) {
|
||||
frm.set_query("student_group", function() {
|
||||
return {
|
||||
@ -34,6 +38,7 @@ frappe.ui.form.on('Student Attendance Tool', {
|
||||
|
||||
student_group: function(frm) {
|
||||
if ((frm.doc.student_group && frm.doc.date) || frm.doc.course_schedule) {
|
||||
frm.students_area.find('.student-attendance-checks').html(`<div style='padding: 2rem 0'>Fetching...</div>`);
|
||||
var method = "erpnext.education.doctype.student_attendance_tool.student_attendance_tool.get_student_attendance_records";
|
||||
|
||||
frappe.call({
|
||||
@ -62,10 +67,6 @@ frappe.ui.form.on('Student Attendance Tool', {
|
||||
},
|
||||
|
||||
get_students: function(frm, students) {
|
||||
if (!frm.students_area) {
|
||||
frm.students_area = $('<div>')
|
||||
.appendTo(frm.fields_dict.students_html.wrapper);
|
||||
}
|
||||
students = students || [];
|
||||
frm.students_editor = new education.StudentsEditor(frm, frm.students_area, students);
|
||||
}
|
||||
@ -163,16 +164,26 @@ education.StudentsEditor = class StudentsEditor {
|
||||
);
|
||||
});
|
||||
|
||||
var htmls = students.map(function(student) {
|
||||
return frappe.render_template("student_button", {
|
||||
student: student.student,
|
||||
student_name: student.student_name,
|
||||
group_roll_number: student.group_roll_number,
|
||||
status: student.status
|
||||
})
|
||||
});
|
||||
// make html grid of students
|
||||
let student_html = '';
|
||||
for (let student of students) {
|
||||
student_html += `<div class="col-sm-3">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input
|
||||
type="checkbox"
|
||||
data-group_roll_number="${student.group_roll_number}"
|
||||
data-student="${student.student}"
|
||||
data-student-name="${student.student_name}"
|
||||
class="students-check"
|
||||
${student.status==='Present' ? 'checked' : ''}>
|
||||
${student.group_roll_number} - ${student.student_name}
|
||||
</label>
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
$(htmls.join("")).appendTo(me.wrapper);
|
||||
$(`<div class='student-attendance-checks'>${student_html}</div>`).appendTo(me.wrapper);
|
||||
}
|
||||
|
||||
show_empty_state() {
|
||||
|
@ -24,24 +24,24 @@ def get_student_attendance_records(based_on, date=None, student_group=None, cour
|
||||
student_list = frappe.get_all("Student Group Student", fields=["student", "student_name", "group_roll_number"],
|
||||
filters={"parent": student_group, "active": 1}, order_by= "group_roll_number")
|
||||
|
||||
table = frappe.qb.DocType("Student Attendance")
|
||||
StudentAttendance = frappe.qb.DocType("Student Attendance")
|
||||
|
||||
if course_schedule:
|
||||
student_attendance_list = (
|
||||
frappe.qb.from_(table)
|
||||
.select(table.student, table.status)
|
||||
frappe.qb.from_(StudentAttendance)
|
||||
.select(StudentAttendance.student, StudentAttendance.status)
|
||||
.where(
|
||||
(table.course_schedule == course_schedule)
|
||||
(StudentAttendance.course_schedule == course_schedule)
|
||||
)
|
||||
).run(as_dict=True)
|
||||
else:
|
||||
student_attendance_list = (
|
||||
frappe.qb.from_(table)
|
||||
.select(table.student, table.status)
|
||||
frappe.qb.from_(StudentAttendance)
|
||||
.select(StudentAttendance.student, StudentAttendance.status)
|
||||
.where(
|
||||
(table.student_group == student_group)
|
||||
& (table.date == date)
|
||||
& (table.course_schedule == "") | (table.course_schedule.isnull())
|
||||
(StudentAttendance.student_group == student_group)
|
||||
& (StudentAttendance.date == date)
|
||||
& ((StudentAttendance.course_schedule == "") | (StudentAttendance.course_schedule.isnull()))
|
||||
)
|
||||
).run(as_dict=True)
|
||||
|
||||
|
@ -9,6 +9,7 @@ from erpnext.manufacturing.doctype.production_plan.production_plan import (
|
||||
get_sales_orders,
|
||||
get_warehouse_list,
|
||||
)
|
||||
from erpnext.manufacturing.doctype.work_order.work_order import OverProductionError
|
||||
from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
|
||||
from erpnext.stock.doctype.item.test_item import create_item
|
||||
from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
|
||||
@ -466,26 +467,29 @@ class TestProductionPlan(ERPNextTestCase):
|
||||
bom = make_bom(item=item, raw_materials=raw_materials)
|
||||
|
||||
# Create Production Plan
|
||||
pln = create_production_plan(item_code=bom.item, planned_qty=10)
|
||||
pln = create_production_plan(item_code=bom.item, planned_qty=5)
|
||||
|
||||
# All the created Work Orders
|
||||
wo_list = []
|
||||
|
||||
# Create and Submit 1st Work Order for 5 qty
|
||||
create_work_order(item, pln, 5)
|
||||
# Create and Submit 1st Work Order for 3 qty
|
||||
create_work_order(item, pln, 3)
|
||||
pln.reload()
|
||||
self.assertEqual(pln.po_items[0].ordered_qty, 3)
|
||||
|
||||
# Create and Submit 2nd Work Order for 2 qty
|
||||
create_work_order(item, pln, 2)
|
||||
pln.reload()
|
||||
self.assertEqual(pln.po_items[0].ordered_qty, 5)
|
||||
|
||||
# Create and Submit 2nd Work Order for 3 qty
|
||||
create_work_order(item, pln, 3)
|
||||
pln.reload()
|
||||
self.assertEqual(pln.po_items[0].ordered_qty, 8)
|
||||
# Overproduction
|
||||
self.assertRaises(OverProductionError, create_work_order, item=item, pln=pln, qty=2)
|
||||
|
||||
# Cancel 1st Work Order
|
||||
wo1 = frappe.get_doc("Work Order", wo_list[0])
|
||||
wo1.cancel()
|
||||
pln.reload()
|
||||
self.assertEqual(pln.po_items[0].ordered_qty, 3)
|
||||
self.assertEqual(pln.po_items[0].ordered_qty, 2)
|
||||
|
||||
# Cancel 2nd Work Order
|
||||
wo2 = frappe.get_doc("Work Order", wo_list[1])
|
||||
|
@ -636,6 +636,21 @@ class WorkOrder(Document):
|
||||
if not self.qty > 0:
|
||||
frappe.throw(_("Quantity to Manufacture must be greater than 0."))
|
||||
|
||||
if self.production_plan and self.production_plan_item:
|
||||
qty_dict = frappe.db.get_value("Production Plan Item", self.production_plan_item, ["planned_qty", "ordered_qty"], as_dict=1)
|
||||
|
||||
allowance_qty =flt(frappe.db.get_single_value("Manufacturing Settings",
|
||||
"overproduction_percentage_for_work_order"))/100 * qty_dict.get("planned_qty", 0)
|
||||
|
||||
max_qty = qty_dict.get("planned_qty", 0) + allowance_qty - qty_dict.get("ordered_qty", 0)
|
||||
|
||||
if max_qty < 1:
|
||||
frappe.throw(_("Cannot produce more item for {0}")
|
||||
.format(self.production_item), OverProductionError)
|
||||
elif self.qty > max_qty:
|
||||
frappe.throw(_("Cannot produce more than {0} items for {1}")
|
||||
.format(max_qty, self.production_item), OverProductionError)
|
||||
|
||||
def validate_transfer_against(self):
|
||||
if not self.docstatus == 1:
|
||||
# let user configure operations until they're ready to submit
|
||||
|
@ -1,17 +0,0 @@
|
||||
<div class="col-sm-3">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input
|
||||
type="checkbox"
|
||||
data-group_roll_number="{{group_roll_number}}"
|
||||
data-student="{{student}}"
|
||||
data-student-name="{{student_name}}"
|
||||
class="students-check"
|
||||
{% if status === "Present" %}
|
||||
checked
|
||||
{% endif %}
|
||||
>
|
||||
{{ group_roll_number }} - {{ student_name }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
@ -16,7 +16,6 @@ import "./templates/item_quick_entry.html";
|
||||
import "./utils/item_quick_entry";
|
||||
import "./utils/customer_quick_entry";
|
||||
import "./utils/supplier_quick_entry";
|
||||
import "./education/student_button.html";
|
||||
import "./education/assessment_result_tool.html";
|
||||
import "./call_popup/call_popup";
|
||||
import "./utils/dimension_tree_filter";
|
||||
|
@ -304,12 +304,13 @@ erpnext.HierarchyChart = class {
|
||||
}
|
||||
|
||||
get_child_nodes(node_id) {
|
||||
let me = this;
|
||||
return new Promise(resolve => {
|
||||
frappe.call({
|
||||
method: this.method,
|
||||
method: me.method,
|
||||
args: {
|
||||
parent: node_id,
|
||||
company: this.company
|
||||
company: me.company
|
||||
}
|
||||
}).then(r => resolve(r.message));
|
||||
});
|
||||
@ -350,12 +351,13 @@ erpnext.HierarchyChart = class {
|
||||
}
|
||||
|
||||
get_all_nodes() {
|
||||
let me = this;
|
||||
return new Promise(resolve => {
|
||||
frappe.call({
|
||||
method: 'erpnext.utilities.hierarchy_chart.get_all_nodes',
|
||||
args: {
|
||||
method: this.method,
|
||||
company: this.company
|
||||
method: me.method,
|
||||
company: me.company
|
||||
},
|
||||
callback: (r) => {
|
||||
resolve(r.message);
|
||||
@ -427,8 +429,8 @@ erpnext.HierarchyChart = class {
|
||||
|
||||
add_connector(parent_id, child_id) {
|
||||
// using pure javascript for better performance
|
||||
const parent_node = document.querySelector(`#${parent_id}`);
|
||||
const child_node = document.querySelector(`#${child_id}`);
|
||||
const parent_node = document.getElementById(`${parent_id}`);
|
||||
const child_node = document.getElementById(`${child_id}`);
|
||||
|
||||
let path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
||||
|
||||
|
@ -235,7 +235,7 @@ erpnext.HierarchyChartMobile = class {
|
||||
let me = this;
|
||||
return new Promise(resolve => {
|
||||
frappe.call({
|
||||
method: this.method,
|
||||
method: me.method,
|
||||
args: {
|
||||
parent: node_id,
|
||||
company: me.company,
|
||||
@ -286,8 +286,8 @@ erpnext.HierarchyChartMobile = class {
|
||||
}
|
||||
|
||||
add_connector(parent_id, child_id) {
|
||||
const parent_node = document.querySelector(`#${parent_id}`);
|
||||
const child_node = document.querySelector(`#${child_id}`);
|
||||
const parent_node = document.getElementById(`${parent_id}`);
|
||||
const child_node = document.getElementById(`${child_id}`);
|
||||
|
||||
const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
||||
|
||||
@ -518,7 +518,8 @@ erpnext.HierarchyChartMobile = class {
|
||||
level.nextAll('li').remove();
|
||||
|
||||
let node_object = this.nodes[node.id];
|
||||
let current_node = level.find(`#${node.id}`).detach();
|
||||
let current_node = level.find(`[id="${node.id}"]`).detach();
|
||||
|
||||
current_node.removeClass('active-child active-path');
|
||||
|
||||
node_object.expanded = 0;
|
||||
|
@ -629,6 +629,12 @@ frappe.ui.form.on('Stock Entry Detail', {
|
||||
frm.events.set_serial_no(frm, cdt, cdn, () => {
|
||||
frm.events.get_warehouse_details(frm, cdt, cdn);
|
||||
});
|
||||
|
||||
// set allow_zero_valuation_rate to 0 if s_warehouse is selected.
|
||||
let item = frappe.get_doc(cdt, cdn);
|
||||
if (item.s_warehouse) {
|
||||
item.allow_zero_valuation_rate = 0;
|
||||
}
|
||||
},
|
||||
|
||||
t_warehouse: function(frm, cdt, cdn) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"actions": [],
|
||||
"autoname": "hash",
|
||||
"creation": "2013-03-29 18:22:12",
|
||||
"creation": "2022-02-05 00:17:49.860824",
|
||||
"doctype": "DocType",
|
||||
"document_type": "Other",
|
||||
"editable_grid": 1,
|
||||
@ -340,13 +340,13 @@
|
||||
"label": "More Information"
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 1,
|
||||
"default": "0",
|
||||
"fieldname": "allow_zero_valuation_rate",
|
||||
"fieldtype": "Check",
|
||||
"label": "Allow Zero Valuation Rate",
|
||||
"no_copy": 1,
|
||||
"print_hide": 1
|
||||
"print_hide": 1,
|
||||
"read_only_depends_on": "eval:doc.s_warehouse"
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 1,
|
||||
@ -556,12 +556,14 @@
|
||||
"index_web_pages_for_search": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2021-06-22 16:47:11.268975",
|
||||
"modified": "2022-02-26 00:51:24.963653",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Stock Entry Detail",
|
||||
"naming_rule": "Random",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"sort_field": "modified",
|
||||
"sort_order": "ASC"
|
||||
"sort_order": "ASC",
|
||||
"states": []
|
||||
}
|
Loading…
Reference in New Issue
Block a user