[Fix] POS Profile data not set in the sales invoice (#13568)
This commit is contained in:
parent
098b444f6f
commit
2ea593bdd8
@ -334,7 +334,7 @@ class SalesInvoice(SellingController):
|
|||||||
for item in self.get("items"):
|
for item in self.get("items"):
|
||||||
if item.get('item_code'):
|
if item.get('item_code'):
|
||||||
for fname, val in get_pos_profile_item_details(pos,
|
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)):
|
if (not for_validate) or (for_validate and not item.get(fname)):
|
||||||
item.set(fname, val)
|
item.set(fname, val)
|
||||||
|
|||||||
@ -410,7 +410,7 @@ def get_party_item_code(args, item_doc, out):
|
|||||||
item_supplier = item_doc.get("supplier_items", {"supplier": args.supplier})
|
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
|
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()
|
res = frappe._dict()
|
||||||
|
|
||||||
if not pos_profile:
|
if not pos_profile:
|
||||||
@ -418,7 +418,7 @@ def get_pos_profile_item_details(company, args, pos_profile=None):
|
|||||||
|
|
||||||
if pos_profile:
|
if pos_profile:
|
||||||
for fieldname in ("income_account", "cost_center", "warehouse", "expense_account"):
|
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)
|
res[fieldname] = pos_profile.get(fieldname)
|
||||||
|
|
||||||
if res.get("warehouse"):
|
if res.get("warehouse"):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user