mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-24 23:49:19 +00:00
Merge branch 'develop' into e-commerce-refactor-develop
This commit is contained in:
@@ -6,6 +6,7 @@ import frappe
|
|||||||
from frappe import _, msgprint
|
from frappe import _, msgprint
|
||||||
from frappe.desk.reportview import get_match_cond
|
from frappe.desk.reportview import get_match_cond
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
from frappe.query_builder.functions import Min
|
||||||
from frappe.utils import comma_and, get_link_to_form, getdate
|
from frappe.utils import comma_and, get_link_to_form, getdate
|
||||||
|
|
||||||
|
|
||||||
@@ -60,8 +61,15 @@ class ProgramEnrollment(Document):
|
|||||||
frappe.throw(_("Student is already enrolled."))
|
frappe.throw(_("Student is already enrolled."))
|
||||||
|
|
||||||
def update_student_joining_date(self):
|
def update_student_joining_date(self):
|
||||||
date = frappe.db.sql("select min(enrollment_date) from `tabProgram Enrollment` where student= %s", self.student)
|
table = frappe.qb.DocType('Program Enrollment')
|
||||||
frappe.db.set_value("Student", self.student, "joining_date", date)
|
date = (
|
||||||
|
frappe.qb.from_(table)
|
||||||
|
.select(Min(table.enrollment_date).as_('enrollment_date'))
|
||||||
|
.where(table.student == self.student)
|
||||||
|
).run(as_dict=True)
|
||||||
|
|
||||||
|
if date:
|
||||||
|
frappe.db.set_value("Student", self.student, "joining_date", date[0].enrollment_date)
|
||||||
|
|
||||||
def make_fee_records(self):
|
def make_fee_records(self):
|
||||||
from erpnext.education.api import get_fee_components
|
from erpnext.education.api import get_fee_components
|
||||||
|
|||||||
@@ -207,8 +207,8 @@ class TestEmployeeReminders(unittest.TestCase):
|
|||||||
|
|
||||||
# teardown: enable emp 2
|
# teardown: enable emp 2
|
||||||
frappe.db.set_value('Employee', self.test_employee_2.name, {
|
frappe.db.set_value('Employee', self.test_employee_2.name, {
|
||||||
'status': 'Left',
|
'status': 'Active',
|
||||||
'holiday_list': self.holiday_list_2
|
'holiday_list': self.holiday_list_2.name
|
||||||
})
|
})
|
||||||
|
|
||||||
def test_advance_holiday_reminders_weekly(self):
|
def test_advance_holiday_reminders_weekly(self):
|
||||||
@@ -232,8 +232,8 @@ class TestEmployeeReminders(unittest.TestCase):
|
|||||||
|
|
||||||
# teardown: enable emp 2
|
# teardown: enable emp 2
|
||||||
frappe.db.set_value('Employee', self.test_employee_2.name, {
|
frappe.db.set_value('Employee', self.test_employee_2.name, {
|
||||||
'status': 'Left',
|
'status': 'Active',
|
||||||
'holiday_list': self.holiday_list_2
|
'holiday_list': self.holiday_list_2.name
|
||||||
})
|
})
|
||||||
|
|
||||||
def test_reminder_not_sent_if_no_holdays(self):
|
def test_reminder_not_sent_if_no_holdays(self):
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ erpnext.PointOfSale.Controller = class {
|
|||||||
|
|
||||||
numpad_event: (value, action) => this.update_item_field(value, action),
|
numpad_event: (value, action) => this.update_item_field(value, action),
|
||||||
|
|
||||||
checkout: () => this.payment.checkout(),
|
checkout: () => this.save_and_checkout(),
|
||||||
|
|
||||||
edit_cart: () => this.payment.edit_cart(),
|
edit_cart: () => this.payment.edit_cart(),
|
||||||
|
|
||||||
@@ -713,4 +713,9 @@ erpnext.PointOfSale.Controller = class {
|
|||||||
})
|
})
|
||||||
.catch(e => console.log(e));
|
.catch(e => console.log(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async save_and_checkout() {
|
||||||
|
this.frm.is_dirty() && await this.frm.save();
|
||||||
|
this.payment.checkout();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -191,10 +191,10 @@ erpnext.PointOfSale.ItemCart = class {
|
|||||||
this.numpad_value = '';
|
this.numpad_value = '';
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$component.on('click', '.checkout-btn', function() {
|
this.$component.on('click', '.checkout-btn', async function() {
|
||||||
if ($(this).attr('style').indexOf('--blue-500') == -1) return;
|
if ($(this).attr('style').indexOf('--blue-500') == -1) return;
|
||||||
|
|
||||||
me.events.checkout();
|
await me.events.checkout();
|
||||||
me.toggle_checkout_btn(false);
|
me.toggle_checkout_btn(false);
|
||||||
|
|
||||||
me.allow_discount_change && me.$add_discount_elem.removeClass("d-none");
|
me.allow_discount_change && me.$add_discount_elem.removeClass("d-none");
|
||||||
@@ -985,6 +985,7 @@ erpnext.PointOfSale.ItemCart = class {
|
|||||||
$(frm.wrapper).off('refresh-fields');
|
$(frm.wrapper).off('refresh-fields');
|
||||||
$(frm.wrapper).on('refresh-fields', () => {
|
$(frm.wrapper).on('refresh-fields', () => {
|
||||||
if (frm.doc.items.length) {
|
if (frm.doc.items.length) {
|
||||||
|
this.$cart_items_wrapper.html('');
|
||||||
frm.doc.items.forEach(item => {
|
frm.doc.items.forEach(item => {
|
||||||
this.update_item_html(item);
|
this.update_item_html(item);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user