Merge branch 'master' into develop
This commit is contained in:
commit
c9fa07b16d
@ -2,7 +2,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
|
|
||||||
__version__ = '8.0.40'
|
__version__ = '8.0.41'
|
||||||
|
|
||||||
|
|
||||||
def get_default_company(user=None):
|
def get_default_company(user=None):
|
||||||
|
@ -299,6 +299,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
|||||||
this.calculate_write_off_amount()
|
this.calculate_write_off_amount()
|
||||||
}else {
|
}else {
|
||||||
this.frm.set_value("change_amount", 0.0)
|
this.frm.set_value("change_amount", 0.0)
|
||||||
|
this.frm.set_value("base_change_amount", 0.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.frm.refresh_fields();
|
this.frm.refresh_fields();
|
||||||
|
@ -19,10 +19,10 @@ status_map = {
|
|||||||
["Converted", "has_customer"],
|
["Converted", "has_customer"],
|
||||||
],
|
],
|
||||||
"Opportunity": [
|
"Opportunity": [
|
||||||
["Quotation", "has_active_quotation"],
|
|
||||||
["Converted", "has_ordered_quotation"],
|
|
||||||
["Lost", "eval:self.status=='Lost'"],
|
["Lost", "eval:self.status=='Lost'"],
|
||||||
["Lost", "has_lost_quotation"],
|
["Lost", "has_lost_quotation"],
|
||||||
|
["Quotation", "has_active_quotation"],
|
||||||
|
["Converted", "has_ordered_quotation"],
|
||||||
["Closed", "eval:self.status=='Closed'"]
|
["Closed", "eval:self.status=='Closed'"]
|
||||||
],
|
],
|
||||||
"Quotation": [
|
"Quotation": [
|
||||||
|
@ -440,16 +440,16 @@ class calculate_taxes_and_totals(object):
|
|||||||
self.doc.conversion_rate, self.doc.precision("grand_total")) - self.doc.total_advance
|
self.doc.conversion_rate, self.doc.precision("grand_total")) - self.doc.total_advance
|
||||||
- flt(self.doc.base_write_off_amount), self.doc.precision("grand_total"))
|
- flt(self.doc.base_write_off_amount), self.doc.precision("grand_total"))
|
||||||
|
|
||||||
if self.doc.doctype == "Sales Invoice":
|
if self.doc.doctype == "Sales Invoice":
|
||||||
self.doc.round_floats_in(self.doc, ["paid_amount"])
|
self.doc.round_floats_in(self.doc, ["paid_amount"])
|
||||||
paid_amount = self.doc.paid_amount \
|
|
||||||
if self.doc.party_account_currency == self.doc.currency else self.doc.base_paid_amount
|
|
||||||
|
|
||||||
change_amount = self.doc.change_amount \
|
|
||||||
if self.doc.party_account_currency == self.doc.currency else self.doc.base_change_amount
|
|
||||||
|
|
||||||
self.calculate_write_off_amount()
|
self.calculate_write_off_amount()
|
||||||
self.calculate_change_amount()
|
self.calculate_change_amount()
|
||||||
|
|
||||||
|
paid_amount = self.doc.paid_amount \
|
||||||
|
if self.doc.party_account_currency == self.doc.currency else self.doc.base_paid_amount
|
||||||
|
|
||||||
|
change_amount = self.doc.change_amount \
|
||||||
|
if self.doc.party_account_currency == self.doc.currency else self.doc.base_change_amount
|
||||||
|
|
||||||
self.doc.outstanding_amount = flt(total_amount_to_pay - flt(paid_amount) +
|
self.doc.outstanding_amount = flt(total_amount_to_pay - flt(paid_amount) +
|
||||||
flt(change_amount), self.doc.precision("outstanding_amount"))
|
flt(change_amount), self.doc.precision("outstanding_amount"))
|
||||||
@ -475,7 +475,9 @@ class calculate_taxes_and_totals(object):
|
|||||||
def calculate_change_amount(self):
|
def calculate_change_amount(self):
|
||||||
self.doc.change_amount = 0.0
|
self.doc.change_amount = 0.0
|
||||||
self.doc.base_change_amount = 0.0
|
self.doc.base_change_amount = 0.0
|
||||||
if self.doc.paid_amount > self.doc.grand_total:
|
if self.doc.paid_amount > self.doc.grand_total and not self.doc.is_return \
|
||||||
|
and any([d.type == "Cash" for d in self.doc.payments]):
|
||||||
|
|
||||||
self.doc.change_amount = flt(self.doc.paid_amount - self.doc.grand_total +
|
self.doc.change_amount = flt(self.doc.paid_amount - self.doc.grand_total +
|
||||||
self.doc.write_off_amount, self.doc.precision("change_amount"))
|
self.doc.write_off_amount, self.doc.precision("change_amount"))
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ frappe.ui.form.on("Opportunity", {
|
|||||||
var doc = frm.doc;
|
var doc = frm.doc;
|
||||||
frm.events.enquiry_from(frm);
|
frm.events.enquiry_from(frm);
|
||||||
frm.trigger('set_contact_link');
|
frm.trigger('set_contact_link');
|
||||||
|
erpnext.toggle_naming_series();
|
||||||
|
|
||||||
if(!doc.__islocal && doc.status!=="Lost") {
|
if(!doc.__islocal && doc.status!=="Lost") {
|
||||||
if(doc.with_items){
|
if(doc.with_items){
|
||||||
@ -53,6 +54,20 @@ frappe.ui.form.on("Opportunity", {
|
|||||||
frm.add_custom_button(__('Lost'),
|
frm.add_custom_button(__('Lost'),
|
||||||
cur_frm.cscript['Declare Opportunity Lost']);
|
cur_frm.cscript['Declare Opportunity Lost']);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
if(!frm.doc.__islocal && frm.perm[0].write && frm.doc.docstatus==0) {
|
||||||
|
if(frm.doc.status==="Open") {
|
||||||
|
frm.add_custom_button(__("Close"), function() {
|
||||||
|
frm.set_value("status", "Closed");
|
||||||
|
frm.save();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
frm.add_custom_button(__("Reopen"), function() {
|
||||||
|
frm.set_value("status", "Open");
|
||||||
|
frm.save();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -122,25 +137,6 @@ erpnext.crm.Opportunity = frappe.ui.form.Controller.extend({
|
|||||||
|
|
||||||
$.extend(cur_frm.cscript, new erpnext.crm.Opportunity({frm: cur_frm}));
|
$.extend(cur_frm.cscript, new erpnext.crm.Opportunity({frm: cur_frm}));
|
||||||
|
|
||||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
|
||||||
erpnext.toggle_naming_series();
|
|
||||||
|
|
||||||
var frm = cur_frm;
|
|
||||||
if(!doc.__islocal && frm.perm[0].write && doc.docstatus==0) {
|
|
||||||
if(frm.doc.status==="Open") {
|
|
||||||
frm.add_custom_button(__("Close"), function() {
|
|
||||||
frm.set_value("status", "Closed");
|
|
||||||
frm.save();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
frm.add_custom_button(__("Reopen"), function() {
|
|
||||||
frm.set_value("status", "Open");
|
|
||||||
frm.save();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
|
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
|
||||||
if(doc.enquiry_from == 'Lead' && doc.lead)
|
if(doc.enquiry_from == 'Lead' && doc.lead)
|
||||||
cur_frm.cscript.lead(doc, cdt, cdn);
|
cur_frm.cscript.lead(doc, cdt, cdn);
|
||||||
|
@ -31,7 +31,6 @@ class Opportunity(TransactionBase):
|
|||||||
if not self.enquiry_from:
|
if not self.enquiry_from:
|
||||||
frappe.throw(_("Opportunity From field is mandatory"))
|
frappe.throw(_("Opportunity From field is mandatory"))
|
||||||
|
|
||||||
self.set_status()
|
|
||||||
self.validate_item_details()
|
self.validate_item_details()
|
||||||
self.validate_uom_is_integer("uom", "qty")
|
self.validate_uom_is_integer("uom", "qty")
|
||||||
self.validate_lead_cust()
|
self.validate_lead_cust()
|
||||||
|
@ -178,7 +178,8 @@ scheduler_events = {
|
|||||||
"erpnext.hr.doctype.employee.employee.send_birthday_reminders",
|
"erpnext.hr.doctype.employee.employee.send_birthday_reminders",
|
||||||
"erpnext.projects.doctype.task.task.set_tasks_as_overdue",
|
"erpnext.projects.doctype.task.task.set_tasks_as_overdue",
|
||||||
"erpnext.accounts.doctype.asset.depreciation.post_depreciation_entries",
|
"erpnext.accounts.doctype.asset.depreciation.post_depreciation_entries",
|
||||||
'erpnext.hr.doctype.daily_work_summary_settings.daily_work_summary_settings.send_summary'
|
"erpnext.hr.doctype.daily_work_summary_settings.daily_work_summary_settings.send_summary",
|
||||||
|
"erpnext.stock.doctype.serial_no.serial_no.update_maintenance_status"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ from erpnext.accounts.party import get_party_account
|
|||||||
from erpnext.accounts.general_ledger import make_gl_entries
|
from erpnext.accounts.general_ledger import make_gl_entries
|
||||||
from erpnext.accounts.doctype.sales_invoice.sales_invoice import get_bank_cash_account
|
from erpnext.accounts.doctype.sales_invoice.sales_invoice import get_bank_cash_account
|
||||||
from erpnext.controllers.accounts_controller import AccountsController
|
from erpnext.controllers.accounts_controller import AccountsController
|
||||||
|
from frappe.utils.csvutils import getlink
|
||||||
|
|
||||||
class InvalidExpenseApproverError(frappe.ValidationError): pass
|
class InvalidExpenseApproverError(frappe.ValidationError): pass
|
||||||
|
|
||||||
@ -146,7 +147,7 @@ class ExpenseClaim(AccountsController):
|
|||||||
frappe.throw(_("Cost center is required to book an expense claim"))
|
frappe.throw(_("Cost center is required to book an expense claim"))
|
||||||
|
|
||||||
if not self.payable_account:
|
if not self.payable_account:
|
||||||
frappe.throw(_("Please set default payable account in the employee {0}").format(self.employee))
|
frappe.throw(_("Please set default payable account for the company {0}").format(getlink("Company",self.company)))
|
||||||
|
|
||||||
if self.is_paid:
|
if self.is_paid:
|
||||||
if not self.mode_of_payment:
|
if not self.mode_of_payment:
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"allow_copy": 0,
|
"allow_copy": 0,
|
||||||
|
"allow_guest_to_view": 0,
|
||||||
"allow_import": 1,
|
"allow_import": 1,
|
||||||
"allow_rename": 1,
|
"allow_rename": 1,
|
||||||
"autoname": "field:event_name",
|
"autoname": "field:event_name",
|
||||||
@ -12,6 +13,7 @@
|
|||||||
"editable_grid": 1,
|
"editable_grid": 1,
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -27,7 +29,7 @@
|
|||||||
"in_standard_filter": 0,
|
"in_standard_filter": 0,
|
||||||
"label": "Event Name",
|
"label": "Event Name",
|
||||||
"length": 0,
|
"length": 0,
|
||||||
"no_copy": 0,
|
"no_copy": 1,
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"precision": "",
|
"precision": "",
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
@ -41,6 +43,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 1,
|
"allow_on_submit": 1,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -71,6 +74,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -99,6 +103,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -129,6 +134,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -157,6 +163,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -186,6 +193,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -216,6 +224,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -244,6 +253,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -274,6 +284,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -303,6 +314,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -331,6 +343,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -361,6 +374,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -390,6 +404,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -418,6 +433,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -447,6 +463,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -476,6 +493,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -504,6 +522,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -533,6 +552,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -562,6 +582,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -592,6 +613,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 1,
|
"allow_on_submit": 1,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -622,6 +644,7 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -651,17 +674,17 @@
|
|||||||
"unique": 0
|
"unique": 0
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"has_web_view": 0,
|
||||||
"hide_heading": 0,
|
"hide_heading": 0,
|
||||||
"hide_toolbar": 0,
|
"hide_toolbar": 0,
|
||||||
"idx": 0,
|
"idx": 0,
|
||||||
"image_view": 0,
|
"image_view": 0,
|
||||||
"in_create": 0,
|
"in_create": 0,
|
||||||
"in_dialog": 0,
|
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2017-02-17 16:51:35.141403",
|
"modified": "2017-05-29 06:13:38.411039",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Training Event",
|
"name": "Training Event",
|
||||||
|
@ -13,7 +13,9 @@ class TrainingResult(Document):
|
|||||||
|
|
||||||
def send_result(self):
|
def send_result(self):
|
||||||
for emp in self.employees:
|
for emp in self.employees:
|
||||||
message = "Thank You for attending {0}. You grade is {1}".format(self.training_event, emp.grade)
|
message = "Thank You for attending {0}.".format(self.training_event)
|
||||||
|
if emp.grade:
|
||||||
|
message = message + "Your grade: {0}".format(emp.grade)
|
||||||
frappe.sendmail(frappe.db.get_value("Employee", emp.employee, "company_email"), \
|
frappe.sendmail(frappe.db.get_value("Employee", emp.employee, "company_email"), \
|
||||||
subject=_("{0} Results".format(self.training_event)), \
|
subject=_("{0} Results".format(self.training_event)), \
|
||||||
content=message)
|
content=message)
|
||||||
|
@ -20,6 +20,7 @@ from erpnext.manufacturing.doctype.manufacturing_settings.manufacturing_settings
|
|||||||
from erpnext.stock.stock_balance import get_planned_qty, update_bin_qty
|
from erpnext.stock.stock_balance import get_planned_qty, update_bin_qty
|
||||||
from erpnext.manufacturing.doctype.bom.bom import get_bom_items_as_dict
|
from erpnext.manufacturing.doctype.bom.bom import get_bom_items_as_dict
|
||||||
from erpnext.stock.utils import get_bin
|
from erpnext.stock.utils import get_bin
|
||||||
|
from frappe.utils.csvutils import getlink
|
||||||
|
|
||||||
class OverProductionError(frappe.ValidationError): pass
|
class OverProductionError(frappe.ValidationError): pass
|
||||||
class StockOverProductionError(frappe.ValidationError): pass
|
class StockOverProductionError(frappe.ValidationError): pass
|
||||||
@ -311,7 +312,7 @@ class ProductionOrder(Document):
|
|||||||
|
|
||||||
if timesheet and timesheet.get("time_logs"):
|
if timesheet and timesheet.get("time_logs"):
|
||||||
timesheet.save()
|
timesheet.save()
|
||||||
timesheets.append(timesheet.name)
|
timesheets.append(getlink("Timesheet", timesheet.name))
|
||||||
|
|
||||||
self.planned_end_date = self.operations[-1].planned_end_time
|
self.planned_end_date = self.operations[-1].planned_end_time
|
||||||
if timesheets:
|
if timesheets:
|
||||||
|
@ -368,7 +368,8 @@ def get_events(start, end, filters=None):
|
|||||||
conditions = get_conditions(filters)
|
conditions = get_conditions(filters)
|
||||||
return frappe.db.sql("""select `tabTimesheet Detail`.name as name,
|
return frappe.db.sql("""select `tabTimesheet Detail`.name as name,
|
||||||
`tabTimesheet Detail`.docstatus as status, `tabTimesheet Detail`.parent as parent,
|
`tabTimesheet Detail`.docstatus as status, `tabTimesheet Detail`.parent as parent,
|
||||||
from_time as start_date, hours, activity_type, project, to_time as end_date,
|
from_time as start_date, hours, activity_type,
|
||||||
|
`tabTimesheet Detail`.project, to_time as end_date,
|
||||||
CONCAT(`tabTimesheet Detail`.parent, ' (', ROUND(hours,2),' hrs)') as title
|
CONCAT(`tabTimesheet Detail`.parent, ' (', ROUND(hours,2),' hrs)') as title
|
||||||
from `tabTimesheet Detail`, `tabTimesheet`
|
from `tabTimesheet Detail`, `tabTimesheet`
|
||||||
where `tabTimesheet Detail`.parent = `tabTimesheet`.name
|
where `tabTimesheet Detail`.parent = `tabTimesheet`.name
|
||||||
|
@ -604,11 +604,18 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
|
|||||||
|
|
||||||
calculate_change_amount: function(){
|
calculate_change_amount: function(){
|
||||||
this.frm.doc.change_amount = 0.0;
|
this.frm.doc.change_amount = 0.0;
|
||||||
if(this.frm.doc.paid_amount > this.frm.doc.grand_total && !this.frm.doc.is_return){
|
this.frm.doc.base_change_amount = 0.0;
|
||||||
this.frm.doc.change_amount = flt(this.frm.doc.paid_amount - this.frm.doc.grand_total +
|
if(this.frm.doc.paid_amount > this.frm.doc.grand_total && !this.frm.doc.is_return) {
|
||||||
this.frm.doc.write_off_amount, precision("change_amount"));
|
var payment_types = $.map(cur_frm.doc.payments, function(d) { return d.type });
|
||||||
this.frm.doc.base_change_amount = flt(this.frm.doc.base_paid_amount - this.frm.doc.base_grand_total +
|
if (in_list(payment_types, 'Cash')) {
|
||||||
this.frm.doc.base_write_off_amount, precision("base_change_amount"));
|
this.frm.doc.change_amount = flt(this.frm.doc.paid_amount - this.frm.doc.grand_total +
|
||||||
|
this.frm.doc.write_off_amount, precision("change_amount"));
|
||||||
|
|
||||||
|
this.frm.doc.base_change_amount = flt(this.frm.doc.base_paid_amount -
|
||||||
|
this.frm.doc.base_grand_total + this.frm.doc.base_write_off_amount,
|
||||||
|
precision("base_change_amount"));
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ class StudentGroup(Document):
|
|||||||
self.validate_strength()
|
self.validate_strength()
|
||||||
if frappe.defaults.get_defaults().student_validation_setting:
|
if frappe.defaults.get_defaults().student_validation_setting:
|
||||||
self.validate_students()
|
self.validate_students()
|
||||||
self.validate_roll_no()
|
self.validate_and_set_child_table_fields()
|
||||||
validate_duplicate_student(self.students)
|
validate_duplicate_student(self.students)
|
||||||
|
|
||||||
def validate_mandatory_fields(self):
|
def validate_mandatory_fields(self):
|
||||||
@ -38,9 +38,16 @@ class StudentGroup(Document):
|
|||||||
if not frappe.db.get_value("Student", d.student, "enabled") and d.active:
|
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)))
|
frappe.throw(_("{0} - {1} is inactive student".format(d.group_roll_number, d.student_name)))
|
||||||
|
|
||||||
def validate_roll_no(self):
|
def validate_and_set_child_table_fields(self):
|
||||||
|
roll_numbers = [d.group_roll_number for d in self.students if d.group_roll_number]
|
||||||
|
max_roll_no = max(roll_numbers) if roll_numbers else 0
|
||||||
roll_no_list = []
|
roll_no_list = []
|
||||||
for d in self.students:
|
for d in self.students:
|
||||||
|
if not d.student_name:
|
||||||
|
d.student_name = frappe.db.get_value("Student", d.student, "title")
|
||||||
|
if not d.group_roll_number:
|
||||||
|
max_roll_no += 1
|
||||||
|
d.group_roll_number = max_roll_no
|
||||||
if d.group_roll_number in roll_no_list:
|
if d.group_roll_number in roll_no_list:
|
||||||
frappe.throw(_("Duplicate roll number for student {0}".format(d.student_name)))
|
frappe.throw(_("Duplicate roll number for student {0}".format(d.student_name)))
|
||||||
else:
|
else:
|
||||||
|
@ -5,8 +5,23 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
import unittest
|
import unittest
|
||||||
|
from frappe.utils.make_random import get_random
|
||||||
# test_records = frappe.get_test_records('Student Group')
|
|
||||||
|
|
||||||
class TestStudentGroup(unittest.TestCase):
|
class TestStudentGroup(unittest.TestCase):
|
||||||
pass
|
def test_student_roll_no(self):
|
||||||
|
doc = frappe.get_doc({
|
||||||
|
"doctype": "Student Group",
|
||||||
|
"student_group_name": "_Test Student Group R",
|
||||||
|
"group_based_on": "Activity"
|
||||||
|
}).insert()
|
||||||
|
|
||||||
|
student_list = []
|
||||||
|
while len(student_list) < 3:
|
||||||
|
s = get_random("Student")
|
||||||
|
if s not in student_list:
|
||||||
|
student_list.append(s)
|
||||||
|
|
||||||
|
doc.extend("students", [{"student":d} for d in student_list])
|
||||||
|
doc.save()
|
||||||
|
self.assertEquals(max([d.group_roll_number for d in doc.students]), 3)
|
||||||
|
|
||||||
|
@ -324,3 +324,12 @@ def update_serial_nos_after_submit(controller, parentfield):
|
|||||||
update_rejected_serial_nos = False
|
update_rejected_serial_nos = False
|
||||||
if accepted_serial_nos_updated:
|
if accepted_serial_nos_updated:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
def update_maintenance_status():
|
||||||
|
serial_nos = frappe.db.sql('''select name from `tabSerial No` where (amc_expiry_date<%s or
|
||||||
|
warranty_expiry_date<%s) and maintenance_status not in ('Out of Warranty', 'Out of AMC')''',
|
||||||
|
(nowdate(), nowdate()))
|
||||||
|
for serial_no in serial_nos:
|
||||||
|
doc = frappe.get_doc("Serial No", serial_no[0])
|
||||||
|
doc.set_maintenance_status()
|
||||||
|
frappe.db.set_value('Serial No', doc.name, 'maintenance_status', doc.maintenance_status)
|
||||||
|
Loading…
Reference in New Issue
Block a user