mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-07 15:25:19 +00:00
* feat: add `total_billing_hours` to Sales Invoice
* fix: re-save doctypes
* fix: indentation
* fix: replace reference to old function
(cherry picked from commit 09ccdee2db)
# Conflicts:
# erpnext/accounts/doctype/sales_invoice/sales_invoice.js
# erpnext/accounts/doctype/sales_invoice/sales_invoice.json
# erpnext/accounts/doctype/sales_invoice/sales_invoice.py
# erpnext/projects/doctype/timesheet/timesheet.py
This commit is contained in:
@@ -478,7 +478,11 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
let row = frappe.get_doc(d.doctype, d.name)
|
||||
set_timesheet_detail_rate(row.doctype, row.name, me.frm.doc.currency, row.timesheet_detail)
|
||||
});
|
||||
<<<<<<< HEAD
|
||||
this.frm.trigger("calculate_timesheet_totals");
|
||||
=======
|
||||
frm.trigger("calculate_timesheet_totals");
|
||||
>>>>>>> 09ccdee2db ( feat: add `total_billing_hours` to Sales Invoice (fp #26783) (#27742))
|
||||
}
|
||||
},
|
||||
|
||||
@@ -887,18 +891,37 @@ frappe.ui.form.on('Sales Invoice', {
|
||||
|
||||
set_timesheet_data: function(frm, timesheets) {
|
||||
frm.clear_table("timesheets")
|
||||
<<<<<<< HEAD
|
||||
timesheets.forEach(async (timesheet) => {
|
||||
if (frm.doc.currency != timesheet.currency) {
|
||||
const exchange_rate = await frm.events.get_exchange_rate(
|
||||
frm, timesheet.currency, frm.doc.currency
|
||||
)
|
||||
frm.events.append_time_log(frm, timesheet, exchange_rate)
|
||||
=======
|
||||
timesheets.forEach(timesheet => {
|
||||
if (frm.doc.currency != timesheet.currency) {
|
||||
frappe.call({
|
||||
method: "erpnext.setup.utils.get_exchange_rate",
|
||||
args: {
|
||||
from_currency: timesheet.currency,
|
||||
to_currency: frm.doc.currency
|
||||
},
|
||||
callback: function(r) {
|
||||
if (r.message) {
|
||||
exchange_rate = r.message;
|
||||
frm.events.append_time_log(frm, timesheet, exchange_rate);
|
||||
}
|
||||
}
|
||||
});
|
||||
>>>>>>> 09ccdee2db ( feat: add `total_billing_hours` to Sales Invoice (fp #26783) (#27742))
|
||||
} else {
|
||||
frm.events.append_time_log(frm, timesheet, 1.0);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
<<<<<<< HEAD
|
||||
async get_exchange_rate(frm, from_currency, to_currency) {
|
||||
if (
|
||||
frm.exchange_rates
|
||||
@@ -925,6 +948,8 @@ frappe.ui.form.on('Sales Invoice', {
|
||||
});
|
||||
},
|
||||
|
||||
=======
|
||||
>>>>>>> 09ccdee2db ( feat: add `total_billing_hours` to Sales Invoice (fp #26783) (#27742))
|
||||
append_time_log: function(frm, time_log, exchange_rate) {
|
||||
const row = frm.add_child("timesheets");
|
||||
row.activity_type = time_log.activity_type;
|
||||
@@ -935,7 +960,11 @@ frappe.ui.form.on('Sales Invoice', {
|
||||
row.billing_hours = time_log.billing_hours;
|
||||
row.billing_amount = flt(time_log.billing_amount) * flt(exchange_rate);
|
||||
row.timesheet_detail = time_log.name;
|
||||
<<<<<<< HEAD
|
||||
row.project_name = time_log.project_name;
|
||||
=======
|
||||
row.project_name = time_log.project_name;
|
||||
>>>>>>> 09ccdee2db ( feat: add `total_billing_hours` to Sales Invoice (fp #26783) (#27742))
|
||||
|
||||
frm.refresh_field("timesheets");
|
||||
frm.trigger("calculate_timesheet_totals");
|
||||
@@ -1032,13 +1061,19 @@ frappe.ui.form.on('Sales Invoice', {
|
||||
}
|
||||
});
|
||||
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
>>>>>>> 09ccdee2db ( feat: add `total_billing_hours` to Sales Invoice (fp #26783) (#27742))
|
||||
frappe.ui.form.on("Sales Invoice Timesheet", {
|
||||
timesheets_remove(frm) {
|
||||
frm.trigger("calculate_timesheet_totals");
|
||||
}
|
||||
});
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
>>>>>>> 09ccdee2db ( feat: add `total_billing_hours` to Sales Invoice (fp #26783) (#27742))
|
||||
|
||||
var set_timesheet_detail_rate = function(cdt, cdn, currency, timelog) {
|
||||
frappe.call({
|
||||
|
||||
@@ -2022,6 +2022,7 @@
|
||||
"label": "Total Billing Hours",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
<<<<<<< HEAD
|
||||
},
|
||||
{
|
||||
"fieldname": "amount_eligible_for_commission",
|
||||
@@ -2035,6 +2036,8 @@
|
||||
"fieldname": "is_cash_or_non_trade_discount",
|
||||
"fieldtype": "Check",
|
||||
"label": "Is Cash or Non Trade Discount"
|
||||
=======
|
||||
>>>>>>> 09ccdee2db ( feat: add `total_billing_hours` to Sales Invoice (fp #26783) (#27742))
|
||||
}
|
||||
],
|
||||
"icon": "fa fa-file-text",
|
||||
@@ -2047,7 +2050,11 @@
|
||||
"link_fieldname": "consolidated_invoice"
|
||||
}
|
||||
],
|
||||
<<<<<<< HEAD
|
||||
"modified": "2023-01-28 19:45:47.538163",
|
||||
=======
|
||||
"modified": "2021-10-02 03:36:10.251715",
|
||||
>>>>>>> 09ccdee2db ( feat: add `total_billing_hours` to Sales Invoice (fp #26783) (#27742))
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Sales Invoice",
|
||||
|
||||
@@ -890,6 +890,7 @@ class SalesInvoice(SellingController):
|
||||
self.set("timesheets", [])
|
||||
if self.project:
|
||||
for data in get_projectwise_timesheet_data(self.project):
|
||||
<<<<<<< HEAD
|
||||
self.append(
|
||||
"timesheets",
|
||||
{
|
||||
@@ -901,6 +902,16 @@ class SalesInvoice(SellingController):
|
||||
"description": data.description,
|
||||
},
|
||||
)
|
||||
=======
|
||||
self.append('timesheets', {
|
||||
'time_sheet': data.time_sheet,
|
||||
'billing_hours': data.billing_hours,
|
||||
'billing_amount': data.billing_amount,
|
||||
'timesheet_detail': data.name,
|
||||
'activity_type': data.activity_type,
|
||||
'description': data.description
|
||||
})
|
||||
>>>>>>> 09ccdee2db ( feat: add `total_billing_hours` to Sales Invoice (fp #26783) (#27742))
|
||||
|
||||
self.calculate_billing_amount_for_timesheet()
|
||||
|
||||
|
||||
@@ -294,7 +294,16 @@ def get_projectwise_timesheet_data(project=None, parent=None, from_time=None, to
|
||||
ORDER BY tsd.from_time ASC
|
||||
"""
|
||||
|
||||
<<<<<<< HEAD
|
||||
filters = {"project": project, "parent": parent, "from_time": from_time, "to_time": to_time}
|
||||
=======
|
||||
filters = {
|
||||
"project": project,
|
||||
"parent": parent,
|
||||
"from_time": from_time,
|
||||
"to_time": to_time
|
||||
}
|
||||
>>>>>>> 09ccdee2db ( feat: add `total_billing_hours` to Sales Invoice (fp #26783) (#27742))
|
||||
|
||||
return frappe.db.sql(query, filters, as_dict=1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user