diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index ee16e4c64a9..b174d9b224f 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -334,7 +334,7 @@ class SalesInvoice(SellingController): for item in self.get("items"): if item.get('item_code'): for fname, val in get_pos_profile_item_details(pos, - frappe._dict(item.as_dict()), pos).items(): + frappe._dict(item.as_dict()), pos, True).items(): if (not for_validate) or (for_validate and not item.get(fname)): item.set(fname, val) diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index cafa4bc4c78..eaa3d4d9561 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -410,7 +410,7 @@ def get_party_item_code(args, item_doc, out): item_supplier = item_doc.get("supplier_items", {"supplier": args.supplier}) out.supplier_part_no = item_supplier[0].supplier_part_no if item_supplier else None -def get_pos_profile_item_details(company, args, pos_profile=None): +def get_pos_profile_item_details(company, args, pos_profile=None, update_data=False): res = frappe._dict() if not pos_profile: @@ -418,7 +418,7 @@ def get_pos_profile_item_details(company, args, pos_profile=None): if pos_profile: for fieldname in ("income_account", "cost_center", "warehouse", "expense_account"): - if not args.get(fieldname) and pos_profile.get(fieldname): + if (not args.get(fieldname) or update_data) and pos_profile.get(fieldname): res[fieldname] = pos_profile.get(fieldname) if res.get("warehouse"):