mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-24 23:49:19 +00:00
Merge branch 'hotfix'
This commit is contained in:
@@ -5,7 +5,7 @@ import frappe
|
|||||||
from erpnext.hooks import regional_overrides
|
from erpnext.hooks import regional_overrides
|
||||||
from frappe.utils import getdate
|
from frappe.utils import getdate
|
||||||
|
|
||||||
__version__ = '10.1.46'
|
__version__ = '10.1.47'
|
||||||
|
|
||||||
def get_default_company(user=None):
|
def get_default_company(user=None):
|
||||||
'''Get default company for user'''
|
'''Get default company for user'''
|
||||||
|
|||||||
@@ -71,19 +71,22 @@ frappe.ui.form.on('Employee Loan', {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
mode_of_payment: function (frm) {
|
mode_of_payment: function (frm) {
|
||||||
frappe.call({
|
if (frm.doc.mode_of_payment && frm.doc.company) {
|
||||||
method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.get_bank_cash_account",
|
frappe.call({
|
||||||
args: {
|
method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.get_bank_cash_account",
|
||||||
"mode_of_payment": frm.doc.mode_of_payment,
|
args: {
|
||||||
"company": frm.doc.company
|
"mode_of_payment": frm.doc.mode_of_payment,
|
||||||
},
|
"company": frm.doc.company
|
||||||
callback: function (r, rt) {
|
},
|
||||||
if (r.message) {
|
callback: function (r, rt) {
|
||||||
frm.set_value("payment_account", r.message.account);
|
if (r.message) {
|
||||||
|
frm.set_value("payment_account", r.message.account);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
employee_loan_application: function (frm) {
|
employee_loan_application: function (frm) {
|
||||||
|
|||||||
@@ -29,8 +29,13 @@ class EmployeeLoanApplication(Document):
|
|||||||
if self.repayment_method == "Repay Fixed Amount per Period":
|
if self.repayment_method == "Repay Fixed Amount per Period":
|
||||||
monthly_interest_rate = flt(self.rate_of_interest) / (12 *100)
|
monthly_interest_rate = flt(self.rate_of_interest) / (12 *100)
|
||||||
if monthly_interest_rate:
|
if monthly_interest_rate:
|
||||||
|
monthly_interest_amount = self.loan_amount * monthly_interest_rate
|
||||||
|
if monthly_interest_amount >= self.repayment_amount:
|
||||||
|
frappe.throw(_("Repayment amount {} should be greater than monthly interest amount {}").
|
||||||
|
format(self.repayment_amount, monthly_interest_amount))
|
||||||
|
|
||||||
self.repayment_periods = math.ceil((math.log(self.repayment_amount) -
|
self.repayment_periods = math.ceil((math.log(self.repayment_amount) -
|
||||||
math.log(self.repayment_amount - (self.loan_amount*monthly_interest_rate))) /
|
math.log(self.repayment_amount - (monthly_interest_amount))) /
|
||||||
(math.log(1 + monthly_interest_rate)))
|
(math.log(1 + monthly_interest_rate)))
|
||||||
else:
|
else:
|
||||||
self.repayment_periods = self.loan_amount / self.repayment_amount
|
self.repayment_periods = self.loan_amount / self.repayment_amount
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ class Project(Document):
|
|||||||
self.validate_weights()
|
self.validate_weights()
|
||||||
self.sync_tasks()
|
self.sync_tasks()
|
||||||
self.tasks = []
|
self.tasks = []
|
||||||
self.load_tasks()
|
|
||||||
self.send_welcome_email()
|
self.send_welcome_email()
|
||||||
|
|
||||||
def validate_project_name(self):
|
def validate_project_name(self):
|
||||||
@@ -82,6 +81,9 @@ class Project(Document):
|
|||||||
|
|
||||||
def sync_tasks(self):
|
def sync_tasks(self):
|
||||||
"""sync tasks and remove table"""
|
"""sync tasks and remove table"""
|
||||||
|
if not hasattr(self, "deleted_task_list"):
|
||||||
|
self.set("deleted_task_list", [])
|
||||||
|
|
||||||
if self.flags.dont_sync_tasks: return
|
if self.flags.dont_sync_tasks: return
|
||||||
task_names = []
|
task_names = []
|
||||||
|
|
||||||
@@ -130,7 +132,7 @@ class Project(Document):
|
|||||||
|
|
||||||
# delete
|
# delete
|
||||||
for t in frappe.get_all("Task", ["name"], {"project": self.name, "name": ("not in", task_names)}):
|
for t in frappe.get_all("Task", ["name"], {"project": self.name, "name": ("not in", task_names)}):
|
||||||
frappe.delete_doc("Task", t.name)
|
self.deleted_task_list.append(t.name)
|
||||||
|
|
||||||
def update_costing_and_percentage_complete(self):
|
def update_costing_and_percentage_complete(self):
|
||||||
self.update_percent_complete()
|
self.update_percent_complete()
|
||||||
@@ -139,8 +141,14 @@ class Project(Document):
|
|||||||
def is_row_updated(self, row, existing_task_data):
|
def is_row_updated(self, row, existing_task_data):
|
||||||
if self.get("__islocal") or not existing_task_data: return True
|
if self.get("__islocal") or not existing_task_data: return True
|
||||||
|
|
||||||
|
project_task_custom_fields = frappe.get_all("Custom Field", {"dt": "Project Task"}, "fieldname")
|
||||||
|
|
||||||
d = existing_task_data.get(row.task_id)
|
d = existing_task_data.get(row.task_id)
|
||||||
|
|
||||||
|
for field in project_task_custom_fields:
|
||||||
|
if row.get(field) != d.get(field):
|
||||||
|
return True
|
||||||
|
|
||||||
if (d and (row.title != d.title or row.status != d.status
|
if (d and (row.title != d.title or row.status != d.status
|
||||||
or getdate(row.start_date) != getdate(d.start_date) or getdate(row.end_date) != getdate(d.end_date)
|
or getdate(row.start_date) != getdate(d.start_date) or getdate(row.end_date) != getdate(d.end_date)
|
||||||
or row.description != d.description or row.task_weight != d.task_weight)):
|
or row.description != d.description or row.task_weight != d.task_weight)):
|
||||||
@@ -263,9 +271,19 @@ class Project(Document):
|
|||||||
user.welcome_email_sent=1
|
user.welcome_email_sent=1
|
||||||
|
|
||||||
def on_update(self):
|
def on_update(self):
|
||||||
|
self.delete_task()
|
||||||
|
self.load_tasks()
|
||||||
self.update_costing_and_percentage_complete()
|
self.update_costing_and_percentage_complete()
|
||||||
self.update_dependencies_on_duplicated_project()
|
self.update_dependencies_on_duplicated_project()
|
||||||
|
|
||||||
|
def delete_task(self):
|
||||||
|
if not self.get('deleted_task_list'): return
|
||||||
|
|
||||||
|
for d in self.get('deleted_task_list'):
|
||||||
|
frappe.delete_doc("Task", d)
|
||||||
|
|
||||||
|
self.deleted_task_list = []
|
||||||
|
|
||||||
def update_dependencies_on_duplicated_project(self):
|
def update_dependencies_on_duplicated_project(self):
|
||||||
if self.flags.dont_sync_tasks: return
|
if self.flags.dont_sync_tasks: return
|
||||||
if not self.copied_from:
|
if not self.copied_from:
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.frm.doc.__islocal) {
|
if (this.frm.doc.__islocal
|
||||||
|
&& frappe.meta.has_field(this.frm.doc.doctype, "disable_rounded_total")) {
|
||||||
this.frm.set_value("disable_rounded_total", cint(frappe.sys_defaults.disable_rounded_total));
|
this.frm.set_value("disable_rounded_total", cint(frappe.sys_defaults.disable_rounded_total));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user