mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-09 00:01:18 +00:00
feat: add total_billing_hours to Sales Invoice
(cherry picked from commit b57521a337)
# Conflicts:
# erpnext/accounts/doctype/sales_invoice/sales_invoice.js
# erpnext/accounts/doctype/sales_invoice/sales_invoice.json
This commit is contained in:
@@ -909,6 +909,7 @@ frappe.ui.form.on("Sales Invoice", {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
async add_timesheet_data(frm, kwargs) {
|
async add_timesheet_data(frm, kwargs) {
|
||||||
if (kwargs === "Sales Invoice") {
|
if (kwargs === "Sales Invoice") {
|
||||||
// called via frm.trigger()
|
// called via frm.trigger()
|
||||||
@@ -921,6 +922,19 @@ frappe.ui.form.on("Sales Invoice", {
|
|||||||
|
|
||||||
const timesheets = await frm.events.get_timesheet_data(frm, kwargs);
|
const timesheets = await frm.events.get_timesheet_data(frm, kwargs);
|
||||||
return frm.events.set_timesheet_data(frm, timesheets);
|
return frm.events.set_timesheet_data(frm, timesheets);
|
||||||
|
=======
|
||||||
|
add_timesheet_row: function(frm, row, exchange_rate) {
|
||||||
|
frm.add_child('timesheets', {
|
||||||
|
'activity_type': row.activity_type,
|
||||||
|
'description': row.description,
|
||||||
|
'time_sheet': row.parent,
|
||||||
|
'billing_hours': row.billing_hours,
|
||||||
|
'billing_amount': flt(row.billing_amount) * flt(exchange_rate),
|
||||||
|
'timesheet_detail': row.name
|
||||||
|
});
|
||||||
|
frm.refresh_field('timesheets');
|
||||||
|
frm.trigger("calculate_timesheet_totals");
|
||||||
|
>>>>>>> b57521a337 (feat: add `total_billing_hours` to Sales Invoice)
|
||||||
},
|
},
|
||||||
|
|
||||||
async get_timesheet_data(frm, kwargs) {
|
async get_timesheet_data(frm, kwargs) {
|
||||||
@@ -1082,7 +1096,58 @@ var set_timesheet_detail_rate = function (cdt, cdn, currency, timelog) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
var select_loyalty_program = function (frm, loyalty_programs) {
|
var select_loyalty_program = function (frm, loyalty_programs) {
|
||||||
|
=======
|
||||||
|
create_invoice_discounting: function(frm) {
|
||||||
|
frappe.model.open_mapped_doc({
|
||||||
|
method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.create_invoice_discounting",
|
||||||
|
frm: frm
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
create_dunning: function(frm) {
|
||||||
|
frappe.model.open_mapped_doc({
|
||||||
|
method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.create_dunning",
|
||||||
|
frm: frm
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
calculate_timesheet_totals: function(frm) {
|
||||||
|
frm.set_value("total_billing_amount",
|
||||||
|
frm.doc.timesheets.reduce((a, b) => a + (b["billing_amount"] || 0.0), 0.0));
|
||||||
|
frm.set_value("total_billing_hours",
|
||||||
|
frm.doc.timesheets.reduce((a, b) => a + (b["billing_hours"] || 0.0), 0.0));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
frappe.ui.form.on("Sales Invoice Timesheet", {
|
||||||
|
time_sheet: function(frm, cdt, cdn){
|
||||||
|
var d = locals[cdt][cdn];
|
||||||
|
if(d.time_sheet) {
|
||||||
|
frappe.call({
|
||||||
|
method: "erpnext.projects.doctype.timesheet.timesheet.get_timesheet_data",
|
||||||
|
args: {
|
||||||
|
"name": d.time_sheet,
|
||||||
|
"project": frm.doc.project || null
|
||||||
|
},
|
||||||
|
callback: function(r) {
|
||||||
|
if(r.message) {
|
||||||
|
frappe.model.set_value(cdt, cdn, "billing_hours", r.message.billing_hours);
|
||||||
|
frappe.model.set_value(cdt, cdn, "billing_amount", r.message.billing_amount);
|
||||||
|
frappe.model.set_value(cdt, cdn, "timesheet_detail", r.message.timesheet_detail);
|
||||||
|
frm.trigger("calculate_timesheet_totals");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var select_loyalty_program = function(frm, loyalty_programs) {
|
||||||
|
>>>>>>> b57521a337 (feat: add `total_billing_hours` to Sales Invoice)
|
||||||
var dialog = new frappe.ui.Dialog({
|
var dialog = new frappe.ui.Dialog({
|
||||||
title: __("Select Loyalty Program"),
|
title: __("Select Loyalty Program"),
|
||||||
fields: [
|
fields: [
|
||||||
|
|||||||
@@ -49,6 +49,18 @@
|
|||||||
"set_target_warehouse",
|
"set_target_warehouse",
|
||||||
"section_break_42",
|
"section_break_42",
|
||||||
"items",
|
"items",
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
"pricing_rule_details",
|
||||||
|
"pricing_rules",
|
||||||
|
"packing_list",
|
||||||
|
"packed_items",
|
||||||
|
"product_bundle_help",
|
||||||
|
"time_sheet_list",
|
||||||
|
"timesheets",
|
||||||
|
"total_billing_amount",
|
||||||
|
"total_billing_hours",
|
||||||
|
>>>>>>> b57521a337 (feat: add `total_billing_hours` to Sales Invoice)
|
||||||
"section_break_30",
|
"section_break_30",
|
||||||
"total_qty",
|
"total_qty",
|
||||||
"total_net_weight",
|
"total_net_weight",
|
||||||
@@ -1977,6 +1989,7 @@
|
|||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
<<<<<<< HEAD
|
||||||
"default": "0",
|
"default": "0",
|
||||||
"fieldname": "ignore_default_payment_terms_template",
|
"fieldname": "ignore_default_payment_terms_template",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
@@ -1985,11 +1998,14 @@
|
|||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
=======
|
||||||
|
>>>>>>> b57521a337 (feat: add `total_billing_hours` to Sales Invoice)
|
||||||
"fieldname": "total_billing_hours",
|
"fieldname": "total_billing_hours",
|
||||||
"fieldtype": "Float",
|
"fieldtype": "Float",
|
||||||
"label": "Total Billing Hours",
|
"label": "Total Billing Hours",
|
||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
|
<<<<<<< HEAD
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "amount_eligible_for_commission",
|
"fieldname": "amount_eligible_for_commission",
|
||||||
@@ -2199,6 +2215,8 @@
|
|||||||
"label": "Company Contact Person",
|
"label": "Company Contact Person",
|
||||||
"options": "Contact",
|
"options": "Contact",
|
||||||
"print_hide": 1
|
"print_hide": 1
|
||||||
|
=======
|
||||||
|
>>>>>>> b57521a337 (feat: add `total_billing_hours` to Sales Invoice)
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "fa fa-file-text",
|
"icon": "fa fa-file-text",
|
||||||
@@ -2211,7 +2229,11 @@
|
|||||||
"link_fieldname": "consolidated_invoice"
|
"link_fieldname": "consolidated_invoice"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
<<<<<<< HEAD
|
||||||
"modified": "2025-02-06 15:59:54.636202",
|
"modified": "2025-02-06 15:59:54.636202",
|
||||||
|
=======
|
||||||
|
"modified": "2021-08-02 18:36:51.978581",
|
||||||
|
>>>>>>> b57521a337 (feat: add `total_billing_hours` to Sales Invoice)
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Sales Invoice",
|
"name": "Sales Invoice",
|
||||||
|
|||||||
Reference in New Issue
Block a user