fix: adding cost center on pos invoice items while applying product discount (#46082)
This commit is contained in:
@@ -1899,7 +1899,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
||||
|
||||
const exist_items = items.map(row => { return {item_code: row.item_code, pricing_rules: row.pricing_rules};});
|
||||
|
||||
args.free_item_data.forEach(pr_row => {
|
||||
args.free_item_data.forEach(async pr_row => {
|
||||
let row_to_modify = {};
|
||||
|
||||
// If there are no free items, or if the current free item doesn't exist in the table, add it
|
||||
@@ -1917,6 +1917,14 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
||||
for (let key in pr_row) {
|
||||
row_to_modify[key] = pr_row[key];
|
||||
}
|
||||
|
||||
if (this.frm.doc.hasOwnProperty("is_pos") && this.frm.doc.is_pos) {
|
||||
let r = await frappe.db.get_value("POS Profile", this.frm.doc.pos_profile, "cost_center");
|
||||
if (r.message.cost_center) {
|
||||
row_to_modify["cost_center"] = r.message.cost_center;
|
||||
}
|
||||
}
|
||||
|
||||
this.frm.script_manager.copy_from_first_row("items", row_to_modify, ["expense_account", "income_account"]);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user