mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-15 04:45:09 +00:00
fix: no permission to get project settings in sales invoice
(cherry picked from commit 221f1468cb)
This commit is contained in:
@@ -897,12 +897,16 @@ frappe.ui.form.on("Sales Invoice", {
|
|||||||
|
|
||||||
project: function (frm) {
|
project: function (frm) {
|
||||||
if (frm.doc.project) {
|
if (frm.doc.project) {
|
||||||
frappe.db.get_value("Projects Settings", {}, "fetch_timesheet_in_sales_invoice", (r) => {
|
frappe.call({
|
||||||
if (cint(r.fetch_timesheet_in_sales_invoice)) {
|
method: "is_auto_fetch_timesheet_enabled",
|
||||||
frm.events.add_timesheet_data(frm, {
|
doc: frm.doc,
|
||||||
project: frm.doc.project,
|
callback: function (r) {
|
||||||
});
|
if (cint(r.message)) {
|
||||||
}
|
frm.events.add_timesheet_data(frm, {
|
||||||
|
project: frm.doc.project,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1090,15 +1090,15 @@ class SalesInvoice(SellingController):
|
|||||||
timesheet.billing_amount = ts_doc.total_billable_amount
|
timesheet.billing_amount = ts_doc.total_billable_amount
|
||||||
|
|
||||||
def update_timesheet_billing_for_project(self):
|
def update_timesheet_billing_for_project(self):
|
||||||
if (
|
if not self.timesheets and self.project and self.is_auto_fetch_timesheet_enabled():
|
||||||
not self.timesheets
|
|
||||||
and self.project
|
|
||||||
and frappe.db.get_single_value("Projects Settings", "fetch_timesheet_in_sales_invoice")
|
|
||||||
):
|
|
||||||
self.add_timesheet_data()
|
self.add_timesheet_data()
|
||||||
else:
|
else:
|
||||||
self.calculate_billing_amount_for_timesheet()
|
self.calculate_billing_amount_for_timesheet()
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def is_auto_fetch_timesheet_enabled(self):
|
||||||
|
return frappe.db.get_single_value("Projects Settings", "fetch_timesheet_in_sales_invoice")
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def add_timesheet_data(self):
|
def add_timesheet_data(self):
|
||||||
self.set("timesheets", [])
|
self.set("timesheets", [])
|
||||||
|
|||||||
Reference in New Issue
Block a user